Skip to content

Instantly share code, notes, and snippets.

@Hecatoncheir
Created January 14, 2020 13:31
Show Gist options
  • Save Hecatoncheir/bc8859add8210ab9d8ddeac29e533664 to your computer and use it in GitHub Desktop.
Save Hecatoncheir/bc8859add8210ab9d8ddeac29e533664 to your computer and use it in GitHub Desktop.
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