zoukankan      html  css  js  c++  java
  • Container

    Container是最常用的布局Widget,表示一个容器,其主要属性包括:

    • width

        表示容器的宽度。

    • Height

        表示容器的高度。

    • alignment

        容器中内容的对齐方式,包括:Alignment.topLeft、Alignment.topCenter、Alignment.topRight、Alignment.centerLeft、Alignment.center、Alignment.centerRight、Alignment.bottomLeft、Alignment.bottomCenter、Alignment.bottomRight等。

    • color

        容器的背景颜色。

    • padding

        容器中内边距。

    • decoration

        容器背景装饰,不能和color同时设置,设置此值时可以根据需要将容器设置为圆角矩形、特定边框宽度和颜色等。

    • foregroundDecoration

        容器内容的前景装饰,和背景装饰属性类似,通常可以通过此属性设置内容的半透明图层。

    • margin

        容器的外边距

    • child

        容器中的子Widget,只能设置一个子Widget。

    Widget getContainer() {
        return Container(
           200.0,
          height: 200.0,
    //      color: Colors.blueAccent,
          alignment: Alignment.center,
          padding: EdgeInsets.all(15.0),
          decoration: BoxDecoration(
            color: Colors.redAccent,
            border: Border.all(color: Colors.blueAccent,  2.0, style: BorderStyle.solid),
            borderRadius: BorderRadius.circular(15.0),
          ),
          foregroundDecoration: BoxDecoration(
            color: Color(0x66000000),
            borderRadius: BorderRadius.circular(15.0),
          ),
          child: Text('Hello'),
          margin: EdgeInsets.all(20.0),
        );
      }
  • 相关阅读:
    一句sql语句删除重复记录
    Remoting测试
    关于委托
    遍历打印文件夹中的word文档
    c# string类型的一个理解误区
    viewstate
    依赖注入与工厂模式Demo
    memcache配置实践
    201732 C#链接数据库实现登陆
    观察者设计模式[伪]
  • 原文地址:https://www.cnblogs.com/timba1322/p/12487271.html
Copyright © 2011-2022 走看看