1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| class _home extends StatefulWidget { @override State<StatefulWidget> createState() { return _homeState(); } } class _homeState extends State<_home> { @override Widget build(BuildContext context) { // TODO: implement build return new Scaffold( appBar: new AppBar( title: Text("title"), centerTitle: true, ), body: new Container( height: 200.0, child: new ListView( scrollDirection: Axis.horizontal,//ListView滑动方向horizontal水平vertical垂直 children: <Widget>[ new Container( width: 180.0, color: Colors.greenAccent, ), new Container( width: 180.0, color: Colors.lightBlue, ), new Container( width: 180.0, color: Colors.red, ), new Container( width: 180.0, color: Colors.black12, ), new Container( width: 180.0, color: Colors.amberAccent, ) ], ), ) ); }
|