水平布局
-
main.dart
代码:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Link World!',
home: Scaffold(
appBar: new AppBar(title: new Text('水平方向布局')),
body: new Row(
children: <Widget>[
Expanded(child:new RaisedButton( // 灵活布局:相当于 flex:1
onPressed: (){},
color: Colors.greenAccent,
child: new Text('Green'),
)),
Expanded(child:new RaisedButton(
onPressed: (){},
color: Colors.orangeAccent,
child: new Text('Red'),
)),
Expanded(child:new RaisedButton(
onPressed: (){},
color: Colors.lightBlue,
child: new Text('Blue'),
)),
],
)
)
);
}
}
【效果】如下:
image.png
网友评论