All done. Need fix logout.
This commit is contained in:
@@ -46,11 +46,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
setState(() {
|
||||
requestAsyncData(user);
|
||||
});
|
||||
|
||||
requestAsyncData(user);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -66,7 +62,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
String loyalty = '';
|
||||
String bonus = '';
|
||||
List<Map> coupons = [];
|
||||
bool dataRequested = false;
|
||||
|
||||
@override
|
||||
Widget getScreenContent() {
|
||||
@@ -88,8 +83,8 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
widgetList.add(getHintLabel());
|
||||
widgetList.add(getInputField()); // Нельзя добавить еще одно поле таким же способом
|
||||
|
||||
if (app != 'autobonus') {
|
||||
|
||||
if (app != 'autobonus') {
|
||||
|
||||
if (this.loyalityType == 'bonus') {
|
||||
widgetList.add(getBonusInputField());
|
||||
}
|
||||
@@ -121,7 +116,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
Resources.getPrimaryColor(app)
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
return new Column(children: <Widget>[
|
||||
new Expanded(
|
||||
child: new ListView(children: widgetList))
|
||||
@@ -190,7 +185,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
height: buttonHeight,
|
||||
child: new FlatButton(
|
||||
child: new Text(title, style: new TextStyle(color: textColor)),
|
||||
onPressed: () => Navigator.of(context).pop(true)),
|
||||
onPressed: () => Navigator.of(context).pop()),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all(
|
||||
color: Resources.getButtonColor(app), width: 1.0),
|
||||
@@ -230,9 +225,11 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
}
|
||||
|
||||
requestAsyncData(Map user) async {
|
||||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
bool showBonus = await platform.invokeMethod('showBonus');
|
||||
if (await platform.invokeMethod('isOnline') && !this.dataRequested) {
|
||||
this.dataRequested = true;
|
||||
if (await platform.invokeMethod('isOnline')) {
|
||||
var response, couponResponse;
|
||||
print(user['coupons_url']);
|
||||
try {
|
||||
@@ -407,7 +404,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
print('show purchase success!');
|
||||
var route = new MaterialPageRoute<bool>(builder: (BuildContext context) => new PurchaseSuccessScreen(
|
||||
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => new PurchaseSuccessScreen(
|
||||
sumTotal,
|
||||
user['first_name'] == null ? '' : user['first_name'],
|
||||
helper,
|
||||
@@ -415,8 +412,8 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
purchase,
|
||||
coupons['results']
|
||||
), fullscreenDialog: true);
|
||||
Navigator.of(context).push(route).then((b) {
|
||||
print('finish registration closed: $b');
|
||||
Navigator.of(context).push(route).then((_) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user