|
|
|
|
@ -36,6 +36,8 @@ class _PackagesCartPageState extends State<PackagesCartPage>
|
|
|
|
|
languageID = await sharedPref.getString(APP_LANGUAGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double subtotal,tax, total;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_agreeTerms = false;
|
|
|
|
|
@ -145,6 +147,9 @@ class _PackagesCartPageState extends State<PackagesCartPage>
|
|
|
|
|
.catchError((error) {
|
|
|
|
|
utils.Utils.showErrorToast(error);
|
|
|
|
|
});
|
|
|
|
|
if(response.status){
|
|
|
|
|
fetchData();
|
|
|
|
|
}
|
|
|
|
|
return response.status ?? false;
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
@ -186,7 +191,7 @@ class _PackagesCartPageState extends State<PackagesCartPage>
|
|
|
|
|
height: 0.25,
|
|
|
|
|
color: Colors.grey[300],
|
|
|
|
|
),
|
|
|
|
|
_payNow(context, onPayNowClick: onPayNowClick)
|
|
|
|
|
_payNow(context, subtotal: subtotal, tax: tax, total: total, onPayNowClick: onPayNowClick)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -197,7 +202,12 @@ class _PackagesCartPageState extends State<PackagesCartPage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fetchData() async {
|
|
|
|
|
await viewModel.service.cartItems(context: context).catchError((error) {});
|
|
|
|
|
await viewModel.service.cartItems(context: context).then((value){
|
|
|
|
|
subtotal = value['subtotal'] ?? 0.0;
|
|
|
|
|
tax = value['tax'] ?? 0.0;
|
|
|
|
|
total = value['total'] ?? 0.0;
|
|
|
|
|
}).catchError((error) {});
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -335,9 +345,13 @@ Widget _termsAndCondition(BuildContext context,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
|
|
|
|
|
Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) {
|
|
|
|
|
bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null));
|
|
|
|
|
|
|
|
|
|
String _subtotal = (subtotal ?? 0.0).toStringAsFixed(2);
|
|
|
|
|
String _tax = (tax ?? 0.0).toStringAsFixed(2);
|
|
|
|
|
String _total = (total ?? 0).toStringAsFixed(2);
|
|
|
|
|
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(5),
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -350,13 +364,13 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
'${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}',
|
|
|
|
|
'${TranslationBase.of(context).subtotal}: $_subtotal ${TranslationBase.of(context).sar}',
|
|
|
|
|
heightFactor: 1.5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
fontSize: 8),
|
|
|
|
|
Texts(
|
|
|
|
|
'${TranslationBase.of(context).vat}: ${'14.9'} ${TranslationBase.of(context).sar}',
|
|
|
|
|
'${TranslationBase.of(context).vat}: $_tax ${TranslationBase.of(context).sar}',
|
|
|
|
|
heightFactor: 1.5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
@ -370,7 +384,7 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
'${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}',
|
|
|
|
|
'${TranslationBase.of(context).total}: $_total ${TranslationBase.of(context).sar}',
|
|
|
|
|
heightFactor: 1.5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
|