showSafaehDialog<T> function
Future<T?>
showSafaehDialog<T>({
- required BuildContext context,
- required WidgetBuilder builder,
- bool barrierDismissible = true,
- Color? barrierColor,
- bool fadeScale = true,
- double railWidthOf(
- BuildContext context
- Duration? motion,
- Curve? enterCurve,
- Curve? exitCurve,
- SafaehTransition? transition,
- SafaehFloatingAppearance? floatingAppearance,
- SafaehRouteOptions? route,
Centered dialog. railWidthOf is accepted for API compatibility and does
not shift the panel — floating dialogs stay in the full viewport.
Unlike showSafaeh, this does not morph into a phone bottom sheet. SafaehRouteOptions.slideUp, SafaehRouteOptions.phonePlacement, and SafaehRouteOptions.tabletBreakpoint are ignored.
Implementation
Future<T?> showSafaehDialog<T>({
required BuildContext context,
required WidgetBuilder builder,
bool barrierDismissible = true,
Color? barrierColor,
bool fadeScale = true,
double Function(BuildContext context)? railWidthOf,
Duration? motion,
Curve? enterCurve,
Curve? exitCurve,
SafaehTransition? transition,
bool useRootNavigator = true,
SafaehFloatingAppearance? floatingAppearance,
SafaehRouteOptions? route,
}) {
final tokens = SafaehTheme.of(context);
final resolvedBarrier = route?.barrierDismissible ?? barrierDismissible;
final resolvedRoot = route?.useRootNavigator ?? useRootNavigator;
final resolvedMotion = safaehResolvedMotion(
context,
motion ?? route?.motion ?? tokens.motion,
);
final resolvedFloatingAppearance =
floatingAppearance ??
route?.floatingAppearance ??
tokens.floatingAppearance;
final theme = Theme.of(context);
return showGeneralDialog<T>(
context: context,
useRootNavigator: resolvedRoot,
barrierDismissible: resolvedBarrier,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor:
barrierColor ?? theme.colorScheme.scrim.withValues(alpha: 0.32),
transitionDuration: resolvedMotion,
pageBuilder: (ctx, animation, secondaryAnimation) {
return _SafaehDialogHost(
builder: builder,
barrierDismissible: resolvedBarrier,
fadeScale: fadeScale,
openAnimation: animation,
motion: resolvedMotion,
enterCurve: enterCurve ?? route?.enterCurve ?? tokens.enterCurve,
exitCurve: exitCurve ?? route?.exitCurve ?? tokens.exitCurve,
railWidthOf: railWidthOf ?? route?.railWidthOf,
maxWidth: route?.maxWidth ?? tokens.dialogMaxWidth,
maxHeight: route?.maxHeight ?? MediaQuery.sizeOf(context).height * 0.85,
transition: transition ?? route?.fadeScale,
useRootNavigator: resolvedRoot,
floatingAppearance: resolvedFloatingAppearance,
);
},
transitionBuilder: (ctx, animation, secondaryAnimation, child) => child,
);
}