Skip to content

Commit 4fcd5f1

Browse files
author
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d
committed
Merge origin/main into duncan/byoh-generic-acp-harness
Pulls in dd222a5 (mobile settings/theme refinements). No conflicts. Co-authored-by: Tyler Longwell <[email protected]> Signed-off-by: Tyler Longwell <[email protected]> * origin/main: Refine mobile settings and themes (#2844)
2 parents 9fd2ed3 + dd222a5 commit 4fcd5f1

50 files changed

Lines changed: 3036 additions & 775 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎mobile/lib/app.dart‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import 'features/pairing/pairing_page.dart';
1010
import 'features/channels/agent_activity/observer_subscription.dart';
1111
import 'features/channels/deep_link_dispatcher.dart';
1212
import 'features/profile/user_status_cache_provider.dart';
13+
import 'features/profile/settings_profile_header.dart';
14+
import 'features/settings/settings_page.dart';
1315
import 'shared/auth/auth.dart';
1416
import 'shared/deeplink/pending_deep_link_provider.dart';
1517
import 'shared/relay/relay.dart';
@@ -25,13 +27,25 @@ class App extends HookConsumerWidget {
2527
final schemeName = ref.watch(schemeProvider);
2628
final authState = ref.watch(authProvider);
2729

28-
final resolved = resolveSchemes(schemeName);
30+
final resolved = resolveSchemes(schemeName, themeMode);
2931
final lightScheme = applyAccent(resolved.light, accentIndex);
3032
final darkScheme = applyAccent(resolved.dark, accentIndex);
31-
// Default and named schemes can force light or dark mode; otherwise
32-
// respect the user's ThemeMode preference.
33+
// Light/Dark modes pin the brightness; System leaves it null so Flutter
34+
// follows the OS across the selected theme and its pair.
3335
final effectiveMode = resolved.forcedMode ?? themeMode;
3436

37+
// Derive the gradient from the themes that produced each color scheme.
38+
// This keeps fallbacks and pinned brightness changes aligned with the
39+
// rendered palette rather than the raw persisted selection.
40+
final buzzLightGradient = buzzTopSectionGradient(
41+
resolved.lightTheme?.name ?? '',
42+
lightScheme.brightness,
43+
);
44+
final buzzDarkGradient = buzzTopSectionGradient(
45+
resolved.darkTheme?.name ?? '',
46+
darkScheme.brightness,
47+
);
48+
3549
// Eagerly initialize websocket session and lifecycle observer when
3650
// authenticated. These providers connect and manage the websocket.
3751
if (authState.value?.status == AuthStatus.authenticated) {
@@ -65,15 +79,21 @@ class App extends HookConsumerWidget {
6579

6680
return MaterialApp(
6781
title: 'Buzz',
68-
theme: AppTheme.light(colorScheme: lightScheme),
69-
darkTheme: AppTheme.dark(colorScheme: darkScheme),
82+
theme: AppTheme.light(
83+
colorScheme: lightScheme,
84+
topSectionGradient: buzzLightGradient,
85+
),
86+
darkTheme: AppTheme.dark(
87+
colorScheme: darkScheme,
88+
topSectionGradient: buzzDarkGradient,
89+
),
7090
themeMode: effectiveMode,
7191
home: authState.when(
7292
loading: () => const _SplashScreen(),
7393
error: (_, _) => const PairingPage(),
7494
data: (state) => switch (state.status) {
7595
AuthStatus.authenticated => const DeepLinkDispatcher(
76-
child: HomePage(),
96+
child: HomePage(settingsPageBuilder: _buildSettingsPage),
7797
),
7898
_ => const DeepLinkDispatcher(
7999
dispatchMessageLinks: false,
@@ -85,6 +105,9 @@ class App extends HookConsumerWidget {
85105
}
86106
}
87107

108+
Widget _buildSettingsPage(BuildContext context) =>
109+
const SettingsPage(profileHeader: SettingsProfileHeader());
110+
88111
class _SplashScreen extends StatelessWidget {
89112
const _SplashScreen();
90113

‎mobile/lib/features/channels/channel_management_provider.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import 'package:flutter/foundation.dart';
55
import 'package:hooks_riverpod/hooks_riverpod.dart';
66

77
import '../../shared/auth/auth.dart';
8+
import '../../shared/custom_emoji/custom_emoji.dart';
9+
import '../../shared/custom_emoji/custom_emoji_provider.dart';
810
import '../../shared/relay/relay.dart';
911
import '../profile/profile_provider.dart';
10-
import '../custom_emoji/custom_emoji.dart';
11-
import '../custom_emoji/custom_emoji_provider.dart';
1212
import 'channel.dart';
1313
import 'channels_provider.dart';
1414

‎mobile/lib/features/channels/channels_page.dart‎

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ import '../../shared/theme/theme.dart';
1515
import '../../shared/widgets/avatar_image.dart';
1616
import '../../shared/widgets/frosted_app_bar.dart';
1717
import '../../shared/widgets/frosted_scaffold.dart';
18-
import '../custom_emoji/custom_emoji.dart';
19-
import '../custom_emoji/custom_emoji_provider.dart';
20-
import '../custom_emoji/custom_emoji_render.dart';
18+
import '../../shared/custom_emoji/custom_emoji.dart';
19+
import '../../shared/custom_emoji/custom_emoji_provider.dart';
20+
import '../../shared/custom_emoji/custom_emoji_render.dart';
2121
import '../profile/profile_avatar.dart';
2222
import '../profile/profile_provider.dart';
23-
import '../settings/settings_page.dart';
2423
import '../profile/presence_cache_provider.dart';
2524
import '../profile/user_cache_provider.dart';
2625
import '../pairing/pairing_page.dart';
@@ -62,6 +61,19 @@ const double _kChannelLabelGap = Grid.xxs;
6261
const double _kChannelRowVerticalPadding = Grid.xxs + Grid.quarter;
6362
const double _kChannelLabelInset =
6463
_kChannelSectionInset + _kChannelLeadingWidth + _kChannelLabelGap;
64+
65+
/// DM avatars are circles, so they fill their box edge to edge where a channel
66+
/// glyph leaves 4dp of slack inside the same 22dp leading column. Sizing them to
67+
/// the glyph's ink width keeps the icon-to-label distance identical across both
68+
/// sections while the labels stay on [_kChannelLabelInset].
69+
const double _kDmAvatarSize = _kChannelIconSize;
70+
71+
/// The top section's avatars are 32dp circles, which fill their box edge to
72+
/// edge; the channel rows below lead with an 18dp glyph left-aligned in a 22dp
73+
/// box at [_kChannelSectionInset]. Edge-aligning the two leaves the circles
74+
/// looking pushed outward, so the bar is pulled in to sit the avatar's centre
75+
/// on the channel-icon column (12 + 16 = 28dp against the glyph's ~29dp).
76+
const double _kTopSectionInset = Grid.twelve;
6577
const Duration _kSectionExpandDuration = Duration(milliseconds: 220);
6678
const Duration _kSectionCollapseDuration = Duration(milliseconds: 170);
6779
const Curve _kSectionExpandCurve = Cubic(0.23, 1, 0.32, 1);
@@ -129,7 +141,9 @@ _UnreadChannelState _computeUnreadChannelState({
129141
}
130142

131143
class ChannelsPage extends HookConsumerWidget {
132-
const ChannelsPage({super.key});
144+
const ChannelsPage({required this.settingsPageBuilder, super.key});
145+
146+
final WidgetBuilder settingsPageBuilder;
133147

134148
@override
135149
Widget build(BuildContext context, WidgetRef ref) {
@@ -208,7 +222,11 @@ class ChannelsPage extends HookConsumerWidget {
208222

209223
return FrostedScaffold(
210224
appBar: FrostedAppBar(
211-
horizontalInset: _kChannelSectionInset,
225+
horizontalInset: _kTopSectionInset,
226+
// Under a Buzz theme the community + account avatar strip carries the
227+
// branded gradient, the way desktop paints it across the sidebar. Null
228+
// under every other theme, leaving the default frosted fill.
229+
gradient: context.appColors.topSectionGradient,
212230
leading: _CommunityIndicator(
213231
onTap: () => showModalBottomSheet<void>(
214232
context: context,
@@ -219,9 +237,9 @@ class ChannelsPage extends HookConsumerWidget {
219237
title: const SizedBox.shrink(),
220238
actions: [
221239
ProfileAvatar(
222-
onTap: () => Navigator.of(context).push(
223-
MaterialPageRoute<void>(builder: (_) => const SettingsPage()),
224-
),
240+
onTap: () => Navigator.of(
241+
context,
242+
).push(MaterialPageRoute<void>(builder: settingsPageBuilder)),
225243
),
226244
],
227245
),

‎mobile/lib/features/channels/channels_page/channel_tile.dart‎

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,19 @@ class _ChannelTile extends ConsumerWidget {
4141
),
4242
child: Row(
4343
children: [
44-
if (channel.isDm)
45-
_DmAvatar(channel: channel, currentPubkey: currentPubkey)
46-
else
47-
SizedBox(
48-
width: _kChannelLeadingWidth,
49-
child: Align(
50-
alignment: Alignment.centerLeft,
51-
child: Icon(
52-
channelIcon(channel),
53-
size: _kChannelIconSize,
54-
color: context.colors.onSurface,
55-
),
56-
),
44+
SizedBox(
45+
width: _kChannelLeadingWidth,
46+
child: Align(
47+
alignment: Alignment.centerLeft,
48+
child: channel.isDm
49+
? _DmAvatar(channel: channel, currentPubkey: currentPubkey)
50+
: Icon(
51+
channelIcon(channel),
52+
size: _kChannelIconSize,
53+
color: context.colors.onSurface,
54+
),
5755
),
56+
),
5857
const SizedBox(width: _kChannelLabelGap),
5958
Expanded(
6059
child: Column(
@@ -343,8 +342,8 @@ class _DmAvatar extends ConsumerWidget {
343342

344343
if (visiblePubkeys.length > 1) {
345344
return Container(
346-
width: 22,
347-
height: 22,
345+
width: _kDmAvatarSize,
346+
height: _kDmAvatarSize,
348347
alignment: Alignment.center,
349348
decoration: BoxDecoration(
350349
color: context.colors.surfaceContainerHighest,
@@ -354,7 +353,7 @@ class _DmAvatar extends ConsumerWidget {
354353
child: Text(
355354
'${visiblePubkeys.length}',
356355
style: context.textTheme.labelSmall?.copyWith(
357-
fontSize: 10,
356+
fontSize: 9,
358357
color: context.colors.onSurface,
359358
fontWeight: FontWeight.w600,
360359
height: 1,
@@ -385,14 +384,14 @@ class _DmAvatar extends ConsumerWidget {
385384
: 'offline';
386385

387386
return SizedBox(
388-
width: 22,
389-
height: 22,
387+
width: _kDmAvatarSize,
388+
height: _kDmAvatarSize,
390389
child: Stack(
391390
clipBehavior: Clip.none,
392391
children: [
393392
AvatarImage(
394393
imageUrl: avatarUrl,
395-
radius: 10,
394+
radius: _kDmAvatarSize / 2,
396395
backgroundColor: context.colors.primaryContainer,
397396
fallback: Text(
398397
initial,
@@ -407,8 +406,8 @@ class _DmAvatar extends ConsumerWidget {
407406
right: -1,
408407
bottom: -1,
409408
child: Container(
410-
width: 9,
411-
height: 9,
409+
width: 8,
410+
height: 8,
412411
decoration: BoxDecoration(
413412
color: _presenceColor(context, presence),
414413
shape: BoxShape.circle,

‎mobile/lib/features/channels/compose_bar.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import '../../shared/theme/theme.dart';
1717
import '../../shared/widgets/avatar_image.dart';
1818
import '../profile/user_cache_provider.dart';
1919
import '../profile/user_profile.dart';
20-
import '../custom_emoji/custom_emoji.dart';
21-
import '../custom_emoji/custom_emoji_provider.dart';
20+
import '../../shared/custom_emoji/custom_emoji.dart';
21+
import '../../shared/custom_emoji/custom_emoji_provider.dart';
2222
import 'camera_capture_cleanup.dart';
2323
import 'channel.dart';
2424
import 'channel_management_provider.dart';

‎mobile/lib/features/channels/emoji_picker.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
33
import 'package:lucide_icons_flutter/lucide_icons.dart';
44

55
import '../../shared/theme/theme.dart';
6-
import '../custom_emoji/custom_emoji.dart';
7-
import '../custom_emoji/custom_emoji_provider.dart';
8-
import '../custom_emoji/custom_emoji_render.dart';
6+
import '../../shared/custom_emoji/custom_emoji.dart';
7+
import '../../shared/custom_emoji/custom_emoji_provider.dart';
8+
import '../../shared/custom_emoji/custom_emoji_render.dart';
99

1010
/// Opens the full emoji picker as a modal bottom sheet.
1111
void showEmojiPicker({

‎mobile/lib/features/channels/message_actions.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
44
import 'package:lucide_icons_flutter/lucide_icons.dart';
55

66
import '../../shared/theme/theme.dart';
7-
import '../custom_emoji/custom_emoji.dart';
8-
import '../custom_emoji/custom_emoji_provider.dart';
7+
import '../../shared/custom_emoji/custom_emoji.dart';
8+
import '../../shared/custom_emoji/custom_emoji_provider.dart';
99
import 'channel_management_provider.dart';
1010
import 'emoji_picker.dart';
1111
import 'thread_detail_page.dart';

‎mobile/lib/features/channels/message_content.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import '../../shared/clipboard_utils.dart';
1515
import '../../shared/relay/relay.dart';
1616
import '../../shared/syntax_highlight.dart';
1717
import '../../shared/theme/theme.dart';
18-
import '../custom_emoji/custom_emoji.dart';
19-
import '../custom_emoji/custom_emoji_provider.dart';
20-
import '../custom_emoji/custom_emoji_render.dart';
18+
import '../../shared/custom_emoji/custom_emoji.dart';
19+
import '../../shared/custom_emoji/custom_emoji_provider.dart';
20+
import '../../shared/custom_emoji/custom_emoji_render.dart';
2121
import 'media_viewer_page.dart';
2222
import 'message_media.dart';
2323

‎mobile/lib/features/channels/reaction_row.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
44

55
import '../../shared/theme/theme.dart';
66
import '../../shared/widgets/avatar_image.dart';
7-
import '../custom_emoji/custom_emoji_render.dart';
7+
import '../../shared/custom_emoji/custom_emoji_render.dart';
88
import '../profile/user_cache_provider.dart';
99
import '../profile/user_profile.dart';
1010
import 'channel_management_provider.dart';

‎mobile/lib/features/channels/timeline_message.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'dart:convert';
33
import 'package:flutter/foundation.dart';
44

55
import '../../shared/relay/relay.dart';
6-
import '../custom_emoji/custom_emoji.dart';
6+
import '../../shared/custom_emoji/custom_emoji.dart';
77
import 'channel_window.dart';
88

99
enum SystemEventType {

0 commit comments

Comments
 (0)