|
|
|
|
@ -37,6 +37,8 @@ class _PackagesCartPageState extends State<PackagesCartPage>
|
|
|
|
|
languageID = await sharedPref.getString(APP_LANGUAGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double subtotal,tax, total;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_agreeTerms = false;
|
|
|
|
|
@ -146,6 +148,9 @@ class _PackagesCartPageState extends State<PackagesCartPage>
|
|
|
|
|
.catchError((error) {
|
|
|
|
|
utils.Utils.showErrorToast(error);
|
|
|
|
|
});
|
|
|
|
|
if(response.status){
|
|
|
|
|
fetchData();
|
|
|
|
|
}
|
|
|
|
|
return response.status ?? false;
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
@ -188,7 +193,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)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -199,7 +204,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(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -337,9 +347,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(
|
|
|
|
|
@ -352,13 +366,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,
|
|
|
|
|
@ -372,7 +386,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,
|
|
|
|
|
|