Closed desire0420 closed 1 year ago
ExtendedTabBar( tabs: List.generate(_tabTitle.length, (int index) => Container( color: Colors.red, child: Tab(text: _tabTitle[index].title))), controller: _tabController, labelPadding: EdgeInsets.symmetric(horizontal: 12.w), indicatorSize: TabBarIndicatorSize.tab, labelColor: MyColor.color_FF000000, labelStyle: TextStyle(fontSize: 15.sp, color: MyColor.color_FF000000, fontWeight: FontWeight.w700), unselectedLabelColor: MyColor.color_FFFFFFFF, unselectedLabelStyle: TextStyle(fontSize: 15.sp, color: MyColor.color_FFFFFFFF), dragStartBehavior: DragStartBehavior.start, foregroundIndicator: true, indicatorWeight: 0, isScrollable: true, indicator: ColorTabIndicator(Colors.blue), )
tab 文字设置背景色的时候 设置 foregroundIndicator: true, 这时候 指示器的颜色会盖住文字颜色 如下图 选中的指示器是蓝色 未选中的背景色是红色
foregroundIndicator 为true 的意思就是 装饰器在文本之前,就是这样设计的
foregroundIndicator 为true 的意思就是 装饰器在文本之前,就是这样设计的 请问下这种效果 要怎么样实现呢
别设置成 true 不就好了吗,demo里面的不就是这样子的。
ExtendedTabBar( tabs: List.generate(_tabTitle.length, (int index) => Container( color: Colors.red, child: Tab(text: _tabTitle[index].title))), controller: _tabController, labelPadding: EdgeInsets.symmetric(horizontal: 12.w), indicatorSize: TabBarIndicatorSize.tab, labelColor: MyColor.color_FF000000, labelStyle: TextStyle(fontSize: 15.sp, color: MyColor.color_FF000000, fontWeight: FontWeight.w700), unselectedLabelColor: MyColor.color_FFFFFFFF, unselectedLabelStyle: TextStyle(fontSize: 15.sp, color: MyColor.color_FFFFFFFF), dragStartBehavior: DragStartBehavior.start, foregroundIndicator: true, indicatorWeight: 0, isScrollable: true, indicator: ColorTabIndicator(Colors.blue), )
tab 文字设置背景色的时候 设置 foregroundIndicator: true, 这时候 指示器的颜色会盖住文字颜色 如下图 选中的指示器是蓝色 未选中的背景色是红色