ModelViewer class
Flutter widget for rendering interactive 3D models.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ModelViewer
Constructors
-
ModelViewer({Key? key, Color backgroundColor = Colors.transparent, required String src, String? alt, bool? ar, List<
String> ? arModes, String? arScale, bool? autoRotate, int? autoRotateDelay, bool? autoPlay, bool? cameraControls, String? iosSrc, VoidCallback? onLoadError, VoidCallback? onLoadSuccess, Widget? loadingView, String? rotationPerSecond, bool? openCache, ModelViewController? modelViewController, bool? openGesture = false, bool? openInteractionPrompt, bool? autoZoom}) -
const
Properties
- alt → String?
-
Configures the model with custom text that will be used to describe the
model to viewers who use a screen reader or otherwise depend on additional
semantic context to understand what they are viewing.
final
- ar → bool?
-
Enable the ability to launch AR experiences on supported devices.
final
-
arModes
→ List<
String> ? -
A prioritized list of the types of AR experiences to enable, if available.
final
- arScale → String?
-
Controls the scaling behavior in AR mode in Scene Viewer. Set to "fixed"
to disable scaling of the model, which sets it to always be at 100% scale.
Defaults to "auto" which allows the model to be resized.
final
- autoPlay → bool?
-
If this is true and a model has animations, an animation will
automatically begin to play when this attribute is set (or when the
property is set to true). The default is false.
final
- autoRotate → bool?
-
Enables the auto-rotation of the model.
final
- autoRotateDelay → int?
-
Sets the delay before auto-rotation begins. The format of the value is a
number in milliseconds. The default is 3000.
final
- autoZoom → bool?
-
按比例缩放
final
- backgroundColor → Color
-
The background color for the model viewer.
final
- cameraControls → bool?
-
Enables controls via mouse/touch when in flat view.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iosSrc → String?
-
The URL to a USDZ model which will be used on supported iOS 12+ devices
via AR Quick Look.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingView → Widget?
-
final
- modelViewController → ModelViewController?
-
final
- onLoadError → VoidCallback?
-
final
- onLoadSuccess → VoidCallback?
-
final
- openCache → bool?
-
final
- openGesture → bool?
-
final
- openInteractionPrompt → bool?
-
final
- rotationPerSecond → String?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- src → String
-
The URL or path to the 3D model. This parameter is required.
Only glTF/GLB models are supported.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ModelViewer> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
-
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