Skip to content

Commit 13bd36a

Browse files
klopez4212Terpbrow
authored
Unify Android navigation controls and clarify the New menu (#9941)
## Summary Align Android navigation around 48 dp header controls and a 20 dp outer gutter. Give neutral controls a consistent fill and a 7% inverse-surface inner stroke. Match the Agents header to See All Channels and use the shared search field in See All. Remove the lock from private-channel title pills while retaining the TalkBack privacy label. When New opens on Messages, animate a 4 dp blur behind its options. ## Testing Built and installed the preview on a Pixel 10. Checked Messages alignment, Invite and Settings controls, Search, Activity, private-channel titles, and opening and dismissing New. Targeted widget tests covered the shared navigation, channel pages, search treatment, and private-title semantics. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz>
1 parent 37e89d1 commit 13bd36a

28 files changed

Lines changed: 677 additions & 306 deletions

‎mobile/lib/features/activity/activity_page.dart‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,10 +703,16 @@ class ActivityPage extends HookConsumerWidget {
703703
)
704704
: IconButton(
705705
tooltip: 'Close activity',
706+
style: androidNavigationButtonStyle(
707+
context,
708+
),
706709
icon: const Icon(BuzzIcons.x),
707710
onPressed: () =>
708711
Navigator.of(context).pop(),
709712
),
713+
if (!closeInRail &&
714+
defaultTargetPlatform == TargetPlatform.android)
715+
const SizedBox(width: Grid.twelve),
710716
Expanded(
711717
child: Text('Activity', style: headerTitleStyle),
712718
),

‎mobile/lib/features/activity/activity_page/header_actions.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ ButtonStyle _activityFilterStyle(BuildContext context, bool active) =>
155155
max(44.0, MediaQuery.textScalerOf(context).scale(16) * 1.4 + 12),
156156
),
157157
padding: const EdgeInsets.symmetric(horizontal: 12),
158+
side: active ? BorderSide.none : context.navigationControlStroke,
158159
shape: const StadiumBorder(),
159160
textStyle: filterChipTextStyle.copyWith(
160161
leadingDistribution: TextLeadingDistribution.even,

‎mobile/lib/features/agents/agents_page.dart‎

Lines changed: 163 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
import '../../shared/widgets/android_page_header.dart';
12
import '../../shared/widgets/ios_glass_navigation_button.dart';
3+
24
import 'dart:async';
5+
36
import 'package:duo_kit/duo_kit.dart';
47

58
import 'package:flutter/material.dart';
69
import 'package:flutter/foundation.dart';
10+
711
import '../../shared/diagnostics/diagnostic_navigation_observer.dart';
812
import '../../shared/widgets/adaptive_conversation_pane.dart';
913
import '../../shared/widgets/duo_toolbar.dart';
14+
1015
import 'package:flutter_hooks/flutter_hooks.dart';
1116
import 'package:hooks_riverpod/hooks_riverpod.dart';
1217

@@ -658,14 +663,164 @@ class AgentsPage extends HookConsumerWidget {
658663
fontWeight: FontWeight.w600,
659664
color: navigationPrimaryForeground(context),
660665
);
661-
final topHeight = frostedAppBarHeight(
662-
context,
663-
nativeLargeTitle: !portrait,
664-
useNativeNavigation: !portrait,
665-
alignWithStatusRegion: portrait,
666-
titleStyle: headerStyle,
667-
bottomHeight: portrait ? 0 : Grid.xxs,
666+
final android = defaultTargetPlatform == TargetPlatform.android;
667+
final topHeight = android
668+
? 0.0
669+
: frostedAppBarHeight(
670+
context,
671+
nativeLargeTitle: !portrait,
672+
useNativeNavigation: !portrait,
673+
alignWithStatusRegion: portrait,
674+
titleStyle: headerStyle,
675+
bottomHeight: portrait ? 0 : Grid.xxs,
676+
);
677+
final body = SafeArea(
678+
top: false,
679+
child: Material(
680+
color: Colors.transparent,
681+
child: BeeRefreshIndicator(
682+
edgeOffset: topHeight,
683+
onRefresh: refresh,
684+
child: CustomScrollView(
685+
physics: const AlwaysScrollableScrollPhysics(),
686+
slivers: [
687+
SliverToBoxAdapter(child: SizedBox(height: topHeight)),
688+
if (signInNeeded)
689+
SliverToBoxAdapter(
690+
child: ReconnectCapsule(
691+
inline: true,
692+
message: signingIn
693+
? 'Finish sign-in in browser'
694+
: 'Reconnect to Builderlab',
695+
actionLabel: signingIn ? 'Cancel' : 'Sign in',
696+
destructiveAction: signingIn,
697+
onSignIn: () => unawaited(
698+
signingIn ? flow.leave() : flow.reconnectAccount(),
699+
),
700+
),
701+
),
702+
SliverToBoxAdapter(
703+
child: Column(
704+
children: [
705+
if (createOnOpen && (loading || signingIn))
706+
const LinearProgressIndicator(),
707+
if (createOnOpen &&
708+
supportsRemoteAgents(community) &&
709+
controller.failure.isNotEmpty)
710+
Padding(
711+
padding: const EdgeInsets.all(Grid.sm),
712+
child: Text(controller.failure),
713+
),
714+
if (failed && keys.isEmpty)
715+
ListTile(
716+
title: const Text('Could not load agents'),
717+
trailing: TextButton(
718+
onPressed: refresh,
719+
child: const Text('Retry'),
720+
),
721+
),
722+
if (!loading && !failed && !needsSignIn && keys.isEmpty)
723+
const Padding(
724+
padding: EdgeInsets.all(Grid.sm),
725+
child: Text(
726+
'You haven’t added any agents yet.',
727+
textAlign: TextAlign.center,
728+
),
729+
),
730+
],
731+
),
732+
),
733+
AgentCardGrid(
734+
itemCount: keys.length,
735+
itemBuilder: (context, index) {
736+
final key = keys[index];
737+
final remote = controller.agents
738+
.where((row) => row['agent_pubkey'] == key)
739+
.firstOrNull;
740+
final editable =
741+
community != null &&
742+
supportsRemoteAgents(community) &&
743+
controller.owner == community.pubkey &&
744+
owned?.contains(key) == true &&
745+
controller.activeAgents.contains(key) &&
746+
remote != null;
747+
return AgentCard(
748+
key: ValueKey(key),
749+
name: names.labelFor(key),
750+
isBestie: key == bestie,
751+
imageUrl:
752+
profiles[key]?.avatarUrl ??
753+
ownedDirectory.asData?.value
754+
.where((entry) => entry.pubkey == key)
755+
.firstOrNull
756+
?.avatarUrl,
757+
location: remote != null ? 'Remote' : null,
758+
onOpen: () => onSelect(key),
759+
footer: editable
760+
? RemoteAgentModelControl(
761+
key: ValueKey('model-$key'),
762+
controller: controller,
763+
agent: remote,
764+
community: community,
765+
isCurrent: () =>
766+
ref
767+
.read(activeCommunityProvider)
768+
.asData
769+
?.value
770+
?.id ==
771+
community.id,
772+
)
773+
: null,
774+
subtitle: editable
775+
? null
776+
: remote != null
777+
? 'Builderbot agent'
778+
: needsSignIn
779+
? null
780+
: 'Manage on desktop',
781+
);
782+
},
783+
),
784+
],
785+
),
786+
),
787+
),
668788
);
789+
if (android) {
790+
return Scaffold(
791+
body: SafeArea(
792+
top: true,
793+
bottom: false,
794+
child: Column(
795+
children: [
796+
SizedBox(
797+
height: kToolbarHeight,
798+
child: androidPageHeader(
799+
context,
800+
title: 'Agents',
801+
leading: IconButton(
802+
tooltip: 'Close agents',
803+
icon: const Icon(BuzzIcons.x),
804+
onPressed: onClose,
805+
style: androidNavigationButtonStyle(context),
806+
),
807+
actions: [
808+
if (supportsRemoteAgents(community))
809+
IconButton(
810+
tooltip: 'Add agent',
811+
onPressed: addAgent,
812+
icon: const Icon(Icons.add),
813+
style: androidNavigationButtonStyle(context),
814+
),
815+
],
816+
),
817+
),
818+
Expanded(child: body),
819+
],
820+
),
821+
),
822+
);
823+
}
669824
return FrostedScaffold(
670825
backgroundColor: context.colors.surface,
671826
appBar: FrostedAppBar(
@@ -720,118 +875,7 @@ class AgentsPage extends HookConsumerWidget {
720875
),
721876
],
722877
),
723-
body: SafeArea(
724-
top: false,
725-
child: Material(
726-
color: Colors.transparent,
727-
child: BeeRefreshIndicator(
728-
edgeOffset: topHeight,
729-
onRefresh: refresh,
730-
child: CustomScrollView(
731-
physics: const AlwaysScrollableScrollPhysics(),
732-
slivers: [
733-
SliverToBoxAdapter(child: SizedBox(height: topHeight)),
734-
if (signInNeeded)
735-
SliverToBoxAdapter(
736-
child: ReconnectCapsule(
737-
inline: true,
738-
message: signingIn
739-
? 'Finish sign-in in browser'
740-
: 'Reconnect to Builderlab',
741-
actionLabel: signingIn ? 'Cancel' : 'Sign in',
742-
destructiveAction: signingIn,
743-
onSignIn: () => unawaited(
744-
signingIn ? flow.leave() : flow.reconnectAccount(),
745-
),
746-
),
747-
),
748-
SliverToBoxAdapter(
749-
child: Column(
750-
children: [
751-
if (createOnOpen && (loading || signingIn))
752-
const LinearProgressIndicator(),
753-
if (createOnOpen &&
754-
supportsRemoteAgents(community) &&
755-
controller.failure.isNotEmpty)
756-
Padding(
757-
padding: const EdgeInsets.all(Grid.sm),
758-
child: Text(controller.failure),
759-
),
760-
if (failed && keys.isEmpty)
761-
ListTile(
762-
title: const Text('Could not load agents'),
763-
trailing: TextButton(
764-
onPressed: refresh,
765-
child: const Text('Retry'),
766-
),
767-
),
768-
if (!loading && !failed && !needsSignIn && keys.isEmpty)
769-
const Padding(
770-
padding: EdgeInsets.all(Grid.sm),
771-
child: Text(
772-
'You haven’t added any agents yet.',
773-
textAlign: TextAlign.center,
774-
),
775-
),
776-
],
777-
),
778-
),
779-
AgentCardGrid(
780-
itemCount: keys.length,
781-
itemBuilder: (context, index) {
782-
final key = keys[index];
783-
final remote = controller.agents
784-
.where((row) => row['agent_pubkey'] == key)
785-
.firstOrNull;
786-
final editable =
787-
community != null &&
788-
supportsRemoteAgents(community) &&
789-
controller.owner == community.pubkey &&
790-
owned?.contains(key) == true &&
791-
controller.activeAgents.contains(key) &&
792-
remote != null;
793-
return AgentCard(
794-
key: ValueKey(key),
795-
name: names.labelFor(key),
796-
isBestie: key == bestie,
797-
imageUrl:
798-
profiles[key]?.avatarUrl ??
799-
ownedDirectory.asData?.value
800-
.where((entry) => entry.pubkey == key)
801-
.firstOrNull
802-
?.avatarUrl,
803-
location: remote != null ? 'Remote' : null,
804-
onOpen: () => onSelect(key),
805-
footer: editable
806-
? RemoteAgentModelControl(
807-
key: ValueKey('model-$key'),
808-
controller: controller,
809-
agent: remote,
810-
community: community,
811-
isCurrent: () =>
812-
ref
813-
.read(activeCommunityProvider)
814-
.asData
815-
?.value
816-
?.id ==
817-
community.id,
818-
)
819-
: null,
820-
subtitle: editable
821-
? null
822-
: remote != null
823-
? 'Builderbot agent'
824-
: needsSignIn
825-
? null
826-
: 'Manage on desktop',
827-
);
828-
},
829-
),
830-
],
831-
),
832-
),
833-
),
834-
),
878+
body: body,
835879
);
836880
}
837881
}

‎mobile/lib/features/channels/channel_detail_page/app_bar.dart‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,14 @@ class _ConversationAppBarTitle extends StatelessWidget {
9393
),
9494
),
9595
const SizedBox(width: 8),
96-
if (!channel.isDm &&
97-
channel.visibility == 'private') ...[
98-
Icon(
99-
BuzzIcons.lock,
100-
size: 14,
101-
color: context.colors.onSurfaceVariant,
102-
semanticLabel: 'Private conversation',
103-
),
104-
const SizedBox(width: Grid.quarter),
105-
],
10696
Flexible(
10797
child: Text(
10898
label,
99+
semanticsLabel:
100+
!channel.isDm &&
101+
channel.visibility == 'private'
102+
? '$label, Private channel'
103+
: null,
109104
key: ValueKey('$prefix-header-name'),
110105
maxLines: 1,
111106
overflow: TextOverflow.ellipsis,

0 commit comments

Comments
 (0)