美文网首页
flutter stack布局实例Alignment

flutter stack布局实例Alignment

作者: 喜剧收尾_XWX | 来源:发表于2020-08-31 12:01 被阅读0次
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      title: "stack布局实例Alignment",
      home: Scaffold(
          appBar: AppBar(
            title: Text('stack布局实例Alignment'),
          ),
          body: Stack(
            //子组件:右下角对齐
            alignment: Alignment.bottomRight,

            children: <Widget>[
              CircleAvatar(
                backgroundImage: AssetImage('images/1.jpeg'),
                radius: 100,
              ),
              Container(
                decoration: BoxDecoration(color: Colors.deepOrange),
                child: Text(
                  '我是超级飞侠',
                  style: TextStyle(fontSize: 22),
                ),
              )
            ],
          )),
    );
  }
}

相关文章

网友评论

      本文标题:flutter stack布局实例Alignment

      本文链接:https://www.haomeiwen.com/subject/kabydktx.html