【问题标题】:Flutter. Foreground blur effect background Views扑。前景模糊效果背景视图
【发布时间】:2019-11-16 05:21:23
【问题描述】:

在使用 Flutter 处理模糊动作时,您可能会遇到在背景上强制模糊效果的问题。通过使用Stack 和内部BackdropFilter。模糊前景视图,影响边界外的其他视图。如何避免这种情况?

//.....
      child: new Stack(
        fit: StackFit.expand,
        children: <Widget>[
          new Image.asset(
            'assets/bg_img.jpg',
            fit: BoxFit.fitHeight,
          ),
          new Container(
            color: Colors.transparent,
            child: new Center(
              child: new Center(
                child: new ClipRect(
                  child: new BackdropFilter(
                    filter: new ui.ImageFilter.blur(
                      sigmaX: 6.0,
                      sigmaY: 6.0,
                    ),
//.....

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    要使用Stack 视图配置模糊效果,您需要在Stack 上设置AlignmentDirectional。前任。以下。

    child: Stack(alignment: AlignmentDirectional.center, 
            children: <Widget>[Column(
                 //.. Your blur effect here. 
    

    【讨论】:

      猜你喜欢
      • 2017-07-17
      • 1970-01-01
      • 2014-06-02
      • 1970-01-01
      • 1970-01-01
      • 2016-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多