我使用 DefaultTabController 作为选项卡视图,但我有很多选项卡来过滤数据,但它不滚动,而且我看不到选项卡的文本
如何使其可滚动以便可以正确查看所有选项卡
Widget build(BuildContext context) {
final list = ['Furniture', 'Clothe', 'Mobiles', 'Laptop','Accessories','Stationary',];
return DefaultTabController(
length: list.length,
child: Scaffold(
appBar: AppBar(
bottom: TabBar(
tabs: list
.map((e) => Tab(
text: e,
),
)
.toList(),
),
),
body: TabBarView(
children: list.map((e) => CustomScreen(string: e)).toList(),
),
));
}
您可以在 Tabbar 中将 isScrollable 添加为 true :
TabBar(
isScrollable: true,
...
),