纵向列表与横向列表
home: Scaffold(
appBar: AppBar(
title: Text('ListView'),
),
body: new ListView(
children: <Widget>[
new ListTile(
leading: new Icon(Icons.access_alarms),
title: Text('hhhh'),
),new ListTile(
leading: new Icon(Icons.access_time),
title: Text('xxxx'),
),
new Image.network(
'https://image.uisdc.com/wp-content/uploads/2018/12/uisdc-banner-20181214-6.jpg',
),new Image.network(
'https://image.uisdc.com/wp-content/uploads/2018/12/uisdc-banner-20181208-4.jpg',
),new Image.network(
'https://image.uisdc.com/wp-content/uploads/2018/12/uisdc-banner-20181207-4.jpg',
),new Image.network(
'https://image.uisdc.com/wp-content/uploads/2018/12/uisdc-banner-20181211-4.jpg'
)
],
)
),
横向
加一条语句
动态列表
import 'package:flutter/material.dart';
void main() => runApp(MyApp(
items: new List<String>.generate(
5, (i)=>"itens $i")//length 长度,匿名函数
));
class MyApp extends StatelessWidget {
// This widget is the root of your application.
final List<String> items;
MyApp({Key key,@required this.items}):super(key:key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: new AppBar(title: new Text ('mystudys')),
body: new ListView.builder(
itemCount: items.length,//使用
itemBuilder: (context,index){
return new ListTile(
title: new Text('哈哈哈 ${items[index]}'),
);
},
),
),
);
}
}
一个人写了比较多的flutter https://blog.csdn.net/z979451341/article/details/80899980