xxxxxxxxxx
AppBar(
title: Text('My App'),
// Set the desired height for the AppBar
toolbarHeight: 80,
// Wrap AppBar with PreferredSize and set preferredSize property
bottom: PreferredSize(
preferredSize: Size.fromHeight(80),
child: Container(
height: 80,
child: Row(
// AppBar content
),
),
),
);
xxxxxxxxxx
appBar: AppBar(
title: Text('AppBar Height'),
toolbarHeight: 100.0, // double
automaticallyImplyLeading: false, // hides back button
),
xxxxxxxxxx
appBar: PreferredSize(
preferredSize: Size.fromHeight(100.0),
child: AppBar(
automaticallyImplyLeading: false, // hides leading widget
flexibleSpace: SomeWidget(),
)
),
xxxxxxxxxx
appBar: PreferredSize(
preferredSize: Size.fromHeight(200.0),
child: AppBar(
automaticallyImplyLeading: false,
flexibleSpace: Image(
image: AssetImage('assets/images/banner_image.jpg'),
fit: BoxFit.cover,
),
backgroundColor: Colors.transparent,
)
),
xxxxxxxxxx
Firstly declare the AppBar widget that you will use in your Scaffold.
Widget demoPage() {
AppBar appBar = AppBar(
title: Text('Demo'),
);
return Scaffold(
appBar: appBar,
body: /*
page body
*/,
);
}
Now you can get the height of your appBar using its preferredSized:
double height = appBar.preferredSize.height