show<T> static method

Future<T?> show<T>({
  1. required BuildContext context,
  2. required Widget child,
  3. double heightFactor = 0.9,
  4. bool isDismissible = false,
  5. bool enableDrag = false,
  6. bool showDragHandle = false,
  7. double borderRadius = 24.0,
  8. VoidCallback? onDismissed,
})

Shows the payment screen as a modal bottom sheet.

This is the primary method to display the SDK payment UI. The bottom sheet slides up from the bottom and covers 90% of the screen.

Parameters:

  • context - The build context
  • child - The payment screen widget to display
  • heightFactor - The height as a factor of screen height (default: 0.9)
  • isDismissible - Whether the sheet can be dismissed by tapping outside
  • enableDrag - Whether the sheet can be dragged to dismiss
  • borderRadius - The radius for the top corners (default: 24.0)
  • onDismissed - Callback when the sheet is dismissed

Returns a Future that completes when the bottom sheet is closed.

Implementation

static Future<T?> show<T>({
  required BuildContext context,
  required Widget child,
  double heightFactor = 0.9,
  bool isDismissible = false,
  bool enableDrag = false,
  bool showDragHandle = false,
  double borderRadius = 24.0,
  VoidCallback? onDismissed,
}) {
  return showModalBottomSheet<T>(
    context: context,
    isScrollControlled: true,
    isDismissible: isDismissible,
    enableDrag: enableDrag,
    backgroundColor: Colors.transparent,
    builder: (context) => AmwalPayBottomSheet(
      heightFactor: heightFactor,
      isDismissible: isDismissible,
      showDragHandle: showDragHandle,
      borderRadius: borderRadius,
      onDismissed: onDismissed,
      child: child,
    ),
  ).then((value) {
    onDismissed?.call();
    return value;
  });
}