Fix correct adjusted amount for custom redeem

This commit is contained in:
Godwin Asuquo
2022-11-30 10:00:05 +02:00
parent 2eb9db4ca6
commit 8511805ee3
7 changed files with 29 additions and 25 deletions
@@ -149,7 +149,7 @@ class IoniaCustomRedeemPage extends BasePage {
padding: EdgeInsets.only(bottom: 12),
child: PrimaryButton(
onPressed: () {
Navigator.of(context).pop(ioniaCustomRedeemViewModel.remaining.toString());
Navigator.of(context).pop([ioniaCustomRedeemViewModel.remaining.toString(), ioniaCustomRedeemViewModel.amount.toString()]);
},
isDisabled: ioniaCustomRedeemViewModel.disableRedeem,
text: S.of(context).add_custom_redemption,
@@ -130,19 +130,19 @@ class IoniaGiftCardDetailPage extends BasePage {
if (!viewModel.giftCard.isEmpty) {
return Column(
children: [
//PrimaryButton(
// onPressed: () async {
// final amount = await Navigator.of(context)
// .pushNamed(Routes.ioniaMoreOptionsPage, arguments: [viewModel.giftCard]) as String;
// if (amount != null) {
// viewModel.updateRemaining(double.parse(amount));
// }
// },
// text: S.of(context).more_options,
// color: Theme.of(context).accentTextTheme!.caption!.color!,
// textColor: Theme.of(context).primaryTextTheme!.headline6!.color!,
//),
//SizedBox(height: 12),
PrimaryButton(
onPressed: () async {
final amount = await Navigator.of(context)
.pushNamed(Routes.ioniaMoreOptionsPage, arguments: [viewModel.giftCard]) as List<String>?;
if (amount != null) {
viewModel.updateRemaining( balance: double.parse(amount.first), customAmount: double.parse(amount.last));
}
},
text: S.of(context).more_options,
color: Theme.of(context).accentTextTheme.caption!.color!,
textColor: Theme.of(context).primaryTextTheme.headline6!.color!,
),
SizedBox(height: 12),
LoadingPrimaryButton(
isLoading: viewModel.redeemState is IsExecutingState,
onPressed: () => viewModel.redeem().then(
@@ -152,7 +152,7 @@ class IoniaGiftCardDetailPage extends BasePage {
},
),
text: S.of(context).mark_as_redeemed,
color: Theme.of(context).accentTextTheme!.bodyText1!.color!,
color: Theme.of(context).accentTextTheme.bodyText1!.color!,
textColor: Colors.white,
),
],
@@ -35,9 +35,9 @@ class IoniaMoreOptionsPage extends BasePage {
SizedBox(height: 40,),
InkWell(
onTap: () async {
final amount = await Navigator.of(context).pushNamed(Routes.ioniaCustomRedeemPage, arguments: [giftCard]) as String;
if(amount.isNotEmpty){
Navigator.pop(context, amount);
final amounts = await Navigator.of(context).pushNamed(Routes.ioniaCustomRedeemPage, arguments: [giftCard]) as List<String>;
if(amounts.first.isNotEmpty){
Navigator.pop(context, amounts);
}
},
child: _GradiantContainer(
@@ -53,7 +53,7 @@ class IoniaFilterModal extends StatelessWidget {
prefixIcon: searchIcon,
hintText: S.of(context).search_category,
contentPadding: EdgeInsets.only(bottom: 5),
fillColor: Theme.of(context).textTheme!.subtitle1!.backgroundColor!,
fillColor: Theme.of(context).textTheme.subtitle1?.backgroundColor,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(8),