showLedgerBottomSheet<T> function

Future<T?> showLedgerBottomSheet<T>({
  1. required BuildContext context,
  2. String? title,
  3. required WidgetBuilder body,
  4. void onClose(
    1. BuildContext
    )?,
  5. TextStyle? titleStyle,
  6. TextAlign? titleAlign,
  7. BoxConstraints? constraints,
  8. Color? barrierColor,
  9. bool useRootNavigator = false,
  10. bool isScrollControlled = true,
  11. RouteSettings? routeSettings,
  12. Color? backgroundColor,
  13. Clip? clipBehavior,
  14. double? elevation,
  15. EdgeInsets? padding,
  16. double? titleBottomSpacing,
  17. bool enableDrag = true,
  18. bool isDismissable = true,
  19. bool showCloseButton = true,
  20. ShapeBorder? shape,
  21. AnimationController? transitionAnimationController,
  22. Alignment confettiAlignment = Alignment.center,
  23. Widget? illustrationWidget,
  24. bool showTitle = true,
})

Implementation

Future<T?> showLedgerBottomSheet<T>({
  required BuildContext context,
  String? title,
  required WidgetBuilder body,
  void Function(BuildContext)? onClose,
  TextStyle? titleStyle,
  TextAlign? titleAlign,
  BoxConstraints? constraints,
  Color? barrierColor,
  bool useRootNavigator = false,
  bool isScrollControlled = true,
  RouteSettings? routeSettings,
  Color? backgroundColor,
  Clip? clipBehavior,
  double? elevation,
  EdgeInsets? padding,
  double? titleBottomSpacing,
  bool enableDrag = true,
  bool isDismissable = true,
  bool showCloseButton = true,
  ShapeBorder? shape,
  AnimationController? transitionAnimationController,
  Alignment confettiAlignment = Alignment.center,
  Widget? illustrationWidget,
  bool showTitle = true,
}) =>
    showModalBottomSheet<T>(
      context: context,
      barrierColor: barrierColor ?? context.grey.shade700.withOpacity(0.5),
      builder: (dialogContext) => Theme(
        data: dialogContext.theme,
        child: Padding(
          padding: (padding ?? (Spacing.lds200.y + Spacing.lds250.x)) +
              EdgeInsets.only(bottom: MediaQuery.of(dialogContext).viewInsets.bottom),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              if (enableDrag) ...[
                Container(
                  height: Spacing.lds50.value,
                  width: Spacing.lds300.value * 2 + Spacing.lds25.value,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(Spacing.lds50.value),
                    color: dialogContext.grey.shade200,
                  ),
                ),
                Spacing.lds200.yBox,
              ],
              if (illustrationWidget != null) illustrationWidget,
              if (showTitle) ...[
                Row(
                  mainAxisAlignment: title != null
                      ? MainAxisAlignment.spaceBetween
                      : MainAxisAlignment.end,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    if (titleAlign == TextAlign.center && showCloseButton)
                      Spacing.lds600.xBox,
                    if (title != null)
                      Expanded(
                        child: CustomText.semantics(
                          title,
                          textAlign: titleAlign ?? TextAlign.left,
                          style: titleStyle ??
                              dialogContext.title3.bold
                                  .copyWith(color: dialogContext.baseBlack),
                        ),
                      ),
                    if (showCloseButton) Spacing.lds200.xBox,
                    if (showCloseButton)
                      Padding(
                        padding: Spacing.lds50.top,
                        child: CustomInkWell(
                          semanticsLabel: 'Close Dialog Sheet Icon',
                          context: dialogContext,
                          trackLabel: 'Close Dialog Sheet Icon',
                          onTap: onClose != null
                              ? () => onClose.call(dialogContext)
                              : () {
                                  Navigator.pop(dialogContext);
                                },
                          enabled: true,
                          child: Container(
                            width: Spacing.lds300.value + Spacing.lds50.value,
                            decoration: BoxDecoration(
                              shape: BoxShape.circle,
                              color: dialogContext.grey.shade50,
                            ),
                            child: Center(
                              child: Padding(
                                padding: Spacing.lds50.all,
                                child: Icon(
                                  Icons.close,
                                  size: Spacing.lds200.value,
                                  color: dialogContext.grey.shade700,
                                ),
                              ),
                            ),
                          ),
                        ),
                      ),
                  ],
                ),
              ],
              if (titleBottomSpacing != null)
                SizedBox(height: titleBottomSpacing)
              else
                Spacing.lds150.yBox,
              Builder(
                builder: body,
              ),
            ],
          ),
        ),
      ),
      isScrollControlled: isScrollControlled,
      constraints: constraints,
      useRootNavigator: useRootNavigator,
      routeSettings: routeSettings,
      backgroundColor: backgroundColor,
      clipBehavior: clipBehavior,
      elevation: elevation,
      enableDrag: enableDrag,
      isDismissible: isDismissable,
      shape: shape,
      useSafeArea: true,
      transitionAnimationController: transitionAnimationController,
    );