getFromContext function

NomoInputThemeData getFromContext(
  1. BuildContext context,
  2. NomoInput widget
)

Implementation

NomoInputThemeData getFromContext(
  BuildContext context,
  NomoInput widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.inputColor ??
          const NomoInputColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.inputSizing ??
          const NomoInputSizingData();
  final globalConstants = NomoTheme.maybeOf(context)?.constants.inputTheme ??
      const NomoInputConstants();
  final themeOverride = NomoInputThemeOverride.maybeOf(context);
  final themeData = NomoInputThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoInputThemeData(
    background: widget.background ?? themeData.background,
    errorColor: widget.errorColor ?? themeData.errorColor,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
    border: widget.border ?? themeData.border,
    selectedBorder: widget.selectedBorder ?? themeData.selectedBorder,
    errorBorder: widget.errorBorder ?? themeData.errorBorder,
    selectedErrorBorder:
        widget.selectedErrorBorder ?? themeData.selectedErrorBorder,
    margin: widget.margin ?? themeData.margin,
    padding: widget.padding ?? themeData.padding,
    duration: widget.duration ?? themeData.duration,
    curve: widget.curve ?? themeData.curve,
    titleSpacing: widget.titleSpacing ?? themeData.titleSpacing,
  );
}