美文网首页
Flutter 之 Divider (六十三)

Flutter 之 Divider (六十三)

作者: maskerII | 来源:发表于2022-05-11 17:48 被阅读0次

1. Divider

Divider 定义

  const Divider({
    Key? key,
    this.height,
    this.thickness,
    this.indent,
    this.endIndent,
    this.color,
  })

1.1 属性介绍

Divider 属性 介绍
height Divider 组件高度
thickness 分割线线宽,分割线居于 Divider 中心
indent 分割线左侧间距
endIndent 分割线右侧间距
color 分割线颜色

2. 示例


class MSDividerDemo1 extends StatelessWidget {
  const MSDividerDemo1({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Divider")),
      body: Column(
        children: [
          Container(
            height: 60,
            color: Colors.amber,
          ),
          Divider(
            height: 20.0, // 分割线部件高度
            color: Colors.red, // 分割线 颜色
            thickness: 2.0, // 分割线的宽度
            indent: 20, // 分割线左侧间距
            endIndent: 20, //分割线右侧间距
          ),
          Container(
            alignment: Alignment(1, 1),
            height: 60,
            color: Colors.red[200],
            child: Divider(
              color: Colors.green,
              indent: 20,
              endIndent: 20,
              thickness: 3.0,
              height: 3.0,
            ),
          ),
        ],
      ),
    );
  }
}

image.png

相关文章

网友评论

      本文标题:Flutter 之 Divider (六十三)

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