getFromContext function

NomoCardThemeData getFromContext(
  1. BuildContext context,
  2. NomoCard widget
)

Implementation

NomoCardThemeData getFromContext(
  BuildContext context,
  NomoCard widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.cardColor ??
          const NomoCardColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.cardSizing ??
          const NomoCardSizingData();
  const globalConstants = NomoCardConstants();
  final themeOverride = NomoCardThemeOverride.maybeOf(context);
  final themeData = NomoCardThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoCardThemeData(
    shadowColor: widget.shadowColor ?? themeData.shadowColor,
    border: widget.border ?? themeData.border,
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    elevation: widget.elevation ?? themeData.elevation,
    offset: widget.offset ?? themeData.offset,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
    padding: widget.padding ?? themeData.padding,
    margin: widget.margin ?? themeData.margin,
  );
}