当前位置:网站首页>[shutter -- layout] linear layout (row and column)
[shutter -- layout] linear layout (row and column)
2022-07-23 19:09:00 【Kevin-Dev】

List of articles
Row
1. brief introduction
stay Flutter A very common multi child node control in , take children Line up . I think it's a reference Web in Flex Layout , So many attributes and performances , It's all similar . But be careful , It doesn't have a scrolling property , If it's more than one line , stay debug The overflow prompt will be displayed below .
2. attribute
MainAxisAlignment: Alignment in spindle direction , Would be right child It's where it works , The default is start.
among MainAxisAlignment Enumerated values :
- center: take children Placed in the center of the spindle ;
- end: take children Place at the end of the spindle ;
- spaceAround: Divide the blank area in the direction of the spindle equally , bring children The blank areas between are equal , But first and last child The blank area of is 1/2;
- spaceBetween: Divide the blank area in the direction of the spindle equally , bring children The blank areas between are equal , Head and tail child All close to the head and tail , There is no gap ;
- spaceEvenly: Divide the blank area in the direction of the spindle equally , bring children The blank areas between are equal , Including head and tail child;
- start: take children Place at the starting point of the spindle ;
among spaceAround、spaceBetween as well as spaceEvenly The difference between , It's about the head and the tail child The way . The distance from the beginning to the end is that of the blank area 1/2、0、1.
MainAxisSize: The value of the space occupied in the direction of the spindle , The default is max.
MainAxisSize There are two values of :
- max: According to the incoming layout constraints , Maximize the available space in the spindle direction ;
- min: And max contrary , Is to minimize the available space in the direction of the principal axis ;
CrossAxisAlignment:children Alignment in the direction of the cross axis , And MainAxisAlignment It's a little different .
CrossAxisAlignment Enumeration values are as follows :
- baseline: In the direction of the cross axis , bring children Of baseline alignment ;
- center:children Centered on the cross axis ;
- end:children Show at the end of the cross axis ;
- start:children Show at the starting point on the cross axis ;
- stretch: Give Way children Fill in the direction of the cross axis ;
TextDirection: Compatibility settings for Arabic Department , Generally, there is no need to deal with .
VerticalDirection: Defined children Order of placement , The default is down.
VerticalDirection There are two kinds of enumeration values :
- down: from top To bottom Make a layout ;
- up: from bottom To top Make a layout .
top Corresponding Row as well as Column Words , It's the left and the top ,bottom Words , Right and bottom .
TextBaseline: The use of TextBaseline The way , There are two kinds of , I've already introduced .
3. example
1. design sketch 
2. Code
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({
Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text(' Linear layout '),
),
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.blue,
child: FlutterLogo(
size: 50.0,
),
),
Container(
color: Colors.pink,
child: FlutterLogo(
size: 50.0,
),
),
Container(
color: Colors.purple,
child: FlutterLogo(
size: 50.0,
),
),
],
),
)
)
);
}
}
Column
1. brief introduction
Column Is a control used to vertically display multiple child controls .Column This control will not scroll . If you have a row of controls that can scroll when there is not enough space , Consider using ListView class .
The constructor is as follows :
Column({
Key key,
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
MainAxisSize mainAxisSize = MainAxisSize.max,
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
TextDirection textDirection,
VerticalDirection verticalDirection = VerticalDirection.down,
TextBaseline textBaseline,
List<Widget> children = const <Widget>[],
})
notes :Row and Column Will only occupy as much space as possible in the direction of the main axis , The length of the vertical axis depends on the length of their largest child elements
2. attribute
Properties and Row equally .
3. example
1. design sketch 
2. Code
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({
Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text(' Linear layout '),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.blue,
child: FlutterLogo(
size: 50.0,
),
),
Container(
color: Colors.pink,
child: FlutterLogo(
size: 50.0,
),
),
Container(
color: Colors.purple,
child: FlutterLogo(
size: 50.0,
),
),
],
),
)
)
);
}
}
边栏推荐
- 软件测试岗位就业竞争压力大,985毕业的“打工人“同样存在苦不堪言
- FPGA flash reading and writing based on SPI
- [2013] [paper notes] terahertz band nano particle surface enhanced Raman——
- C#启动程序传递参数丢失双引号,如何解决?
- 基于FPGA的SPI通讯协议实现
- Gradle【图文安装及使用演示 精讲】
- Electronic components - resistance
- 一、爬虫概念及基本流程
- .NET Core 实现后台任务(定时任务)Longbow.Tasks 组件(三)
- TCL脚本语言详解(1)
猜你喜欢
![[attack and defense world web] difficulty four-star 12 point advanced question: cat](/img/fc/6508c7d534c26f487b0a8ae5be7347.png)
[attack and defense world web] difficulty four-star 12 point advanced question: cat
![Paddlenlp's UIE classification model [taking emotional propensity analysis news classification as an example] including intelligent annotation scheme)](/img/00/e97dcac9f07e5d4512614536a17cd4.png)
Paddlenlp's UIE classification model [taking emotional propensity analysis news classification as an example] including intelligent annotation scheme)
.NET Core 实现后台任务(定时任务)Longbow.Tasks 组件(三)
[paper reading] gettext: trajectory flow map enhanced transformer for next POI recommendation

11. Basic concepts of neural network
![[2020] [paper notes] phase change materials and Hypersurfaces——](/img/cc/a69afb3acd4b73a17dbbe95896404d.png)
[2020] [paper notes] phase change materials and Hypersurfaces——

【2013】【论文笔记】太赫兹波段纳米颗粒表面增强拉曼——

AE 教程,如何在 After Effects 中对 Illustrator 分图层文档进行动画绘制?

人脸识别系统技术方案

Detailed explanation: tmp1750 chip three channel linear LED driver
随机推荐
MQ【MessageQueue 图文详解及四大MQ比较】
Tcl 语言之Synopsys Tcl篇(3)(数字IC)
It's too strong. An annotation handles the data desensitization returned by the interface
Access intranet rds+mysql through SSH
一定要执行多个请求,都要捕获错误,使用try catch 不够优雅
Jetpack Compose之Navigation组件使用
[2020] [paper notes] optically controlled spectral ratio adjustable y based on two-dimensional photonic crystal——
[paper reading] gettext: trajectory flow map enhanced transformer for next POI recommendation
398. Random number index hash table method
【2020】【论文笔记】基于二维光子晶体的光控分光比可调Y——
1259. Programmation dynamique de poignée de main disjointe
C#启动程序传递参数丢失双引号,如何解决?
MySql【从了解到掌握 一篇就够】
Three ways to realize multithreading
FPGA实现IIC协议(一)IIC总线协议
MQ [messagequeue graphic explanation and four MQ comparisons]
11.神经网络基本概念
Completion report of communication software development and Application
My creation anniversary
The first layer of OSI model: physical layer, the cornerstone of existence!