一、RaisedButton 定义一个按钮
Flutter 中通过 RaisedButton 定义一个按钮。RaisedButton 里面有很多的参数,只讲简单的进行使用。
return RaisedButton(
    child: Text('女装'),
    textColor: Theme.of(context).accentColor,
    onPressed: (){
  },
);
 
二、Wrap 组件
Wrap 可以实现流布局,单行的 Wrap 跟 Row 表现几乎一致,单列的 Wrap 则跟 Row 表现几乎一致。但 Row 与 Column 都是单行单列的,Wrap 则突破了这个限制,mainAxis 上空间不足时,则向 crossAxis 上去扩展显示
 
direction  主轴的方向,默认水平
alignment  主轴的对其方式
spacing  主轴方向上的间距
textDirection  文本方向
verticalDirection  定义了 children 摆放顺序,默认是 down,见Flex 相关属性介绍。
 
runAlignment   run的对齐方式。run 可以理解为新的行或者列,如果是水平方向布局的话,run 可以理解为新的一行
runSpacing   run的间距
 
**
Wrap({
Key key,
this.direction = Axis.horizontal,//主轴(mainAxis)的方向,默认为水平。
this.alignment = WrapAlignment.start,//主轴方向上的对齐方式,默认为start。
this.spacing = 0.0,//主轴方向上的间距。
this.runAlignment = WrapAlignment.start,//run的对齐方式。run可以理解为新的行或者列,如果是水平方向布局的话,run可以理解为新的一行。
this.runSpacing = 0.0,//run的间距。
this.crossAxisAlignment = WrapCrossAlignment.start,//交叉轴(crossAxis)方向上的对齐方式。
this.textDirection,//文本方向。
this.verticalDirection = VerticalDirection.down,//定义了children摆放顺序,默认是down,见Flex相关属性介绍。
List<Widget> children = const <Widget>[],//
})
*/
 
案例

案例代码一

return Container(
child: Wrap(
children: <Widget>[
Container(margin: EdgeInsets.all(5), width: 100, height: 30, decoration: BoxDecoration(color: Colors.red),),
Container(margin: EdgeInsets.all(5), width: 100, height: 30, decoration: BoxDecoration(color: Colors.red),),
Container(margin: EdgeInsets.all(5), width: 100, height: 30, decoration: BoxDecoration(color: Colors.red),),
Container(margin: EdgeInsets.all(5), width: 100, height: 30, decoration: BoxDecoration(color: Colors.red),),
Container(margin: EdgeInsets.all(5), width: 100, height: 30, decoration: BoxDecoration(color: Colors.red),),
Container(margin: EdgeInsets.all(5), width: 100, height: 30, decoration: BoxDecoration(color: Colors.red),)
],
),
);

案例代码 二

class HomenCenter extends StatelessWidget {
Widget build(BuildContext context) {
// TODO: implement build
return Wrap(
spacing: 5,
children: <Widget>[
MyButton('按钮1'),
MyButton('按钮1'),
MyButton('按钮1'),
MyButton('按钮1'),
MyButton('按钮1'),
MyButton('按钮1'),
MyButton('按钮1'),
],
);
}
} class MyButton extends StatelessWidget {
final text;
MyButton(this.text);
@override
Widget build(BuildContext context) {
// TODO: implement build
return RaisedButton (
child: Text(this.text),
color: Colors.red,
textColor: Colors.white,
onPressed: () {},
);
}
}

