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 ...
随机推荐
- 【重点突破】—— UniApp 微信小程序开发官网学习One
一.初步认识 uni-app官网:https://uniapp.dcloud.io/component/README HBuilderX官方IDE下载地址: http://www.dcloud.io/ ...
- Type.MakeGenericType 方法 (Type[]) 泛型反射
替代由当前泛型类型定义的类型参数组成的类型数组的元素,并返回表示结果构造类型的 Type 对象. 命名空间: System程序集: mscorlib(mscorlib.dll 中) public ...
- 三十九、python面向对象一
A.python面向对象 1.面向对象基础:面向对象三个特性:封装,继承,多态C# java 只能用面向对象编程Ruby,python 函数+面向对象 函数式编程:def 函数def f1(a): r ...
- Spring 由缓存切点驱动的通知者
Spring 缓存通知者和切点 缓存切点 /** * Spring 核心切点抽象 */ public interface Pointcut { /** * 类过滤器,当前切点是否需要织入在指定的类上 ...
- pycharm运行测试用例遇到错误:ZeroDivisionError: float division by zero的原因
运行测试用例报错:ZeroDivisionError: float division by zero 一般是因为测试用例模块命名没有以test开头,导致unittest找不到用例,用例总数为0,导致除 ...
- 【Linux开发】Ubuntu下几个软件的配置记录backup
调用ubuntu命令行的方法:ctrl+alt+t gcc -o test test.c 开发工具包括eclipse,Qt等全部放入了/opt/路径下,java开发环境放在了/usr/local/jd ...
- 005 gcc 的简单使用
0. 前言 本文主要讲关于 gcc 的几种编译方式 不妨设文件名为 test.c 1. 方法一 $ gcc test.c (Windows OS)编译成功的话,没有回馈,在 test.c 所在的文件夹 ...
- [转帖]Oracle dba_objects和all_objects 最大的区别
Oracle dba_objects和all_objects 最大的区别 原创 Oracle 作者:maohaiqing0304 时间:2015-08-14 15:07:18 9281 0 链 ...
- C语言数组名取地址。。。
int main(){ int a[5] = { 1, 2, 3, 4, 5 }; printf("%08X ,%08X ,%08X ,%08X", a, &a, a + ...
- mysql简单命令
库: 增 create database db1:新建一个默认编码的库 create database db1 charset uet8 ;建一个编码为 utf8 的库 删 drop database ...