refactor: category picker dialog matching ListSearchPreferenceWidget UX, without Preference overhead #43
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refactor
The category selector on the Add/Edit Expense and Add/Edit Recurring screens is currently a
DropdownMenu/ExposedDropdownMenuattached to anOutlinedTextField. It works, but it is limited to a flat scrollable list with no search and no category metadata (color swatch, etc.) visible at a glance.There is already a
ListSearchPreferenceWidgetin the settings screen that shows a much nicer pattern: tap-to-open dialog, search field, list with a leading swatch/icon, checkmark on the selected row. We want that UX in the form, but without thePreferenceoverhead — categories are not a setting, they are a piece of form data bound to the screen'sStateFlow.Goal
Extract a generic
ListSearchDialog(orListPickerDialog) composable that:query: String, anonQueryChange: (String) -> Unit, and a list of items.Dialogwith aSearchBar/OutlinedTextFieldon top and aLazyColumnof clickable rows.onSelected(item)and dismisses on pick.Then replace the current category dropdown with a field that opens this dialog, populating it from the
CategoryRepository/ category list the screen already has in its state.Why
Preferencemachinery so it can be used in any form.Scope
app/src/main/java/dev/achmad/ledgerr/ui/component/ListSearchDialog.kt(or similar).AddEditExpenseScreenandAddEditRecurringScreento use the new picker for the category field.ListSearchPreferenceWidgetitself — leave the preference wiring intact; the new composable is a leaner version.Reference
ListSearchPreferenceWidgetin the settings module — copy the visual structure, drop thePreference.PreferenceItem.Switch/ value-storage plumbing.