toCardScreen method

Future<void> toCardScreen({
  1. Locale? locale,
  2. String? transactionId,
  3. required OnPayCallback onPay,
  4. 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 internationalization
  • transactionId - Optional transaction identifier
  • onPay - Required callback function for payment completion
  • log - Optional callback for logging events and analytics

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) =&gt; print('Card payment completed: $result'),
  log: (event, params) =&gt; 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,
        ),
      ),
    );