【问题标题】:flutter custom appbar vertical position relative to status bar颤振自定义appbar相对于状态栏的垂直位置
【发布时间】:2021-01-19 01:22:51
【问题描述】:

我使用下面link中的示例创建了一个自定义的appBar。

代码有效,但应用栏位于 Android 状态栏后面的屏幕顶部

如何定位 appBar 以使其在状态栏下方开始呈现?

使用的版本:

  • Flutter 1.26.0-8.0.pre • 频道开发
  • Android R30

【问题讨论】:

    标签: flutter flutter-layout flutter-appbar


    【解决方案1】:

    有一个名为SafeArea 的小部件可以设置小部件的填充以避免状态栏的侵入。您可以将其用作:

    // Use the SafeArea here to position the AppBar under the status bar
    SafeArea( 
       child: Scaffold(
          appBar: PreferredSize(
            preferredSize: Size(double.infinity, 100),
            child: Container(
              decoration: BoxDecoration(
    
              // ... other lines
    

    【讨论】:

      猜你喜欢
      • 2020-10-29
      • 2019-11-07
      • 2022-07-27
      • 2020-08-09
      • 1970-01-01
      • 1970-01-01
      • 2019-05-19
      • 2021-09-16
      • 1970-01-01
      相关资源
      最近更新 更多