getFromContext function

NomoVerticalMenuThemeData getFromContext(
  1. BuildContext context,
  2. NomoVerticalMenu widget
)

Implementation

NomoVerticalMenuThemeData getFromContext(
  BuildContext context,
  NomoVerticalMenu widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.verticalMenuColor ??
          const NomoVerticalMenuColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.verticalMenuSizing ??
          const NomoVerticalMenuSizingData();
  const globalConstants = NomoVerticalMenuConstants();
  final themeOverride = NomoVerticalMenuThemeOverride.maybeOf(context);
  final themeData = NomoVerticalMenuThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoVerticalMenuThemeData(
    border: widget.border ?? themeData.border,
    selectedBorder: widget.selectedBorder ?? themeData.selectedBorder,
    foreground: widget.foreground ?? themeData.foreground,
    background: widget.background ?? themeData.background,
    selectedBackground:
        widget.selectedBackground ?? themeData.selectedBackground,
    selectedForeground:
        widget.selectedForeground ?? themeData.selectedForeground,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
    hPadding: widget.hPadding ?? themeData.hPadding,
    itemSpacing: widget.itemSpacing ?? themeData.itemSpacing,
    spacing: widget.spacing ?? themeData.spacing,
    height: widget.height ?? themeData.height,
    iconSize: widget.iconSize ?? themeData.iconSize,
  );
}