getFromContext function

NomoElevationThemeData getFromContext(
  1. BuildContext context,
  2. NomoElevation widget
)

Implementation

NomoElevationThemeData getFromContext(
  BuildContext context,
  NomoElevation widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.elevationColor ??
          const NomoElevationColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.elevationSizing ??
          const NomoElevationSizingData();
  final globalConstants =
      NomoTheme.maybeOf(context)?.constants.elevationTheme ??
          const NomoElevationConstants();
  final themeOverride = NomoElevationThemeOverride.maybeOf(context);
  final themeData = NomoElevationThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoElevationThemeData(
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    shadowColor: widget.shadowColor ?? themeData.shadowColor,
    elevation: widget.elevation ?? themeData.elevation,
    animationDuration: widget.animationDuration ?? themeData.animationDuration,
    animationCurve: widget.animationCurve ?? themeData.animationCurve,
  );
}