Tabbar 简单封装

作者: 践行丶见远 | 来源:发表于2019-07-30 08:34 被阅读0次

    Tabbar自定义记录

      PreferredSize _customTabBar() {
        return PreferredSize(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Expanded(
                child: TabBar(
                  isScrollable: true,
                  controller: _tabController,
                  tabs: _tabs.map((e) => Tab(text: e)).toList(),
                ),
              ),
              IconButton(
                icon: Icon(
                  Icons.menu,
                  color: Colors.white,
                ),
                onPressed: _editTabs,
              ),
            ],
          ),
          preferredSize: Size.fromHeight(44),
        );
      }
    

    使用

          appBar: AppBar(
            title: Text('健康咨询'),
            bottom: _customTabBar();
          ),
      默认 
    bottom: TabBar(
              isScrollable: true,
              controller: _tabController,
              tabs: _tabs.map((e) => Tab(text: e)).toList(),
            ),
    
    

    相关文章

      网友评论

        本文标题:Tabbar 简单封装

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