美文网首页Flutter撞墙之旅
Flutter 去掉AppBar的点击水波纹效果和点击出现的灰色

Flutter 去掉AppBar的点击水波纹效果和点击出现的灰色

作者: swift_honor | 来源:发表于2020-11-17 10:14 被阅读0次

    此处使用ThemeData进行局部控件的颜色设置,splashColor设置的是水波纹效果,highlightColor设置的是选择的高亮效果。将两个颜色都设置成透明色,就达到了我们要的效果。
    注意⚠️:使用ThemeData进行设置时候AppBar文字的颜色labelColor和未选中的文字颜色unselectedLabelColor需要根据自己的需求进行设置下

     Container(
              height: 40,
              child: Theme(child: TabBar(
                tabs: _tabs.map((e) => Text(e)).toList(),
                controller: _tabController,
                indicatorColor: WMSColors.accentColor,
                indicatorSize: TabBarIndicatorSize.label,
                labelColor: WMSColors.blackCommon,
                unselectedLabelColor: WMSColors.blackCommon,
                labelStyle: TextStyle(fontSize: 16),
                onTap: (index) {
                 //点击事件
                },
              ),data: ThemeData(splashColor: Colors.transparent,highlightColor: Colors.transparent,),),
    
            ),
    

    相关文章

      网友评论

        本文标题:Flutter 去掉AppBar的点击水波纹效果和点击出现的灰色

        本文链接:https://www.haomeiwen.com/subject/xyfxiktx.html