美文网首页flutter
Flutter之Wrap组件

Flutter之Wrap组件

作者: 习惯了_就好 | 来源:发表于2019-01-03 15:49 被阅读38次
    /**
        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>[],//
        })
     */
    
    body: Wrap(
              spacing: 5.0,
              runSpacing: 0.0,
              children: <Widget>[
                Chip(
                  label: Text("abcd"),
                  avatar: CircleAvatar(
                    backgroundColor: Color(0xfff1f1f1),
                    child: Text("A",style: TextStyle(fontSize: 12.0),),
                  ),
                ),
                Chip(
                  label: Text("abcd"),
                  avatar: CircleAvatar(
                    backgroundColor: Color(0xfff1f1f1),
                    child: Icon(Icons.alarm),
                  ),
                ),
                Chip(
                  label: Text("abcd"),
                  avatar: Icon(Icons.alarm),
                ),
                Chip(
                  label: Text("abcd"),
                  avatar: CircleAvatar(
                    backgroundColor: Color(0xfff1f1f1),
                    child: Text("C",style: TextStyle(fontSize: 12.0),),
                  ),
                ),
                Chip(
                  label: Text("abcd"),
                  padding: EdgeInsets.only(left: 20.0),
                  avatar: CircleAvatar(
                    backgroundColor: Color(0xfff1f1f1),
                    child: Text("D",style: TextStyle(fontSize: 12.0),),
                  ),
                ),
                Chip(
                  label: Text("abcd"),
                ),
              ],
            ),
    

    相关文章

      网友评论

        本文标题:Flutter之Wrap组件

        本文链接:https://www.haomeiwen.com/subject/mpafrqtx.html