zoukankan      html  css  js  c++  java
  • 页面布局 Paddiing Row Column Expanded 组件详解

    一、Paddiing 组件
        padding    EdgeInsetss 设置填充的值
        child  组件 
     
    return Padding(
        padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
        child: GridView.count()
        )
     
    二、 Row 水平布局组件
    mainAxisAlignment   主轴的排序方式
    crossAxisAlignment   次轴的排序方式
    children  组件子元素 
     
    三、 Column 垂直布局组件
    mainAxisAlignment   主轴的排序方式
    crossAxisAlignment  次轴的排序方式
    children   组件子元素 
     
    四、 Expanded 类似 Web 中的 Flex布局
     
    Expanded 可以用在 Row 和 Column 布局中
    flex  元素站整个父 Row /Column 的比例
    child  子元素
     
    案例

     案例代码

    class HomenCenter extends StatelessWidget {
    Widget build(BuildContext context) {
    // TODO: implement build
    return Padding(
    padding: EdgeInsets.all(5),
    child: Column(
    children: <Widget>[
    Row(
    children: <Widget>[
    Expanded(
    child: Container(child: Text('你好啊', style: TextStyle(color: Colors.white),), height: 150, decoration: BoxDecoration(color: Colors.black),
    ),
    )
    ],
    ),
    SizedBox(height: 5,),
    Container(
    height: 150,
    child: Row(
    children: <Widget>[
    Expanded(flex: 2, child: Container(decoration: BoxDecoration(color: Colors.yellow))
    ),
    SizedBox( 5,),
    Expanded(
    flex: 1,
    child: Column(
    children: <Widget>[
    Expanded(flex: 1, child: Container(decoration: BoxDecoration(color: Colors.red),)),
    SizedBox(height: 5,),
    Expanded(flex: 1, child: Container(decoration: BoxDecoration(color: Colors.blue),))
    ]
    )
    )
    ],
    ),
    )
    ],
    ),
    );
    }
    }
  • 相关阅读:
    webpack 中级配置
    webpack4学习笔记
    window搭建go环境
    谈谈你对laravel的契约,容器,服务提供者,facades的理解以及他们的关系是什么
    php开发微信公众号踩坑
    腾讯云搭建git服务器
    linux的常用命令
    egg项目部署
    axios的使用记录以及实现上传图片
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
  • 原文地址:https://www.cnblogs.com/zhaofeis/p/12333496.html
Copyright © 2011-2022 走看看