forked from md-siam/widget_of_the_day
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistview.dart
57 lines (53 loc) · 1.32 KB
/
listview.dart
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
46
47
48
49
50
51
52
53
54
55
56
57
import 'package:flutter/material.dart';
import 'package:widget_of_the_day/4_listview&builder/circle.dart';
import 'package:widget_of_the_day/4_listview&builder/square.dart';
class MyListView extends StatelessWidget {
MyListView({Key? key}) : super(key: key);
final List _post = [
'post 1',
'post 2',
'post 3',
'post 4',
'post 5',
];
final List _stories = [
'story 1',
'story 2',
'story 3',
'story 4',
'story 5',
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("ListView"),
),
body: Column(
children: [
// instagram stories
SizedBox(
height: 100,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: _stories.length,
itemBuilder: (BuildContext context, int index) {
return MyCircle(
child: _stories[index],
);
},
),
),
Expanded(
child: ListView.builder(
itemCount: _post.length,
itemBuilder: (BuildContext context, int index) {
return MySquare(child: _post[index]);
},
),
),
],
),
);
}
}