颤振的景观方向布局

颤振的景观方向布局,第1张

概述如何在横向模式下设置AppBar高度,以便它不占用屏幕填充? 是否有通常的Flutter景观布局小工具?上述问题布局如下: new Padding( padding: media.padding, child: new Scaffold( key: _scaffoldKey, body: new Row( children: <Widget>[ 如何在横向模式下设置Appbar高度,以便它不占用屏幕填充?

是否有通常的Flutter景观布局小工具?上述问题布局如下:

new padding(  padding: media.padding,child: new Scaffold(      key: _scaffoldKey,body: new Row(        children: <Widget>[          new limitedBox(            maxWIDth: 320.0,child: new Column(children: [              _buildAppbar(),new Expanded(                  child: new ModuleDrawer(                Widget.module.sugar,toppadding: 0.0,)),]),),new Expanded(            child: new RecordList(              Widget.model,],)));
解决方法 你可以使用Scaffold的主要属性,结合通过简单的Mediaquery检测方向.因此,在横向模式下,将主标志设置为false,以告知脚手架在确定Appbar高度时不考虑状态栏高度.

见the documentation:

Whether this scaffold is being displayed at the top of the screen.

If true then the height of the appbar will be extended by the height of the screen’s status bar,i.e. the top padding for Mediaquery.

The default value of this property,like the default value of Appbar.primary,is true.

所以在你的情况下,这样的事情应该做:

@overrIDeWidget build(BuildContext context) {    final OrIEntation orIEntation = Mediaquery.of(context).orIEntation;    final bool isLandscape = orIEntation == OrIEntation.landscape;    return new Scaffold(        primary: !isLandscape,appbar: new Appbar(          Title: new Text('Appbar Title'),body: new Center(            child: new Text('Look at the appbar on landscape!'),);}
总结

以上是内存溢出为你收集整理的颤振的景观方向布局全部内容,希望文章能够帮你解决颤振的景观方向布局所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

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

原文地址: https://outofmemory.cn/web/1001902.html

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

发表评论

登录后才能评论

评论列表(0条)

保存