getFromContext function

NomoTextButtonThemeData getFromContext(
  1. BuildContext context,
  2. NomoTextButton widget
)

Implementation

NomoTextButtonThemeData getFromContext(
  BuildContext context,
  NomoTextButton widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.textButtonColor ??
          const NomoTextButtonColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.textButtonSizing ??
          const NomoTextButtonSizingData();
  const globalConstants = NomoTextButtonConstants();
  final themeOverride = NomoTextButtonThemeOverride.maybeOf(context);
  final themeData = NomoTextButtonThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoTextButtonThemeData(
    foregroundColor: widget.foregroundColor ?? themeData.foregroundColor,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
    padding: widget.padding ?? themeData.padding,
  );
}