当前位置:网站首页>flutter系列之:flutter中的Wrap
flutter系列之:flutter中的Wrap
2022-06-23 03:47:00 【InfoQ】
简介
Row和Column的困境
Widget build(BuildContext context) {
return Row(
textDirection: TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
YellowBox(),
YellowBox(),
Expanded(
child: YellowBox(),
),
YellowBox(),
],
);
}
Widget build(BuildContext context) {
return Container(
width: 100,
height: 50,
decoration: BoxDecoration(
color: Colors.yellow,
border: Border.all(),
),
);
}

Widget build(BuildContext context) {
return Row(
textDirection: TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
YellowBox(),
YellowBox(),
Expanded(
child: YellowBox(),
),
YellowBox(),
YellowBox(),
],
);
}

Wrap组件详解
class Wrap extends MultiChildRenderObjectWidget
Wrap({
Key? key,
this.direction = Axis.horizontal,
this.alignment = WrapAlignment.start,
this.spacing = 0.0,
this.runAlignment = WrapAlignment.start,
this.runSpacing = 0.0,
this.crossAxisAlignment = WrapCrossAlignment.start,
this.textDirection,
this.verticalDirection = VerticalDirection.down,
this.clipBehavior = Clip.none,
List<Widget> children = const <Widget>[],
}) : assert(clipBehavior != null), super(key: key, children: children);
Widget build(BuildContext context) {
return Wrap(
direction: Axis.horizontal,
textDirection: TextDirection.ltr,
children: [
YellowBox(),
YellowBox(),
// Expanded(
// child: YellowBox(),
// ),
YellowBox(),
YellowBox(),
YellowBox(),
],
);

Widget build(BuildContext context) {
return Wrap(
direction: Axis.horizontal,
spacing: 10,
textDirection: TextDirection.ltr,
children: [
YellowBox(),
YellowBox(),
// Expanded(
// child: YellowBox(),
// ),
YellowBox(),
YellowBox(),
YellowBox(),
],
);
}

Widget build(BuildContext context) {
return Wrap(
direction: Axis.horizontal,
spacing: 10,
runSpacing: 10,
textDirection: TextDirection.ltr,
children: [
YellowBox(),
YellowBox(),
// Expanded(
// child: YellowBox(),
// ),
YellowBox(),
YellowBox(),
YellowBox(),
],
);
}

总结
边栏推荐
猜你喜欢

Software project management 8.4 Software project quality plan

What if the self incrementing IDs of online MySQL are exhausted?

Web page dynamic and static separation based on haproxy

Pytorch---Pytorch进行自定义Dataset

Compilation, installation and global configuration section description of haproxy

城链科技董事长肖金伟:践行数据经济系国家战略,引领数字时代新消费发展!

嵌入式软件测试工具TPT18更新全解析

无线网络安全的12个优秀实践

redis 精讲系列介绍八 - 淘汰策略

两招提升硬盘存储数据的写入效率
随机推荐
How e-commerce makes use of small programs
自媒体时代的贤内助——AI 视频云
背景彩带动画插件ribbon.js
Static lookup tables and static lookup tables
聊聊内存模型和内存序
[OWT] OWT client native P2P E2E test vs2017 construction 4: Construction and link of third-party databases p2pmfc exe
支持在 Kubernetes 运行,添加多种连接器,SeaTunnel 2.1.2 版本正式发布!
Select sort method
数据加密技术之源代码加密
SVG+JS智能家居监控网格布局
1-1 introduction to VMWare
【二叉树进阶】AVLTree - 平衡二叉搜索树
顺序表查找
虫子 STM32 中断 (懂的都懂)
For patch rollback, please check the cbpersistent log
d重载嵌套函数
Bug STM32 advanced timer (haha, to tell you the truth, the hardware timer can't reflect its strength. In fact, I want to send the kernel timer. Just think about it. Take your time)
Using jhipster to build microservice architecture
QMainWindow
TDesign update weekly report (the second week of January 2022)