toWalletOptionsScreen method
Future<void>
toWalletOptionsScreen(
- BuildContext context,
- RouteSettings settings,
- OnPayCallback onPay,
- OnPayCallback onCountComplete,
- GetTransactionFunction getTransactionFunction,
- int countDownInSeconds,
- EventCallback? log,
Navigates to the wallet payment options screen.
This method presents the user with available digital wallet payment options, including Apple Pay, Google Pay, and other supported wallets.
Parameters:
context
- The current build context for navigationsettings
- Route settings containing navigation argumentsonPay
- Callback function executed when payment is completedonCountComplete
- Callback function executed when countdown timer expiresgetTransactionFunction
- Function to retrieve transaction detailscountDownInSeconds
- Duration of the payment countdown timerlog
- Optional callback for logging events and analytics
Navigation Flow
- Extracts payment arguments from route settings
- Creates a new route to the wallet options screen
- Passes all necessary parameters to the screen
- Handles navigation and screen presentation
Example
await AmwalSdkNavigator.instance.toWalletOptionsScreen(
context,
settings,
(result) => print('Payment completed: $result'),
() => print('Countdown expired'),
() async => await getTransactionDetails(),
90, // 90 seconds countdown
(event, params) => logEvent(event, params),
);
Navigates to the wallet payment options screen.
Implementation
Future<void> toWalletOptionsScreen(
BuildContext context,
RouteSettings settings,
OnPayCallback onPay,
OnPayCallback onCountComplete,
GetTransactionFunction getTransactionFunction,
int countDownInSeconds,
EventCallback? log,
) async {
final args = settings.arguments as PaymentArguments;
await Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => SaleByWalletPayingOptions(
getTransactionFunction: getTransactionFunction,
onCountComplete: onCountComplete,
onPay: onPay,
amount: args.amount,
terminalId: args.terminalId,
merchantId: args.merchantId,
currencyId: args.currencyData!.idN,
currency: args.currencyData!.name,
transactionId: args.transactionId,
countDownInSeconds: countDownInSeconds,
log: log,
),
),
);
}