-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 5207 - new "My proofs" and "Proof" pages
New files: * `price_proof_page.dart`: Full page display of a proof. * `prices_proofs_page.dart`: Page that displays the latest proofs of the current user. Impacted files: * `app_en.arb`: added 3 labels for "my proofs" * `app_fr.arb`: added 3 labels for "my proofs" * `price_data_widget.dart`: instead of a web app link, we open the new "my proof" page * `user_preferences_account.dart`: added a link to open the new "my proofs" page
- Loading branch information
1 parent
7809854
commit b02f3ac
Showing
6 changed files
with
347 additions
and
8 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
45 changes: 45 additions & 0 deletions
45
packages/smooth_app/lib/pages/prices/price_proof_page.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,45 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:openfoodfacts/openfoodfacts.dart'; | ||
import 'package:smooth_app/helpers/launch_url_helper.dart'; | ||
import 'package:smooth_app/query/product_query.dart'; | ||
import 'package:smooth_app/widgets/smooth_app_bar.dart'; | ||
import 'package:smooth_app/widgets/smooth_scaffold.dart'; | ||
|
||
/// Full page display of a proof. | ||
class PriceProofPage extends StatelessWidget { | ||
const PriceProofPage( | ||
this.proof, | ||
); | ||
|
||
final Proof proof; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final AppLocalizations appLocalizations = AppLocalizations.of(context); | ||
final DateFormat dateFormat = | ||
DateFormat.yMd(ProductQuery.getLocaleString()).add_Hms(); | ||
return SmoothScaffold( | ||
appBar: SmoothAppBar( | ||
title: Text(appLocalizations.prices_proof_subtitle), | ||
subTitle: Text(dateFormat.format(proof.created)), | ||
actions: <Widget>[ | ||
IconButton( | ||
tooltip: appLocalizations.prices_app_button, | ||
icon: const Icon(Icons.open_in_new), | ||
onPressed: () async => LaunchUrlHelper.launchURL(_getUrl()), | ||
), | ||
], | ||
), | ||
body: Image( | ||
image: NetworkImage(_getUrl()), | ||
fit: BoxFit.cover, | ||
), | ||
); | ||
} | ||
|
||
String _getUrl() => proof | ||
.getFileUrl(uriProductHelper: ProductQuery.uriProductHelper) | ||
.toString(); | ||
} |
Oops, something went wrong.