Tabbar|Tabbar 简单封装

Tabbar自定义记录

PreferredSize _customTabBar() { return PreferredSize( child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ 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(), ),

    推荐阅读