Skip to content

Commit 49e8e47

Browse files
committed
add ListView widget.
1 parent f3f027e commit 49e8e47

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed

lib/const/page_item_const.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,9 @@ const PAGE_ITEMS = [
167167
"img": PageImage.FLUTTER_OPEN,
168168
"click": PageName.FLOW,
169169
},
170+
{
171+
"title": PageName.LAYOUT,
172+
"img": PageImage.FLUTTER_OPEN,
173+
"click": PageName.LAYOUT,
174+
},
170175
];

lib/const/page_name_const.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ class PageName {
3838
static const INDEX_STACK = "IndexedStack";
3939
static const EXPANDED = "Expanded";
4040
static const FLOW = "Flow";
41+
static const LAYOUT = "Layout";
42+
4143
}

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class FlutterOpenApp extends StatelessWidget {
5252
PageName.INDEX_STACK: (context) => IndexStackPage(),
5353
PageName.EXPANDED: (context) => ExpandPage(),
5454
PageName.FLOW: (context) => FlowPage(),
55+
PageName.LAYOUT: (context) => LayoutPage(),
5556
},
5657
);
5758
}

lib/page/muti/LayoutPage.dart

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
///
2+
/// Created by NieBin on 2019/5/26
3+
/// Github: https://github.com/nb312
4+
5+
import "package:flutter/material.dart";
6+
import 'package:flutter_widgets/const/_const.dart';
7+
8+
class LayoutPage extends StatefulWidget {
9+
@override
10+
LayoutState createState() => LayoutState();
11+
}
12+
13+
class LayoutState extends State<LayoutPage> {
14+
Widget _builder(BuildContext context, BoxConstraints constraints) =>
15+
Container(
16+
constraints:
17+
BoxConstraints.expand(height: 100, width: constraints.maxWidth),
18+
color: RED,
19+
);
20+
21+
Widget _listView() => ListView(
22+
shrinkWrap: true,
23+
itemExtent: 100,
24+
controller: ScrollController(initialScrollOffset: 100),
25+
children: <Widget>[
26+
Container(
27+
constraints: BoxConstraints.expand(height: 100),
28+
color: RED,
29+
),
30+
Container(
31+
constraints: BoxConstraints.expand(height: 100),
32+
color: BLUE,
33+
),
34+
Container(
35+
constraints: BoxConstraints.expand(height: 100),
36+
color: YELLOW,
37+
),
38+
Container(
39+
constraints: BoxConstraints.expand(height: 100),
40+
color: RED_LIGHT,
41+
),
42+
Container(
43+
constraints: BoxConstraints.expand(height: 100),
44+
color: BLUE_DEEP,
45+
),
46+
Container(
47+
constraints: BoxConstraints.expand(height: 100),
48+
color: RED,
49+
),
50+
Container(
51+
constraints: BoxConstraints.expand(height: 100),
52+
color: BLUE,
53+
),
54+
Container(
55+
constraints: BoxConstraints.expand(height: 100),
56+
color: YELLOW,
57+
),
58+
Container(
59+
constraints: BoxConstraints.expand(height: 100),
60+
color: RED_LIGHT,
61+
),
62+
Container(
63+
constraints: BoxConstraints.expand(height: 100),
64+
color: BLUE_DEEP,
65+
)
66+
],
67+
);
68+
69+
@override
70+
Widget build(BuildContext context) {
71+
return Scaffold(
72+
appBar: AppBar(
73+
title: Text(""),
74+
),
75+
body: _listView(),
76+
);
77+
}
78+
}

lib/page/muti/_muti.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
export "IndexStackPage.dart";
77
export "ExpandPage.dart";
88
export 'FlowPage.dart';
9+
export 'LayoutPage.dart';

0 commit comments

Comments
 (0)