flutter set appbar height code example

Example 1: height appbar flutter

appBar: PreferredSize(
  preferredSize: Size.fromHeight(100.0),
  child: AppBar(
    automaticallyImplyLeading: false, // hides leading widget
    flexibleSpace: SomeWidget(),
  )
),

Example 2: how to subtract he height of appbar in flutter

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

Tags:

Dart Example