PurchaseWidget: Handle when it fails to load options

Fixes APP-AY
This commit is contained in:
Vishesh Handa
2020-09-03 11:55:43 +02:00
parent e33857f8e9
commit 9db05bb7d8
3 changed files with 19 additions and 4 deletions

View File

@ -174,6 +174,9 @@ widgets:
other: "{} Notes link to this Note"
SortingOrderSelector:
title: Sorting Criteria
PurchaseButton:
text: Purchase for {price}
fail: Failed to Load
rootFolder: Root Folder
ignoredFiles:

View File

@ -59,6 +59,10 @@ class ShapePainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
if (values.isEmpty) {
return;
}
var paint = Paint()
..color = color
..strokeWidth = 2

View File

@ -22,12 +22,20 @@ class PurchaseButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
var price = product != null ? product.price : "Dev Mode";
String text;
if (product != null) {
text = tr("widgets.PurchaseButton.text", namedArgs: {
'price': product.price,
});
if (subscription) {
text += '/ $timePeriod';
}
} else {
text = tr("widgets.PurchaseButton.fail");
}
return RaisedButton(
child: subscription
? Text('Purchase for $price / $timePeriod')
: Text('Purchase for $price'),
child: Text(text),
color: Theme.of(context).primaryColor,
padding: const EdgeInsets.fromLTRB(32.0, 16.0, 32.0, 16.0),
onPressed: product != null ? () => _initPurchase(context) : null,