From 745b303fbda983c35357c33aca19d67b72437021 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sun, 11 Oct 2026 09:02:55 +0300 Subject: [PATCH] perf(ui): eliminate per-frame ImageFilter.blur sigma animation in showAppDialog backdrop --- lib/shared/widgets/app_dialog.dart | 6 +++--- test/shared/app_dialog_test.dart | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/shared/widgets/app_dialog.dart b/lib/shared/widgets/app_dialog.dart index bfb9e357..0dffda0d 100644 --- a/lib/shared/widgets/app_dialog.dart +++ b/lib/shared/widgets/app_dialog.dart @@ -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}); @@ -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), ), diff --git a/test/shared/app_dialog_test.dart b/test/shared/app_dialog_test.dart index 938e62a7..576e01fd 100644 --- a/test/shared/app_dialog_test.dart +++ b/test/shared/app_dialog_test.dart @@ -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); @@ -155,7 +155,7 @@ void main() { await tester.pump(const Duration(milliseconds: 40)); final filter = tester.widget(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)); @@ -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( @@ -204,7 +204,7 @@ void main() { await tester.pump(const Duration(milliseconds: 40)); final filter = tester.widget(find.byType(BackdropFilter)); - expect(filter.filter, isNot(fullFilter)); + expect(filter.filter, fullFilter); expect(tintOf(tester).a, lessThan(fullTint.a)); await tester.pumpAndSettle();