VapView class
A widget that displays Tencent VAP (Video Animation Player) animations.
VapView is a Flutter widget that renders VAP animations with support for:
- Multiple scale types (fitCenter, centerCrop, fitXY)
- Loop control (no repeat, finite repeats, infinite loop)
- Audio control (mute/unmute)
- Dynamic content injection via VAP tags
- Cross-platform support (iOS and Android)
The widget provides a VapController through the onViewCreated callback for programmatic control of animation playback and content management.
Example usage:
VapView(
scaleType: ScaleType.fitCenter,
repeat: -1, // Infinite loop
mute: false,
vapTagContents: {
'username': TextContent('John Doe'),
'avatar': ImageURLContent('https://example.com/avatar.jpg'),
},
onViewCreated: (controller) {
controller.setAnimListener(
onVideoStart: () => print('Animation started'),
onVideoComplete: () => print('Animation completed'),
);
controller.playAsset('animations/sample.mp4');
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- VapView
Constructors
-
VapView({Key? key, ScaleType scaleType = ScaleType.fitCenter, int repeat = 0, bool mute = false, Map<
String, VAPContent> ? vapTagContents, dynamic onViewCreated(VapController)?}) -
Creates a VapView widget.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mute → bool
-
Whether the animation should be muted during playback.
final
- onViewCreated → dynamic Function(VapController)?
-
Callback invoked when the platform view is created.
final
- repeat → int
-
Number of times the animation should repeat.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleType → ScaleType
-
How the video should be scaled within the view bounds.
final
-
vapTagContents
→ Map<
String, VAPContent> ? -
Initial dynamic content for VAP tags.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< VapView> -
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, int wrapWidth = 65}) → 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