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:
1 parent
86e9b7fe01
commit
566e3aadf8
4 files changed
+66
-78
No files matched your search
@@ -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