Created
February 16, 2020 13:48
-
-
Save ryanlid/0f23160a775cde81adcfd1d24d43577b to your computer and use it in GitHub Desktop.
Wrap 按宽高自动换行布局
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp( | |
MaterialApp( | |
title: "Wrap按宽高自动换行布局示例", | |
home: MyApp(), | |
), | |
); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Wrap按宽高自动换行布局示例"), | |
), | |
body: Wrap( | |
spacing: 8.0, | |
runSpacing: 4.0, | |
children: <Widget>[ | |
Chip( | |
avatar: CircleAvatar( | |
backgroundColor: Colors.lightGreen.shade800, | |
child: Text( | |
"西门", | |
style: TextStyle(fontSize: 10.0), | |
), | |
), | |
label: Text("西门吹雪"), | |
), | |
Chip( | |
avatar: CircleAvatar( | |
backgroundColor: Colors.lightBlue.shade700, | |
child: Text( | |
"司空", | |
style: TextStyle(fontSize: 10.0), | |
), | |
), | |
label: Text("司空摘星"), | |
), | |
Chip( | |
avatar: CircleAvatar( | |
backgroundColor: Colors.lightBlue.shade700, | |
child: Text( | |
"婉清", | |
style: TextStyle(fontSize: 10.0), | |
), | |
), | |
label: Text("木婉清"), | |
), | |
Chip( | |
avatar: CircleAvatar( | |
backgroundColor: Colors.lightBlue.shade700, | |
child: Text( | |
"一郎", | |
style: TextStyle(fontSize: 10.0), | |
), | |
), | |
label: Text("萧十一郎"), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment