getFromContext function

NomoNotificationThemeData getFromContext(
  1. BuildContext context,
  2. NomoNotification widget
)

Implementation

NomoNotificationThemeData getFromContext(
  BuildContext context,
  NomoNotification widget,
) {
  final globalColorTheme =
      NomoTheme.maybeOf(context)?.componentColors.notificationColor ??
          const NomoNotificationColorData();
  final globalSizingTheme =
      NomoTheme.maybeOf(context)?.componentSizes.notificationSizing ??
          const NomoNotificationSizingData();
  const globalConstants = NomoNotificationConstants();
  final themeOverride = NomoNotificationThemeOverride.maybeOf(context);
  final themeData = NomoNotificationThemeData.from(
          globalColorTheme, globalSizingTheme, globalConstants)
      .copyWith(themeOverride);
  return NomoNotificationThemeData(
    backgroundColor: widget.backgroundColor ?? themeData.backgroundColor,
    foregroundColor: widget.foregroundColor ?? themeData.foregroundColor,
    padding: widget.padding ?? themeData.padding,
    borderRadius: widget.borderRadius ?? themeData.borderRadius,
    spacing: widget.spacing ?? themeData.spacing,
    maxWidth: widget.maxWidth ?? themeData.maxWidth,
  );
}