-
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/3980
- Loading branch information
Showing
10 changed files
with
230 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/smooth_app/lib/pages/product/add_packaging_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:openfoodfacts/openfoodfacts.dart'; | ||
import 'package:smooth_app/helpers/product_cards_helper.dart'; | ||
import 'package:smooth_app/pages/product/common/product_refresher.dart'; | ||
import 'package:smooth_app/pages/product/edit_new_packagings.dart'; | ||
import 'package:smooth_app/pages/product/ocr_packaging_helper.dart'; | ||
|
||
/// "Add (new) packaging" button for user contribution. | ||
class AddPackagingButton extends StatelessWidget { | ||
const AddPackagingButton({ | ||
required this.product, | ||
}); | ||
|
||
final Product product; | ||
|
||
@override | ||
Widget build(BuildContext context) => addPanelButton( | ||
OcrPackagingHelper().getAddButtonLabel(AppLocalizations.of(context)), | ||
onPressed: () async { | ||
// ignore: use_build_context_synchronously | ||
if (!await ProductRefresher().checkIfLoggedIn(context)) { | ||
return; | ||
} | ||
// ignore: use_build_context_synchronously | ||
await Navigator.push<void>( | ||
context, | ||
MaterialPageRoute<void>( | ||
builder: (BuildContext context) => EditNewPackagings( | ||
product: product, | ||
), | ||
fullscreenDialog: true, | ||
), | ||
); | ||
}, | ||
); | ||
} |
Oops, something went wrong.