我只想在点击选项卡项时禁用或更改 highlightColor
和 splashColor
行为?
我的代码段,
SliverAppBar(
backgroundColor: MyColors.darkGreen,
elevation: 0.0,
automaticallyImplyLeading: false,
bottom: TabBar(
isScrollable: true,
unselectedLabelColor: Colors.grey,
labelColor: Colors.white,
onTap: (int itemIndex) {},
indicatorSize: TabBarIndicatorSize.tab,
indicator: BubbleTabIndicator(
indicatorHeight: 25.0,
indicatorColor: Colors.white38,
tabBarIndicatorSize: TabBarIndicatorSize.tab,
),
tabs: tabs,
controller: _tabController,
),
pinned: true,
floating: false,
title: _titleWidget,
),
指导我如何制作。
最佳答案
只需将您的 AppBar
放在带有透明 highlightColor
和 splashColor
的 Theme 中。
例如。
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(70),
child: Theme(
data: ThemeData(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
),
child: AppBar( ... )
关于flutter - 如何在 Flutter 中禁用 Tab Bar 项的突出显示和飞溅行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59004669/