resolve method

AlertStyle resolve(
  1. MarkdownAlertType type,
  2. ColorScheme scheme
)

The style of one type with every remaining default filled in.

The per-type override wins over the shared fields. The result carries no per-type overrides of its own.

Implementation

AlertStyle resolve(MarkdownAlertType type, ColorScheme scheme) {
  final own = overrideFor(type);
  final s = own == null ? this : own.merge(this);
  final dark = scheme.brightness == Brightness.dark;
  final color = s.color ?? _defaultColor(type, dark);
  return AlertStyle(
    color: color,
    backgroundColor:
        s.backgroundColor ?? color.withValues(alpha: dark ? 0.12 : 0.08),
    icon: s.icon ?? _defaultIcon(type),
    iconSize: s.iconSize,
    showIcon: s.showIcon ?? true,
    title: s.title ?? _defaultTitle(type),
    titleStyle: s.titleStyle,
    titleGap: s.titleGap ?? 4,
    textStyle: s.textStyle,
    barWidth: s.barWidth ?? 3,
    borderRadius: s.borderRadius ?? const Radius.circular(6),
    padding: s.padding ?? const EdgeInsetsDirectional.fromSTEB(12, 8, 12, 8),
    margin: s.margin ?? const EdgeInsets.symmetric(vertical: 4),
  );
}