如何在Flutter中获取AppBar的高度?

如何在Flutter中获取AppBar的高度?,第1张

如何在Flutter中获取AppBar的高度

我认为这不是理想的方法,但它会起作用

首先 声明

AppBar
您将在中使用的小部件
Scaffold

Widget demoPage() {  AppBar appBar = AppBar(    title: Text('Demo'),  );  return Scaffold(    appBar: appBar,    body: ,  );}

现在, 你可以得到 高度 您的

appBar
使用它
preferredSized

double height = appBar.preferredSize.height;

您可以使用此高度从 屏幕高度 减小

final double height = MediaQuery.of(context).size.height;


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5002872.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-14
下一篇2022-11-14

发表评论

登录后才能评论

评论列表(0条)

    保存