Skip to content

Commit

Permalink
fix: Image extraction screen (#3026)
Browse files Browse the repository at this point in the history
* fix white screen issue

* changes required after review
  • Loading branch information
Puja-Kumari-909 committed Sep 17, 2022
1 parent c459397 commit f893237
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Expand Up @@ -1653,5 +1653,13 @@
"offline_data": "Offline Data",
"@offline_data": {
"description": "App bar tile for offline data page"
},
"ocr_image_upload_instruction" : "Upload an image to automatically extract the provided information",
"@ocr_image_upload_instruction" : {
"description" : "Message shown when there is no image on ocr extraction page"
},
"upload_image" : "Upload Photo",
"@upload_image" : {
"description" : "Message shown on asking to upload image"
}
}
29 changes: 26 additions & 3 deletions packages/smooth_app/lib/pages/product/edit_ingredients_page.dart
Expand Up @@ -158,7 +158,7 @@ class _EditOcrPageState extends State<EditOcrPage> {
@override
Widget build(BuildContext context) {
final AppLocalizations appLocalizations = AppLocalizations.of(context);

final Size size = MediaQuery.of(context).size;
final List<Widget> children = <Widget>[];

if (_imageProvider != null) {
Expand All @@ -178,7 +178,27 @@ class _EditOcrPageState extends State<EditOcrPage> {
),
);
} else {
children.add(Container(color: Colors.white));
children.add(
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: size.height * 0.25),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.image_not_supported,
size: size.height / 4,
),
Text(
appLocalizations.ocr_image_upload_instruction,
style: Theme.of(context).textTheme.bodyText2,
textAlign: TextAlign.center,
)
],
),
),
);
}
}

Expand Down Expand Up @@ -292,7 +312,10 @@ class _OcrWidget extends StatelessWidget {
),
child: SmoothActionButtonsBar(
positiveAction: SmoothActionButton(
text: helper.getActionRefreshPhoto(appLocalizations),
text: (hasImageProvider ||
helper.getImageUrl(product) != null)
? helper.getActionRefreshPhoto(appLocalizations)
: appLocalizations.upload_image,
onPressed: () => onTapGetImage(true),
),
),
Expand Down

0 comments on commit f893237

Please sign in to comment.