This is not an ideal way, I think, but it will work.
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;
You can use this height to reduce from the screen height.
final double height = MediaQuery.of(context).size.height;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…