Merge pull request #690 from zjs81/fix/consistent-overflow-menus
Make top-right overflow menus consistent across main views
This commit is contained in:
6 files changed
+613
-66
No files matched your search
@@ -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),
|
||||
),
|
||||
|
||||
@@ -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
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user