Skip to content

Commit 7e7dcc9

Browse files
committed
feat: ListView
1 parent 652d015 commit 7e7dcc9

File tree

6 files changed

+117
-0
lines changed

6 files changed

+117
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## **ListView**

lib/widget/regular/index.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'wrap/index.dart' as Wrap;
1212
import 'table/index.dart' as Table;
1313
import 'flow/index.dart' as Flow;
1414
import 'stack/index.dart' as Stack;
15+
import 'listview/index.dart' as ListView;
1516

1617
const nameSpaces = '/regular_';
1718

@@ -80,6 +81,11 @@ List widgets = [
8081
widget: Stack.Index(),
8182
code: 57795, // settings_system_daydream
8283
title: Stack.Index.title
84+
),
85+
ItemInfo(
86+
widget: ListView.Index(),
87+
code: 60236, // spa
88+
title: ListView.Index.title
8389
)
8490
];
8591

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_screenutil/flutter_screenutil.dart';
3+
4+
class Index extends StatefulWidget {
5+
@override
6+
_IndexState createState() => _IndexState();
7+
}
8+
9+
class _IndexState extends State<Index> {
10+
List listview = [
11+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c3e1d90c.jpg',
12+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c40f3bc2.jpg',
13+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c4406144.jpg',
14+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c46823f8.jpg',
15+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c48c73d0.jpg',
16+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c4b4dc2f.jpg',
17+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c51a2a45.jpg',
18+
'http://pic1.win4000.com/wallpaper/2019-02-14/5c65107a0ee05.jpg',
19+
'http://pic1.win4000.com/wallpaper/2019-02-14/5c65108043791.jpg',
20+
'http://pic1.win4000.com/wallpaper/2019-02-14/5c651084373de.jpg'
21+
];
22+
@override
23+
Widget build(BuildContext context) {
24+
return Scaffold(
25+
appBar: AppBar(title: Text('ListView'),),
26+
body: ListView(
27+
scrollDirection: Axis.vertical,
28+
children: List.generate(10, (index) {
29+
return ListTile(
30+
title: Text('title $index'),
31+
subtitle: Text('subtitle $index'),
32+
leading: CircleAvatar(
33+
backgroundImage: NetworkImage(listview[index]),
34+
),
35+
trailing: Icon(Icons.arrow_right),
36+
);
37+
}),
38+
),
39+
);
40+
}
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_screenutil/flutter_screenutil.dart';
3+
4+
class Index extends StatefulWidget {
5+
@override
6+
_IndexState createState() => _IndexState();
7+
}
8+
9+
class _IndexState extends State<Index> {
10+
List listview = [
11+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c3e1d90c.jpg',
12+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c40f3bc2.jpg',
13+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c4406144.jpg',
14+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c46823f8.jpg',
15+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c48c73d0.jpg',
16+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c4b4dc2f.jpg',
17+
'http://pic1.win4000.com/wallpaper/2019-02-15/5c664c51a2a45.jpg',
18+
'http://pic1.win4000.com/wallpaper/2019-02-14/5c65107a0ee05.jpg',
19+
'http://pic1.win4000.com/wallpaper/2019-02-14/5c65108043791.jpg',
20+
'http://pic1.win4000.com/wallpaper/2019-02-14/5c651084373de.jpg'
21+
];
22+
@override
23+
Widget build(BuildContext context) {
24+
return Scaffold(
25+
appBar: AppBar(title: Text('ListView.Builder'),),
26+
body: ListView.builder(
27+
itemCount: listview.length,
28+
itemBuilder: (BuildContext context, int index) {
29+
return ListTile(
30+
title: Text('title $index'),
31+
subtitle: Text('subtitle $index'),
32+
leading: CircleAvatar(
33+
backgroundImage: NetworkImage(listview[index]),
34+
),
35+
trailing: Icon(Icons.arrow_right),
36+
);
37+
},
38+
)
39+
);
40+
}
41+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp;
3+
import 'demo.dart' as Demo;
4+
import 'demo_builder.dart' as DemoBuilder;
5+
6+
class Index extends StatefulWidget {
7+
static String title = 'ListView';
8+
static String originCodeUrl = '';
9+
static String mdUrl = 'docs/widget/regular/listview/index.md';
10+
@override
11+
_IndexState createState() => _IndexState();
12+
}
13+
14+
class _IndexState extends State<Index> {
15+
@override
16+
Widget build(BuildContext context) {
17+
return WidgetComp.Index(
18+
title: Index.title,
19+
originCodeUrl: Index.originCodeUrl,
20+
mdUrl: Index.mdUrl,
21+
demoChild: <Widget>[
22+
Demo.Index(),
23+
DemoBuilder.Index()
24+
],
25+
);
26+
}
27+
}

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ flutter:
7070
- docs/widget/regular/table/
7171
- docs/widget/regular/flow/
7272
- docs/widget/regular/stack/
73+
- docs/widget/regular/listview/
7374
- docs/widget/navigator/appbar/
7475
- docs/widget/navigator/scaffold/
7576
# An image asset can refer to one or more resolution-specific "variants", see

0 commit comments

Comments
 (0)