当前位置:网站首页>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"),
)
边栏推荐
- QT socket setting connection timeout
- Redux learning (III) -- using Redux saga, writing middleware functions, and splitting reducer files
- Unity 全景漫游过程中使用AWSD控制镜头移动,EQ控制镜头升降,鼠标右键控制镜头旋转。
- Redux learning (II) -- encapsulating the connect function
- Scripy web crawler series tutorials (I) | construction of scripy crawler framework development environment
- Wechat applet (authorized login) (not recommended, click the home page to view the updated authorized login)
- Using Metasploit Trojan horse for remote control
- Array de duplication....
- Why is it that the live video of the devices connected to easygbs suddenly cannot be played? Insufficient database read / write
- JS implementation of Hill sort of graphic insertion sort [with source code]
猜你喜欢

572. subtree of another tree

The realization of online Fox game server room configuration battle engagement customization function

Simple integration of client go gin six list watch two (about the improvement of RS, pod and deployment)

Unity 全景漫游过程中使用AWSD控制镜头移动,EQ控制镜头升降,鼠标右键控制镜头旋转。

100. same tree

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

client-go gin的简单整合六-list-watch二(关于Rs与Pod以及Deployment的完善)

Teach everyone how to implement an electronic signature

Metasploitabile2 target learning

Biweekly investment and financial report: capital rush yuan universe game
随机推荐
JVM from getting started to abandoning 1: memory model
563. 二叉树的坡度
Make a small game with R language and only basic package
ijkPlayer中的错误码
sql查询问题,只显示列名 不显示数据
Redux learning (II) -- encapsulating the connect function
NPM upgrade: unable to load file c:\users\administrator\appdata\roaming\npm\npm-upgrade ps1
SQL语言-查询语句
UEFI查找PCI设备
QT socket setting connection timeout
text-overflow失效
争议很大的问题
FPGA interview topic notes (I) - FPGA development process, metastable state and competitive risk, build and hold time, asynchronous FIFO depth, etc
Teach everyone how to implement an electronic signature
C language war "minesweeping"
client-go gin的简单整合六-list-watch二(关于Rs与Pod以及Deployment的完善)
June training (day 11) - matrix
解决ffmpeg獲取AAC音頻文件duration不准
Handwritten promise [01] - Implementation of promise class core logic
必读1:格局越大的人,越懂得说话