|
|
|
|
@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
@ -22,7 +23,6 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'cart-order-preview.dart';
|
|
|
|
|
|
|
|
|
|
class CartOrderPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
final Function(int) changeTab;
|
|
|
|
|
|
|
|
|
|
const CartOrderPage({Key key, this.changeTab}) : super(key: key);
|
|
|
|
|
@ -38,7 +38,6 @@ class _CartOrderPageState extends State<CartOrderPage> {
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
getData();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -47,212 +46,216 @@ class _CartOrderPageState extends State<CartOrderPage> {
|
|
|
|
|
OrderPreviewViewModel model = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
|
|
|
|
|
AppScaffold appScaffold;
|
|
|
|
|
return NetworkBaseView(
|
|
|
|
|
isLoading: isLoading,
|
|
|
|
|
isLocalLoader: true,
|
|
|
|
|
child: appScaffold = AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).shoppingCart,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
showHomeAppBarIcon: false,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
isMainPharmacyPages: true,
|
|
|
|
|
showPharmacyCart: false,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
body: !(model.cartResponse.shoppingCarts == null ||
|
|
|
|
|
model.cartResponse.shoppingCarts.length == 0)
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).shoppingCart,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
showHomeAppBarIcon: false,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
isMainPharmacyPages: true,
|
|
|
|
|
showPharmacyCart: false,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
body: NetworkBaseView(
|
|
|
|
|
isLoading: isLoading,
|
|
|
|
|
isLocalLoader: true,
|
|
|
|
|
child: !(model.cartResponse.shoppingCarts == null ||
|
|
|
|
|
model.cartResponse.shoppingCarts.length == 0)
|
|
|
|
|
? Container(
|
|
|
|
|
height: height * 0.85,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
|
height: height * 0.85,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
GestureIconButton(
|
|
|
|
|
TranslationBase.of(context).deleteAllItems,
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.delete_outline_sharp,
|
|
|
|
|
color: Colors.grey.shade700,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => {model.deleteShoppingCart()},
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
GestureIconButton(
|
|
|
|
|
TranslationBase.of(context).deleteAllItems,
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.delete_outline_sharp,
|
|
|
|
|
color: Colors.grey.shade700,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => {model.deleteShoppingCart()},
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
...List.generate(
|
|
|
|
|
model.cartResponse.shoppingCarts != null
|
|
|
|
|
? model.cartResponse.shoppingCarts.length
|
|
|
|
|
: 0,
|
|
|
|
|
(index) => ProductOrderItem(
|
|
|
|
|
model.cartResponse
|
|
|
|
|
.shoppingCarts[index], () {
|
|
|
|
|
print(model.cartResponse
|
|
|
|
|
.shoppingCarts[index].quantity);
|
|
|
|
|
model
|
|
|
|
|
.changeProductQuantity(model
|
|
|
|
|
.cartResponse
|
|
|
|
|
.shoppingCarts[index])
|
|
|
|
|
.then((value) {
|
|
|
|
|
if (model.state != ViewState.Error) {
|
|
|
|
|
// appScaffold.appBar.badgeUpdater(
|
|
|
|
|
// '${value.quantityCount ?? 0}');
|
|
|
|
|
}
|
|
|
|
|
if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
Utils.showErrorToast(model.error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, () {
|
|
|
|
|
model
|
|
|
|
|
.deleteProduct(model.cartResponse
|
|
|
|
|
.shoppingCarts[index])
|
|
|
|
|
.then((value) {
|
|
|
|
|
if (model.state != ViewState.Error) {
|
|
|
|
|
// appScaffold.appBar.badgeUpdater(
|
|
|
|
|
// '${value.quantityCount ?? 0}');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 2,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).subtotal,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).vat}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).total,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/images/pharmacy_module/payment.png",
|
|
|
|
|
width: mediaQuery.size.width - 20,
|
|
|
|
|
height: 30.0,
|
|
|
|
|
fit: BoxFit.scaleDown,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 120,
|
|
|
|
|
)
|
|
|
|
|
...List.generate(
|
|
|
|
|
model.cartResponse.shoppingCarts != null
|
|
|
|
|
? model
|
|
|
|
|
.cartResponse.shoppingCarts.length
|
|
|
|
|
: 0,
|
|
|
|
|
(index) => ProductOrderItem(
|
|
|
|
|
model.cartResponse
|
|
|
|
|
.shoppingCarts[index], () {
|
|
|
|
|
print(model.cartResponse
|
|
|
|
|
.shoppingCarts[index].quantity);
|
|
|
|
|
model
|
|
|
|
|
.changeProductQuantity(model
|
|
|
|
|
.cartResponse
|
|
|
|
|
.shoppingCarts[index])
|
|
|
|
|
.then((value) {
|
|
|
|
|
if (model.state !=
|
|
|
|
|
ViewState.Error) {
|
|
|
|
|
// appScaffold.appBar.badgeUpdater(
|
|
|
|
|
// '${value.quantityCount ?? 0}');
|
|
|
|
|
}
|
|
|
|
|
if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
Utils.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, () {
|
|
|
|
|
model
|
|
|
|
|
.deleteProduct(model
|
|
|
|
|
.cartResponse
|
|
|
|
|
.shoppingCarts[index])
|
|
|
|
|
.then((value) {
|
|
|
|
|
if (model.state !=
|
|
|
|
|
ViewState.Error) {
|
|
|
|
|
// appScaffold.appBar.badgeUpdater(
|
|
|
|
|
// '${value.quantityCount ?? 0}');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/new-design/empty_box.png',
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 100,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 2,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).subtotal,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).noData,
|
|
|
|
|
// 'There is no data',
|
|
|
|
|
style: TextStyle(fontSize: 30),
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).vat}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).total,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Divider(
|
|
|
|
|
color: Color(0xFFD6D6D6),
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/images/pharmacy_module/payment.png",
|
|
|
|
|
width: mediaQuery.size.width - 20,
|
|
|
|
|
height: 30.0,
|
|
|
|
|
fit: BoxFit.scaleDown,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 120,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/new-design/empty_box.png',
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 100,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: !(model.cartResponse.shoppingCarts == null ||
|
|
|
|
|
model.cartResponse.shoppingCarts.length == 0)
|
|
|
|
|
? height * 0.15
|
|
|
|
|
: 0,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: OrderBottomWidget(model.addresses, height),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).noData,
|
|
|
|
|
// 'There is no data',
|
|
|
|
|
style: TextStyle(fontSize: 30),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: !(model.cartResponse.shoppingCarts == null ||
|
|
|
|
|
model.cartResponse.shoppingCarts.length == 0)
|
|
|
|
|
? height * 0.15
|
|
|
|
|
: 0,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: OrderBottomWidget(model.addresses, height, model),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -268,8 +271,9 @@ class _CartOrderPageState extends State<CartOrderPage> {
|
|
|
|
|
class OrderBottomWidget extends StatefulWidget {
|
|
|
|
|
final List<Addresses> addresses;
|
|
|
|
|
final double height;
|
|
|
|
|
final OrderPreviewViewModel model;
|
|
|
|
|
|
|
|
|
|
OrderBottomWidget(this.addresses, this.height);
|
|
|
|
|
OrderBottomWidget(this.addresses, this.height, this.model);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_OrderBottomWidgetState createState() => _OrderBottomWidgetState();
|
|
|
|
|
@ -281,9 +285,9 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectProvider = Provider.of(context);
|
|
|
|
|
OrderPreviewViewModel cart = Provider.of(context);
|
|
|
|
|
return !(cart.cartResponse.shoppingCarts == null ||
|
|
|
|
|
cart.cartResponse.shoppingCarts.length == 0)
|
|
|
|
|
|
|
|
|
|
return !(widget.model.cartResponse.shoppingCarts == null ||
|
|
|
|
|
widget.model.cartResponse.shoppingCarts.length == 0)
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -373,7 +377,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
|
|
|
|
|
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
|
|
|
|
|
fontSize: projectProvider.isArabic ? 12 : 14,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
@ -391,7 +395,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
|
|
|
|
|
"${widget.model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
@ -403,50 +407,35 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
|
|
|
|
onPressed: isAgree
|
|
|
|
|
// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0
|
|
|
|
|
? () => {
|
|
|
|
|
if(cart.isCartItemsOutOfStock()){
|
|
|
|
|
// Toast msg
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)
|
|
|
|
|
}else {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page:
|
|
|
|
|
OrderPreviewPage(widget.addresses)))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (widget.model.isCartItemsOutOfStock())
|
|
|
|
|
{
|
|
|
|
|
// Toast msg
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: TranslationBase.of(context)
|
|
|
|
|
.outOfStockMsg)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_navigateToAddressPage(widget
|
|
|
|
|
.model.user.patientIdentificationNo)
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// FadePage(
|
|
|
|
|
// page:
|
|
|
|
|
// OrderPreviewPage(widget.addresses)))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: new Text(
|
|
|
|
|
"${TranslationBase.of(context).checkOut}",
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
color:
|
|
|
|
|
isAgree ? Colors.white : Colors.grey.shade300,
|
|
|
|
|
isAgree ? Colors.white : Colors.grey.shade300,
|
|
|
|
|
fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
color: Color(0xFF4CAF50),
|
|
|
|
|
disabledColor:Color(0xFF848484),
|
|
|
|
|
// disabledColor: Color(0xff005aff),
|
|
|
|
|
disabledColor: Color(0xFF848484),
|
|
|
|
|
)
|
|
|
|
|
// RaisedButton(
|
|
|
|
|
// onPressed: isAgree
|
|
|
|
|
//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0
|
|
|
|
|
// ? () => {
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// FadePage(
|
|
|
|
|
// page:
|
|
|
|
|
// OrderPreviewPage(widget.addresses)))
|
|
|
|
|
// }
|
|
|
|
|
// : null,
|
|
|
|
|
// child: new Text(
|
|
|
|
|
// "${TranslationBase.of(context).checkOut}",
|
|
|
|
|
// style: new TextStyle(
|
|
|
|
|
// color:
|
|
|
|
|
// isAgree ? Colors.white : Colors.grey.shade300,
|
|
|
|
|
// fontSize: 14),
|
|
|
|
|
// ),
|
|
|
|
|
// color: Color(0xff005aff),
|
|
|
|
|
// disabledColor: Color(0xff005aff),
|
|
|
|
|
// )
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -454,4 +443,24 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
|
|
|
|
)
|
|
|
|
|
: Container();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_navigateToAddressPage(String identificationNo) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: PharmacyAddressesPage(
|
|
|
|
|
orderPreviewViewModel: widget.model,
|
|
|
|
|
))).then((result) async {
|
|
|
|
|
if (result != null) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
var address = result;
|
|
|
|
|
widget.model.paymentCheckoutData.address =
|
|
|
|
|
Addresses.fromJson(address.toJson());
|
|
|
|
|
await widget.model.getInformationsByAddress(identificationNo);
|
|
|
|
|
await widget.model.getShoppingCart();
|
|
|
|
|
// widget.changeMainState();
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|