应用栏标签栏中的颤动问题大小图标?
Flutter problem size icon in tabbar in appbar?
我有一个小问题,我找不到解决方案。
我在 APPBAR 中创建了一个 TABBAR,但我无法调整它的大小以使我的标签栏图标可见。
我的标签栏没问题,但是图标和标签的大小不合适...
我尝试了几种方法,但 none 有效...
我的问题:My probleme
我的代码:
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage>
with SingleTickerProviderStateMixin {
TabController _tabcontroller;
@override
void initState() {
super.initState();
_tabcontroller = new TabController(length: 3, vsync: this);
_tabcontroller.addListener(() {
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
elevation: 1,
title: new TabBar(
indicatorColor: Colors.transparent,
controller: _tabcontroller,
tabs: [
new SafeArea(
child: new Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20.0)),
child: Center(
child: new Icon(
Icons.icecream,
color: _tabcontroller.index == 0
? Theme.of(context).primaryColor
: Colors.grey,
size: ScreenUtil().setSp(80.0),
),
),
),
),
new SafeArea(
child: new Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20.0)),
child: Center(
child: new Icon(
Tinder_clone.iconfinder_338_tinder_logo_4375488__1_,
color: _tabcontroller.index == 1
? Theme.of(context).primaryColor
: Colors.grey,
size: ScreenUtil().setSp(80.0),
),
),
),
),
new SafeArea(
child: new Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20.0)),
child: Center(
child: new Icon(
Tinder_clone.iconfinder_message_01_186393,
color: _tabcontroller.index == 2
? Theme.of(context).primaryColor
: Colors.grey,
size: ScreenUtil().setSp(80.0),
),
),
),
),
]),
),
感谢您的帮助,
将 TabBar
放在 AppBar
中时,您应该使用 bottom
属性。
// ... other lines
return new Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
elevation: 1,
bottom: new TabBar(
indicatorColor: Colors.transparent,
controller: _tabcontroller,
// ... other lines
我有一个小问题,我找不到解决方案。 我在 APPBAR 中创建了一个 TABBAR,但我无法调整它的大小以使我的标签栏图标可见。
我的标签栏没问题,但是图标和标签的大小不合适...
我尝试了几种方法,但 none 有效...
我的问题:My probleme
我的代码:
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage>
with SingleTickerProviderStateMixin {
TabController _tabcontroller;
@override
void initState() {
super.initState();
_tabcontroller = new TabController(length: 3, vsync: this);
_tabcontroller.addListener(() {
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
elevation: 1,
title: new TabBar(
indicatorColor: Colors.transparent,
controller: _tabcontroller,
tabs: [
new SafeArea(
child: new Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20.0)),
child: Center(
child: new Icon(
Icons.icecream,
color: _tabcontroller.index == 0
? Theme.of(context).primaryColor
: Colors.grey,
size: ScreenUtil().setSp(80.0),
),
),
),
),
new SafeArea(
child: new Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20.0)),
child: Center(
child: new Icon(
Tinder_clone.iconfinder_338_tinder_logo_4375488__1_,
color: _tabcontroller.index == 1
? Theme.of(context).primaryColor
: Colors.grey,
size: ScreenUtil().setSp(80.0),
),
),
),
),
new SafeArea(
child: new Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20.0)),
child: Center(
child: new Icon(
Tinder_clone.iconfinder_message_01_186393,
color: _tabcontroller.index == 2
? Theme.of(context).primaryColor
: Colors.grey,
size: ScreenUtil().setSp(80.0),
),
),
),
),
]),
),
感谢您的帮助,
将 TabBar
放在 AppBar
中时,您应该使用 bottom
属性。
// ... other lines
return new Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
elevation: 1,
bottom: new TabBar(
indicatorColor: Colors.transparent,
controller: _tabcontroller,
// ... other lines