mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-23 01:01:06 +10:00
fix: migrate filter menus to type-safe generics and harden popup dismissal
- Move ContactSortOption/ContactTypeFilter enums to dedicated contact_filter_types.dart (re-exported from contact_search.dart) - Migrate ContactsFilterMenu and DiscoveryContactsFilterMenu to use sealed class action types with SortFilterMenu<T> generics, replacing int action constants and switch statements - Guard _closeDropdownAndRun with ModalRoute.isCurrent check to prevent accidental dismissal of parent routes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -454,8 +454,11 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
}
|
||||
}
|
||||
|
||||
void _closeDropdownAndRun(BuildContext context, VoidCallback action) {
|
||||
Navigator.of(context).pop();
|
||||
void _closeDropdownAndRun(BuildContext popupContext, VoidCallback action) {
|
||||
final route = ModalRoute.of(popupContext);
|
||||
if (route != null && route.isCurrent) {
|
||||
Navigator.of(popupContext).pop();
|
||||
}
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
action();
|
||||
|
||||
Reference in New Issue
Block a user