PrismCodeViewStyle class
Visual configuration for PrismCodeView.
Includes a ready-made color scheme for built-in languages, or bring your own by mapping each TokenKind to a TextStyle.
- Annotations
Constructors
-
PrismCodeViewStyle({TextStyle? textStyle, Map<
TokenKind, TextStyle> tokenStyles = defaultTokenStyles, Color? background, BorderRadius borderRadius = const BorderRadius.all(Radius.circular(8)), EdgeInsetsGeometry? padding, TextStyle? lineNumberStyle, bool showLineNumbers = false, bool enableCopy = true, bool wrap = false}) -
Creates a style.
const
Properties
- background → Color?
-
Code block background color. Defaults to the theme's surface variant.
final
- borderRadius → BorderRadius
-
Corner radius of the code block.
final
- enableCopy → bool
-
Whether to show a copy-to-clipboard button.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- lineNumberStyle → TextStyle?
-
Style applied to the gutter line numbers.
final
- padding → EdgeInsetsGeometry?
-
Padding inside the code block.
Padding inside the code block. Defaults to
PrismTokens.spaceMd.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLineNumbers → bool
-
Whether to render a gutter with line numbers.
final
- textStyle → TextStyle?
-
Base text style (font, size). Token styles inherit from it.
final
-
tokenStyles
→ Map<
TokenKind, TextStyle> -
Colors per TokenKind.
final
- wrap → bool
-
Whether long lines wrap instead of scrolling horizontally.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolve(
BuildContext context) → PrismCodeViewStyle -
Returns a copy with unset fields resolved against
context. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
darkTokenStyles
→ const Map<
TokenKind, TextStyle> - A dark-theme palette (e.g. One-Dark inspired).
-
defaultTokenStyles
→ const Map<
TokenKind, TextStyle> - A pleasant default light-theme palette.