Add custom numeric keyboard and amount selector#344
Add custom numeric keyboard and amount selector#344NiazSagor wants to merge 4 commits intoemavgl:masterfrom
Conversation
This commit introduces a custom `AmountSelector` keyboard to replace the standard `TextFormField` for record amounts. This change provides a more specialized input experience, including an integrated calculator mode, automatic decimal shifting, and localized number formatting. Key changes: - Created `SmartAmountFormatter` and several specialized `TextInputFormatter` classes (`AutoDecimalShiftFormatter`, `LeadingZeroIntegerTrimmerFormatter`, `CalculatorNormalizer`, `GroupSeparatorFormatter`) to handle complex numeric and mathematical input. - Implemented `AmountSelector`, a modal bottom sheet keyboard with support for basic arithmetic operations, sign toggling, and haptic feedback. - Added utility widgets and extensions for the new keyboard, including `AnimatedExpanded`, `evaluateExpression` logic, and custom styling formatters. - Updated `edit-record-page.dart` to trigger the `AmountSelector` via an `InkWell` card, replacing the direct text input field with a formatted display area. Took 2 hours 16 minutes
|
Hi @emavgl I have started with taking the same style as in https://github.com/enrique-lozano/Monekin where a custom keyboard opens via a Modal Bottom Sheet. |
This commit moves the `AmountSelector` and its associated logic, widgets, and utilities from `lib/records/keyboard/` to a more structured directory in `lib/records/amount_selector/`. Key changes include: - Reorganized files into `logic/`, `widgets/`, `formatting/`, and `utils/` subdirectories. - Updated `AmountSelector` to use `LeadingZeroIntegerTrimmerFormatter` and improved the integration of `AutoDecimalShiftFormatter`. - Enhanced `OinKoinNumberFormatter` to conditionally apply grouping separators based on the `autoDec` preference. - Cleaned up unused extensions and imports, specifically removing the unused `CurrencyDisplayer` and redundant file size formatting logic. - Updated references in `EditRecordPage` to point to the new locations. Took 1 hour 4 minutes
|
Hi @NiazSagor, thanks for the PR. I will have a look in the next few days! |
|
So, I tried this out, it looks very nice :) I have some thoughts however:
When the calculator is open, and you start the expression, it does not calculate automatically as before. I am not sure what I like here to be honest, but if we decide that the expr should be manually evaluated, we can use the current "change sign" button with a "=" to evalute the expr. What's your take for this? Do you prefer a manual button to evaluate or evaluate automatically? At when typing an expression, you have the same expression twice in two row. If we go for the automatic way, we can use one row to show the evaluated amount and one row the expression instead. Since the calculator buttons will be always visible. I would use the last row to visualize in order: digit spacing character, 0, deciamal separator.
|
This commit introduces a custom
AmountSelectorkeyboard to replace the standardTextFormFieldfor record amounts. This change provides a more specialized input experience, including an integrated calculator mode, automatic decimal shifting, and localized number formatting.Key changes:
SmartAmountFormatterand several specializedTextInputFormatterclasses (AutoDecimalShiftFormatter,LeadingZeroIntegerTrimmerFormatter,CalculatorNormalizer,GroupSeparatorFormatter) to handle complex numeric and mathematical input.AmountSelector, a modal bottom sheet keyboard with support for basic arithmetic operations, sign toggling, and haptic feedback.AnimatedExpanded,evaluateExpressionlogic, and custom styling formatters.edit-record-page.dartto trigger theAmountSelectorvia anInkWellcard, replacing the direct text input field with a formatted display area.Closes #326