这是我的第一个问题。我目前正在使用标签栏处理 sliverAppBar。当我向下拖动条子时,我可以做些什么来使标签栏保持在顶部而不是向下移动? 这是基于我的代码的外观,这是我的代码:
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primaryColor: Colors.green[700]),
home: DefaultTabController(
length: 3,
child: Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
expandedHeight: 450,
pinned: true,
bottom: TabBar(
tabs: [
Tab(icon: Icon(Icons.directions_car)),
Tab(icon: Icon(Icons.directions_transit)),
Tab(icon: Icon(Icons.directions_bike)),
],
),
backgroundColor: Colors.green[700],
flexibleSpace: FlexibleSpaceBar(
background: Image.asset(
'images/green.png',
fit: BoxFit.cover,
),
),
),
SliverFillRemaining(
child: Container(
child: Column(
children: List<int>.generate(12, (index) => index)
.map((index) => Container(
height: 40,
margin: EdgeInsets.symmetric(vertical: 10),
color: Colors.grey[300],
alignment: Alignment.center,
child: Text('$index item'),
))
.toList(),
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
)),
))
],
),
),
),
);
}
}
编辑:我仍然希望条子的功能能够向下拖动,但我想将标签保持在顶部而不移动