getFromContext function

NomoRouteBodyThemeData getFromContext(
  1. BuildContext context,
  2. NomoRouteBody widget
)

Implementation

NomoRouteBodyThemeData getFromContext(
  BuildContext context,
  NomoRouteBody widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.routeBodyColor ??
          const NomoRouteBodyColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.routeBodySizing ??
          const NomoRouteBodySizingData();
  const globalConstants = NomoRouteBodyConstants();
  final themeOverride = NomoRouteBodyThemeOverride.maybeOf(context);
  final themeData = NomoRouteBodyThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoRouteBodyThemeData(
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    background: widget.background ?? themeData.background,
    padding: widget.padding ?? themeData.padding,
    scrollBarThickness:
        widget.scrollBarThickness ?? themeData.scrollBarThickness,
    scrollBarRadius: widget.scrollBarRadius ?? themeData.scrollBarRadius,
    maxContentWidth: widget.maxContentWidth ?? themeData.maxContentWidth,
  );
}