showLedgerBottomSheet<T> function
Future<T?>
showLedgerBottomSheet<T>({
- required BuildContext context,
- String? title,
- required WidgetBuilder body,
- void onClose()?,
- TextStyle? titleStyle,
- TextAlign? titleAlign,
- BoxConstraints? constraints,
- Color? barrierColor,
- 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,
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,
);