toCardScreen method
Future<void>
toCardScreen({
- Locale? locale,
- String? transactionId,
- required OnPayCallback onPay,
- EventCallback? log,
Navigates to the main card payment screen.
This method presents the primary card payment interface where users can choose between different card payment methods and enter card details.
Parameters:
locale
- Optional locale setting for internationalizationtransactionId
- Optional transaction identifieronPay
- Required callback function for payment completionlog
- Optional callback for logging events and analytics
Navigation Method
Uses the SDK's navigator observer for consistent navigation behavior within the SDK context, rather than the standard context-based navigation.
Example
await AmwalSdkNavigator.instance.toCardScreen(
locale: const Locale('en'),
transactionId: 'txn_123',
onPay: (result) => print('Card payment completed: $result'),
log: (event, params) => logEvent(event, params),
);
Navigates to the main card payment screen.
Implementation
Future<void> toCardScreen({
Locale? locale,
String? transactionId,
required OnPayCallback onPay,
EventCallback? log,
}) async =>
await amwalNavigatorObserver.navigator!.push(
MaterialPageRoute(
builder: (_) => CardSdkApp(
locale: locale,
transactionId: transactionId,
onPay: onPay,
log: log,
),
),
);