show static method

void show(
  1. BuildContext context, {
  2. required dynamic contentWidget,
  3. String title = '请选择',
  4. dynamic confirm,
  5. dynamic cancel,
  6. VoidCallback? onConfirm,
  7. VoidCallback? onCancel,
  8. bool barrierDismissible = true,
  9. bool showTitle = true,
})

Implementation

static void show(
  BuildContext context, {
  required contentWidget,
  String title = '请选择',
  dynamic confirm,
  dynamic cancel,
  VoidCallback? onConfirm,
  VoidCallback? onCancel,
  bool barrierDismissible = true,
  bool showTitle = true,
}) {
  final ThemeData theme = Theme.of(context);
  showGeneralDialog(
    context: context,
    pageBuilder: (BuildContext buildContext, Animation<double> animation,
        Animation<double> secondaryAnimation) {
      final Widget pageChild = BottomPickerWidget(
        contentWidget: contentWidget,
        confirm: confirm,
        cancel: cancel,
        onConfirmPressed: onConfirm,
        onCancelPressed: onCancel,
        barrierDismissible: barrierDismissible,
        pickerTitleConfig: PickerTitleConfig(
          titleContent: title,
          showTitle: showTitle,
        ),
      );
      return Theme(data: theme, child: pageChild);
    },
    barrierDismissible: barrierDismissible,
    barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
    barrierColor: Colors.black54,
    transitionDuration: const Duration(milliseconds: 150),
    transitionBuilder: (BuildContext context, Animation<double> animation,
        Animation<double> secondaryAnimation, Widget child) {
      return FadeTransition(
        opacity: CurvedAnimation(
          parent: animation,
          curve: Curves.easeOut,
        ),
        child: child,
      );
    },
    useRootNavigator: true,
  );
}