Skip to content

Commit

Permalink
feat: use material style for dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
VaiTon committed Apr 3, 2022
1 parent 6830058 commit 71048eb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
3 changes: 2 additions & 1 deletion packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@label_web": {},
"learnMore": "Learn more",
"@learnMore": {},
"general_confirmation": "Are you sure?",
"incompatible": "Incompatible",
"@incompatible": {
"description": "Short label for product list view: the product is incompatible with your preferences"
Expand Down Expand Up @@ -349,7 +350,7 @@
},
"nutrition": "Nutrition",
"@nutrition": {},
"nutrition_page_close_confirmation": "Are you sure you want to go back?",
"nutrition_page_close_confirmation": "Are you sure you want to close without saving?",
"nutrition_facts_photo": "Nutrition facts photo",
"@nutrition_facts_photo": {
"description": "Button label: For adding a picture of the nutrition facts of a product"
Expand Down
41 changes: 24 additions & 17 deletions packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:openfoodfacts/utils/UnitHelper.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/database/product_query.dart';
import 'package:smooth_app/generic_lib/buttons/smooth_action_button.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/widgets/smooth_card.dart';
import 'package:smooth_app/pages/product/common/product_refresher.dart';
Expand Down Expand Up @@ -325,16 +324,20 @@ class _NutritionPageLoadedState extends State<NutritionPageLoaded> {
await showDialog<bool>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text(localizations.nutrition_page_close_confirmation),
actions: <Widget>[
SmoothActionButton(
text: localizations.yes,
shape: const RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
),
title: Text(localizations.general_confirmation),
content: Text(localizations.nutrition_page_close_confirmation),
actions: <TextButton>[
TextButton(
child: Text(localizations.cancel.toUpperCase()),
onPressed: () => Navigator.pop(context, false),
),
TextButton(
child: Text(localizations.close.toUpperCase()),
onPressed: () => Navigator.pop(context, true),
),
SmoothActionButton(
text: localizations.cancel,
onPressed: () => Navigator.pop(context, false),
)
],
),
) ??
Expand All @@ -354,16 +357,20 @@ class _NutritionPageLoadedState extends State<NutritionPageLoaded> {
final bool shouldSave = await showDialog<bool>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text(localizations.save_confirmation),
actions: <Widget>[
SmoothActionButton(
text: localizations.save,
title: Text(localizations.general_confirmation),
content: Text(localizations.save_confirmation),
shape: const RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
),
actions: <TextButton>[
TextButton(
child: Text(localizations.cancel.toUpperCase()),
onPressed: () => Navigator.pop(context, false),
),
TextButton(
child: Text(localizations.save.toUpperCase()),
onPressed: () => Navigator.pop(context, true),
),
SmoothActionButton(
text: localizations.cancel,
onPressed: () => Navigator.pop(context, false),
)
],
)) ??
false;
Expand Down

0 comments on commit 71048eb

Please sign in to comment.