💄 Optimized drafts

This commit is contained in:
2025-06-25 00:01:52 +08:00
parent 568d70fffb
commit b89cffeb18
11 changed files with 148 additions and 169 deletions

View File

@ -62,21 +62,7 @@ class PostComposeScreen extends HookConsumerWidget {
@QueryParam('type') this.type,
});
// Helper method to parse visibility
int _parseVisibility(String visibility) {
switch (visibility) {
case 'public':
return 0;
case 'unlisted':
return 1;
case 'friends':
return 2;
case 'private':
return 3;
default:
return 0;
}
}
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -140,9 +126,7 @@ class PostComposeScreen extends HookConsumerWidget {
state.titleController.text = mostRecentDraft.title;
state.descriptionController.text = mostRecentDraft.description;
state.contentController.text = mostRecentDraft.content;
state.visibility.value = _parseVisibility(
mostRecentDraft.visibility,
);
state.visibility.value = mostRecentDraft.visibility;
}
}
}
@ -272,9 +256,7 @@ class PostComposeScreen extends HookConsumerWidget {
state.descriptionController.text =
draft.description;
state.contentController.text = draft.content;
state.visibility.value = _parseVisibility(
draft.visibility,
);
state.visibility.value = draft.visibility;
}
},
),