add loading around api call to add card
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
|
import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
|
||||||
import 'package:Mzansi_Innovation_Hub/mih_objects/loyalty_card.dart';
|
import 'package:Mzansi_Innovation_Hub/mih_objects/loyalty_card.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -109,6 +110,7 @@ class MIHMzansiWalletApis {
|
|||||||
String card_number,
|
String card_number,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
) async {
|
) async {
|
||||||
|
loadingPopUp(context);
|
||||||
var response = await http.post(
|
var response = await http.post(
|
||||||
Uri.parse(
|
Uri.parse(
|
||||||
"${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/insert/"),
|
"${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/insert/"),
|
||||||
@@ -122,8 +124,7 @@ class MIHMzansiWalletApis {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
if (response.statusCode == 201) {
|
||||||
// Navigator.pushNamed(context, '/patient-manager/patient',
|
Navigator.pop(context);
|
||||||
// arguments: widget.signedInUser);
|
|
||||||
String message =
|
String message =
|
||||||
"Your $shop_name Loyalty Card was successfully added to your Mzansi Wallet.";
|
"Your $shop_name Loyalty Card was successfully added to your Mzansi Wallet.";
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@@ -132,21 +133,9 @@ class MIHMzansiWalletApis {
|
|||||||
'/mzansi-wallet',
|
'/mzansi-wallet',
|
||||||
arguments: signedInUser,
|
arguments: signedInUser,
|
||||||
);
|
);
|
||||||
// Navigator.pop(context);
|
|
||||||
// setState(() {
|
|
||||||
// dateController.text = "";
|
|
||||||
// timeController.text = "";
|
|
||||||
// });
|
|
||||||
// Navigator.of(context).pushNamed(
|
|
||||||
// '/patient-manager',
|
|
||||||
// arguments: BusinessArguments(
|
|
||||||
// widget.arguments.signedInUser,
|
|
||||||
// widget.arguments.businessUser,
|
|
||||||
// widget.arguments.business,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
successPopUp(message, context);
|
successPopUp(message, context);
|
||||||
} else {
|
} else {
|
||||||
|
Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
internetConnectionPopUp(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,4 +164,13 @@ class MIHMzansiWalletApis {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void loadingPopUp(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user