Padding组件:

main.dart

  1. import 'package:flutter/material.dart';
  2. import 'res/listData.dart';
  3. /*
  4. flutter页面布局Padding Row Column Expanded组件详情:
  5. */
  6.  
  7. void main() {
  8. runApp(MyApp());
  9. }
  10.  
  11. class MyApp extends StatelessWidget {
  12. @override
  13. Widget build(BuildContext context) {
  14. // TODO: implement build
  15. return MaterialApp(
  16. home: Scaffold(
  17. appBar: AppBar(
  18. title: Text('Padding Row Column Expanded'),
  19. ),
  20. body: HomeContent(),
  21. ),
  22. );
  23. }
  24. }
  25.  
  26. class HomeContent extends StatelessWidget {
  27. @override
  28. Widget build(BuildContext context) {
  29. return Padding(
  30. padding: EdgeInsets.fromLTRB(, , , ),
  31. child: GridView.count(
  32. crossAxisCount: ,
  33. childAspectRatio: 1.7,
  34. children: <Widget>[
  35. Padding(
  36. padding: EdgeInsets.fromLTRB(, , , ),
  37. child: Image.network("https://www.itying.com/images/flutter/1.png",
  38. fit: BoxFit.cover),
  39. ),
  40. Padding(
  41. padding: EdgeInsets.fromLTRB(, , , ),
  42. child: Image.network("https://www.itying.com/images/flutter/1.png",
  43. fit: BoxFit.cover),
  44. ),
  45. Padding(
  46. padding: EdgeInsets.fromLTRB(, , , ),
  47. child: Image.network("https://www.itying.com/images/flutter/1.png",
  48. fit: BoxFit.cover),
  49. ),
  50. Padding(
  51. padding: EdgeInsets.fromLTRB(, , , ),
  52. child: Image.network("https://www.itying.com/images/flutter/1.png",
  53. fit: BoxFit.cover),
  54. ),
  55. Padding(
  56. padding: EdgeInsets.fromLTRB(, , , ),
  57. child: Image.network("https://www.itying.com/images/flutter/1.png",
  58. fit: BoxFit.cover),
  59. )
  60. ],
  61. ),
  62. );
  63. }
  64. }

Row水平布局组件:

  1. import 'package:flutter/material.dart';
  2. import 'res/listData.dart';
  3. /*
  4. flutter页面布局Padding Row Column Expanded组件详情:
  5. Row水平布局组件:
  6. mainAxisAlignment 主轴的排序方式
  7. crossAxisAlignment 次轴的排序方式
  8. children 组件子元素:
  9. */
  10.  
  11. void main() {
  12. runApp(MyApp());
  13. }
  14.  
  15. class MyApp extends StatelessWidget {
  16. @override
  17. Widget build(BuildContext context) {
  18. // TODO: implement build
  19. return MaterialApp(
  20. home: Scaffold(
  21. appBar: AppBar(
  22. title: Text('Padding Row Column Expanded'),
  23. ),
  24. body: HomeContent(),
  25. ),
  26. );
  27. }
  28. }
  29.  
  30. class HomeContent extends StatelessWidget {
  31. @override
  32. Widget build(BuildContext context) {
  33. return Container(
  34. height: 800.0,
  35. width: 400.0,
  36. color: Colors.pink,
  37. child: Row(
  38. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  39. crossAxisAlignment: CrossAxisAlignment.start,
  40. children: <Widget>[
  41. IconContainer(Icons.home, color: Colors.blue),
  42. IconContainer(Icons.search, color: Colors.orange),
  43. IconContainer(Icons.select_all, color: Colors.red)
  44. ],
  45. ),
  46. );
  47. }
  48. }
  49.  
  50. class IconContainer extends StatelessWidget {
  51. double size = 32.0;
  52. Color color = Colors.red;
  53. IconData icon;
  54. IconContainer(this.icon, {this.color, this.size}) {}
  55. @override
  56. Widget build(BuildContext context) {
  57. // TODO: implement build
  58. return Container(
  59. height: 100.0,
  60. width: 100.0,
  61. color: this.color,
  62. child: Center(
  63. child: Icon(this.icon, size: this.size, color: Colors.white),
  64. ),
  65. );
  66. }
  67. }

