feat: Add "Common Name" field to Basic Details edit page#7354
feat: Add "Common Name" field to Basic Details edit page#7354kashafbatool wants to merge 3 commits into
Conversation
|
@kashafbatool can you have the same widget and behaviour as product name, since common name behaves in the same way (multilingual field) |
There was a problem hiding this comment.
Pull request overview
This PR adds a new "Common Name" field to the Basic Details edit page, allowing users to view and edit the product's genericName property which was previously not accessible on mobile.
Changes:
- Added a text input field for the product's common/generic name in the basic details page
- Added controller initialization and disposal for the generic name field
- Updated change detection and product saving logic to include generic name
- Auto-formatted code in app_localizations.dart
- Updated Flutter SDK version references
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_page.dart | Adds generic name controller, UI field, and handling logic for the common name feature |
| packages/smooth_app/lib/l10n/app_localizations.dart | Auto-generated formatting changes to improve code readability |
| packages/smooth_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | New iOS app icon configuration file |
| packages/smooth_app/ios/Podfile.lock | Updates SDWebImage dependency from 5.21.4 to 5.21.5 |
| .vscode/settings.json | Updates Flutter SDK path to version 3.38.6 |
| .fvmrc | Updates Flutter version manager configuration to 3.38.6 |
|
|
||
| Padding( | ||
| padding: EdgeInsets.symmetric(vertical: _heightSpace), | ||
| child: SmoothTextFormField( | ||
| controller: _genericNameController, | ||
| type: TextFieldTypes.PLAIN_TEXT, | ||
| hintText: 'Common Name', | ||
| prefixIcon: const Icon(Icons.info_outline), | ||
| ), | ||
| ), | ||
|
|
There was a problem hiding this comment.
The generic name field is displayed as a plain SmoothTextFormField, while other fields like ProductQuantityInputWidget use a SmoothCardWithRoundedHeader for consistency and better UX. Consider creating a similar widget (e.g., ProductGenericNameInputWidget) that follows the established pattern with a card header, proper styling, and potentially help text explaining what a "common name" is.
| Padding( | |
| padding: EdgeInsets.symmetric(vertical: _heightSpace), | |
| child: SmoothTextFormField( | |
| controller: _genericNameController, | |
| type: TextFieldTypes.PLAIN_TEXT, | |
| hintText: 'Common Name', | |
| prefixIcon: const Icon(Icons.info_outline), | |
| ), | |
| ), | |
| Padding( | |
| padding: EdgeInsets.symmetric(vertical: _heightSpace), | |
| child: Card( | |
| child: Padding( | |
| padding: const EdgeInsets.all(SMALL_SPACE), | |
| child: Column( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: <Widget>[ | |
| Text( | |
| 'Common name', | |
| style: Theme.of(context).textTheme.titleMedium, | |
| ), | |
| const SizedBox(height: SMALL_SPACE), | |
| SmoothTextFormField( | |
| controller: _genericNameController, | |
| type: TextFieldTypes.PLAIN_TEXT, | |
| hintText: 'Common name', | |
| prefixIcon: const Icon(Icons.info_outline), | |
| ), | |
| ], | |
| ), | |
| ), | |
| ), | |
| ), |
| if (_genericNameController.text != (_product.genericName ?? '')) { | ||
| result.genericName = _genericNameController.text; | ||
| hasChanged = true; | ||
| } |
There was a problem hiding this comment.
The weight field handling logic has been accidentally removed from this method. The original code checked if _weightController.isDifferentFromInitialValue and set result.quantity = _weightController.text;. This needs to be restored to prevent losing weight/quantity changes when saving products. The generic name logic should be added after the weight logic, not replace it.
| child: SmoothTextFormField( | ||
| controller: _genericNameController, | ||
| type: TextFieldTypes.PLAIN_TEXT, | ||
| hintText: 'Common Name', |
There was a problem hiding this comment.
The hint text is hardcoded to 'Common Name' instead of using localization. Following the pattern used in ProductQuantityInputWidget and other parts of this app, this should use AppLocalizations. For example, it should be something like appLocalizations.add_basic_details_generic_name_hint (after adding the appropriate localization key).
| hintText: 'Common Name', | |
| hintText: | |
| AppLocalizations.of(context).add_basic_details_generic_name_hint, |
| @@ -1,3 +1,3 @@ | |||
| { | |||
| "flutter": "3.35.6" | |||
| "flutter": "3.38.6" | |||
There was a problem hiding this comment.
The Flutter SDK version in .fvmrc is set to 3.38.6, but the flutter-version.txt file specifies 3.38.5. These should match to ensure consistent development environments. According to the development guidelines, flutter-version.txt is the source of truth for the required Flutter version.
| "flutter": "3.38.6" | |
| "flutter": "3.35.1" |
| "webview" | ||
| ], | ||
| "dart.flutterSdkPath": ".fvm/versions/3.27.4" | ||
| "dart.flutterSdkPath": ".fvm/versions/3.38.6" |
There was a problem hiding this comment.
The Flutter SDK path points to version 3.38.6, but flutter-version.txt specifies 3.38.5. This should be updated to match the version in flutter-version.txt to maintain consistency across the development environment.
| "dart.flutterSdkPath": ".fvm/versions/3.38.6" | |
| "dart.flutterSdkPath": ".fvm/versions/3.35.1" |
| hintText: 'Common Name', | ||
| prefixIcon: const Icon(Icons.info_outline), | ||
| ), | ||
| ), |
There was a problem hiding this comment.
There is trailing whitespace at the end of this line. This should be removed to maintain code cleanliness and pass linting checks.
| prefixIcon: const Icon(Icons.info_outline), | ||
| ), | ||
| ), | ||
|
|
There was a problem hiding this comment.
There is trailing whitespace at the end of this line. This should be removed to maintain code cleanliness and pass linting checks.
What
I added a new text field for the "Common Name" (
generic_name) in the Basic Details edit page.This allows users to view and edit the product's common name, which was previously missing on mobile.
Fixes
Fixes #7353
Screenshot