SelectableMath.tex constructor
SelectableMath.tex(
- String expression, {
- Key? key,
- TexParserSettings settings = const TexParserSettings(),
- MathOptions? options,
- OnErrorFallback onErrorFallback = defaultOnErrorFallback,
- bool autofocus = false,
- Color? cursorColor,
- Radius? cursorRadius,
- double cursorWidth = 2.0,
- double? cursorHeight,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- bool enableInteractiveSelection = true,
- FocusNode? focusNode,
- MathStyle mathStyle = MathStyle.display,
- double? logicalPpi,
- bool showCursor = false,
- double? textScaleFactor,
- TextSelectionControls? textSelectionControls,
- TextStyle? textStyle,
- ToolbarOptions? toolbarOptions,
SelectableMath builder using a TeX string
expression
will first be parsed under settings
. Then the acquired
SyntaxTree
will be built under a specific options. If ParseException
is thrown or a build error occurs, onErrorFallback
will be displayed.
You can control the options via mathStyle
and textStyle
.
See alse:
Implementation
factory SelectableMath.tex(
String expression, {
Key? key,
TexParserSettings settings = const TexParserSettings(),
MathOptions? options,
OnErrorFallback onErrorFallback = defaultOnErrorFallback,
bool autofocus = false,
Color? cursorColor,
Radius? cursorRadius,
double cursorWidth = 2.0,
double? cursorHeight,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
bool enableInteractiveSelection = true,
FocusNode? focusNode,
MathStyle mathStyle = MathStyle.display,
double? logicalPpi,
bool showCursor = false,
double? textScaleFactor,
TextSelectionControls? textSelectionControls,
TextStyle? textStyle,
ToolbarOptions? toolbarOptions,
}) {
SyntaxTree? ast;
ParseException? parseError;
try {
ast = SyntaxTree(greenRoot: TexParser(expression, settings).parse());
} on ParseException catch (e) {
parseError = e;
} on Object catch (e) {
parseError = ParseException('Unsanitized parse exception detected: $e.'
'Please report this error with correponding input.');
}
return SelectableMath(
key: key,
ast: ast,
autofocus: autofocus,
cursorColor: cursorColor,
cursorRadius: cursorRadius,
cursorWidth: cursorWidth,
cursorHeight: cursorHeight,
dragStartBehavior: dragStartBehavior,
enableInteractiveSelection: enableInteractiveSelection,
focusNode: focusNode,
mathStyle: mathStyle,
logicalPpi: logicalPpi,
onErrorFallback: onErrorFallback,
options: options,
parseException: parseError,
showCursor: showCursor,
textScaleFactor: textScaleFactor,
textSelectionControls: textSelectionControls,
textStyle: textStyle,
toolbarOptions: toolbarOptions,
);
}