getFromContext function

NomoDialogThemeData getFromContext(
  1. BuildContext context,
  2. NomoDialog widget
)

Implementation

NomoDialogThemeData getFromContext(
  BuildContext context,
  NomoDialog widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.dialogColor ??
          const NomoDialogColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.dialogSizing ??
          const NomoDialogSizingData();
  const globalConstants = NomoDialogConstants();
  final themeOverride = NomoDialogThemeOverride.maybeOf(context);
  final themeData = NomoDialogThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoDialogThemeData(
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    elevation: widget.elevation ?? themeData.elevation,
    contentSpacing: widget.contentSpacing ?? themeData.contentSpacing,
    widthRatio: widget.widthRatio ?? themeData.widthRatio,
    margin: widget.margin ?? themeData.margin,
    padding: widget.padding ?? themeData.padding,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
  );
}