CodeBlockStyle class
How a fenced code block is drawn.
Every field is optional. An unset field falls back to the theme, then to the value the package used before this style existed — so setting one field changes one thing and nothing else moves.
A style on the widget wins over the theme per field, not per object.
- Annotations
Constructors
- CodeBlockStyle({Color? backgroundColor, Color? borderColor, double? borderWidth, Radius? borderRadius, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? headerPadding, String? fontFamily, String? fontFamilyPackage, double? fontSize, Color? textColor, bool? showLanguageLabel, TextStyle? languageStyle, bool? showCopyButton, String? copyLabel, String? copiedLabel})
-
Creates a CodeBlockStyle. Null fields defer to the theme, then to the default.
const
Properties
- backgroundColor → Color?
-
Panel fill. Defaults to
ColorScheme.onInverseSurface.final - borderColor → Color?
-
Panel outline. Defaults to none.
final
- borderRadius → Radius?
-
Corner rounding. Defaults to 8.
final
- borderWidth → double?
-
Outline thickness. Defaults to 1 when a colour is set.
final
- copiedLabel → String?
-
Copy button text after copying. Defaults to
Copied!.final - copyLabel → String?
-
Copy button text. Defaults to
Copy code.final - fontFamily → String?
-
Code font. Defaults to the bundled JetBrains Mono.
final
- fontFamilyPackage → String?
-
Package the font ships in.
final
- fontSize → double?
-
Code size. Defaults to the surrounding size.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- headerPadding → EdgeInsetsGeometry?
-
Space around the header row.
final
- languageStyle → TextStyle?
-
Style of that label.
final
- padding → EdgeInsetsGeometry?
-
Space around the code. Defaults to 16.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showCopyButton → bool?
-
Whether the copy button is shown. Defaults to true.
final
- showLanguageLabel → bool?
-
Whether the language is shown. Defaults to true.
final
- textColor → Color?
-
Code colour. Defaults to the surrounding colour.
final
Methods
-
copyWith(
{Color? backgroundColor, Color? borderColor, double? borderWidth, Radius? borderRadius, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? headerPadding, String? fontFamily, String? fontFamilyPackage, double? fontSize, Color? textColor, bool? showLanguageLabel, TextStyle? languageStyle, bool? showCopyButton, String? copyLabel, String? copiedLabel}) → CodeBlockStyle - A copy with the given fields replaced.
-
merge(
CodeBlockStyle? other) → CodeBlockStyle -
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) → CodeBlockStyle - This style with every remaining default filled in.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
lerp(
CodeBlockStyle? a, CodeBlockStyle? b, double t) → CodeBlockStyle? - Linearly interpolates between two styles.