首页 > 其他 > 详细

[Flutter] Stack Layout

时间:2019-08-07 09:30:28      阅读:101      评论:0      收藏:0      [点我收藏+]

Normally if you place three the same size icons in a stack, they will stands on top of each other, then we can use ‘Align‘ and ‘Position‘ to positioning them:

class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       body: SizedBox.expand(
         child: Stack(
           children: <Widget>[
             Icon(
               Icons.camera,
               size: 100,
               color: Colors.red,
             ),
             Align(
                 alignment: Alignment.center,
                 child: Icon(
                   Icons.camera,
                   size: 100,
                   color: Colors.blue,
                 )),
             Positioned(
                 bottom: 20,
                 child: Icon(
                   Icons.camera,
                   size: 100,
                   color: Colors.green,
                 ))
           ],
         ),
       ),
     ),
   );
 }
}

技术分享图片

[Flutter] Stack Layout

原文:https://www.cnblogs.com/Answer1215/p/11312818.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!