Math class

Static, non-selectable widget for equations.

Sample usage:

Math.tex(
  r'\frac a b\sqrt[3]{n}',
  mathStyle: MathStyle.display,
  textStyle: TextStyle(fontSize: 42),
)

Compared to SelectableMath, Math will offer a significant performance advantage. So if no selection capability is needed or the equation counts on the same screen is huge, it's preferable to use Math.

Inheritance

Constructors

Math({Key? key, SyntaxTree? ast, MathStyle mathStyle = MathStyle.display, double? logicalPpi, OnErrorFallback onErrorFallback = defaultOnErrorFallback, MathOptions? options, ParseException? parseError, double? textScaleFactor, TextStyle? textStyle})
Math widget default constructor
const
Math.tex(String expression, {Key? key, MathStyle mathStyle = MathStyle.display, TextStyle? textStyle, OnErrorFallback onErrorFallback = defaultOnErrorFallback, TexParserSettings settings = const TexParserSettings(), double? textScaleFactor, MathOptions? options})
Math builder using a TeX string
factory

Properties

ast → SyntaxTree?
The equation to display.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
logicalPpi double?
{@macro flutter_math_fork.math_options.logicalPpi}
final
mathStyle MathStyle
Equation style.
final
onErrorFallback OnErrorFallback
Fallback widget when there are uncaught errors during parsing or building.
final
options MathOptions?
Equation style.
final
parseError ParseException?
Errors generated during parsing.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textScaleFactor double?
Deprecated. Will be removed in a future version of Flutter. Use textScaler instead.
final
textStyle TextStyle?
The style for rendered math analogous to Text.style.
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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
texBreak({int relPenalty = 500, int binOpPenalty = 700, bool enforceNoBreak = true}) → BreakResult<Math>
Line breaking results using standard TeX-style line breaking.
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

Static Methods

defaultOnErrorFallback(FlutterMathException error) Widget
Default fallback function for Math, SelectableMath