InlineCodeStyle class

How inline code is drawn.

Every field is optional and falls back to a value derived from the ambient ColorScheme, so the common case is a one-liner:

GptMarkdown(
  text,
  inlineCodeStyle: InlineCodeStyle(
    fontFamily: 'GeistMono',
    color: Colors.pink,
    backgroundColor: Colors.pink.withValues(alpha: 0.06),
    borderColor: Colors.pink.withValues(alpha: 0.2),
  ),
)

Set it on GptMarkdownThemeData instead to restyle every GptMarkdown in the app at once.

Annotations

Constructors

InlineCodeStyle({String? fontFamily, String? fontFamilyPackage, List<String>? fontFamilyFallback, double? fontSizeFactor, FontWeight? fontWeight, Color? color, Color? backgroundColor, Color? borderColor, double? borderWidth, Radius? borderRadius, EdgeInsets? padding, BoxHeightStyle? boxHeightStyle})
Creates an inline code style. Null fields keep the resolved default.
const

Properties

backgroundColor Color?
Chip fill. Defaults to a tint of ColorScheme.onSurface — 10% on a light scheme, 14% on a dark one, since a light tint over a dark surface reads weaker than the same tint over a light one.
final
borderColor Color?
Chip outline. Defaults to a tint of ColorScheme.onSurface — 28% light, 34% dark.
final
borderRadius Radius?
Corner radius. Defaults to Radius.circular(4).
final
borderWidth double?
Outline thickness. Defaults to 1.0. Zero disables the outline.
final
boxHeightStyle BoxHeightStyle?
How the height of each line fragment is measured.
final
color Color?
Colour of the code text. Defaults to ColorScheme.onSurface.
final
fontFamily String?
The monospace family. Defaults to the bundled JetBrains Mono, the same family fenced code blocks use.
final
fontFamilyFallback List<String>?
Fallback families, used when a glyph is missing from fontFamily.
final
fontFamilyPackage String?
The package fontFamily is shipped in.
final
fontSizeFactor double?
Code font size relative to the surrounding text. Defaults to 0.94.
final
fontWeight FontWeight?
Weight of the code text. Defaults to the surrounding weight.
final
hashCode int
The hash code for this object.
no setteroverride
padding EdgeInsets?
Space between the text and the chip edge. Defaults to EdgeInsets.symmetric(vertical: 1) — no horizontal padding, so the chip hugs the code and the surrounding words keep their normal spacing.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

applyTo(TextStyle base) TextStyle
base with this style's typography applied.
copyWith({String? fontFamily, String? fontFamilyPackage, List<String>? fontFamilyFallback, double? fontSizeFactor, FontWeight? fontWeight, Color? color, Color? backgroundColor, Color? borderColor, double? borderWidth, Radius? borderRadius, EdgeInsets? padding, BoxHeightStyle? boxHeightStyle}) InlineCodeStyle
A copy of this style with the given fields replaced.
merge(InlineCodeStyle? other) InlineCodeStyle
This style, with any unset field taken from other, field by field.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(ColorScheme scheme) InlineCodeStyle
This style with every null field filled in from scheme.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

lerp(InlineCodeStyle? a, InlineCodeStyle? b, double t) InlineCodeStyle?
Linearly interpolates between two inline code styles.