dart - flutter 模糊叠加

我想制作一个对话框,而不是用通常的物质方式来使后面的小部件变暗,从而使它们模糊。所以基本上我想知道是否有一种方法不仅可以模糊图像,还可以模糊整个应用程序(或部分应用程序)

最佳答案

You can use the BackdropFilter to make the image actual blur and put the white overlay on that using below code. Here _value is the slider value which use can select. for ex. 10.0

@override
  Widget build(BuildContext context) {
    final ThemeData theme = Theme.of(context);
    SystemChrome.setEnabledSystemUIOverlays([]);
    // TODO: implement build
    return new Scaffold(
      resizeToAvoidBottomPadding: false,
      body: new Stack(children: <Widget>[
        new PageView.builder(
          itemBuilder: (context, pos) {
            return new Stack(
               children: <Widget>[
                 new FadeInImage(
                   fit: BoxFit.cover,
                   placeholder: new CachedNetworkImageProvider(
                       widget.CatimgList[pos].thumb_img),
                   image: new CachedNetworkImageProvider(
                       widget.CatimgList[pos].image_large),
                 ),
                new BackdropFilter(
                   filter: new ImageFilter.blur(sigmaX: _value, sigmaY: _value),
                   child: new Container(
                     decoration: new BoxDecoration(
                         color: Colors.white.withOpacity(_value)),
                   ),
                 )
               ],
            );
      );
)

关于dart - flutter 模糊叠加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51801800/

相关文章:

flutter - 在 Flutter 中,如何在某个 (x,y) 位置找到小部件?

dart - flutter - 图像被删除后仍然存在?

dart - 在 Flutter 应用中下载大型 pdf 文件

android-studio - 如何在 Android Studio 中创建目录文件夹?

ios - 将我的 Flutter App 发送到我的真实 iPhone 而不是模拟器

dart - 使用 Flutter 单击按钮后的网络请求

firebase - 当应用程序处于前台时,Flutter FCM 推送通知不起作用

flutter - Flutter 中的 `TabBarView` 和 `PageView` 有什么

flutter - 如何更改底部导航栏的颜色?

flutter - 如何混淆 Flutter 应用程序?