AnySyntaxHighlighter class
widget AnySyntaxHighlighter this widget will provide the syntax highlighting to input text
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AnySyntaxHighlighter
Constructors
-
AnySyntaxHighlighter(String text, {Key? key, TextAlign textAlign = TextAlign.start, TextDirection? textDirection, bool softWrap = true, TextOverflow overflow = TextOverflow.clip, double textScaleFactor = 1.0, int? maxLines, Locale? locale, StrutStyle? strutStyle, TextWidthBasis textWidthBasis = TextWidthBasis.parent, TextHeightBehavior? textHeightBehavior, double padding = 2, double margin = 0, bool isSelectableText = false, AnySyntaxHighlighterTheme theme = const AnySyntaxHighlighterTheme(), double? fontSize, String? useGoogleFont, Set<
String> reservedWordSets = const {'java', 'python', 'c', 'cpp', 'c#', 'dart', 'go', 'javascript', 'r', 'swift', 'bash', 'ruby'}, bool lineNumbers = false, bool hasCopyButton = false, Icon copyIcon = const Icon(Icons.copy_rounded, color: Colors.white), Decoration? overrideDecoration}) -
AnySyntaxHighlighter Widget constructor
const
Properties
- copyIcon → Icon
-
custom icon for copu button
final
- fontSize → double?
-
set fontSize using this parameter
final
- hasCopyButton → bool
-
enable copy button widget at top right corner
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSelectableText → bool
-
if set true will build a SelectableText.rich() widget, builds RichText otherwise
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- lineNumbers → bool
-
if true an additional line numbers widget will appear in left hand side
final
- locale → Locale?
-
to be passed as locale parameter of RichText widget
final
- margin → double
-
padding and margin for outer container widget
final
- maxLines → int?
-
to be passed as maxLines parameter of RichText widget
final
- overflow → TextOverflow
-
to be passed as textOverflow parameter of RichText widget
default value is TextOverflow.clip
final
- overrideDecoration → Decoration?
-
override theme's box decoration
final
- padding → double
-
padding and margin for outer container widget
final
-
reservedWordSets
→ Set<
String> -
set of reserved words for this instance of AnySyntaxHighlighter
this allows to create language specific highlighting
user can add desired reserved words for a language by using
ReservedWords.userReservedWords['language_name'] = {'keyword1', 'keyword2'}
make sure to import corresponding library before using itfinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- softWrap → bool
-
to be passed as softWrap parameter of RichText widget
final
- strutStyle → StrutStyle?
-
to be passed as strutStyle parameter of RichText widget
final
- text → String
-
input text code
final
- textAlign → TextAlign
-
to be passed as textAlign parameter of RichText widget
final
- textDirection → TextDirection?
-
to be passed as textDirection parameter of RichText widget
final
- textHeightBehavior → TextHeightBehavior?
-
to be passed as textHeightBehavior parameter of RichText widget
final
- textScaleFactor → double
-
to be passed as textScaleFactor parameter of RichText widget
final
- textWidthBasis → TextWidthBasis
-
to be passed as textWidthBasis parameter of RichText widget
final
- theme → AnySyntaxHighlighterTheme
-
theme for highlighting code
final
- useGoogleFont → String?
-
choose google fonts you wish to use
if it's value is null no google fonts will be used
if not null it will use GoogleFonts.getFont(useGoogleFont) to get
that font
final
Methods
-
assertions(
) → void - assertions before building widget
-
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
-
floatingCopyButton(
) → Widget - floating copy button widget
-
getTokenByString(
String value) → Token - this functions initiates the starting properties of a token , rest of the properties are calculated on basis of previous and next token
-
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
-
tokenizer(
String input) → List< Token> - creates and returns list of tokens from String input
-
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