diff --git a/lib/screens/purchase_success.dart b/lib/screens/purchase_success.dart index 10c30db..29c6098 100644 --- a/lib/screens/purchase_success.dart +++ b/lib/screens/purchase_success.dart @@ -42,6 +42,7 @@ class PurchaseSuccessScreenState extends BaseState { int bonusMinus = 0; int currency; bool showBonus; + String flavor; @override String getTitle() { return StringsLocalization.carryingPurchase(); @@ -59,26 +60,27 @@ class PurchaseSuccessScreenState extends BaseState { }); }); } - if (showBonus == null) { - platform.invokeMethod('showBonus').then((showBonus) { + if (this.flavor == null) { + platform.invokeMethod('getFlavor').then((flavor) { setState(() { - this.showBonus = showBonus; - if (showBonus == true) { - if (this.details['sum_bonus'] is String) { - String regexString = r'(\d+) начислено, (\d+).*'; - RegExp regExp = new RegExp(regexString); - var matches = regExp.allMatches(this.details['sum_bonus']); - if(matches.length != 0) { - var match = matches.elementAt(0); // => extract the first (and only) match - this.bonusPlus = int.parse(match.group(1)); - this.bonusMinus = int.parse(match.group(2)); - } + this.flavor = flavor; +// if (showBonus == true) { +// +// } + if (this.details['sum_bonus'] is String) { + String regexString = r'(\d+) начислено, (\d+).*'; + RegExp regExp = new RegExp(regexString); + var matches = regExp.allMatches(this.details['sum_bonus']); + if(matches.length != 0) { + var match = matches.elementAt(0); // => extract the first (and only) match + this.bonusPlus = int.parse(match.group(1)); + this.bonusMinus = int.parse(match.group(2)); } + } - if (this.details['sum_bonus'] is int) { - this.bonusPlus = this.details['sum_bonus']; - //bonusMinus = this.details['sum_bonus']; - } + if (this.details['sum_bonus'] is int) { + this.bonusPlus = this.details['sum_bonus']; + //bonusMinus = this.details['sum_bonus']; } }); }); @@ -92,17 +94,19 @@ class PurchaseSuccessScreenState extends BaseState { List widgetList = []; widgetList.add(getValueWithDescription(StringsLocalization.buyer(), username)); widgetList.add(getSuccessMessage()); - if (showBonus == true) { - if (bonusPlus > 0) { - widgetList.add(getValueWithDescription(StringsLocalization.bonusPlus(), bonusPlus.toString())); - } - if (bonusMinus > 0) { - widgetList.add(getValueWithDescription(StringsLocalization.bonusMinus(), bonusMinus.toString())); - } + + if (bonusPlus > 0) { + widgetList.add(getValueWithDescription(StringsLocalization.bonusPlus(), bonusPlus.toString())); + } + if (bonusMinus > 0) { + widgetList.add(getValueWithDescription(StringsLocalization.bonusMinus(), bonusMinus.toString())); + } + + if (this.flavor != 'autobonus') { + widgetList.add(getValueWithDescription(StringsLocalization.discountRate(), '${details['discount']}%')); + widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}')); } - widgetList.add(getValueWithDescription(StringsLocalization.discountRate(), '${details['discount']}%')); - widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}')); // widgetList.add( new Expanded(child: new Center())); this.coupons.forEach((couponItem) { widgetList.add(getCoupons(couponItem));