TextElementComponent.fromDocument constructor
TextElementComponent.fromDocument({
- required DocumentRoot document,
- DocumentStyle? style,
- Vector2? position,
- Vector2? size,
- Vector2? scale,
- double? angle,
- Anchor? anchor,
- List<
Component> ? children, - int priority = 0,
- ComponentKey? key,
Implementation
factory TextElementComponent.fromDocument({
required DocumentRoot document,
DocumentStyle? style,
Vector2? position,
Vector2? size,
Vector2? scale,
double? angle,
Anchor? anchor,
List<Component>? children,
int priority = 0,
ComponentKey? key,
}) {
final effectiveStyle = style ?? DocumentStyle();
final effectiveSize = _coalesceSize(effectiveStyle, size);
final element = document.format(
effectiveStyle,
width: effectiveSize.x,
height: effectiveSize.y,
);
final box = element.boundingBox;
return TextElementComponent(
element: element,
position: position,
documentSize: effectiveSize,
size: box.bottomRight.toVector2(),
scale: scale,
angle: angle,
anchor: anchor,
children: children,
priority: priority,
key: key,
);
}