【发布时间】:2021-05-11 08:47:17
【问题描述】:
我正在做一个项目,我需要这样的标签栏标签。我尝试过使用标签->图标、文本,但它更小
我想要的东西:
我当前的代码:
List<Tab> getTabs(int count, AsyncSnapshot snapshot) {
_tabs.clear();
for (int i = 0; i < count; i++) {
categoriesmodel categ = snapshot.data[i];
_tabs.add(
getTab(
categ.categories_name.toString(),
categ.icon_of_category.toString(),
),
);
}
return _tabs;
}
Tab getTab(String tabtitle, String imagepath) {
return Tab(
icon: Image.network(
imagepath,
height: 40,
width: 40,
),
child: Text(
tabtitle,
style: TextStyle(color: Colors.black),
),
);}
应用栏内
bottom: PreferredSize(
preferredSize: Size(120, 120),
child: Container(
height: 120,
color: Colors.white,
child: TabBar(
isScrollable: true,
indicatorColor: mainaccent,
tabs: _tabs,
controller: _tabController,
),
),
),
【问题讨论】:
标签: flutter dart flutter-layout tabbar