加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flutter基础—定位对齐之对齐

发布时间:2020-12-14 14:55:01 所属栏目:百科 来源:网络整理
导读:Align控件即对齐控件,能将子控件所指定方式对齐,并根据子控件的大小调整自己的大

Align控件即对齐控件,能将子控件所指定方式对齐,并根据子控件的大小调整自己的大小。

对齐子控件的方式:

bottomCenter    (0.5,1.0)    底部中心
bottomLeft    (0.0,1.0)    左下角
bottomRight    (1.0,1.0)    右下角
center    (0.5,0.5)    水平垂直居中
centerLeft    (0.0,0.5)    左边缘中心
centerRight    (1.0,0.5)    右边缘中心
topCenter    (0.5,0.0)    顶部中心
topLeft    (0.0,0.0)    左上角
topRight    (1.0,0.0)    右上角
import 'package:flutter/material.dart';
class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('对齐'),),body: new Stack(
        children: <Widget>[
          new Align(
            alignment: new FractionalOffset(0.0,0.0),child: new Image.network('http://up.qqjia.com/z/25/tu32710_10.jpg'),new Align(
            alignment: FractionalOffset.bottomRight,child: new Image.network('http://up.qqjia.com/z/25/tu32710_11.jpg'),]
      ),);
  }
}
void main() {
  runApp(
    new MaterialApp(
      title: 'Flutter教程',home: new LayoutDemo(),);
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读