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:
1 parent
2f8fcb87d7
commit
cf4b21ef02
6 files changed
+613
-66
No files matched your search
@@ -5,8 +5,10 @@ import '../connector/meshcore_connector.dart';
|
||||
import '../helpers/snack_bar_builder.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../screens/scanner_screen.dart';
|
||||
import '../screens/settings_screen.dart';
|
||||
import '../screens/usb_screen.dart';
|
||||
import '../storage/last_radio_store.dart';
|
||||
import '../theme/theme_icons.dart';
|
||||
import '../utils/dialog_utils.dart';
|
||||
import '../utils/platform_info.dart';
|
||||
import 'mesh_ui.dart';
|
||||
@@ -164,3 +166,36 @@ PopupMenuItem<T> connectionMenuItem<T>(
|
||||
onTap: () => showConnectSheet(screenContext),
|
||||
);
|
||||
}
|
||||
|
||||
/// Overflow-menu entry that opens [SettingsScreen].
|
||||
/// [screenContext] must outlive the menu, as onTap runs after it closes.
|
||||
PopupMenuItem<T> settingsMenuItem<T>(
|
||||
BuildContext screenContext,
|
||||
BuildContext menuContext,
|
||||
) {
|
||||
return PopupMenuItem<T>(
|
||||
child: MeshMenuItemRow(
|
||||
leading: const ThemedIcon(ThemeIconSlot.settings, size: 20),
|
||||
label: menuContext.l10n.settings_title,
|
||||
),
|
||||
onTap: () => Navigator.push(
|
||||
screenContext,
|
||||
MaterialPageRoute(builder: (_) => const SettingsScreen()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Trailing app-level section shared by the main views' overflow menus:
|
||||
/// an optional [PopupMenuDivider] (omitted when [hasPrecedingItems] is false)
|
||||
/// followed by [connectionMenuItem] and [settingsMenuItem].
|
||||
List<PopupMenuEntry<T>> mainOverflowTrailingItems<T>(
|
||||
BuildContext screenContext,
|
||||
BuildContext menuContext, {
|
||||
bool hasPrecedingItems = true,
|
||||
}) {
|
||||
return <PopupMenuEntry<T>>[
|
||||
if (hasPrecedingItems) const PopupMenuDivider(),
|
||||
connectionMenuItem<T>(screenContext, menuContext),
|
||||
settingsMenuItem<T>(screenContext, menuContext),
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user