move apiURL, appToken to libs/consts.dart, refs #9990

This commit is contained in:
anonymouzz
2017-08-03 17:08:56 +07:00
parent 10c3c18df1
commit 3d5262f786
8 changed files with 62 additions and 46 deletions

View File

@@ -95,7 +95,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
}
@override getTextWidget() {
return new TextField(keyboardType: TextInputType.text, decoration: new InputDecoration.collapsed(hintText: getHint(),
return new TextField(keyboardType: TextInputType.number, decoration: new InputDecoration.collapsed(hintText: getHint(),
hintStyle: new TextStyle(color: greyTextColor, fontSize: 16.0)),
controller: controller,
onChanged: (text) => handleUserInput(text));
@@ -111,9 +111,9 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
};
httpClient.get(url, headers: headers).then((response) {
print(response.body);
Map bonuses = JSON.decode(response.body);
String type = bonuses['type'];
setState(() {
@@ -122,7 +122,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
} else {
List amountToBonus = bonuses['amount_to_bonus'];
double loyalityVal = (double.parse(amountToBonus[1]) / amountToBonus[0]) * 100;
this.loyality = '${loyalityVal.toStringAsFixed(0)}%';
this.loyality = '${loyalityVal.toStringAsFixed(0)}%';
}
});
}).catchError((error) {
@@ -180,7 +180,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
'doc_id': result,
'curr_iso_code': '643',
'commit': 'true',
'sum_total': sum_total
'sum_total': sum_total
};
var headers = {
@@ -189,7 +189,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
};
httpClient.post(url, body: body, headers: headers).then((response) {
print(response.body);
Navigator.of(context).pop();
pushRoute(context, new PurchaseSuccessScreen(sum_total, user['first_name'] == null ? '' : user['first_name']));
@@ -200,4 +200,4 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
});
}
}
}
}