resolve method

InlineCodeStyle resolve(
  1. ColorScheme scheme
)

This style with every null field filled in from scheme.

Implementation

InlineCodeStyle resolve(ColorScheme scheme) {
  final hasCustomFamily = fontFamily != null;
  final isDark = scheme.brightness == Brightness.dark;
  return InlineCodeStyle(
    fontFamily: fontFamily ?? kGptMarkdownMonoFontFamily,
    fontFamilyPackage:
        fontFamilyPackage ??
        (hasCustomFamily ? null : kGptMarkdownFontPackage),
    fontFamilyFallback: fontFamilyFallback,
    fontSizeFactor: fontSizeFactor ?? 0.94,
    fontWeight: fontWeight,
    color: color ?? scheme.onSurface,
    // Tints have to be stronger on a dark scheme: the same alpha of a light
    // ink over a dark ground separates less than dark ink over a light one.
    backgroundColor:
        backgroundColor ??
        scheme.onSurface.withValues(alpha: isDark ? 0.14 : 0.10),
    borderColor:
        borderColor ??
        scheme.onSurface.withValues(alpha: isDark ? 0.34 : 0.28),
    borderWidth: borderWidth ?? 1.0,
    borderRadius: borderRadius ?? const Radius.circular(4),
    padding: padding ?? const EdgeInsets.symmetric(vertical: 1),
    boxHeightStyle: boxHeightStyle ?? ui.BoxHeightStyle.tight,
  );
}