mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
PurchaseWidget: Handle when it fails to load options
Fixes APP-AY
This commit is contained in:
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user