Created
January 14, 2020 13:31
-
-
Save Hecatoncheir/bc8859add8210ab9d8ddeac29e533664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return DefaultTabController( | |
length: 1, | |
child: NestedScrollView( | |
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | |
return <Widget>[ | |
SliverOverlapAbsorber( | |
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), | |
sliver: SliverAppBar(title: Text("Items List")), | |
), | |
]; | |
}, | |
body: TabBarView(children: [ | |
SafeArea( | |
top: false, | |
bottom: false, | |
child: Builder( | |
builder: (BuildContext context) { | |
return CustomScrollView( | |
key: PageStorageKey<String>('_'), | |
slivers: <Widget>[ | |
SliverOverlapInjector( | |
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( | |
context), | |
), | |
SliverFixedExtentList( | |
itemExtent: 48.0, | |
delegate: SliverChildBuilderDelegate( | |
(BuildContext context, int index) { | |
return ListTile( | |
title: Text("item #$index"), | |
onTap: () => Navigator.pushNamed( | |
context, "/details", | |
arguments: index), | |
); | |
}, | |
childCount: 55, | |
), | |
) | |
], | |
); | |
}, | |
), | |
) | |
]), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment