Skip to content

Commit

Permalink
feat: added dialog if users click on unselect image button openfoodfa…
Browse files Browse the repository at this point in the history
…cts#2427

Signed-off-by: BhuvanAde <bhuvanadey@gmail.com>
  • Loading branch information
BhuvanAde committed Feb 13, 2023
1 parent f2ede98 commit 902deba
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Expand Up @@ -837,6 +837,12 @@
"ask_me_later_button_label": "Later",
"@ask_me_later": {
"description": "Button to ignore the camera permission request"

},
"are_you_sure": "Are you sure?",
"@are_you_sure": {
"description": "Are you sure?"

},
"knowledge_panel_text_source": "Go further on {sourceName}",
"@knowledge_panel_text_source": {
Expand Down Expand Up @@ -969,6 +975,7 @@
"@camera_mode_title": {
"description": "Title for the mode for the camera/scanner"
},

"camera_mode_subtitle": "Only change this value, if you have some issues with the scanner (unable to decode barcodes). Tap to switch between the two modes.\nThe current one is: {mode}",
"@camera_mode_subtitle": {
"description": "SubTitle for the mode for the camera/scanner",
Expand Down
36 changes: 35 additions & 1 deletion packages/smooth_app/lib/pages/product/product_image_viewer.dart
Expand Up @@ -126,7 +126,41 @@ class _ProductImageViewerState extends State<ProductImageViewer> {
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: SMALL_SPACE),
child: _getUnselectImageButton(appLocalizations),
child: (imageProvider == null)
? Container()
: EditImageButton(
iconData: Icons.do_disturb_on,
label: appLocalizations
.edit_photo_unselect_button_label,
onPressed: () async {
final bool? confirmed = await showDialog<bool>(
context: context,
builder: (BuildContext context) {
return SmoothAlertDialog(
title:
appLocalizations.confirm_button_label,
body: Text(
appLocalizations.are_you_sure,
),
close: true,
positiveAction: SmoothActionButton(
text: appLocalizations.yes,
onPressed: () =>
Navigator.of(context).pop(true)),
negativeAction: SmoothActionButton(
text: appLocalizations.no,
onPressed: () => Navigator.of(context)
.pop(false)));
},
);
if (confirmed == true) {
await BackgroundTaskUnselect.addTask(
_barcode,
imageField: widget.imageField,
widget: this,
);
}
}),
),
),
Expanded(
Expand Down

0 comments on commit 902deba

Please sign in to comment.