mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +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"
|
other: "{} Notes link to this Note"
|
||||||
SortingOrderSelector:
|
SortingOrderSelector:
|
||||||
title: Sorting Criteria
|
title: Sorting Criteria
|
||||||
|
PurchaseButton:
|
||||||
|
text: Purchase for {price}
|
||||||
|
fail: Failed to Load
|
||||||
|
|
||||||
rootFolder: Root Folder
|
rootFolder: Root Folder
|
||||||
ignoredFiles:
|
ignoredFiles:
|
||||||
|
@ -59,6 +59,10 @@ class ShapePainter extends CustomPainter {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
|
if (values.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var paint = Paint()
|
var paint = Paint()
|
||||||
..color = color
|
..color = color
|
||||||
..strokeWidth = 2
|
..strokeWidth = 2
|
||||||
|
@ -22,12 +22,20 @@ class PurchaseButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return RaisedButton(
|
||||||
child: subscription
|
child: Text(text),
|
||||||
? Text('Purchase for $price / $timePeriod')
|
|
||||||
: Text('Purchase for $price'),
|
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
padding: const EdgeInsets.fromLTRB(32.0, 16.0, 32.0, 16.0),
|
padding: const EdgeInsets.fromLTRB(32.0, 16.0, 32.0, 16.0),
|
||||||
onPressed: product != null ? () => _initPurchase(context) : null,
|
onPressed: product != null ? () => _initPurchase(context) : null,
|
||||||
|
Reference in New Issue
Block a user