Files
buzz/mobile/lib/shared/theme/mobile_appearance.dart
klopez4212 a5dfdd6d55 Align mobile appearance and channels with desktop (#8358)
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 |
| --- | --- | --- | --- |
|
![channel-list-iphone](https://raw.githubusercontent.com/block/buzz/1effb78b36cbcd77bd6339f11742133ec9e8214a/pr-8358--channel-list-iphone.png)
|
![appearance-light](https://raw.githubusercontent.com/block/buzz/1effb78b36cbcd77bd6339f11742133ec9e8214a/pr-8358--appearance-light.png)
|
![appearance-dark](https://raw.githubusercontent.com/block/buzz/1effb78b36cbcd77bd6339f11742133ec9e8214a/pr-8358--appearance-dark.png)
|
![chat-colors](https://raw.githubusercontent.com/block/buzz/1effb78b36cbcd77bd6339f11742133ec9e8214a/pr-8358--chat-colors.png)
|

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
2026-10-15 08:45:16 -04:00

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,
),
],
);
}