usability fixes
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter_contacts/flutter_contacts.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qpay/models/responsive_policy.dart';
|
||||
import 'package:qpay/screens/accounts/account_provider.dart';
|
||||
import 'package:qpay/screens/pay/pay_controller.dart';
|
||||
import 'package:qpay/screens/transaction_controller.dart';
|
||||
import 'package:qpay/widgets/app_snack_bar.dart';
|
||||
@@ -64,7 +65,6 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
|
||||
super.initState();
|
||||
|
||||
controller = PayController(context);
|
||||
controller.getPaymentProcessors();
|
||||
|
||||
controller.getProducts(controller.model.selectedProvider?.id ?? "");
|
||||
transactionController = Provider.of<TransactionController>(
|
||||
@@ -72,6 +72,7 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
|
||||
listen: false,
|
||||
);
|
||||
|
||||
controller.getPaymentProcessors(transactionController.model.currency);
|
||||
_setupData();
|
||||
|
||||
_controller = AnimationController(
|
||||
@@ -234,38 +235,71 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTransactionDetailsCard(
|
||||
children: [
|
||||
_buildDetailRow(
|
||||
icon: Icons.business_outlined,
|
||||
label: "Provider",
|
||||
value:
|
||||
controller
|
||||
Builder(
|
||||
builder: (context) {
|
||||
// Look up City Wallet balance matching the
|
||||
// transaction currency from the shared
|
||||
// AccountProvider.
|
||||
final accountProvider = context
|
||||
.watch<AccountProvider>();
|
||||
final currency =
|
||||
transactionController.model.currency;
|
||||
final cityWallet = accountProvider
|
||||
.balanceForCurrency(currency);
|
||||
final hasCityWallet =
|
||||
cityWallet != null &&
|
||||
cityWallet.name == 'City Wallet';
|
||||
|
||||
return _buildTransactionDetailsCard(
|
||||
children: [
|
||||
_buildDetailRow(
|
||||
icon: Icons.business_outlined,
|
||||
label: "Provider",
|
||||
value:
|
||||
controller
|
||||
.model
|
||||
.selectedProvider
|
||||
?.name ??
|
||||
"",
|
||||
),
|
||||
_buildDetailRow(
|
||||
icon: Icons.account_balance_outlined,
|
||||
label:
|
||||
controller
|
||||
.model
|
||||
.selectedProvider
|
||||
?.accountFieldName ??
|
||||
"",
|
||||
value: transactionController
|
||||
.model
|
||||
.selectedProvider
|
||||
?.name ??
|
||||
"",
|
||||
),
|
||||
_buildDetailRow(
|
||||
icon: Icons.account_balance_outlined,
|
||||
label:
|
||||
controller
|
||||
.formData
|
||||
.creditAccount,
|
||||
),
|
||||
_buildDetailRow(
|
||||
icon: Icons.monetization_on,
|
||||
label: "Currency",
|
||||
value: transactionController
|
||||
.model
|
||||
.selectedProvider
|
||||
?.accountFieldName ??
|
||||
"",
|
||||
value: transactionController
|
||||
.model
|
||||
.formData
|
||||
.creditAccount,
|
||||
),
|
||||
_buildDetailRow(
|
||||
icon: Icons.monetization_on,
|
||||
label: "Currency",
|
||||
value:
|
||||
transactionController.model.currency,
|
||||
),
|
||||
],
|
||||
.currency,
|
||||
),
|
||||
if (hasCityWallet)
|
||||
_buildDetailRow(
|
||||
icon: Icons
|
||||
.account_balance_wallet_outlined,
|
||||
label: "City Wallet Balance",
|
||||
value:
|
||||
'\$${cityWallet!.balance.toStringAsFixed(2)}',
|
||||
valueStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
InkWell(
|
||||
@@ -748,6 +782,7 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required String value,
|
||||
TextStyle? valueStyle,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
@@ -762,11 +797,13 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
|
||||
const Spacer(),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
style:
|
||||
valueStyle ??
|
||||
TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user