Skip to content

Commit

Permalink
feat: 3297 - added extra buttons for emb and labels
Browse files Browse the repository at this point in the history
Impacted files:
* `app_en.arb`: added labels for "add pics" buttons (emb and labels)
* `app_fr.arb`: added labels for "add pics" buttons (emb and labels)
* `simple_input_page_helpers.dart`: added extra buttons for emb and labels
* `smooth_large_button_with_icon.dart`: minor UI fix
  • Loading branch information
monsieurtanuki committed Nov 29, 2023
1 parent de8d612 commit 27116bd
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SmoothLargeButtonWithIcon extends StatelessWidget {
flex: 10,
child: AutoSizeText(
text,
maxLines: 2,
maxLines: 3,
minFontSize: 10,
textAlign: textAlign,
style: style,
Expand Down
8 changes: 8 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,14 @@
"@add_origin_photo_button_label": {
"description": "Label for the add ORIGIN photo button"
},
"add_emb_photo_button_label": "Take photos of any traceability code information",
"@add_emb_photo_button_label": {
"description": "Label for the add EMB photo button"
},
"add_label_photo_button_label": "Take photos of any labels & certifications information",
"@add_label_photo_button_label": {
"description": "Label for the add LABELS photo button"
},
"choose_image_source_title": "Choose image source",
"@choose_image_source_title": {
"description": "Title for the image source chooser"
Expand Down
8 changes: 8 additions & 0 deletions packages/smooth_app/lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,14 @@
"@add_origin_photo_button_label": {
"description": "Label for the add ORIGIN photo button"
},
"add_emb_photo_button_label": "Prenez des photos de toute information sur les codes de traçabilité",
"@add_emb_photo_button_label": {
"description": "Label for the add EMB photo button"
},
"add_label_photo_button_label": "Prenez des photos de toute information sur les labels & certifications",
"@add_label_photo_button_label": {
"description": "Label for the add LABELS photo button"
},
"choose_image_source_title": "Choisissez la source de l'image",
"@choose_image_source_title": {
"description": "Title for the image source chooser"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,32 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier {
) =>
null;

/// Typical extra widget for the "add other pics" button.
@protected
Widget getExtraPhotoWidget(
final BuildContext context,
final Product product,
final String title,
) =>
Padding(
padding: const EdgeInsets.symmetric(
vertical: VERY_LARGE_SPACE,
horizontal: SMALL_SPACE,
),
child: addPanelButton(
title.toUpperCase(),
onPressed: () async => confirmAndUploadNewPicture(
context,
imageField: ImageField.OTHER,
barcode: product.barcode!,
language: ProductQuery.getLanguage(),
// we're already logged in if needed
isLoggedInMandatory: false,
),
iconData: Icons.add_a_photo,
),
);

/// Returns true if changes were made.
bool getChangedProduct(final Product product) {
if (!_changed) {
Expand Down Expand Up @@ -244,25 +270,10 @@ class SimpleInputPageOriginHelper extends AbstractSimpleInputPageHelper {
final BuildContext context,
final Product product,
) =>
Padding(
padding: const EdgeInsets.symmetric(
vertical: VERY_LARGE_SPACE,
horizontal: SMALL_SPACE,
),
child: addPanelButton(
AppLocalizations.of(context)
.add_origin_photo_button_label
.toUpperCase(),
onPressed: () async => confirmAndUploadNewPicture(
context,
imageField: ImageField.OTHER,
barcode: product.barcode!,
language: ProductQuery.getLanguage(),
// we're already logged in if needed
isLoggedInMandatory: false,
),
iconData: Icons.add_a_photo,
),
getExtraPhotoWidget(
context,
product,
AppLocalizations.of(context).add_origin_photo_button_label,
);
}

Expand Down Expand Up @@ -308,6 +319,17 @@ class SimpleInputPageEmbCodeHelper extends AbstractSimpleInputPageHelper {
@override
AnalyticsEditEvents getAnalyticsEditEvent() =>
AnalyticsEditEvents.traceabilityCodes;

@override
Widget? getExtraWidget(
final BuildContext context,
final Product product,
) =>
getExtraPhotoWidget(
context,
product,
AppLocalizations.of(context).add_emb_photo_button_label,
);
}

/// Implementation for "Labels" of an [AbstractSimpleInputPageHelper].
Expand Down Expand Up @@ -357,6 +379,17 @@ class SimpleInputPageLabelHelper extends AbstractSimpleInputPageHelper {
@override
AnalyticsEditEvents getAnalyticsEditEvent() =>
AnalyticsEditEvents.labelsAndCertifications;

@override
Widget? getExtraWidget(
final BuildContext context,
final Product product,
) =>
getExtraPhotoWidget(
context,
product,
AppLocalizations.of(context).add_label_photo_button_label,
);
}

/// Implementation for "Categories" of an [AbstractSimpleInputPageHelper].
Expand Down

0 comments on commit 27116bd

Please sign in to comment.