fix: restrict Add/Edit expense "Amount" input to numeric values only #41

Closed
opened 2026-06-28 14:47:37 +00:00 by admin · 0 comments
Owner

Bug

In the Add Expense and Edit Expense screens, the "Amount" field accepts any character because it uses a plain OutlinedTextField without keyboard type restrictions. Users can type letters and symbols, which the parser then has to reject (or silently store) and the on-screen keyboard shows the QWERTY layout instead of the numeric keypad.

Repro

  1. Tap the FAB → Add Expense.
  2. Tap into the "Amount" field.
  3. Notice the soft keyboard is the full QWERTY layout and any character is accepted.

Expected

  • The field only accepts numeric input (digits and a single decimal separator).
  • The soft keyboard shows the numeric keypad (KeyboardType.Decimal or Number).
  • Existing validation (positive amount, max 2 decimals, etc.) still applies; this is just the input restriction.

Implementation hint

Use OutlinedTextField (or the project's wrapper) with:

keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
visualTransformation = ... // keep current formatting if any

Apply the same fix to the Add/Edit Recurring expense screen for consistency.

Scope

Two screens: AddEditExpenseScreen and AddEditRecurringScreen.

## Bug In the Add Expense and Edit Expense screens, the "Amount" field accepts any character because it uses a plain `OutlinedTextField` without keyboard type restrictions. Users can type letters and symbols, which the parser then has to reject (or silently store) and the on-screen keyboard shows the QWERTY layout instead of the numeric keypad. ## Repro 1. Tap the FAB → Add Expense. 2. Tap into the "Amount" field. 3. Notice the soft keyboard is the full QWERTY layout and any character is accepted. ## Expected - The field only accepts numeric input (digits and a single decimal separator). - The soft keyboard shows the numeric keypad (`KeyboardType.Decimal` or `Number`). - Existing validation (positive amount, max 2 decimals, etc.) still applies; this is just the input restriction. ## Implementation hint Use `OutlinedTextField` (or the project's wrapper) with: ```kotlin keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal), visualTransformation = ... // keep current formatting if any ``` Apply the same fix to the Add/Edit **Recurring** expense screen for consistency. ## Scope Two screens: `AddEditExpenseScreen` and `AddEditRecurringScreen`.
admin closed this issue 2026-06-28 14:59:29 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/ledgerr#41