Column 垂直布局:

  1. import 'package:flutter/material.dart';
  2. import 'res/listData.dart';
  3. /*
  4. flutter页面布局Padding Row Column Expanded组件详情:
  5. Column水平布局组件:
  6. mainAxisAlignment 主轴的排序方式
  7. crossAxisAlignment 次轴的排序方式
  8. children 组件子元素:
  9. */
  10.  
  11. void main() {
  12. runApp(MyApp());
  13. }
  14.  
  15. class MyApp extends StatelessWidget {
  16. @override
  17. Widget build(BuildContext context) {
  18. // TODO: implement build
  19. return MaterialApp(
  20. home: Scaffold(
  21. appBar: AppBar(
  22. title: Text('Padding Row Column Expanded'),
  23. ),
  24. body: HomeContent(),
  25. ),
  26. );
  27. }
  28. }
  29.  
  30. class HomeContent extends StatelessWidget {
  31. @override
  32. Widget build(BuildContext context) {
  33. return Container(
  34. height: 800.0,
  35. width: 400.0,
  36. color: Colors.pink,
  37. child: Column(
  38. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  39. crossAxisAlignment: CrossAxisAlignment.start,
  40. children: <Widget>[
  41. IconContainer(Icons.home, color: Colors.blue),
  42. IconContainer(Icons.search, color: Colors.orange),
  43. IconContainer(Icons.select_all, color: Colors.red)
  44. ],
  45. ),
  46. );
  47. }
  48. }
  49.  
  50. class IconContainer extends StatelessWidget {
  51. double size = 32.0;
  52. Color color = Colors.red;
  53. IconData icon;
  54. IconContainer(this.icon, {this.color, this.size}) {}
  55. @override
  56. Widget build(BuildContext context) {
  57. // TODO: implement build
  58. return Container(
  59. height: 100.0,
  60. width: 100.0,
  61. color: this.color,
  62. child: Center(
  63. child: Icon(this.icon, size: this.size, color: Colors.white),
  64. ),
  65. );
  66. }
  67. }
Expanded
  1. import 'package:flutter/material.dart';
  2. import 'res/listData.dart';
  3. /*
  4. Flutter Expanded类似Web中的Flex布局:
  5. flex:元素占整个父Row/Column的比例:
  6. child 子元素
  7.  
  8. */
  9.  
  10. void main() {
  11. runApp(MyApp());
  12. }
  13.  
  14. class MyApp extends StatelessWidget {
  15. @override
  16. Widget build(BuildContext context) {
  17. // TODO: implement build
  18. return MaterialApp(
  19. home: Scaffold(
  20. appBar: AppBar(
  21. title: Text('Padding Row Column Expanded'),
  22. ),
  23. body: HomeContent(),
  24. ),
  25. );
  26. }
  27. }
  28.  
  29. class HomeContent extends StatelessWidget {
  30. @override
  31. Widget build(BuildContext context) {
  32. return Row(
  33. children: <Widget>[
  34. // Expanded(
  35. // flex: 1,
  36. // child: IconContainer(Icons.search,color:Colors.blue),
  37. // ),
  38. // Expanded(
  39. // flex: 2,
  40. // child: IconContainer(Icons.home,color:Colors.orange),
  41. // ),
  42. // Expanded(
  43. // flex: 1,
  44. // child: IconContainer(Icons.select_all,color:Colors.red),
  45. // )
  46.  
  47. Expanded(
  48. flex: ,
  49. child: IconContainer(Icons.home,color:Colors.orange),
  50. ),
  51. IconContainer(Icons.search,color:Colors.blue)
  52. ],
  53. );
  54. }
  55. }
  56.  
  57. class IconContainer extends StatelessWidget {
  58. double size = 32.0;
  59. Color color = Colors.red;
  60. IconData icon;
  61. IconContainer(this.icon, {this.color, this.size}) {}
  62. @override
  63. Widget build(BuildContext context) {
  64. // TODO: implement build
  65. return Container(
  66. height: 100.0,
  67. width: 100.0,
  68. color: this.color,
  69. child: Center(
  70. child: Icon(this.icon, size: this.size, color: Colors.white),
  71. ),
  72. );
  73. }
  74. }

