merge-update-with-lab-changes
mosazaid 5 years ago
parent acdd19eeed
commit c1f3d3cc1c

@ -62,6 +62,8 @@ class OrderPreviewService extends BaseService {
Future<Map> getShoppingCart() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId == null) return null;
Map<String, String> queryParams = {'shopping_cart_type': '1'};
dynamic localRes;
hasError = false;
@ -94,8 +96,8 @@ class OrderPreviewService extends BaseService {
Map<String, dynamic> body = Map();
body["shopping_cart_item"] = choppingCartObject;
await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", isExternal: false,
onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId",
isExternal: false, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -112,8 +114,8 @@ class OrderPreviewService extends BaseService {
Map<String, dynamic> body = Map();
await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", isExternal: false,
onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId",
isExternal: false, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -225,8 +227,9 @@ class OrderPreviewService extends BaseService {
body['order'] = orderBody;
try {
await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, isExternal: false, isAllowAny: true,
onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART,
isExternal: false,
isAllowAny: true, onSuccess: (response, statusCode) async {
orderList.clear();
response['orders'].forEach((item) {
orderList.add(OrderDetailModel.fromJson(item));
@ -263,24 +266,22 @@ class OrderPreviewService extends BaseService {
}
}
Future<LatLng> getDriverLocation(dynamic driverId) async{
Future<LatLng> getDriverLocation(dynamic driverId) async {
Map<String, dynamic> jsonBody = Map();
jsonBody['DriverID'] = driverId;
LatLng coordinates;
await baseAppClient.post(DRIVER_LOCATION,
onSuccess: (response, statusCode) async {
if(statusCode == 200){
if (statusCode == 200) {
dynamic locationObject = response['PatientER_GetDriverLocationList'][0];
double lat = locationObject['Latitude'];
double lon = locationObject['Longitude'];
if(lat != null && lon != null){
coordinates = LatLng(lat,lon);
if (lat != null && lon != null) {
coordinates = LatLng(lat, lon);
}
}
}, onFailure: (String error, int statusCode) {
}, body: jsonBody);
}, onFailure: (String error, int statusCode) {}, body: jsonBody);
return coordinates;
}

@ -9,6 +9,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
@ -17,8 +19,10 @@ class OrderPreviewViewModel extends BaseViewModel {
OrderPreviewService _orderService = locator<OrderPreviewService>();
List<Addresses> get addresses => _orderService.addresses;
LacumAccountInformation get lacumInformation =>
_orderService.lacumInformation;
List<OrderDetailModel> get orderListModel => _orderService.orderList;
PharmacyModuleViewModel pharmacyModuleViewModel =
@ -38,24 +42,31 @@ class OrderPreviewViewModel extends BaseViewModel {
getShoppingCart();
}
}
void update(){
notifyListeners();
}
Future getShoppingCart() async {
setState(ViewState.Busy);
// setState(ViewState.Busy);
// GifLoaderDialogUtils.showMyDialog(
// locator<NavigationService>().navigatorKey.currentContext);
await _orderService.getShoppingCart().then((res) {
_handleGetShoppingCartResponse(res);
if (res != null) _handleGetShoppingCartResponse(res);
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
// setState(ViewState.Error);
} else {
if (paymentCheckoutData != null) {
paymentCheckoutData.cartDataVisible = true;
}
// GifLoaderDialogUtils.hideDialog(
// locator<NavigationService>().navigatorKey.currentContext);
setState(ViewState.Idle);
}
}
Future <ShoppingCartResponse> changeProductQuantity(ShoppingCart product) async {
Future<ShoppingCartResponse> changeProductQuantity(
ShoppingCart product) async {
setState(ViewState.Busy);
var resp = await _orderService.changeProductQuantity(product.id, product);
var object = _handleGetShoppingCartResponse(resp);
@ -112,7 +123,8 @@ class OrderPreviewViewModel extends BaseViewModel {
res["shopping_carts"].forEach((item) {
ShoppingCart shoppingCart = ShoppingCart.fromJson(item);
cartResponse.shoppingCarts.add(shoppingCart);
totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge;
totalAdditionalShippingCharge +=
shoppingCart.product.additionalShippingCharge;
});
return cartResponse;
}
@ -164,7 +176,8 @@ class OrderPreviewViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _orderService.getLacumGroupInformation();
paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData
.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
@ -175,7 +188,9 @@ class OrderPreviewViewModel extends BaseViewModel {
getShippingOption() async {
setState(ViewState.Busy);
await _orderService.getShippingOption(paymentCheckoutData.address).then((res) {
await _orderService
.getShippingOption(paymentCheckoutData.address)
.then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
paymentCheckoutData.updateData();
});
@ -191,7 +206,8 @@ class OrderPreviewViewModel extends BaseViewModel {
setState(ViewState.Busy);
await pharmacyModuleViewModel.generatePharmacyToken();
await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts);
await _orderService.makeOrder(
paymentCheckoutData, cartResponse.shoppingCarts);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.ErrorLocal);

@ -69,7 +69,6 @@ class _Login extends State<Login> {
nationalIDorFile.text = "2001273";
mobileNumberController.text = mobileNo = "0555416043";
}/* else {
// TODO Mousa Sheeeloh
nationalIDorFile.text = "3376044";
mobileNumberController.text = mobileNo = "0555416575";
}*/

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:provider/provider.dart';
class CartOrderPage extends StatefulWidget {
@ -25,13 +27,14 @@ class CartOrderPage extends StatefulWidget {
class _CartOrderPageState extends State<CartOrderPage> {
bool isLoading = true;
@override
void initState() {
super.initState();
Provider.of<OrderPreviewViewModel>(context, listen: false).getShoppingCart();
getData();
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
@ -40,7 +43,9 @@ class _CartOrderPageState extends State<CartOrderPage> {
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
AppScaffold appScaffold;
return NetworkBaseView(
baseViewModel: model,
// baseViewModel: model,
isLoading: isLoading,
isLocalLoader: true,
child: AppScaffold(
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
@ -245,6 +250,15 @@ class _CartOrderPageState extends State<CartOrderPage> {
),
);
}
void getData()async {
await Provider.of<OrderPreviewViewModel>(context, listen: false).getShoppingCart();
setState(() {
isLoading= false;
});
}
}
class OrderBottomWidget extends StatefulWidget {

@ -31,33 +31,47 @@ class OrderPreviewPage extends StatefulWidget {
class _OrderPreviewPageState extends State<OrderPreviewPage> {
MyInAppBrowser browser;
bool isLoading = true;
@override
void initState() {
super.initState();
Provider.of<OrderPreviewViewModel>(context, listen: false).getShoppingCart();
getData();
}
void getData() async {
if (isLoading)
await Provider.of<OrderPreviewViewModel>(context, listen: false)
.getShoppingCart();
setState(() {
isLoading = false;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
OrderPreviewViewModel model = Provider.of(context);
return NetworkBaseView(
child: AppScaffold(
return AppScaffold(
appBarTitle: "${TranslationBase.of(context).checkOut}",
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
isLoading: isLoading,
isLocalLoader: true,
backgroundColor: Colors.white,
baseViewModel: model,
// baseViewModel: model,
body: Container(
color: Color(0xFFF1F1F1),
height: height * 0.90,
child: SingleChildScrollView(
child: Container(
color: Color(0xFFF1F1F1),
child: Column(
children: [
SelectAddressWidget(model,widget.addresses),
SelectAddressWidget(model, widget.addresses),
SizedBox(
height: 10,
),
@ -87,9 +101,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase
.of(context)
.reviewOrder,
TranslationBase.of(context).reviewOrder,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
@ -98,10 +110,8 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) =>
ProductOrderPreviewItem(
model.cartResponse
.shoppingCarts[index]),
(index) => ProductOrderPreviewItem(
model.cartResponse.shoppingCarts[index]),
),
],
),
@ -111,13 +121,10 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
padding: EdgeInsets.all(8),
child: model.cartResponse.subtotal != null
? Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase
.of(context)
.orderSummary,
TranslationBase.of(context).orderSummary,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
@ -126,22 +133,16 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
height: 20,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.subtotal}",
"${TranslationBase.of(context).subtotal}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -156,23 +157,16 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.shipping}",
"${TranslationBase.of(context).shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model
.totalAdditionalShippingCharge)
.toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -187,23 +181,16 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.vat}",
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse
.subtotalVatAmount).toStringAsFixed(
2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -218,22 +205,16 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase
.of(context)
.total,
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
@ -253,14 +234,10 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
),
),
bottomSheet: Container(
height: model.cartResponse.shoppingCarts != null
? height * 0.10
: 0,
height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
color: Colors.white,
child: PaymentBottomWidget(model),
),
),
baseViewModel: model,
);
}
}
@ -308,8 +285,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
@override
Widget build(BuildContext context) {
return Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) =>
Container(
builder: (ctx, paymentData, _) => Container(
color: Colors.white,
child: address == null
? InkWell(
@ -329,9 +305,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase
.of(context)
.selectAddress,
TranslationBase.of(context).selectAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
@ -366,9 +340,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
TranslationBase
.of(context)
.shippingAddress,
TranslationBase.of(context).shippingAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
@ -378,9 +350,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
InkWell(
onTap: () => {_navigateToAddressPage()},
child: Texts(
TranslationBase
.of(context)
.changeAddress,
TranslationBase.of(context).changeAddress,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
@ -400,9 +370,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.address1} ${address.address2} ${address
.address2},, ${address.city}, ${address
.country} ${address.zipPostalCode}",
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.grey.shade500,
@ -448,9 +416,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
"${TranslationBase
.of(context)
.shipBy}",
"${TranslationBase.of(context).shipBy}",
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black,
@ -493,8 +459,7 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
.then((result) =>
{
.then((result) => {
setState(() {
if (result != null) {
paymentOption = result;
@ -536,9 +501,7 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase
.of(context)
.selectPaymentOption,
TranslationBase.of(context).selectPaymentOption,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
@ -592,9 +555,7 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Texts(
TranslationBase
.of(context)
.changeMethod,
TranslationBase.of(context).changeMethod,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
@ -640,15 +601,12 @@ class _LakumWidgetState extends State<LakumWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
"${TranslationBase
.of(context)
.lakumPoints}",
"${TranslationBase.of(context).lakumPoints}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Texts(
"${widget.model.paymentCheckoutData.lacumInformation
.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
"${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
fontSize: 12,
fontWeight: FontWeight.normal,
),
@ -663,9 +621,7 @@ class _LakumWidgetState extends State<LakumWidget> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
"${TranslationBase
.of(context)
.riyal}",
"${TranslationBase.of(context).riyal}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
@ -760,9 +716,7 @@ class _LakumWidgetState extends State<LakumWidget> {
)),
),
child: Texts(
"${TranslationBase
.of(context)
.use}",
"${TranslationBase.of(context).use}",
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
@ -794,8 +748,7 @@ class PaymentBottomWidget extends StatelessWidget {
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) =>
paymentData.cartDataVisible
builder: (ctx, paymentData, _) => paymentData.cartDataVisible
? Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -810,10 +763,7 @@ class PaymentBottomWidget extends StatelessWidget {
child: Row(
children: [
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
@ -822,9 +772,7 @@ class PaymentBottomWidget extends StatelessWidget {
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase
.of(context)
.inclusiveVat}",
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Color(0xff929295),
fontWeight: FontWeight.w600,
@ -834,9 +782,7 @@ class PaymentBottomWidget extends StatelessWidget {
),
),
Texts(
"${model.cartResponse.quantityCount} ${TranslationBase
.of(context)
.items}",
"${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
@ -858,8 +804,10 @@ class PaymentBottomWidget extends StatelessWidget {
await model.makeOrder();
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message: "Order has been placed successfully!!");
openPayment(model.orderListModel[0], model.user);
message:
"Order has been placed successfully!!");
openPayment(
model.orderListModel[0], model.user);
} else {
AppToast.showErrorToast(message: model.error);
}
@ -870,9 +818,7 @@ class PaymentBottomWidget extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: new Text(
"${TranslationBase
.of(context)
.proceedPay}",
"${TranslationBase.of(context).proceedPay}",
style: new TextStyle(
color: (paymentData.address != null &&
paymentData.paymentOption != null)
@ -900,8 +846,10 @@ class PaymentBottomWidget extends StatelessWidget {
);
}
openPayment(OrderDetailModel order,
AuthenticatedUser authenticatedUser,) {
openPayment(
OrderDetailModel order,
AuthenticatedUser authenticatedUser,
) {
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
@ -912,8 +860,7 @@ class PaymentBottomWidget extends StatelessWidget {
order.id,
order.billingAddress.email,
order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser
.middleName} ${authenticatedUser.lastName}",
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
authenticatedUser.patientID,
authenticatedUser,
browser);

@ -57,6 +57,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
onModelReady: (model) async {
await model.getSavedLanguage();
await model.getBannerList();
if(model.isLogin)
await orderPreviewViewModel.getShoppingCart();
},
allowAny: true,

@ -58,6 +58,7 @@ class AppScaffold extends StatelessWidget {
final List<Widget> appBarIcons;
final List<ImagesInfo> imagesInfo;
final bool isHelp;
final bool isLocalLoader;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@ -89,7 +90,7 @@ class AppScaffold extends StatelessWidget {
this.showHomeAppBarIcon = true,
this.imagesInfo,
appBar,
this.customAppBar});
this.customAppBar, this.isLocalLoader= false});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
@ -146,7 +147,17 @@ class AppScaffold extends StatelessWidget {
buildBodyWidget(context) {
return Stack(
children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
children: <Widget>[
Center(
child:isLoading? CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
):body),
isHelp == true ? RobotIcon() : Container()]);
}
}

@ -10,8 +10,9 @@ class NetworkBaseView extends StatefulWidget {
final BaseViewModel baseViewModel;
final Widget child;
final bool isLocalLoader;
final bool isLoading;
NetworkBaseView({Key key, this.baseViewModel, this.child, this.isLocalLoader = false});
NetworkBaseView({Key key, this.baseViewModel, this.child, this.isLocalLoader = false, this.isLoading});
@override
_NetworkBaseViewState createState() => _NetworkBaseViewState();
@ -31,7 +32,14 @@ class _NetworkBaseViewState extends State<NetworkBaseView>{
@override
Widget build(BuildContext context) {
return Container(
child: buildBaseViewWidget(),
child: (widget.baseViewModel!=null ) ?buildBaseViewWidget():Center(
child:widget.isLoading? CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
):widget.child,
) ,
);
}

Loading…
Cancel
Save