页面布局 Wrap 组件 和 RaisedButton按钮的更多相关文章

  1. 13Flutter页面布局 Wrap组件

    /* Flutter页面布局Wrap组件: Wrap可以实现流布局,单行的Wrap跟Row表现几乎一致,单列的Wrap则跟Row表现几乎一致. 但Row与Column都是单行单列的.Wrap则突破了这 ...

  2. 常用到的html页面布局和组件: 自己用

    1. 用div当作圆 <div style="border: 1px solid blue;height: 100px; width: 100px; border-radius: 20 ...

  3. 【Flutter学习】页面布局之基础布局组件

    一,概述 Flutter中拥有30多种预定义的布局widget,常用的有Container.Padding.Center.Flex.Row.Colum.ListView.GridView.按照< ...

  4. Flutter——Wrap组件(流式布局)

    Wrap 可以实现流布局,单行的 Wrap 跟 Row 表现几乎一致,单列的 Wrap 则跟 Row 表现几乎一致.但 Row 与 Column 都是单行单列的,Wrap 则突破了这个限制,mainA ...

  5. 046——VUE中组件之使用动态组件灵活设置页面布局

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. 11Flutter页面布局 Stack层叠组件 Stack与Align Stack与Positioned实现定位布局

    /* Flutter 页面布局 Stack层叠组件: Stack与Align Stack与Positioned实现定位布局: Flutter Stack组件: Stack表示堆得意思,我们可以用Sta ...

  7. 10Flutter页面布局 Padding Row Column Expanded组件详解:

    Padding组件: main.dart import 'package:flutter/material.dart'; import 'res/listData.dart'; /* flutter页 ...

  8. 《React后台管理系统实战 :二》antd左导航:cmd批量创建子/目录、用antd进行页面布局、分离左导航为单独组件、子路由、动态写左导航、css样式相对陷阱

    一.admin页面布局及路由创建 0)cmd批量创建目录及子目录 //创建各个目录,及charts和子目录bar md home category product role user charts\b ...

  9. Flutter 布局类组件:流式布局(Wrap和Flow)

    前言 把超出屏幕显示范围会自动折行的布局称为流式布局.Flutter中通过Wrap和Flow来支持流式布局,将Row换成Wrap后溢出部分则会自动折行. Wrap 接口描述 Wrap({ Key ke ...

随机推荐

  1. mysql 中LIKE 与FIND_IN_SET 与关联表left join 速度效率比较

    有一张表Table有IDStr字段,如下只显示二个字段还有很多其他字段 方式一 字段逗号分割,直接用UserIDStr字段,里面存多个ID用逗号分割 UUID UserIDStr 1111 1,2,3 ...

  2. linux异常 - 无法分配内存

    解决方案: 删除虚拟机上不必要的东西 重启开虚拟机的电脑

  3. apk 测试入门基本操作

    通过以上两个方法查询到运行的system service后,就可以在dumpsys后面加上service的名字,查看指定的service信息. // 查看Activity相关信息adb shell d ...

  4. 安卓模拟器genymotion 安装使用

    下载:https://www.genymotion.com/download/ 安装前先注册: https://www.runoob.com/w3cnote/android-tutorial-geny ...

  5. 深度学习之numpy.poly1d()函数

    1.np.poly1d()此函数有两个参数: 参数1:为一个数组,若没有参数2,则生成一个多项式,例如: p = np.poly1d([2,3,5,7]) print(p)    ==>> ...

  6. day14 find

    find命令查找信息补充 查看找文件数据信息: 精确查找: find 路径信息 -type 文件类型 -name "文件名" 模糊查找: find 路径信息 -type 文件类型 ...

  7. QT(mingw) 编译 boost

    参考链接 :https://www.cnblogs.com/zhangnianyong/p/6546712.html Qt为mingw 5.8.0.Boost为1.62.0. 1.安装qt-opens ...

  8. 把jar包部署为linux服务

    一直未配置成功,直到放弃后reboot了下,才直到错的不是自己的配置,而是自己不懂 1.在touch /etc/rc.d/init.d/tl_c_cons_service(创建新文件) 2.vi /e ...

  9. bugku 变量1

    变量1 题目信息 flag In the variable ! <?php error_reporting(0); include "flag1.php"; highligh ...

  10. buuctf wireshark

    首先下载文件夹 然后用wireshark进行分析 然后发现啥也不会然后查一下资料https://www.jianshu.com/p/55ec409c739e 然后根据资料找了tcp然后根据解析做出此题 ...