flutter组件之Stack
发布日期:2021-10-15 18:54:37
浏览次数:4
分类:技术文章
本文共 1592 字,大约阅读时间需要 5 分钟。
stack组件可以实现定位问题,如果您想以简单的方式重叠多个子级,例如具有一些文本和图像,并用渐变和一个附加在底部的按钮覆盖,则该类很有用。
// SizedBox组件能强制子控件具有特定宽度、高度或两者都有,使子控件设置的宽高失效// width: 100.0,//宽度// height: 100.0,//高度// child: Container(// width: 200.0,// height: 200.0,// color: Color(0xffff0000),// ),SizedBox( width: 250, height: 250, child: new Stack( children:[ //定位组件 //left: 20.0 //top: 10.0 //right: 10.0 //bottom: 10.0 //width: 10.0 //height: 20.0 //child: new Text() Positioned( top: 100.0, child: Container( color: Colors.blue, child: Text("第一个组件"), ), ), Positioned( top: 200, right: 100, child: Container( color: Colors.yellow, child: Text("第二个组件"), ), ), Positioned( left: 100.0, child: Container( color: Colors.red, child: Text("第三个组件"), ), ), new Container( width: 250, height: 250, color: Colors.white, ), new Container( padding: EdgeInsets.all(5.0), //对齐方式 alignment: Alignment.bottomCenter, decoration: BoxDecoration( //渐变色 gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Colors.black.withAlpha(0), Colors.black12, Colors.black45 ], ), ), child: new Text( "Foreground Text", style: TextStyle(color: Colors.white, fontSize: 20.0), ), ), ], ),)
转载地址:https://blog.csdn.net/shenshulong/article/details/103909141 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
表示我来过!
[***.240.166.169]2024年04月08日 01时02分03秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
命名实体识别_利用CRF_CodingPark编程公园
2019-04-26
Pycharm使用-取消pytest的办法_CodingPark编程公园
2019-04-26
OpenCV图像处理基础_CodingPark编程公园
2019-04-26
生成个性二维码_CodingPark编程公园
2019-04-26
读txt文件报错_CodingPark编程公园
2019-04-26
文件读&写_Python_CodingPark编程公园
2019-04-26
list与str的转换&list嵌套问题_CodingPark编程公园
2019-04-26
Gensim库生成与导入W2V模型_CodingPark编程公园
2019-04-26
cmd命令行实用技巧_CodingPark编程公园
2019-04-26
如何在junit中使用SpringFramework的Ioc容器
2019-04-26
一个案例教你理解Spring面向切面编程(Spring Aop)
2019-04-26
手把手教你整合SSM框架
2019-04-26
自己造个简单数据校验的注解@Value和@Mail
2019-04-26
Poj百练 4148:生理周期 (分类:枚举)
2019-04-26
Java如何读写注册表
2019-04-26