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 _MyHomePageState extends State<MyHomePage> { | |
TextEditingController controllerA = TextEditingController(); | |
TextEditingController controllerB = TextEditingController(); | |
FocusNode nodeA = FocusNode(); | |
FocusNode nodeB = FocusNode(); | |
@override | |
void initState() { | |
super.initState(); | |
nodeA.addListener(() { |
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
DefaultTabController( | |
length: _tabs.length, // This is the number of tabs. | |
child: NestedScrollView( | |
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | |
return <Widget>[ | |
SliverOverlapAbsorber( | |
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), | |
child: SliverAppBar( | |
title: const Text('Books'), // This is the title in the app bar. | |
pinned: true, |
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
CustomScrollView( | |
slivers: <Widget>[ | |
...headerSliverBuilder(context, bodyIsScrolled), | |
SliverFillRemaining(child: body), | |
], | |
); |
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
Scaffold( | |
appBar: AppBar(title: const Text('Books'), elevation: 0.0), // ScaffoldのappBarに普通のAppBarをセット | |
body: DefaultTabController( | |
length: _tabs.length, | |
child: NestedScrollView( | |
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | |
return <Widget>[ | |
// SliverAppBarを削除 | |
]; | |
}, |
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
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, |
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 _StickyTabBarDelegate extends SliverPersistentHeaderDelegate { | |
const _StickyTabBarDelegate(this.tabBar); | |
final TabBar tabBar; | |
@override | |
double get minExtent => tabBar.preferredSize.height; | |
@override | |
double get maxExtent => tabBar.preferredSize.height; |
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
Scaffold( | |
appBar: AppBar(title: const Text('Books'), elevation: 0.0), | |
body: DefaultTabController( | |
length: _tabs.length, | |
child: NestedScrollView( | |
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | |
return <Widget>[ | |
// AppBarとTabBarの間のコンテンツ | |
SliverList( | |
delegate: SliverChildListDelegate( |
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
final controller = ScrollController(); | |
final globalKey = GlobalKey(); | |
ListView.builder( | |
controller: controller, | |
itemBuilder: (context, index) { | |
return SomeWidget( | |
key: globalKey, | |
child: child, | |
); |
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
final controller = AutoScrollController(); | |
ListView.builder( | |
controller: controller, | |
itemCount: _maxItemCount, | |
itemBuilder: (context, index) { | |
return AutoScrollTag( | |
key: ValueKey(index), | |
controller: controller, | |
index: index, |
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
final controller = IndexedScrollController(); | |
IndexedListView.builder( | |
controller: controller, | |
itemBuilder: (context, index) { | |
return child; | |
}, | |
); | |
// スクロール処理 |
OlderNewer