mirror of
https://github.com/block/buzz.git
synced 2026-11-28 04:01:45 +00:00
## Summary - Organize mobile Messages into configurable flat sections. See All keeps the list and its search position when opening a conversation, and supports side-by-side browsing on an unfolded Duo. - Use the same 16-point Messages gutter in booklet and open Duo layouts. The regular iPhone uses 20 points. Align navigation actions and use native inline titles on See All. - Update mobile typography and spacing across chat rows, message bubbles, drafts, and the composer. Render code proportionally to the 17-point message body. ## Device review Compare the leading edges of the section headings and channel icons in Messages on the open Duo and in booklet mode. Open See All and check that its rows follow the same column. --------- Signed-off-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
100 lines
3.0 KiB
Dart
100 lines
3.0 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;
|
|
return _surfaceTheme(theme, pageSurface, containerSurface);
|
|
}
|
|
|
|
/// Dark sheets sit one surface step below their grouped controls.
|
|
ThemeData utilitySheetThemeData(ThemeData theme) {
|
|
if (theme.brightness == Brightness.light) {
|
|
return utilitySurfaceThemeData(theme);
|
|
}
|
|
final colors = theme.colorScheme;
|
|
return _surfaceTheme(
|
|
theme,
|
|
colors.surfaceContainer,
|
|
colors.surfaceContainerHigh,
|
|
);
|
|
}
|
|
|
|
ThemeData _surfaceTheme(
|
|
ThemeData theme,
|
|
Color pageSurface,
|
|
Color containerSurface,
|
|
) {
|
|
final colors = theme.colorScheme;
|
|
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;
|
|
}
|