Flutter 在CupertinoPageScaffold内添加TabBarView
我想在这个示例中添加TabBarView,每个选项卡都包含iteam列表,你知道吗? 在SliverAppBar中,我们可以有底部:TabBar,但这里我想使用Cupertino小部件Flutter 在CupertinoPageScaffold内添加TabBarView,flutter,flutter-layout,Flutter,Flutter Layout,我想在这个示例中添加TabBarView,每个选项卡都包含iteam列表,你知道吗? 在SliverAppBar中,我们可以有底部:TabBar,但这里我想使用Cupertino小部件 @override Widget build(BuildContext context) { return CupertinoPageScaffold( child: SafeArea( child: CustomScrollView( sliver
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
child: SafeArea(
child: CustomScrollView(
slivers: <Widget>[
CupertinoSliverNavigationBar(
backgroundColor: Colors.white,
trailing: Icon(CupertinoIcons.add),
largeTitle: Text('LargeTitle'),
),
CupertinoSliverRefreshControl(
onRefresh: () {
print("Refresh was triggered");
return Future<void>.delayed(const Duration(seconds: 1));
},
),
SliverSafeArea(
top: false,
minimum: const EdgeInsets.only(top: 8),
sliver: SliverList(
// Use a delegate to build items as they're scrolled on screen.
delegate: SliverChildBuilderDelegate(
// The builder function returns a ListTile with a title that
// displays the index of the current item.
(context, index) => ListTile(title: Text('Item #$index')),
// Builds 1000 ListTiles
childCount: 1000,
),
),
),
],
),
),
);
}
@覆盖
小部件构建(构建上下文){
返回式CupertinoPageScaffold(
儿童:安全区(
子:自定义滚动视图(
条子:[
CupertinoSliverNavigationBar(
背景颜色:Colors.white,
尾随:图标(CupertinoIcons.add),
largeTitle:Text('largeTitle'),
),
铜控(
onRefresh:(){
打印(“刷新被触发”);
返回未来。延迟(常数持续时间(秒:1));
},
),
斯莱凡尼亚(
上图:错,
最小值:仅常数边集(顶部:8),
银条:银条列表(
//当项目在屏幕上滚动时,使用委托生成项目。
代表:SliverChildBuilderDelegate(
//生成器函数返回一个标题为
//显示当前项目的索引。
(上下文,索引)=>ListTile(标题:Text('Item#$index')),
//构建1000个ListTiles
儿童人数:1000,
),
),
),
],
),
),
);
}