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

+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),