getFromContext function

NomoDropDownMenuThemeData getFromContext(
  1. BuildContext context,
  2. NomoDropDownMenu widget
)

Implementation

NomoDropDownMenuThemeData getFromContext(
  BuildContext context,
  NomoDropDownMenu widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.dropDownMenuColor ??
          const NomoDropDownMenuColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.dropDownMenuSizing ??
          const NomoDropDownMenuSizingData();
  const globalConstants = NomoDropDownMenuConstants();
  final themeOverride = NomoDropDownMenuThemeOverride.maybeOf(context);
  final themeData = NomoDropDownMenuThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoDropDownMenuThemeData(
    iconColor: widget.iconColor ?? themeData.iconColor,
    dropdownElevation: widget.dropdownElevation ?? themeData.dropdownElevation,
    dropdownColor: widget.dropdownColor ?? themeData.dropdownColor,
    dropdownBorder: widget.dropdownBorder ?? themeData.dropdownBorder,
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    border: widget.border ?? themeData.border,
    minFontSize: widget.minFontSize ?? themeData.minFontSize,
    itemPadding: widget.itemPadding ?? themeData.itemPadding,
    padding: widget.padding ?? themeData.padding,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
  );
}