1 import 'package:Flutter/material.dart'; 2 3 class LayoutDemo extends StatelessWidget{ 4 @override 5 Widget build(BuildContext context) { 6 // Todo: implement build 7 return new Scaffold( 8 appBar: new AppBar( 9 title: new Text('水平布局示例'), 10 ), 11 body: new Row( 12 children: <Widget>[ 13 new Expanded(child: new Text('左侧文本',textAlign: TextAlign.center)), 14 new Expanded(child: new Text('中间文本',textAlign: TextAlign.center)), 15 new Expanded(child: new FittedBox(fit: BoxFit.contain,child: const Flutterlogo())) 16 ], 17 ), 18 ); 19 } 20 } 21 22 void main(){ 23 runApp( 24 new MaterialApp( 25 title: '水平对齐', 26 home: new LayoutDemo(), 27 ), 28 ); 29 }
原文地址:https://www.cnblogs.com/tom2015010203/p/11944544.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。