Skip to content

Commit

Permalink
fix: Overflow in add new product front photo button (#1497)
Browse files Browse the repository at this point in the history
* Overflow of the button when taking a front photo in French removed

* formatted

* added confirm_button_lable and appbar

* description removed

* added appbar titles

* formatted
  • Loading branch information
Gagarod authored Apr 13, 2022
1 parent 932f0bc commit 2b86e95
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:smooth_app/generic_lib/buttons/smooth_simple_button.dart';

Expand All @@ -18,10 +19,11 @@ class SmoothActionButton extends StatelessWidget {
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
return SmoothSimpleButton(
child: Text(
child: AutoSizeText(
text,
style: themeData.textTheme.bodyText2!
.copyWith(color: themeData.colorScheme.onPrimary),
maxLines: 1,
),
onPressed: onPressed,
height: height,
Expand Down
6 changes: 6 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@
"@confirm_front_packaging_photo_button_label": {
"description": "Button clicking on which confirms the picture of the front of product that user just took."
},
"confirm_button_label": "Confirm",
"front_packaging_photo_title": "Front Packaging Photo",
"ingredients_photo_title": "Ingredients Photo",
"nutritional_facts_photo_title": "Nutritional Facts Photo",
"recycling_photo_title": "Recycling Photo",
"other_interesting_photo_title": "Other Interesting Photo",
"front_photo_uploaded": "Front photo uploaded",
"@front_photo_uploaded": {},
"ingredients_photo_button_label": "Ingredients photo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class _ConfirmAndUploadPictureState extends State<ConfirmAndUploadPicture> {
// picture as sometimes the picture can be blurry.
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(),
appBar: AppBar(
title: Text(_getAppBarTitle(context, widget.imageType)),
),
body: Stack(
children: <Widget>[
Positioned(
Expand Down Expand Up @@ -102,11 +104,27 @@ class _ConfirmAndUploadPictureState extends State<ConfirmAndUploadPicture> {
);
}

String _getAppBarTitle(BuildContext context, ImageField imageType) {
final AppLocalizations appLocalizations = AppLocalizations.of(context)!;
switch (imageType) {
case ImageField.FRONT:
return appLocalizations.front_packaging_photo_title;
case ImageField.INGREDIENTS:
return appLocalizations.ingredients_photo_title;
case ImageField.NUTRITION:
return appLocalizations.nutritional_facts_photo_title;
case ImageField.PACKAGING:
return appLocalizations.recycling_photo_title;
case ImageField.OTHER:
return appLocalizations.other_interesting_photo_title;
}
}

String _getConfirmButtonText(BuildContext context, ImageField imageType) {
final AppLocalizations appLocalizations = AppLocalizations.of(context)!;
switch (imageType) {
case ImageField.FRONT:
return appLocalizations.confirm_front_packaging_photo_button_label;
return appLocalizations.confirm_button_label;
case ImageField.INGREDIENTS:
return appLocalizations.confirm_ingredients_photo_button_label;
case ImageField.NUTRITION:
Expand Down
12 changes: 6 additions & 6 deletions packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
version: "0.6.4"
json_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -555,7 +555,7 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.4"
matomo_forever:
dependency: "direct main"
description:
Expand Down Expand Up @@ -660,7 +660,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
path_drawing:
dependency: transitive
description:
Expand Down Expand Up @@ -938,7 +938,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -987,7 +987,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8"
version: "0.4.9"
transparent_image:
dependency: transitive
description:
Expand Down Expand Up @@ -1092,7 +1092,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
visibility_detector:
dependency: "direct main"
description:
Expand Down

0 comments on commit 2b86e95

Please sign in to comment.