Skip to content

Instantly share code, notes, and snippets.

@kitoko552
Last active February 5, 2020 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitoko552/f6b849d9fa8f8b9f79af4fdaf90aca2d to your computer and use it in GitHub Desktop.
Save kitoko552/f6b849d9fa8f8b9f79af4fdaf90aca2d to your computer and use it in GitHub Desktop.
Scaffold(
appBar: AppBar(title: const Text('Books'), elevation: 0.0),
body: DefaultTabController(
length: _tabs.length,
child: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
// TabBarを追加
SliverPersistentHeader(
pinned: true,
delegate: _StickyTabBarDelegate(
TabBar(
tabs: _tabs.map((String name) => Tab(text: name)).toList(),
),
),
),
];
},
body: TabBarView(),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment