Files
buzz/mobile/lib/shared/theme/utility_surface_theme.dart
klopez4212 ed11c8d8bf Refresh mobile utility surfaces and theme picker (#6944)
## Summary

- invert mobile utility surfaces so pages and sheets use the softer page
background with raised containers
- rebuild the community theme picker around swipeable Home/Chat
previews, accent and appearance controls, and native iOS glass
interactions
- align shared sheet/profile spacing and radii, and move Theme into the
Community settings card

### Related issue

None found.

### Testing

- `just mobile-check`
- `just mobile-test` (1,871 tests)
- signed iOS Release build installed on a physical iPhone

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Kenny Lopez <klopez4212@gmail.com>
Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
2026-08-28 18:56:42 +01:00

78 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'app_theme.dart';
/// Returns a theme with the page and container surface roles exchanged.
///
/// The marker makes the transform idempotent: a sheet opened from an already
/// transformed utility page keeps the same hierarchy instead of swapping the
/// two colors back again.
ThemeData utilitySurfaceThemeData(ThemeData theme) {
if (theme.extension<_UtilitySurfaceThemeMarker>() != null) return theme;
final colors = theme.colorScheme;
final pageSurface = colors.surfaceContainerHighest;
final containerSurface = colors.surface;
final containerShape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(Radii.container),
);
return theme.copyWith(
colorScheme: colors.copyWith(
surface: pageSurface,
surfaceContainerHighest: containerSurface,
),
scaffoldBackgroundColor: pageSurface,
cardTheme: theme.cardTheme.copyWith(
color: containerSurface,
shape: containerShape,
),
inputDecorationTheme: theme.inputDecorationTheme.copyWith(
border: _withUtilityContainerRadius(theme.inputDecorationTheme.border),
enabledBorder: _withUtilityContainerRadius(
theme.inputDecorationTheme.enabledBorder,
),
focusedBorder: _withUtilityContainerRadius(
theme.inputDecorationTheme.focusedBorder,
),
errorBorder: _withUtilityContainerRadius(
theme.inputDecorationTheme.errorBorder,
),
focusedErrorBorder: _withUtilityContainerRadius(
theme.inputDecorationTheme.focusedErrorBorder,
),
disabledBorder: _withUtilityContainerRadius(
theme.inputDecorationTheme.disabledBorder,
),
),
bottomSheetTheme: theme.bottomSheetTheme.copyWith(
backgroundColor: pageSurface,
modalBackgroundColor: pageSurface,
),
extensions: [
...theme.extensions.values,
const _UtilitySurfaceThemeMarker(),
],
);
}
InputBorder? _withUtilityContainerRadius(InputBorder? border) {
if (border is! OutlineInputBorder) return border;
return border.copyWith(borderRadius: BorderRadius.circular(Radii.container));
}
@immutable
class _UtilitySurfaceThemeMarker
extends ThemeExtension<_UtilitySurfaceThemeMarker> {
const _UtilitySurfaceThemeMarker();
@override
_UtilitySurfaceThemeMarker copyWith() => this;
@override
_UtilitySurfaceThemeMarker lerp(
covariant ThemeExtension<_UtilitySurfaceThemeMarker>? other,
double t,
) => this;
}