getFromContext function

NomoSnackBarThemeData getFromContext(
  1. BuildContext context,
  2. NomoSnackBar widget
)

Implementation

NomoSnackBarThemeData getFromContext(
  BuildContext context,
  NomoSnackBar widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.snackBarColor ??
          const NomoSnackBarColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.snackBarSizing ??
          const NomoSnackBarSizingData();
  final globalConstants = NomoTheme.maybeOf(context)?.constants.snackBarTheme ??
      const NomoSnackBarConstants();
  final themeOverride = NomoSnackBarThemeOverride.maybeOf(context);
  final themeData = NomoSnackBarThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoSnackBarThemeData(
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    foregroundColor: widget.foregroundColor ?? themeData.foregroundColor,
    elevation: widget.elevation ?? themeData.elevation,
    border: widget.border ?? themeData.border,
    height: widget.height ?? themeData.height,
    margin: widget.margin ?? themeData.margin,
    spacing: widget.spacing ?? themeData.spacing,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
  );
}