Make top-right overflow menus consistent across main views

Reorder the Channels overflow menu so screen-specific items appear above a divider followed by Connect/Disconnect and Settings, matching Contacts. Add the section divider on Map whenever screen items precede Connect/Disconnect, standardize the overflow tooltip and screen-context callback capture across all three main views via a shared trailing-section helper, and update the UI design reference and widget tests.
This commit is contained in:
zjs81 committed 2026-11-21 18:37:15 -07:00
1 parent 2f8fcb87d7
commit cf4b21ef02
6 files changed
+613 -66

No files matched your search

+2 -15
View File
@@ -39,9 +39,7 @@ import 'channel_chat_screen.dart';
import 'community_qr_scanner_screen.dart';
import 'contacts_screen.dart';
import 'map_screen.dart';
import 'settings_screen.dart';
import '../review_mode/review_mode_banner.dart';
import '../theme/theme_icons.dart';
class ChannelsScreen extends StatefulWidget {
final bool hideBackButton;
@@ -124,11 +122,11 @@ class _ChannelsScreenState extends State<ChannelsScreen> {
bottom: const SyncProgressAppBarBottom(),
actions: [
PopupMenuButton(
tooltip: context.l10n.contacts_moreOptions,
// onTap handlers run after the menu route pops, so they must
// capture the screen's context — not the itemBuilder's menu
// context, which is deactivated by then.
itemBuilder: (menuContext) => [
connectionMenuItem(context, menuContext),
PopupMenuItem(
child: MeshMenuItemRow(
icon: Icons.bookmark_border,
@@ -146,18 +144,7 @@ class _ChannelsScreenState extends State<ChannelsScreen> {
),
onTap: () => _showManageCommunitiesDialog(context),
),
PopupMenuItem(
child: MeshMenuItemRow(
leading: const ThemedIcon(ThemeIconSlot.settings, size: 20),
label: menuContext.l10n.settings_title,
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsScreen(),
),
),
),
...mainOverflowTrailingItems(context, menuContext),
],
icon: const Icon(Icons.more_vert),
),
+12 -26
View File
@@ -43,8 +43,6 @@ import 'discovery_screen.dart';
import 'map_screen.dart';
import '../review_mode/review_mode_banner.dart';
import 'repeater_hub_screen.dart';
import 'settings_screen.dart';
import '../theme/theme_icons.dart';
enum RoomLoginDestination { chat, management }
@@ -364,25 +362,26 @@ class _ContactsScreenState extends State<ContactsScreen> {
actions: [
PopupMenuButton(
tooltip: context.l10n.contacts_moreOptions,
itemBuilder: (context) => <PopupMenuEntry<dynamic>>[
// onTap handlers run after the menu route pops, so they must
// capture the screen's context — not the itemBuilder's menu
// context, which is deactivated by then.
itemBuilder: (menuContext) => <PopupMenuEntry<dynamic>>[
PopupMenuItem(
enabled: !readOnly,
onTap: _openAddContact,
child: MeshMenuItemRow(
icon: Icons.person_add,
label: context.l10n.addContact_title,
label: menuContext.l10n.addContact_title,
),
),
PopupMenuItem(
child: MeshMenuItemRow(
icon: Icons.person_add_rounded,
label: context.l10n.discoveredContacts_Title,
label: menuContext.l10n.discoveredContacts_Title,
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DiscoveryScreen(),
),
MaterialPageRoute(builder: (_) => const DiscoveryScreen()),
),
),
const PopupMenuDivider(),
@@ -390,7 +389,7 @@ class _ContactsScreenState extends State<ContactsScreen> {
enabled: !readOnly,
child: MeshMenuItemRow(
icon: Icons.connect_without_contact,
label: context.l10n.contacts_zeroHopAdvert,
label: menuContext.l10n.contacts_zeroHopAdvert,
),
onTap: () => _sendSelfAdvert(connector, flood: false),
),
@@ -398,7 +397,7 @@ class _ContactsScreenState extends State<ContactsScreen> {
enabled: !readOnly,
child: MeshMenuItemRow(
icon: Icons.cell_tower,
label: context.l10n.contacts_floodAdvert,
label: menuContext.l10n.contacts_floodAdvert,
),
onTap: () => _sendSelfAdvert(connector, flood: true),
),
@@ -406,7 +405,7 @@ class _ContactsScreenState extends State<ContactsScreen> {
enabled: !readOnly,
child: MeshMenuItemRow(
icon: Icons.copy,
label: context.l10n.contacts_copyAdvertToClipboard,
label: menuContext.l10n.contacts_copyAdvertToClipboard,
),
onTap: () => _contactExport(Uint8List.fromList([])),
),
@@ -414,24 +413,11 @@ class _ContactsScreenState extends State<ContactsScreen> {
enabled: !readOnly,
child: MeshMenuItemRow(
icon: Icons.radar,
label: context.l10n.manualTrace_menuItem,
label: menuContext.l10n.manualTrace_menuItem,
),
onTap: () => ManualPathTraceScreen.open(context),
),
const PopupMenuDivider(),
connectionMenuItem(this.context, context),
PopupMenuItem(
child: MeshMenuItemRow(
leading: const ThemedIcon(ThemeIconSlot.settings, size: 20),
label: context.l10n.settings_title,
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsScreen(),
),
),
),
...mainOverflowTrailingItems(context, menuContext),
],
icon: const Icon(Icons.more_vert),
),
+13 -21
View File
@@ -51,7 +51,6 @@ import '../helpers/guessed_location_estimator.dart';
import '../helpers/marker_message.dart';
import '../helpers/snack_bar_builder.dart';
import '../helpers/utf8_length_limiter.dart';
import 'settings_screen.dart';
import 'line_of_sight_map_screen.dart';
import '../theme/theme_icons.dart';
@@ -800,14 +799,18 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
bottom: const SyncProgressAppBarBottom(),
actions: [
PopupMenuButton(
itemBuilder: (context) => [
tooltip: context.l10n.contacts_moreOptions,
// onTap handlers run after the menu route pops, so they must
// capture the screen's context — not the itemBuilder's menu
// context, which is deactivated by then.
itemBuilder: (menuContext) => [
if (!_isBuildingPathTrace &&
connector.selfLatitude != null &&
connector.selfLongitude != null)
PopupMenuItem(
child: MeshMenuItemRow(
icon: Icons.radar,
label: context.l10n.contacts_pathTrace,
label: menuContext.l10n.contacts_pathTrace,
),
onTap: () => _openPathTrace(
connector,
@@ -822,7 +825,7 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
enabled: !readOnly,
child: MeshMenuItemRow(
icon: Icons.radar,
label: context.l10n.manualTrace_menuItem,
label: menuContext.l10n.manualTrace_menuItem,
),
onTap: () => ManualPathTraceScreen.open(context),
),
@@ -830,7 +833,7 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
PopupMenuItem(
child: MeshMenuItemRow(
leading: const LosIcon(size: 20),
label: context.l10n.map_lineOfSight,
label: menuContext.l10n.map_lineOfSight,
),
onTap: () {
final candidates = <LineOfSightEndpoint>[];
@@ -861,7 +864,7 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LineOfSightMapScreen(
builder: (_) => LineOfSightMapScreen(
title: context.l10n.map_losScreenTitle,
candidates: candidates,
),
@@ -869,21 +872,10 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
);
},
),
connectionMenuItem(this.context, context),
PopupMenuItem(
child: MeshMenuItemRow(
leading: const ThemedIcon(
ThemeIconSlot.settings,
size: 20,
),
label: context.l10n.settings_title,
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsScreen(),
),
),
...mainOverflowTrailingItems(
context,
menuContext,
hasPrecedingItems: !_isBuildingPathTrace,
),
],
icon: const Icon(Icons.more_vert),