Adjust pay with button to pay with current wallet currency

This commit is contained in:
OmarHatem28 2022-07-04 19:02:59 +02:00
parent 9e7ca93a0b
commit 4859e2e26d
2 changed files with 27 additions and 25 deletions

View file

@ -1,5 +1,7 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart'; import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart';
import 'package:country_pickers/country.dart'; import 'package:country_pickers/country.dart';
@ -329,8 +331,8 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
contentWidget: Column( contentWidget: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
receiptRow(S.of(context).amount, phonePlanViewModel.totalPrice), cakePayReceiptRow(S.of(context).amount, phonePlanViewModel.totalPrice),
receiptRow(S.of(context).cake_pay_balance, 100), cakePayReceiptRow(S.of(context).cake_pay_balance, 100),
], ],
), ),
isDividerExists: true, isDividerExists: true,
@ -342,14 +344,14 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
actionLeftButton: () => Navigator.of(dialogContext).pop()); actionLeftButton: () => Navigator.of(dialogContext).pop());
}); });
}, },
text: S.of(context).pay_with_cake_phone, text: "${S.of(context).pay_with} ${S.of(context).cake_pay_balance}",
color: Theme.of(context).accentTextTheme.caption.backgroundColor, color: Theme.of(context).accentTextTheme.caption.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.title.color, textColor: Theme.of(context).primaryTextTheme.title.color,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
PrimaryButton( PrimaryButton(
onPressed: () {}, onPressed: () {},
text: S.of(context).pay_with_xmr, text: "${S.of(context).pay_with} ${getIt.get<AppStore>().wallet.currency.toString()}",
color: Theme.of(context).accentTextTheme.body2.color, color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white, textColor: Colors.white,
), ),
@ -408,29 +410,30 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
); );
} }
Widget receiptRow(String title, double amount) { Widget cakePayReceiptRow(String title, double amount) {
return Padding( return Padding(
padding: const EdgeInsets.only(top: 24), padding: const EdgeInsets.only(top: 24),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
"$title:", "$title:",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.subhead.color, color: Theme.of(context).accentTextTheme.subhead.color,
),
), ),
), Text(
Text( "\$${amount.roundToDouble() == amount ? amount.round() : amount}",
"\$${amount.roundToDouble() == amount ? amount.round() : amount}", style: TextStyle(
style: TextStyle( fontSize: 18,
fontSize: 18, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, color: Theme.of(context).primaryTextTheme.title.color,
color: Theme.of(context).primaryTextTheme.title.color, ),
), ),
), ],
], ),
),); );
} }
} }

View file

@ -559,8 +559,7 @@
"phone_number_product_description": "SMS messages are forwarded to your email address. Includes 20 free SMS messages for each month of service with the option to pay for more.", "phone_number_product_description": "SMS messages are forwarded to your email address. Includes 20 free SMS messages for each month of service with the option to pay for more.",
"initial_service_term": "Initial Service Term", "initial_service_term": "Initial Service Term",
"phone_number_promotion_text": "You can add more time later. Save big on longer terms!", "phone_number_promotion_text": "You can add more time later. Save big on longer terms!",
"pay_with_cake_phone": "Pay with CakePhone Balance", "pay_with": "Pay with",
"pay_with_xmr": "Pay with XMR",
"due_today": "Due today:", "due_today": "Due today:",
"free_sms_email_forward": "Free SMS Email Forwards", "free_sms_email_forward": "Free SMS Email Forwards",
"month": "month", "month": "month",