Hide discount widgets for crypto flavor

This commit is contained in:
Ivan Murashov
2018-03-09 20:08:28 +03:00
parent 86e3f4ba4c
commit bd1e0ec17f
12 changed files with 95 additions and 73 deletions

View File

@@ -40,7 +40,6 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
int bonusMinus = 0;
int currency;
bool showBonus;
String flavor;
@override String getTitle() {
return StringsLocalization.carryingPurchase();
@@ -51,6 +50,7 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
}
@override Widget build(BuildContext context) {
if (currency == null) {
helper.getCurrency().then((currency) {
setState(() {
@@ -58,27 +58,20 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
});
});
}
if (this.flavor == null) {
platform.invokeMethod('getFlavor').then((flavor) {
setState(() {
this.flavor = flavor;
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 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'];
}
});
});
if (this.details['sum_bonus'] is int) {
this.bonusPlus = this.details['sum_bonus'];
}
return getMainWidget();
@@ -97,13 +90,13 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
widgetList.add(getValueWithDescription(StringsLocalization.bonusMinus(), bonusMinus.toString()));
}
if (this.flavor != 'autobonus') {
if (app != 'autobonus') {
widgetList.add(getValueWithDescription(StringsLocalization.discountRate(), '${details['discount']}%'));
widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}'));
if (app != 'crypto') {
widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}'));
}
}
// widgetList.add( new Expanded(child: new Center()));
if (this.coupons.length > 0) {
if (app != 'crypto' && this.coupons.length > 0) {
widgetList.add(getItemTitle(StringsLocalization.couponsUsed()));
this.coupons.forEach((couponItem) {
widgetList.add(getItemToggle(
@@ -140,8 +133,6 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
};
}
getSuccessMessage() {
return new Row(
children: <Widget>[