当前位置:网站首页>Flutter series: detailed explanation of container layout commonly used in flutter
Flutter series: detailed explanation of container layout commonly used in flutter
2022-06-11 21:27:00 【InfoQ】
brief introduction
Container Use
class Container extends StatelessWidget {
Container({
Key? key,
this.alignment,
this.padding,
this.color,
this.decoration,
this.foregroundDecoration,
double? width,
double? height,
BoxConstraints? constraints,
this.margin,
this.transform,
this.transformAlignment,
this.child,
this.clipBehavior = Clip.none,
})
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
),
child: Column(
children: [
buildBoxRow(),
buildBoxRow(),
],
),
);
}
Widget buildBoxRow() => Row(
textDirection: TextDirection.ltr,
children: [
Container(
width: 100,
child: Image.asset("images/head.jpg")
)
],
);

rotate Container
Widget buildBoxRow() => Row(
textDirection: TextDirection.ltr,
children: [
Container(
transform: Matrix4.rotationZ(0.2),
width: 100,
child: Image.asset("images/head.jpg")
)
],
);


/// Translation matrix.
factory Matrix4.translation(Vector3 translation) => Matrix4.zero()
..setIdentity()
..setTranslation(translation);
/// Translation matrix.
factory Matrix4.translationValues(double x, double y, double z) =>
Matrix4.zero()
..setIdentity()
..setTranslationRaw(x, y, z);
/// Scale matrix.
factory Matrix4.diagonal3Values(double x, double y, double z) =>
Matrix4.zero()
.._m4storage[15] = 1.0
.._m4storage[10] = z
.._m4storage[5] = y
.._m4storage[0] = x;
Container Medium BoxConstraints
const BoxConstraints({
this.minWidth = 0.0,
this.maxWidth = double.infinity,
this.minHeight = 0.0,
this.maxHeight = double.infinity,
}) : assert(minWidth != null),
assert(maxWidth != null),
assert(minHeight != null),
assert(maxHeight != null);
BoxConstraints.loose(Size size)
BoxConstraints.tight(Size size)
BoxConstraints.expand({double? width, double? height})
const BoxConstraints.expand({
double? width,
double? height,
}) : minWidth = width ?? double.infinity,
maxWidth = width ?? double.infinity,
minHeight = height ?? double.infinity,
maxHeight = height ?? double.infinity;
summary
边栏推荐
- Cs144 lab0 lab1 record
- Comprehensive RTL code design method and precautions
- JVM method area
- JUnit tests multithreaded code, and the sub thread does not run
- LeetCode-322-零钱兑换
- One article to show you how to understand the harmonyos application on the shelves
- ORA-04098: trigger ‘xxx. xxx‘ is invalid and failed re-validation
- JVM方法区
- Hangzhou Electric Zhongchao 91006 guess the weight
- flutter系列之:flutter中常用的container layout详解
猜你喜欢

Cs144 lab0 lab1 record

关于斜率优化

JVM object allocation policy TLAB

LeetCode-98-验证二叉搜索树

Only 38 years old! Zhou Chuan, a researcher of the Chinese Academy of Sciences, died unfortunately. Rao Yi sent a document to mourn: he guided me when he was still my student

Three waves of changes in cloud computing

Jenkins+allure integrated report construction

【C語言進階】整型在內存中的存儲

LeetCode-32-最长有效括号
![BZOJ3189 : [Coci2011] Slika](/img/46/c3aa54b7b3e7dfba75a7413dfd5b68.png)
BZOJ3189 : [Coci2011] Slika
随机推荐
Using the sap ui5 cli command line tool to build and run SAP ui5 applications
[Game Theory - introduction]
实验10 Bezier曲线生成-实验提高-控制点生成B样条曲线
A problem of setting the private library of golang
[Part 13] source code analysis and application details of completabilefuture class [key]
杭电中超9 1006 Guess the Weight
线性表的链式存储结构
Diary at 16:29:41 on June 9, 2022
LabVIEW controls Arduino to realize ultrasonic ranging (advanced chapter-5)
LeetCode-43-字符串相乘
常用文件函数
Bipartite King
JVM之对象创建过程
Serval and rooted Tree (cf1153d) - DP
为什么需要微服务
Educational codeforces round 111 (rated for Div. 2) C Supplement
关于gorm的preload方法笔记说明
LeetCode-76-最小覆盖子串
【C語言進階】整型在內存中的存儲
Codeforces Round #742 (Div. 2) F. One-Four Overload