Skip to content

Fix #500: Selected Tags Lost After Rotation - #525

Open
victorwon2001 wants to merge 1 commit into
vicolo-dev:masterfrom
victorwon2001:fix/issue-500
Open

victorwon2001 wants to merge 1 commit into
vicolo-dev:masterfrom
victorwon2001:fix/issue-500

Conversation

@victorwon2001

@victorwon2001 victorwon2001 commented Sep 1, 2026

Copy link
Copy Markdown

Fixes #500

Implementation summary

Moved the temporary selection state and options list in "showSelectBottomSheet" outside the modal builder's rebuild scope so that unsaved selections are no longer reset when the device rotates. Selection indices are managed as a copy, ensuring the caller's state is not modified before Save, while an explicit reload continues to resynchronize both the options and selection state as before. Added a regression test verifying that after Select All followed by a portrait→landscape rotation, all items remain selected and Save passes "[0, 1, 2]".

Changes

lib/common/logic/show_select.dart | 8 +--
test/common/widgets/fields/select_field_test.dart | 72 +++++++++++++++++++++++
2 files changed, 76 insertions(+), 4 deletions(-)

Testing

  • "pwd && git status --short && git diff --check && git diff -- lib/common/logic/show_select.dart test/common/widgets/fields/select_field_test.dart" — passed: Confirmed the disposable snapshot location. As expected, the snapshot does not contain complete Git index/history data, so the files appeared as untracked and no tracked diff was available.
  • "command -v flutter || true; flutter --version 2>/dev/null || true; ls -d /tmp/flutter-* 2>/dev/null || true" — passed: Confirmed that the "/tmp/flutter-3.22.2" SDK is available for validation instead of Flutter from the system PATH.
  • "/tmp/flutter-3.22.2/bin/flutter test test/common/widgets/fields/select_field_test.dart" — passed: All 9 tests passed. The new "keeps multi-select state after rotation" test also passed, directly verifying selection persistence after rotation and the values passed on Save.
  • "/tmp/flutter-3.22.2/bin/flutter test --coverage" — passed: All 146 Flutter tests passed.
  • "/tmp/flutter-3.22.2/bin/flutter analyze lib/common/logic/show_select.dart" — passed: No analyzer issues were found in the modified implementation file.
  • "/tmp/flutter-3.22.2/bin/flutter analyze test/common/widgets/fields/select_field_test.dart" — passed: No analyzer issues were found in the added regression test file.
  • "/tmp/flutter-3.22.2/bin/dart format --output=none --set-exit-if-changed lib/common/logic/show_select.dart test/common/widgets/fields/select_field_test.dart" — passed: Both modified files were already compliant with Dart formatter output, so 0 files were changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selected Tags Lost After Rotation

1 participant