Flutter 移除 CupertinoNavigationBar 背景

Moh*_*med 4 ios flutter flutter-layout

有没有办法消除 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),
          ),
Run Code Online (Sandbox Code Playgroud)

Sca*_*aux 8

CupertinoNavigationBar 有一个border属性。如果您想删除边框,您可以执行以下操作:

CupertinoNavigationBar(
   border: Border(bottom: BorderSide(color: Colors.transparent)),
));
Run Code Online (Sandbox Code Playgroud)


flo*_*vdg 0

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