feat: extract appBar background color and blurred surface to config pipeline#978
feat: extract appBar background color and blurred surface to config pipeline#978SERDUN wants to merge 2 commits into
Conversation
…ipeline Add configurable appBarBackgroundColor and appBarBlurredSurface (color, sigmaX, sigmaY) to the theme config→style pipeline across all 7 main screens, replacing hardcoded values.
Add Common page fields section documenting appBarBackgroundColor and appBarBlurredSurface, update Keypad page example.
There was a problem hiding this comment.
Pull request overview
This pull request extracts app bar background color and blurred surface configuration from hardcoded values into a configurable pipeline. It introduces two new common fields (appBarBackgroundColor and appBarBlurredSurface) to the BasePageConfig interface, making them available across all page configurations.
Changes:
- Created
BlurredSurfaceConfig(freezed DTO) andBlurredSurfaceStyleto represent blur configuration and visual styling - Added
appBarBackgroundColorandappBarBlurredSurfacetoBasePageConfigand all implementing page configs - Updated all 7 main screens and their factories to use configurable blur parameters instead of hardcoded values
- Modified
BlurredSurfacewidget to accept parameters without defaults - Added documentation for the new common page fields
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/webtrit_appearance_theme/lib/models/common/blurred_surface_config.dart | New freezed model for blur configuration with color, sigmaX, sigmaY |
| packages/webtrit_appearance_theme/lib/models/common/blurred_surface_config.g.dart | Generated JSON serialization code |
| packages/webtrit_appearance_theme/lib/models/common/blurred_surface_config.freezed.dart | Generated freezed code for immutable model |
| packages/webtrit_appearance_theme/lib/models/common/common.dart | Export statement for new config |
| packages/webtrit_appearance_theme/lib/models/pages/base_page_config.dart | Added appBarBackgroundColor and appBarBlurredSurface getters |
| packages/webtrit_appearance_theme/lib/models/theme_page_config.dart | Added new fields to all page config classes |
| packages/webtrit_appearance_theme/lib/models/theme_page_config.g.dart | Generated JSON serialization for all page configs |
| packages/webtrit_appearance_theme/lib/models/theme_page_config.freezed.dart | Generated freezed code for all page configs |
| lib/widgets/blurred_surface_style.dart | New style class with merge/lerp support |
| lib/widgets/blurred_surface.dart | Changed default sigma values from 10 to 0, removed default color logic |
| lib/theme/extension/blurred_surface_config_extension.dart | Extension to convert config to style |
| lib/theme/extension/extension.dart | Export for new extension |
| lib/theme/styles/base_screen_style.dart | Added appBar fields to base style |
| lib/theme/factory/styles/*_screen_style_factory.dart | All 7 factories updated to wire config to style |
| lib/features//view/_screen_style.dart | All 7 screen styles updated with new fields |
| lib/features//view/_screen.dart | All 7 screens updated to use configurable blur |
| docs/page_configuration.md | Documentation for new common fields |
Comments suppressed due to low confidence (1)
lib/widgets/blurred_surface.dart:27
- The default color logic was removed from the BlurredSurface widget. Previously, it would fall back to
Theme.of(context).canvasColor.withAlpha(150)when no color was provided. Now it directly uses the nullable color, which could result in a transparent overlay when no color is configured. This breaks the fallback behavior and may result in screens having no visible overlay color when the config doesn't specify one.
return ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: sigmaX, sigmaY: sigmaY),
child: child ?? Container(color: color),
),
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// scrollable content appears blurred beneath the app bar. | ||
| class BlurredSurface extends StatelessWidget { | ||
| const BlurredSurface({super.key, this.color, this.sigmaX = 10, this.sigmaY = 10, this.child}); | ||
| const BlurredSurface({super.key, this.color, this.sigmaX = 0, this.sigmaY = 0, this.child}); |
There was a problem hiding this comment.
The default blur sigma values were changed from 10 to 0. When sigmaX and sigmaY are both 0, no blur effect is applied. This is a breaking change that will affect all existing uses of BlurredSurface that relied on the default blur effect. Screens need to explicitly provide non-zero values or the blur effect will be disabled by default.
| const BlurredSurface({super.key, this.color, this.sigmaX = 0, this.sigmaY = 0, this.child}); | |
| const BlurredSurface({super.key, this.color, this.sigmaX = 10, this.sigmaY = 10, this.child}); |
| sigmaX: effectiveStyle?.appBarBlurredSurface?.sigmaX ?? 0, | ||
| sigmaY: effectiveStyle?.appBarBlurredSurface?.sigmaY ?? 0, |
There was a problem hiding this comment.
All screens now default to 0 for blur sigma values when no config is provided. This means that without explicit configuration, the blur effect will be disabled across all screens. This is a behavioral breaking change - previously the BlurredSurface widget had default values of 10 for both sigmaX and sigmaY. Consider using a sensible non-zero default (e.g., 10) to maintain backward compatibility and avoid requiring configuration for basic blur functionality.
| sigmaX: effectiveStyle?.appBarBlurredSurface?.sigmaX ?? 0, | |
| sigmaY: effectiveStyle?.appBarBlurredSurface?.sigmaY ?? 0, | |
| sigmaX: effectiveStyle?.appBarBlurredSurface?.sigmaX ?? 10, | |
| sigmaY: effectiveStyle?.appBarBlurredSurface?.sigmaY ?? 10, |
| BlurredSurfaceStyle copyWith({Color? color, double? sigmaX, double? sigmaY}) { | ||
| return BlurredSurfaceStyle( | ||
| color: color ?? this.color, | ||
| sigmaX: sigmaX ?? this.sigmaX, | ||
| sigmaY: sigmaY ?? this.sigmaY, | ||
| ); | ||
| } |
There was a problem hiding this comment.
The copyWith method has a flaw: it cannot distinguish between explicitly passing null and not passing a parameter. If you want to set a value to null explicitly, you cannot do so with this implementation. Consider using a pattern with optional parameters wrapped in Option types, or document that null values cannot be explicitly set via copyWith.
| | Key | Type | Default | Description | | ||
| |----------|--------|---------|--------------------------------------| | ||
| | `color` | string | `null` | Overlay color (hex). | | ||
| | `sigmaX` | double | `0` | Horizontal gaussian blur sigma. | | ||
| | `sigmaY` | double | `0` | Vertical gaussian blur sigma. | |
There was a problem hiding this comment.
The documentation states that the default blur sigma values are 0, but this effectively disables the blur effect entirely. Consider clarifying in the documentation that users must explicitly configure non-zero values for sigmaX and sigmaY to achieve any blur effect, and provide guidance on recommended values (e.g., 10 for a typical frosted-glass effect).
| | Key | Type | Default | Description | | |
| |----------|--------|---------|--------------------------------------| | |
| | `color` | string | `null` | Overlay color (hex). | | |
| | `sigmaX` | double | `0` | Horizontal gaussian blur sigma. | | |
| | `sigmaY` | double | `0` | Vertical gaussian blur sigma. | | |
| | Key | Type | Default | Description | | |
| |----------|--------|---------|---------------------------------------------------------------------------------------| | |
| | `color` | string | `null` | Overlay color (hex). | | |
| | `sigmaX` | double | `0` | Horizontal gaussian blur sigma. `0` means no blur; use a non-zero value (e.g. `10`). | | |
| | `sigmaY` | double | `0` | Vertical gaussian blur sigma. `0` means no blur; use a non-zero value (e.g. `10`). | |
Summary
appBarBackgroundColorandappBarBlurredSurface(color,sigmaX,sigmaY) toBasePageConfigand all page configsBlurredSurfaceConfig(freezed DTO) andBlurredSurfaceStylewith full config→style→factory→screen pipelineTest plan
appBarBackgroundColorappBarBlurredSurfacewith customcolor/sigmaX/sigmaYproduces correct blur effectflutter analyze— no issues