Files
org.parres.whitenoise/lib/hooks/use_dropdown_controller.dart
JeffGandGitHub e919e7bbeb fix: make dropdowns mutually exclusive and reduce transition duration (#337)
* fix: make dropdowns mutually exclusive using WnDropdownScope

Adds WnDropdownController and WnDropdownScope to WnDropdownSelector,
following the same pattern as WnListItemController/WnListItemScope.
When multiple WnDropdownSelector widgets are wrapped in a WnDropdownScope,
opening one automatically closes any other that is open.

Updates AppearanceScreen to use WnDropdownScope so the theme and language
dropdowns cannot both be open at the same time (fixes #332).

* fix: reduce slate content transition duration from 250ms to 150ms

* fix: set slate content transition duration to 200ms

* test: achieve 100% coverage on all files touched by this branch

- Add WnDropdownController unit tests (openItemKey getter, close no-op,
  open same key no-notify, controller lifecycle)
- Add WnDropdownSelector tests covering controller integration paths:
  toggle-closes via controller, selectOption via controller, disable-
  while-open with controller, non-ValueKey effectiveKey fallback
- Add use_dropdown_controller_test.dart for the new hook
- Add AppearanceScreen tests verifying exclusive dropdown behaviour
- Add WnSlateContentTransition duration assertion (200ms)
- Fix controller.close() called during build by deferring via
  addPostFrameCallback

* fix: revert incorrect Spanish translation change

The precommit l10n auto-fix incorrectly dropped the 'a' before
{userName} in addToGroupConfirmation. Restored to the correct
'¿Añadir a {userName} a {groupName}?' in both the ARB source and
generated file.
2026-02-20 17:56:59 +01:00

13 lines
329 B
Dart

import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:whitenoise/widgets/wn_dropdown_selector.dart';
WnDropdownController useDropdownController() {
final controller = useMemoized(() => WnDropdownController(), const []);
useEffect(() {
return controller.dispose;
}, [controller]);
return controller;
}