diff --git a/assets/langs/en.yaml b/assets/langs/en.yaml index 37a18634..57517de6 100644 --- a/assets/langs/en.yaml +++ b/assets/langs/en.yaml @@ -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: diff --git a/lib/widgets/purchase_slider.dart b/lib/widgets/purchase_slider.dart index 81c6179f..6abd7d1c 100644 --- a/lib/widgets/purchase_slider.dart +++ b/lib/widgets/purchase_slider.dart @@ -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 diff --git a/lib/widgets/purchase_widget.dart b/lib/widgets/purchase_widget.dart index 0cbd0aea..6d3d05c4 100644 --- a/lib/widgets/purchase_widget.dart +++ b/lib/widgets/purchase_widget.dart @@ -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,