zoukankan      html  css  js  c++  java
  • flutter中tabbar的tab背景颜色设置

    关键代码

    bottom: PreferredSize(
              preferredSize: Size.fromHeight(48),
              child: Material(
                //这里设置tab的背景色
                color: Colors.green,
                child: TabBar(
                  // indicator: ColorTabIndicator(Colors.black),//选中时标签颜色
                  indicatorColor: Colors.black,//选中时下划线颜色,如果使用了indicator这里设置无效
                  controller: _tabController,
                  labelColor: Colors.white,
                  unselectedLabelColor: Colors.yellow,
                  tabs: _tabs.map((item)=>Tab(text: item,)).toList(),
                ),
              ),
            )
          )
    

    tabbar中的tab的背景颜色取的实际是AppBar的主题色,所以我们将tabbar放在Material中来重置了主题色,变成我们想要的背景色.

    完整代码:

    import 'package:flutter/material.dart';
    
    class TabbarBgColorTest extends StatefulWidget{
      

    作者:noonez
    来源:简书

  • 相关阅读:
    nginx 配置https, 服务器是阿里云的ECS(亲测)
    jenkins 安装2.170版本 的问题汇中
    终于有人把“TCC分布式事务”实现原理讲明白了!
    springcloud(九) springboot Actuator + admin 监控
    springcloud(八) Hystrix监控
    springcloud(七) feign + Hystrix 整合 、
    springboot 2.0 自定义redis自动装配
    springboot 2.0 自动装配原理 以redis为例
    博文分类索引--Python
    【python】-- Ajax
  • 原文地址:https://www.cnblogs.com/jiuyi/p/12611280.html
Copyright © 2011-2022 走看看