【问题标题】:Indicator Tab Flutter指示器选项卡颤动
【发布时间】:2021-09-07 15:46:04
【问题描述】:

我有一个像这样的标签

但我希望我的标签看起来像这样

我用的是TabBar,我想让绿线像我想要的图片一样在中间,请帮忙

 TabBar(
                              indicatorColor: HexColor(ColorSetup().colorPrimary),
                              indicatorWeight: 8,
                              indicatorSize: TabBarIndicatorSize.tab,
                              indicatorPadding: EdgeInsets.only(left : 5.w, right : 5.w, top : 4.h),
                              labelColor: HexColor(ColorSetup().colorBlack),
                              labelStyle: TextStyle(
                                  fontSize: 14.sp,
                                  fontFamily: StringSetup().dinFont,
                                  fontWeight: FontWeight.w700,
                                  color: HexColor(ColorSetup().colorBlack)),
                              unselectedLabelStyle: TextStyle(
                                  fontSize: 14.sp,
                                  fontFamily: StringSetup().dinFont,
                                  fontWeight: FontWeight.w400,
                                  color: HexColor(ColorSetup().colorBlack)),
                              tabs: <Widget>[
                                Tab(
                                  text: 'ALL REWARDS',
                                ),
                                Tab(
                                  text: 'MY REWARDS',
                                ),
                              ],
                            )

【问题讨论】:

    标签: flutter tabbar indicator


    【解决方案1】:

    你可以使用这个参数

    indicator: UnderlineTabIndicator(
            borderSide: BorderSide(width: 3.0, color: Color(0XFF7E7E7E)),
            insets: EdgeInsets.only(right: 25, bottom: 0, left: 2),
          ),
    indicatorSize: TabBarIndicatorSize.label,
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-30
      • 1970-01-01
      • 2021-06-06
      • 2015-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多