fix(mobile): retain edited title when album updates (#15806)

* fix(album-viewer): retain edited title when album updates

ensure `AlbumViewerEditableTitle` keeps user input while editing,
even when the album updates from another provider. fall back to
`albumName` only when not in edit mode.

* linting

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
pull/15395/head
Mangat Singh Toor | ਮੰਗਤ ਸਿੰਘ ਤੂਰ 2025-01-31 07:24:53 +07:00 committed by GitHub
parent 1b141d5ca9
commit 221e197633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

@ -16,7 +16,14 @@ class AlbumViewerEditableTitle extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final titleTextEditController = useTextEditingController(text: albumName);
final albumViewerState = ref.watch(albumViewerProvider);
final titleTextEditController = useTextEditingController(
text: albumViewerState.isEditAlbum &&
albumViewerState.editTitleText.isNotEmpty
? albumViewerState.editTitleText
: albumName,
);
void onFocusModeChange() {
if (!titleFocusNode.hasFocus && titleTextEditController.text.isEmpty) {