mirror of
https://github.com/block/buzz.git
synced 2026-10-28 21:11:48 +00:00
Aligns mobile with desktop's neutral palette and six chat colors. Appearance now offers Light, Dark, and System instead of themes, while preserving community preferences and the single Home and Chat preview pair. Chat colors survive local preference reloads without historical-index remapping, and the Chat preview shows the draft outgoing bubble color. Channel and section icons are removed, section chevrons sit beside names, and section dividers use 7% opacity. DM avatars remain. Validation: `just mobile-check`, 35 focused tests, and the full mobile suite passed (3,351 tests; 4 skipped). Updated light/dark previews were rendered and visually checked. The earlier release was verified on iPhone; this follow-up has not been reinstalled. The earlier repository-wide lint passed, but full `just ci` was stopped for low disk space. Hosted CI is running for the new head. **Intentional design parity:** Section labels and chevrons retain desktop’s `--text-unavailable` colors: light `#959595`, dark `#595959`. Verified against `block/buzz-app` main at `0201b54c496120a44e020834663dc534cae9a79f`. These colors do not meet 4.5:1 text contrast on the mobile section surfaces; the product decision for this PR is to preserve desktop parity and leave them unchanged. Kenneth explicitly accepts this known contrast tradeoff for this PR/release and requests that reviewers treat it as a scoped product exception rather than a blocker. This does not claim WCAG compliance or change the repository-wide accessibility target. Any future contrast adjustment should be coordinated across desktop and mobile. ### Snapshots Channel list: physical iPhone. Appearance and chat colors: Flutter-rendered previews. | Channels | Light | Dark | Chat colors | | --- | --- | --- | --- | |  |  |  |  | --------- Signed-off-by: kenny lopez <klopez4212@gmail.com>
59 lines
1.9 KiB
Dart
59 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'chat_colors.dart';
|
|
import 'color_scheme.dart';
|
|
import 'app_theme.dart';
|
|
|
|
/// Chat-only colors, independent of controls and navigation.
|
|
@immutable
|
|
class ChatColors extends ThemeExtension<ChatColors> {
|
|
/// Creates the outgoing message palette.
|
|
const ChatColors({required this.outgoing, required this.foreground});
|
|
|
|
/// Fill for messages authored by the active signing identity.
|
|
final Color outgoing;
|
|
|
|
/// Desktop text color paired with the outgoing fill.
|
|
final Color foreground;
|
|
|
|
/// Reads chat colors while supporting isolated widget previews.
|
|
static ChatColors of(BuildContext context) =>
|
|
Theme.of(context).extension<ChatColors>() ??
|
|
ChatColors(
|
|
outgoing: Theme.of(context).colorScheme.primary,
|
|
foreground: contrastForeground(Theme.of(context).colorScheme.primary),
|
|
);
|
|
|
|
@override
|
|
ChatColors copyWith({Color? outgoing, Color? foreground}) => ChatColors(
|
|
outgoing: outgoing ?? this.outgoing,
|
|
foreground: foreground ?? this.foreground,
|
|
);
|
|
|
|
@override
|
|
ChatColors lerp(covariant ChatColors? other, double t) => other == null
|
|
? this
|
|
: ChatColors(
|
|
outgoing: Color.lerp(outgoing, other.outgoing, t)!,
|
|
foreground: Color.lerp(foreground, other.foreground, t)!,
|
|
);
|
|
}
|
|
|
|
/// Builds the single mobile palette. Legacy theme names remain readable for
|
|
/// community preference compatibility, but never select an application palette.
|
|
ThemeData mobileAppearanceTheme(Brightness brightness, String chatColor) {
|
|
final theme = brightness == Brightness.dark
|
|
? AppTheme.dark()
|
|
: AppTheme.light();
|
|
final index = chatColorIndex(chatColor);
|
|
return theme.copyWith(
|
|
extensions: [
|
|
...theme.extensions.values,
|
|
ChatColors(
|
|
outgoing: chatColorForScheme(theme.colorScheme, index),
|
|
foreground: index == 0 ? theme.colorScheme.onSurface : Colors.white,
|
|
),
|
|
],
|
|
);
|
|
}
|