簡體   English   中英

Flutter 應用欄標簽欄中的問題大小圖標?

[英]Flutter problem size icon in tabbar in appbar?

我有一個小問題,我找不到解決方案。 我在 APPBAR 中創建了一個 TABBAR,但我無法調整它的大小以使我的標簽欄圖標可見。

我的標簽欄沒問題,但圖標和標簽的大小不太好......

我嘗試了幾種方法,但都沒有用......

我的問題:的問題

我的代碼:

 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), ), ), ), ), ]), ),

謝謝你的幫助,

AppBar中放置TabBar時,您應該使用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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM