Skip to content

Commit 38ef6ec

Browse files
authored
Merge pull request #6 from Anirudhk07/Anirudhk07-patch-1
Added Sliver List
2 parents 26809b8 + b9ca563 commit 38ef6ec

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
- [Outer Line Style ](#outer-line-style )
4949
- [TextFormField](#textformfield)
5050
- [Navigation Drawer](#navigation-drawer)
51+
- [Sliver List](#sliver-list)
52+
5153

5254
- [Utilities](#utilities)
5355

@@ -1000,6 +1002,39 @@ TextFormField(
10001002
labelStyle: TextStyle(color: Colors.yellow))
10011003
)
10021004
```
1005+
## Sliver List
1006+
1007+
![slivers2](https://user-images.githubusercontent.com/46351318/85413440-74530900-b588-11ea-8616-059b15cf1a49.gif)
1008+
1009+
1010+
* SliverList takes a delegate parameter which provides the items in the list as they scroll into view.
1011+
1012+
* You can specify the actual list of children with a SliverChildListDelegate Or build them lazily with a SliverChildBuilderDelegate.
1013+
1014+
```
1015+
SliverList(
1016+
delegate: SliverChildListDelegate(
1017+
[
1018+
Container(color: Colors.red, height: 150.0),
1019+
Container(color: Colors.purple, height: 150.0),
1020+
Container(color: Colors.green, height: 150.0),
1021+
],
1022+
),
1023+
);
1024+
// This builds an infinite scrollable list of differently colored
1025+
// Containers.
1026+
SliverList(
1027+
delegate: SliverChildBuilderDelegate((BuildContext context, int index) {
1028+
// To convert this infinite list to a list with three items,
1029+
// uncomment the following line:
1030+
// if (index > 3) return null;
1031+
return Container(color: getRandomColor(), height: 150.0);
1032+
},
1033+
// Or, uncomment the following line:
1034+
// childCount: 3,
1035+
),
1036+
);
1037+
```
10031038

10041039
> **References:**
10051040
1. https://medium.com/@anilcan/forms-in-flutter-6e1364eafdb5

0 commit comments

Comments
 (0)