CodeDisplay class

A widget that displays formatted code with customizable styles and decorations.

Inheritance

Constructors

CodeDisplay(String code, {CodeDisplayColorThemes? codeColorTheme, double? width, double? height, bool? showCopyButton, Widget? copyButtonReplacement, BoxDecoration? boxDecoration, TextStyle? commentTextStyle, TextStyle? baseTextStyle, TextStyle? classTextStyle, TextStyle? keywordTextStyle, TextStyle? stringTextStyle, TextStyle? punctuationTextStyle, EdgeInsets? padding, Key? key})
Creates a CodeDisplay widget.

Properties

baseTextStyle TextStyle?
The base text style.
final
boxDecoration BoxDecoration?
The box decoration of the code display.
final
classTextStyle TextStyle?
The text style for classes.
final
code String
The code to be displayed.
final
codeColorTheme CodeDisplayColorThemes?
The color theme for syntax highlighting.
final
commentTextStyle TextStyle?
The text style for comments.
final
copyButtonReplacement Widget?
If showCopyButton is set, by default an elevated button will be shown. To provide a custom copy copy button, this property can be used.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the code display.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keywordTextStyle TextStyle?
The text style for keywords.
final
padding EdgeInsets?
The padding of the container.
final
punctuationTextStyle TextStyle?
The text style for punctuation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCopyButton bool?
Determines if copy for code button should be shown.
final
stringTextStyle TextStyle?
The text style for strings.
final
width double?
The width of the code display.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
getBoxDecoration(BoxDecoration? boxDecoration, Color? color) BoxDecoration
Returns a BoxDecoration with the specified color if the boxDecoration is not null, otherwise returns a BoxDecoration with the specified color, or an empty BoxDecoration.
getTextStyle(TextStyle? textStyle, Color? color) TextStyle
Returns a TextStyle with the specified color if the textStyle is not null, otherwise returns a TextStyle with the specified color, or an empty TextStyle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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