我怎样才能达到AppBar米Flutter 的高度?
我正在使用MarialApp小部件(‘Package:Ffltter/Material al.dart’).
我有我的上下文的高度,我想扣除appbar的高度.
final double height = MediaQuery.of(context).size.height;
我怎样才能达到AppBar米Flutter 的高度?
我正在使用MarialApp小部件(‘Package:Ffltter/Material al.dart’).
我有我的上下文的高度,我想扣除appbar的高度.
final double height = MediaQuery.of(context).size.height;
我认为这不是一个理想的方式,但它会奏效的.
Firstly声明将在Scaffold
中使用的AppBar
小部件.
Widget demoPage() {
AppBar appBar = AppBar(
title: Text('Demo'),
);
return Scaffold(
appBar: appBar,
body: /*
page body
*/,
);
}
你可以用它的preferredSized
分到你appBar
分中的height分:
double height = appBar.preferredSize.height;
您可以使用此高度从screen height降低.
final double height = MediaQuery.of(context).size.height;