Skip to content

feat: Add "Common Name" field to Basic Details edit page#7354

Open
kashafbatool wants to merge 3 commits into
openfoodfacts:developfrom
kashafbatool:develop
Open

feat: Add "Common Name" field to Basic Details edit page#7354
kashafbatool wants to merge 3 commits into
openfoodfacts:developfrom
kashafbatool:develop

Conversation

@kashafbatool
Copy link
Copy Markdown

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

992cc9a6-f1a0-4d2b-b811-0ff7266353c7

@teolemon
Copy link
Copy Markdown
Member

@kashafbatool can you have the same widget and behaviour as product name, since common name behaves in the same way (multilingual field)
Also, can you add a toggle in settings to enable it (next to "Show nutrition table"), since it's not a often used field anymore.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +162 to +172

Padding(
padding: EdgeInsets.symmetric(vertical: _heightSpace),
child: SmoothTextFormField(
controller: _genericNameController,
type: TextFieldTypes.PLAIN_TEXT,
hintText: 'Common Name',
prefixIcon: const Icon(Icons.info_outline),
),
),

Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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),
),
],
),
),
),
),

Copilot uses AI. Check for mistakes.
Comment on lines +271 to 274
if (_genericNameController.text != (_product.genericName ?? '')) {
result.genericName = _genericNameController.text;
hasChanged = true;
}
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
child: SmoothTextFormField(
controller: _genericNameController,
type: TextFieldTypes.PLAIN_TEXT,
hintText: 'Common Name',
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
hintText: 'Common Name',
hintText:
AppLocalizations.of(context).add_basic_details_generic_name_hint,

Copilot uses AI. Check for mistakes.
Comment thread .fvmrc
@@ -1,3 +1,3 @@
{
"flutter": "3.35.6"
"flutter": "3.38.6"
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"flutter": "3.38.6"
"flutter": "3.35.1"

Copilot uses AI. Check for mistakes.
Comment thread .vscode/settings.json
"webview"
],
"dart.flutterSdkPath": ".fvm/versions/3.27.4"
"dart.flutterSdkPath": ".fvm/versions/3.38.6"
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"dart.flutterSdkPath": ".fvm/versions/3.38.6"
"dart.flutterSdkPath": ".fvm/versions/3.35.1"

Copilot uses AI. Check for mistakes.
hintText: 'Common Name',
prefixIcon: const Icon(Icons.info_outline),
),
),
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. This should be removed to maintain code cleanliness and pass linting checks.

Copilot uses AI. Check for mistakes.
prefixIcon: const Icon(Icons.info_outline),
),
),

Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. This should be removed to maintain code cleanliness and pass linting checks.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@g123k g123k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An explained by @teolemon, the UI should be similar to the other components in the page

@github-project-automation github-project-automation Bot moved this from 💬 To discuss and validate to 🏗️ In Progress in 🤳🥫 The Open Food Facts mobile app (Android & iOS) Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Add common name to common information edit product page

4 participants