flutter 布局简介
import 'package:flutter/material.dart';
class LayoutDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// aspectratio会自动填充父元素宽度,根据设定的宽高比自动扩充高度。
AspectRatio(
aspectRatio: /,
child: Container(
color: Colors.black87,
),
),
SizedBox(
height: ,
width: ,
child: Container(
child: Icon(Icons.poll, size: ),
alignment: Alignment.topRight,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(),
gradient: LinearGradient(
colors: [
Color.fromRGBO(, , , 0.9),
Color.fromRGBO(, , , 0.95),
],
),
boxShadow: [
BoxShadow(
color: Colors.black87,
offset: Offset(, ),
blurRadius: ,
spreadRadius: -
)
]
),
),
),
// 这里的sizedbox可当divider用
SizedBox(
height: ,
),
SizedBox(
height: ,
width: ,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromRGBO(, , , ),
Color.fromRGBO(, , , ),
],
),
),
),
)
],
);
}
}

比较常用的就是Row()、Colmun(),具体的用法参考css的flexbox布局,比较相似。
flutter 布局简介的更多相关文章
- Flutter 布局(五)- LimitedBox、Offstage、OverflowBox、SizedBox详解
本文主要介绍Flutter布局中的LimitedBox.Offstage.OverflowBox.SizedBox四种控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. Limited ...
- Flutter 布局(三)- FittedBox、AspectRatio、ConstrainedBox详解
本文主要介绍Flutter布局中的FittedBox.AspectRatio.ConstrainedBox,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. FittedBox Scale ...
- Flutter 布局(四)- Baseline、FractionallySizedBox、IntrinsicHeight、IntrinsicWidth详解
本文主要介绍Flutter布局中的Baseline.FractionallySizedBox.IntrinsicHeight.IntrinsicWidth四种控件,详细介绍了其布局行为以及使用场景,并 ...
- Flutter 布局(二)- Padding、Align、Center详解
本文主要介绍Flutter布局中的Padding.Align以及Center控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. Padding A widget that insets ...
- Flutter 布局详解
本文主要介绍了Flutter布局相关的内容,对相关知识点进行了梳理,并从实际例子触发,进一步讲解该如何去进行布局. 1. 简介 在介绍Flutter布局之前,我们得先了解Flutter中的一些布局相关 ...
- Flutter 布局(十)- ListBody、ListView、CustomMultiChildLayout详解
本文主要介绍Flutter布局中的ListBody.ListView.CustomMultiChildLayout控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. ListBody ...
- Flutter 布局(七)- Row、Column详解
本文主要介绍Flutter布局中的Row.Column控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. Row A widget that displays its children ...
- Flutter 布局(八)- Stack、IndexedStack、GridView详解
本文主要介绍Flutter布局中的Stack.IndexedStack.GridView控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. Stack A widget that po ...
- Flutter 布局(九)- Flow、Table、Wrap详解
本文主要介绍Flutter布局中的Flow.Table.Wrap控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. Flow A widget that implements the ...
随机推荐
- JavaScript json loop item in array
Iterating through/Parsing JSON Object via JavaScript 解答1 Your JSON object is incorrect because it ha ...
- HTTP头详解:
GET/mycode/2.gifHTTP/1.1 [表示发送的是GET请求,请求资源是/mycode/2.gif,协议HTTP/1.1] Host:localhost [主机] Connectio ...
- C# 截获某个域中未捕获的异常 CLR20R3 程序终止的几种解决方案
AppDomain.UnhandledException可以获的异常,却截不下来,求解 AppDomain.CurrentDomain.UnhandledException += CurrentDom ...
- hibernate 配置+注释
Hibernate配置属性 属性名 用途 hibernate.dialect 一个Hibernate Dialect类名允许Hibernate针对特定的关系数据库生成优化的SQL. 取值 full.c ...
- 如何比较两个txt文件内容的细微差别
如何比较两个txt文件内容的细微差别 https://jingyan.baidu.com/article/19020a0a1dd04a529c284272.html 听语音 | 浏览:3500 | 更 ...
- flutter SnackBar异常Another exception was thrown: Scaffold.of() called with a context that does not contain a Scaffold
代码如下: import 'package:flutter/material.dart'; void main() { runApp(MaterialApp( title: 'Returning Da ...
- <nginx.conf> nginx设置用户权限
问题在于,我们使用weblogic在前台系统获取其他系统的文件,然后保存在webloigc目录下,然后配置了nginx来当http服务器,这样,其他的系统可以来下载文件,但是访问的时候提示403错误, ...
- Java中关于Date等日期类的简单使用
Date Date类不常用,很多方法被废弃了,常用它的两个构造方法来new一个Date对象. Date d1 = new Date(); //不传任何参数,代表当前时间点 System.out.pri ...
- Linux window 安装tomcat各版本下载地址
1.地址 https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/
- 【Linux开发】Linux启动脚本设置
前言linux有自己一套完整的启动 体系,抓住了linux启动 的脉络,linux的启动 过程将不再神秘.阅读之前建议先看一下附图.本文中假设inittab中设置的init tree为:/etc/rc ...