Skip to content

Instantly share code, notes, and snippets.

View kitoko552's full-sized avatar

KITO Kosuke kitoko552

  • stand.fm, Inc.
  • Tokyo, Japan
View GitHub Profile
class _MyHomePageState extends State<MyHomePage> {
TextEditingController controllerA = TextEditingController();
TextEditingController controllerB = TextEditingController();
FocusNode nodeA = FocusNode();
FocusNode nodeB = FocusNode();
@override
void initState() {
super.initState();
nodeA.addListener(() {
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,
CustomScrollView(
slivers: <Widget>[
...headerSliverBuilder(context, bodyIsScrolled),
SliverFillRemaining(child: body),
],
);
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を削除
];
},
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,
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;
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(
final controller = ScrollController();
final globalKey = GlobalKey();
ListView.builder(
controller: controller,
itemBuilder: (context, index) {
return SomeWidget(
key: globalKey,
child: child,
);
final controller = AutoScrollController();
ListView.builder(
controller: controller,
itemCount: _maxItemCount,
itemBuilder: (context, index) {
return AutoScrollTag(
key: ValueKey(index),
controller: controller,
index: index,
final controller = IndexedScrollController();
IndexedListView.builder(
controller: controller,
itemBuilder: (context, index) {
return child;
},
);
// スクロール処理