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

多個元素定位

Align

  1. var stack = new Container(
  2. height: 400,
  3. width: 300,
  4. color: Colors.blueAccent,
  5. child: Stack(
  6. children: <Widget>[
  7. Align(
  8. //alignment:Alignment.topLeft,
  9. alignment:Alignment(1,2),
  10. child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
  11. ),
  12. Align(
  13. alignment:Alignment.center,
  14. child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
  15. ),
  16. Align(
  17. alignment:Alignment.bottomLeft,
  18. child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
  19. ),
  20. ],
  21. ),
  22. );
  1. Positioned
  1. var stack = new Container(
  2. height: 400,
  3. width: 300,
  4. color: Colors.blueAccent,
  5. child: Stack(
  6. children: <Widget>[
  7. Positioned(
  8. top:1,
  9. left: 1,
  10. right: 1,
  11. bottom: 1,
  12. child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
  13. ),
  14. Positioned(
  15. top:1,
  16. left: 1,
  17. child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
  18. ),
  19. Positioned(
  20. right: 1,
  21. bottom: 1,
  22. child: Icon(Icons.access_alarm,size: 30,color: Colors.red,),
  23. ),
  24. ],
  25. ),
  26. );

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. android 摇一摇功能的实现

    将这个功能封装成了一个类,这样今后方便调用 package com.bobo.myyaoyiyaotest; import android.R.bool; import android.content ...

  2. 大数据笔记(九)——Mapreduce的高级特性(B)

    二.排序 对象排序 员工数据 Employee.java  ----> 作为key2输出 需求:按照部门和薪水升序排列 Employee.java package mr.object; impo ...

  3. React Native商城项目实战11 - 个人中心头部内容

    1.创建MineHeaderView.js /** * 个人中心头部内容 */ import React, { Component } from 'react'; import { AppRegist ...

  4. CAS-4.2.7接入REST登录认证,移动端、C/S端登录解决方案

    一.发送GET请求获取RSA公钥和JSESSIONID 请求地址:/cas/login,请求类型:GET curl -I http://cas.gfstack.geo:8080/cas/login 返 ...

  5. WinForm实现最小化右下角

    首先,要在窗体里面加入这么两个控件,左边的是托盘控件,右边的是菜单控件. 然后设置窗体的FormClosing事件: if (e.CloseReason == CloseReason.UserClos ...

  6. fedora23禁用不需要的服务?--systemd服务单元?

    sign up: 签约; 登记, 注册. i'll sign up and go to the front and fight. he persuaded the company to sign up ...

  7. java 操作hdfs(连接HDFS)

    FileSystem fs = null; Configuration conf = null; @Before public void init() throws Exception{ conf = ...

  8. java实现多种加密模式的AES算法-总有一种你用的着

    https://blog.csdn.net/u013871100/article/details/80100992 AES-128位-无向量-ECB/PKCS7Padding package com. ...

  9. KVM 虚拟化架构和实现原理

    目录 目录 KVM虚拟化架构 devkvm QEMU OpenstackKVMQEMU 的关系 KVM的虚拟化实现 KVM虚拟化架构 KVM是嵌入在Linux操作系统标准内核中的一个虚拟化模块,它能够 ...

  10. Delphi MlSkin V1.1 发布啦! 它能让你的程序拥有像QQ一样多彩炫丽的外观!

    http://bbs.csdn.net/topics/390740239 本帖最后由 u014161811 于 2014-03-24 09:46:40 编辑 QQ皮肤透明TEdit透明TMemo图片按 ...