【问题标题】:Flutter Remove CupertinoNavigationBar BackdropFlutter 移除 CupertinoNavigationBar 背景
【发布时间】:2019-04-10 03:41:34
【问题描述】:

有没有办法消除 CupertinoNavigationBar 的模糊,使其真正透明?我摆脱了边框和颜色,但有一个模糊,对于 android AppBar 没有任何模糊,但对于 iOS AppBar 它就在那里。我检查了它的代码,并有一个 ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0) 应用于它,但我该如何删除它?

代码:

CupertinoNavigationBar(
    backgroundColor: Colors.transparent,
    border: Border.all(
        color: Colors.transparent,
        width: 0.0,
        style: BorderStyle.none
    ),
    leading: IconButton(
    icon: Icon(
        Icons.close,
        color: Colors.red,
    ),
    onPressed: () {
        Navigator.pop(context);
    }),
    automaticallyImplyLeading: false,
    trailing: IconButton(
        icon: Icon(
            Icons.refresh,
            color: Colors.blue,
        ),
        onPressed: widget.onRestart
    ),
),

【问题讨论】:

    标签: ios flutter flutter-layout


    【解决方案1】:

    CupertinoNavigationBar 有一个 border 属性。如果你想删除边框,你可以这样做:

    CupertinoNavigationBar(
       border: Border(bottom: BorderSide(color: Colors.transparent)),
    ));
    

    【讨论】:

      【解决方案2】:

      目前没有 API 可以执行此操作。您需要打开 GitHub 问题来请求此功能,或者分叉 Flutter 库并自己删除该代码。这似乎是一个合理的请求,而且它可能只是一个构造函数标志,因此对于 Flutter 团队来说可能是一个相对快速的解决方案。

      【讨论】:

        猜你喜欢
        • 2020-09-28
        • 2021-06-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-11
        • 2021-11-28
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多