当前位置:网站首页>Flutter Container组件
Flutter Container组件
2022-06-11 06:45:00 【xiangxiongfly915】
Flutter Container组件
基本属性
width & height:设置组件的宽高。
color:设置背景颜色。
padding & margin:设置内外边距。
decoration:背景装饰,与color属性互斥。
constraints:约束条件,也可以指定组件宽高。
alignment:子元素对齐方式。
transform:变形。
简单使用

Container(
width: 100,
height: 50,
color: Colors.blue,
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(10),
alignment: Alignment.center,
child: const Text("hello world"),
)
decoration 属性

Container(
child: const Text("hello Container"),
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(10),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: Colors.red.shade50,
border: Border.all(
color: Colors.red.shade900,
width: 2,
),
),
)

Container(
width: 150,
height: 150,
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage("images/avatar.jpg"),
fit: BoxFit.cover,
),
shape: BoxShape.circle,
border: Border.all(
color: Colors.red.shade900,
width: 2,
),
),
)
constraints & transform & alignment 属性

Container(
margin: const EdgeInsets.all(50),
constraints: const BoxConstraints.tightFor(width: 200, height: 150),
decoration: BoxDecoration(
gradient: RadialGradient(
colors: [Colors.blue.shade800, Colors.blue.shade200],
center: Alignment.center,
radius: 0.5,
),
boxShadow: const [
BoxShadow(
color: Colors.grey,
offset: Offset(2, 2),
blurRadius: 2,
),
],
),
transform: Matrix4.rotationZ(0.2),
transformAlignment: Alignment.center,
alignment: Alignment.center,
child: const Text("hello world"),
)
边栏推荐
- 100. 相同的树
- Flat design, blog website (VIII) code source code
- 022 basic introduction to redis database 0
- About the principle and code implementation of Siou (review IOU, giou, Diou, CIO)
- 搜狐员工遭遇工资补助诈骗 黑产与灰产有何区别 又要如何溯源?
- 网狐游戏服务器房间配置约战定制功能实现
- 022-Redis数据库0基础入门
- Throttling and anti shake
- Vulnhub's breach1.0 range exercise
- Autojs, read one line, delete one line, and stop scripts other than your own
猜你喜欢

PHP laravel8 send email

Vulhub 8.1-backdoor vulnerability recurrence

Jenkins voucher management

Warning: Each child in a list should have a unique “key“ prop.

A highly controversial issue

Scripy web crawler series tutorials (I) | construction of scripy crawler framework development environment

100. 相同的树

socket. IO cross domain stepping pit

latex 各种箭头/带文字标号的箭头/可变长箭头

JVM from getting started to giving up 2: garbage collection
随机推荐
Differences between FindIndex and indexof
MMEditing中超分模型训练与测试
Wechat applet (authorized login) (not recommended, click the home page to view the updated authorized login)
SQL language - query statement
Communication between different VLANs
Handwritten promise [01] - Implementation of promise class core logic
Multimedia框架解析之MediaExtractor源码分析(一)
JS implementation of graphic merging and sorting process [source code attached]
关于parseInt()
Alias the path with the help of craco
Sohu employees encounter wage subsidy fraud. What is the difference between black property and gray property and how to trace the source?
572. subtree of another tree
MongoDB安装
Redux learning (III) -- using Redux saga, writing middleware functions, and splitting reducer files
EasyGBS接入的设备视频直播突然全部无法播放是为什么?数据库读写不够
Who is stronger, zip or 7-Zip, and how to choose?
Handwriting promise [03] - realize multiple calls and chain calls of then method
CCS method of installing compiler
Moment time plug-in tips -js (super detailed)
A promise with bare hands