如何在Flutter中移除选项卡栏中的高程或框阴影?

huangapple go评论49阅读模式
英文:

How to remove elevation or box shadow in tab bar in flutter?

问题

我在我的一个屏幕上使用了选项卡栏。正如您所看到的,当我滚动时,选项卡栏下面会出现高程。我尝试了多种方法来移除它,但无法成功。您们有关于这个的任何想法吗?

这是代码部分:

TabBar(
  indicatorSize: TabBarIndicatorSize.tab,
  isScrollable: false,
  controller: _tabController,
  indicatorPadding: EdgeInsets.only(left: 16.w, right: 16.w),
  tabs: [tab1(), tab2(), tab3()],
) 

如何在Flutter中移除选项卡栏中的高程或框阴影?

英文:

I am using tab bar in one of my screen. As you can see when I scroll there comes the elevation under the tab bar. I tried multiple ways to remove that, but can't. Do you guys have any idea on this ?
This is the code

TabBar(
          indicatorSize: TabBarIndicatorSize.tab,
          isScrollable: false,
          controller: _tabController,
          indicatorPadding: EdgeInsets.only(left: 16.w, right: 16.w),
          tabs:[tab1(),tab2(),tab3(),
  ],
) 

如何在Flutter中移除选项卡栏中的高程或框阴影?

答案1

得分: 0

我假设这不是TabBar的高程。这是AppBar的阴影,因为您(在我看来)将TabBar放在AppBar内。所以请按照以下方式设置AppBar

appBar: AppBar(
  ....,
  elevation: 0,
),
英文:

I am assuming that it is not TabBar elevation. It is a shadow of AppBar as you are putting(in my opinion) TabBar inside AppBar. So do like this with your AppBar:

appBar: AppBar(
  ....,
  elevation: 0,
),

huangapple
  • 本文由 发表于 2023年2月6日 21:14:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75361789.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定