Home > Blockchain >  height property does not show on Flutter BottomAppBarTheme
height property does not show on Flutter BottomAppBarTheme

Time:01-07

I am making a custom AppBar, with a bottom light grey line. When I add the BottomAppBarTheme, I can add only shape, elevation and color. But on Flutter enter image description here

CodePudding user response:

The height property is not part of the BottomAppBarTheme class because the height of the bottom app bar is determined by the height of the widgets it contains.

Try this solution:

Container(
  height: 50,
  child: BottomAppBar(
    child: Container(
      child: Text('My App Bar'),
    ),
  ),
)

CodePudding user response:

in bottomBarTheme you can't add height for bottomBar. for BottomAppBar custom height you can try this

 bottomNavigationBar: SizedBox(
    height: 74,
    child: BottomAppBar(
      shape: const CircularNotchedRectangle(), // Add your custom shape here
      child: Row(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: const <Widget>[
          ///.... // Your bottomBar tabs IconButtons
        ],
      ),
    ),
)

for appBar custom height use toolbarHeight property inside AppBar widget or in appBarTheme property too like this.

appBarTheme: AppBarTheme.of(context)
              .copyWith(backgroundColor: Colors.blue, toolbarHeight: 75)
  • Related