alignment調整佈局
var stack = new Stack(
alignment: Alignment.center,//元素居中
//alignment: Alignment (1,1),//xy座標,可使用小數點
    children: <Widget>[
//按順序疊放
Container(
height: 300,
width: 300,
color: Colors.red,
),
Text('文字')
],
);

多個元素定位

Align

var stack = new Container(
height: 400,
width: 300,
color: Colors.blueAccent,
child: Stack(
children: <Widget>[
Align(
//alignment:Alignment.topLeft,
alignment:Alignment(1,2),
child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
),
Align(
alignment:Alignment.center,
child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
),
Align(
alignment:Alignment.bottomLeft,
child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
),
],
),
);
Positioned
var stack = new Container(
height: 400,
width: 300,
color: Colors.blueAccent,
child: Stack(
children: <Widget>[
Positioned(
top:1,
left: 1,
right: 1,
bottom: 1,
child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
),
Positioned(
top:1,
left: 1,
child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
),
Positioned(
right: 1,
bottom: 1,
child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
),
],
),
);

Flutter-stack層疊樣式的更多相关文章

  1. vue樣式綁定

    vue的樣式可以使得class,style不僅可以綁定文本,而且可以綁定數組和對象. 使用對象{} 使用數組 綁定對象 使用computed屬性, 使用內聯樣式.

  2. [转]利用 NPOI 變更字體尺寸及樣式

    本文转自:http://blog.cscworm.net/?p=1650 利用 NPOI 變更字體尺寸及樣式: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...

  3. flutter stack

    import 'package:flutter/material.dart'; void main() { runApp(MaterialApp(home: new MyApp())); } clas ...

  4. Flutter——Stack组件(层叠组件)、Align组件、Positioned组件

    Stack 表示堆的意思,我们可以用 Stack 或者 Stack 结合 Align 或者 Stack 结合 Positiond 来实现页面的定位布局. Stack组件 常用于两个子元素. Stack ...

  5. flutter stack嵌套,appbar透明,Container设置背景图片并且图片在appbar之下

    stack嵌套 一般情况下 stack是无法嵌套,出现stack嵌套,布局就会出乱 解决方式:就是第二个stack需要确定宽高 appbar透明 AppBar( backgroundColor: Co ...

  6. Flutter Stack布局中定位的方式

    前言 想要记录一下Stack布局中,定位的两种方式 代码 //……省略无关代码…… child: new Column( children: <Widget>[ new SizedBox( ...

  7. Flutter——Wrap组件(流式布局)

    Wrap 可以实现流布局,单行的 Wrap 跟 Row 表现几乎一致,单列的 Wrap 则跟 Row 表现几乎一致.但 Row 与 Column 都是单行单列的,Wrap 则突破了这个限制,mainA ...

  8. [Flutter] Stack Layout

    Normally if you place three the same size icons in a stack, they will stands on top of each other, t ...

  9. haroopad 預覽區樣式

    body { color:red; font-family:'Microsoft YaHei'; } html,body{ font-family: "微軟雅黑" !importa ...

随机推荐

  1. 大数据笔记(十九)——数据采集引擎Sqoop和Flume安装测试详解

    一.Sqoop数据采集引擎 采集关系型数据库中的数据 用在离线计算的应用中 强调:批量 (1)数据交换引擎: RDBMS <---> Sqoop <---> HDFS.HBas ...

  2. Ubuntu启动 卡在checking battery state 解决方案

    Ubuntu启动,卡在checking battery statALT + F1或者CTRL+ALT+F6切换到命令行[CTRL+ALT+F7返回界面]执行 sudo gdm start后就可以正常登 ...

  3. 高通camera基本代码架构【转】

    本文转载自:http://blog.sina.com.cn/s/blog_c0de2be70102vyn1.html 1  camera基本代码架构 高通平台对于camera的代码组织,大体上还是遵循 ...

  4. C# winform 键盘全局事件

    本文转载自:http://www.cnblogs.com/yukaizhao/archive/2010/12/14/winform_keyup.html 在winform程序中给form添加了keyu ...

  5. C# 内存建表备忘

    #region=====建表===== DataSet dataSet; // 创建表 DataTable table = new DataTable("testTable"); ...

  6. iview在项目中遇到的坑

    1.下拉框选中某一项搜索发现总是搜不到,最后发现是选中后选中值后边莫名多了很长的空格,原因很简单,在代码中opction闭合标签和主体没有在一行. 2.iview+vue项目中,用百分比或者displ ...

  7. Windows7 系统安装

    转载请标明本文链接:(https://www.cnblogs.com/softwarecb/p/11773811.html) 目前微软已经停止支持Windows 7,而且由于芯片组更新的原因,新的硬件 ...

  8. jquery点击来回切换

    做个笔记偶尔用有时记不住 方法一: <div id="test"> test </div> $('#test').mouseover(function () ...

  9. JAVA总结--多线程

    一.概念 1.进程:一个具有一定独立功能的程序,关于某些数据集合,一次运行活动. 两点:1.有自己的空间存储数据:2.一个程序. 进程,是系统   进行   资源分配  和 调度  的基础单位.动态性 ...

  10. Django 数据库多字段同时关联一个表为外键的解决办法

    多个字段对应一个外键时,会报错,如: class Storehouse_list(models.Model):#库位列表 nid = models.AutoField(primary_key=True ...