10Flutter页面布局 Padding Row Column Expanded组件详解:的更多相关文章

  1. 页面布局 Paddiing Row Column Expanded 组件详解

    一.Paddiing 组件     padding    EdgeInsetss 设置填充的值     child  组件    return Padding(     padding: EdgeIn ...

  2. flutter 页面布局 Paddiing Row Column Expanded 组件

    Flutter Paddiing 组件 在 html 中常见的布局标签都有 padding 属性,但是 Flutter 中很多 Widget 是没有 padding 属 性.这个时候我们可以用 Pad ...

  3. Tomcat负载均衡、调优核心应用进阶学习笔记(一):tomcat文件目录、页面、架构组件详解、tomcat运行方式、组件介绍、tomcat管理

    文章目录 tomcat文件目录 bin conf lib logs temp webapps work 页面 架构组件详解 tomcat运行方式 组件介绍 tomcat管理 tomcat文件目录 ➜ ...

  4. Echars 6大公共组件详解

    Echars 六大组件详解 : title  tooltip toolbox legend  dataZoom visualMap 一.title标题详解 myTitleStyle = { color ...

  5. Angular6 学习笔记——组件详解之组件通讯

    angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net ...

  6. Angular6 学习笔记——组件详解之模板语法

    angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net ...

  7. Tomcat系列之服务器的安装与配置以及各组件详解

    Tomcat系列之服务器的安装与配置以及各组件详解 大纲 一.前言 二.安装与配置Tomcat 三.Tomcat 目录的结构 四.Tomcat 配置文件 注,本文的测试的操作系统为CentOS 6.4 ...

  8. Android中Intent组件详解

    Intent是不同组件之间相互通讯的纽带,封装了不同组件之间通讯的条件.Intent本身是定义为一个类别(Class),一个Intent对象表达一个目的(Goal)或期望(Expectation),叙 ...

  9. Android笔记——四大组件详解与总结

     android四大组件分别为activity.service.content provider.broadcast receiver. ------------------------------- ...

随机推荐

  1. vi/vim常用按键

    最近这段时间坚持了vim的使用,我在我的IDEA里面加了一个插件,可以支持vim. 然后不管是IDEA还是Vim都有自己的按键,而且都很好用,所以我就总结下在IDEA下的vim使用命令 当然,都是原生 ...

  2. 7.MapReduce操作Hbase

    7 HBase的MapReduce   HBase中Table和Region的关系,有些类似HDFS中File和Block的关系.由于HBase提供了配套的与MapReduce进行交互的API如 Ta ...

  3. select函数的详细使用(C语言)

    Select在Socket编程中还是比较重要的,可是对于初学Socket的人来说都不太爱用Select写程序,他们只是习惯写诸如connect.accept.recv或recvfrom这样的阻塞程序( ...

  4. 一个异常研究InvalidApartmentStateChange

    微软资料:invalidApartmentStateChange MDA 地址:https://docs.microsoft.com/zh-cn/dotnet/framework/debug-trac ...

  5. ASP.NET Core 2.0身份和角色管理入门

    见  https://blog.csdn.net/mzl87/article/details/84892916 https://www.codeproject.com/Articles/1235077 ...

  6. ubunu安装qq、微信等、

    参考: https://www.lulinux.com/archives/1319 安装下面下载deepin-wine-for-ubuntu,然后进去安装 https://github.com/wsz ...

  7. npm设置成淘宝镜像

    1.淘宝 npm 网址 https://npm.taobao.org/ 2.修改 2.1 通过命令配置 2.1.1. 命令 npm config set registry https://regist ...

  8. Entity Framework学习过程

    ///安装ef nuget中文控制台指令 PM> Install-Package EntityFramework.zh-Hans <!--配置数据库连接--> <connect ...

  9. Python 11--文件流

  10. js 获取窗口大小

     //获得窗口大小         function findDimensions() //函数:获取尺寸         {             var point = {};          ...