/
main.dart
44 lines (39 loc) · 1.05 KB
/
main.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
// ignore_for_file: public_member_api_docs
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:lazy_loading_list/lazy_loading_list.dart';
void main() {
runApp(MyApp(
items: List<String>.generate(50, (i) => 'Item $i'),
));
}
class MyApp extends StatelessWidget {
final List<String> items;
MyApp({Key key, @required this.items}) : super(key: key);
@override
Widget build(BuildContext context) {
final title = 'Long List';
return MaterialApp(
title: title,
home: Scaffold(
appBar: AppBar(
title: Text(title),
),
body: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return LazyLoadingList(
initialSizeOfItems: 10,
index: index,
hasMore: true,
loadMore: () => print('Loading More'),
child: ListTile(
title: Text('${items[index]}'),
),
);
},
),
),
);
}
}