Open
Description
I'm having an issue with a GridView of blurred tiles using BackdropFilter with ImageFilter.blur
where any surrounding color leaks into them:
Here is a Dartpad example: https://dartpad.dev/?id=1196002918293fdd251557b037d2d786
Here is the code sample:
import 'dart:ui';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'ImageFilter Color Leak Issue',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text('ImageFilter.blur Color Leak Issue'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
child: Container(
color: Colors.white,
width: double.infinity,
child: FittedBox(
fit: BoxFit.contain,
child: Padding(
padding: const EdgeInsets.all(40),
child: Container(
width: 400,
height: 400,
color: const Color(0xFF0000FF),
child: GridView.count(
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 3,
children: tiles(),
),
),
),
),
),
),
Expanded(
child: Container(
color: Colors.black,
width: double.infinity,
child: FittedBox(
fit: BoxFit.contain,
child: Padding(
padding: const EdgeInsets.all(40),
child: Container(
width: 400,
height: 400,
color: const Color(0xFF0000FF),
child: GridView.count(
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 3,
children: tiles(),
),
),
),
),
),
),
],
),
),
);
}
List<Widget> tiles() => List<Widget>.generate(
9,
(_) => ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 20,
sigmaY: 20,
),
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(12),
),
),
),
),
);
}
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.3, on macOS 11.5.1 20G80 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.66.0-insider)
[✓] Connected device (1 available)
! Device emulator-5562 is offline.
[✓] HTTP Host Availability
• No issues found!
Metadata
Metadata
Assignees
Labels
Important issues not at the top of the work listflutter/engine repository. See also e: labels.flutter/packages/flutter/material repository.Found to occur in 2.10Found to occur in 2.11flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onOwned by Design Languages teamTriaged by Design Languages team
Type
Projects
Status
Todo