GemAnimation constructor
GemAnimation({
- AnimationType type = AnimationType.none,
- int duration = 0,
- void onCompleted()?,
Construct a new GemAnimation.
Creates an animation descriptor and registers an internal progress listener
that will invoke onCompleted when the native animation finishes. This constructor
is suitable for passing directly to SDK methods that accept an animation object.
Parameters
type: The animation type. Defaults to AnimationType.none.duration: Animation duration in milliseconds. A value of0uses the SDK's default duration.onCompleted: Optional callback invoked after the native animation completes.
Implementation
GemAnimation({
this.type = AnimationType.none,
this.duration = 0,
this.onCompleted,
}) {
_progressListener = EventDrivenProgressListener();
GemKitPlatform.instance.registerEventHandler(
_progressListener.id,
_progressListener,
);
_progressListener.registerOnCompleteWithData((_, _, _) {
if (onCompleted != null) {
onCompleted!();
}
});
}