getFromContext function

PrimaryNomoButtonThemeData getFromContext(
  1. BuildContext context,
  2. PrimaryNomoButton widget
)

Implementation

PrimaryNomoButtonThemeData getFromContext(
  BuildContext context,
  PrimaryNomoButton widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.primaryButtonColor ??
          const PrimaryNomoButtonColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.primaryButtonSizing ??
          const PrimaryNomoButtonSizingData();
  const globalConstants = PrimaryNomoButtonConstants();
  final themeOverride = PrimaryNomoButtonThemeOverride.maybeOf(context);
  final themeData = PrimaryNomoButtonThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return PrimaryNomoButtonThemeData(
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    foregroundColor: widget.foregroundColor ?? themeData.foregroundColor,
    elevation: widget.elevation ?? themeData.elevation,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
    padding: widget.padding ?? themeData.padding,
  );
}