Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/shared/widgets/app_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ class _BlurredDialogScaffoldState extends State<_BlurredDialogScaffold> {

/// Frosted, dimmed dialog backdrop at [progress] (0 = none, 1 = full).
///
/// Both blur sigma and tint alpha scale with [progress], so the frost fades in
/// and out without pop-in and without an enclosing `Opacity`.
/// Uses constant blur sigma (8) whenever visible and fades the background
/// tint alpha, eliminating per-frame Gaussian blur shader re-rasterization (#1341).
class _DialogBackdrop extends StatelessWidget {
const _DialogBackdrop({required this.progress});

Expand All @@ -151,7 +151,7 @@ class _DialogBackdrop extends StatelessWidget {
if (t <= 0) return const SizedBox.expand();
return ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: sigma * t, sigmaY: sigma * t),
filter: ImageFilter.blur(sigmaX: sigma, sigmaY: sigma),
child: ColoredBox(
color: const Color(0xFF000000).withValues(alpha: tintAlpha * t),
),
Expand Down
8 changes: 4 additions & 4 deletions test/shared/app_dialog_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void main() {
return box.color;
}

testWidgets('blur and tint scale in during enter; no Opacity wraps the filter',
testWidgets('constant blur with tint scaling during enter; no Opacity wraps the filter (#1341)',
(tester) async {
final ctx = await pumpHost(tester);

Expand All @@ -155,7 +155,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 40));

final filter = tester.widget<BackdropFilter>(find.byType(BackdropFilter));
expect(filter.filter, isNot(fullFilter), reason: 'sigma is still ramping');
expect(filter.filter, fullFilter, reason: 'sigma is constant to avoid per-frame blur re-rasterization');
expect(tintOf(tester).a, greaterThan(0));
expect(tintOf(tester).a, lessThan(fullTint.a));

Expand Down Expand Up @@ -190,7 +190,7 @@ void main() {
);
});

testWidgets('blur and tint fade out again on dismiss', (tester) async {
testWidgets('tint fades out on dismiss while blur remains constant until route pops (#1341)', (tester) async {
final ctx = await pumpHost(tester);

final future = showAppDialog<void>(
Expand All @@ -204,7 +204,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 40));

final filter = tester.widget<BackdropFilter>(find.byType(BackdropFilter));
expect(filter.filter, isNot(fullFilter));
expect(filter.filter, fullFilter);
expect(tintOf(tester).a, lessThan(fullTint.a));

await tester.pumpAndSettle();
Expand Down
Loading