CustomInteractiveViewerController class
A controller for CustomInteractiveViewer that manages transformation state
and provides methods for programmatically manipulating the view.
A controller should be attached to only one viewer at a time using attach.
- Inheritance
-
- Object
- ChangeNotifier
- CustomInteractiveViewerController
Constructors
- CustomInteractiveViewerController({TickerProvider? vsync, double initialScale = 1.0, Offset initialOffset = Offset.zero, double initialRotation = 0.0, double? minScale, double? maxScale, void onEvent(ViewerEvent event)?})
- Creates a controller with initial transformation state.
Properties
- alignment ↔ Alignment
-
Resolved alignment for interaction transforms.
getter/setter pair
- contentSizeGetter ← Size? Function()?
-
Sets the content size provider function
no getter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- interactionBehavior ↔ InteractionBehavior
-
Interaction behavior pipeline.
getter/setter pair
- isAnimating → bool
-
Whether the view is currently animating
no setter
- isPanning → bool
-
Whether the view is currently being panned
no setter
- isScaling → bool
-
Whether the view is currently being scaled
no setter
- maxScale → double?
-
Maximum allowed scale for programmatic zooming.
no setter
- minScale → double?
-
Minimum allowed scale for programmatic zooming.
no setter
- offset → Offset
-
Current offset
no setter
- onEvent → void Function(ViewerEvent event)?
-
Callback for transformation events
final
- rotation → double
-
Current rotation
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → double
-
Current scale factor
no setter
- state → TransformationState
-
Current transformation state
no setter
- transformationMatrix → Matrix4
-
Gets the current transformation matrix
no setter
- viewportSizeGetter ← Size? Function()?
-
Sets the viewport size provider function
no getter
- vsync ↔ TickerProvider?
-
Ticker provider for animations
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
animateTo(
{required TransformationState targetState, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, bool animate = true}) → Future< void> - Animates from the current state to the provided target state.
-
applyInteraction(
InteractionRequest request) → void - Applies an interaction request immediately.
-
attach(
Object owner, {TickerProvider? vsync, double? minScale, double? maxScale, InteractionBehavior? behavior, Alignment? alignment}) → void - Attach this controller to a widget owner.
-
center(
{Size? contentSize, Size? viewportSize, bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Centers the content within the viewport.
-
centerOnRect(
Rect rect, {Size? viewportSize, double? scale, bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Centers the view on a specific rectangle within the content.
-
constrainToBounds(
Size contentSize, Size viewportSize) → void - Ensures content stays within bounds
-
contentToScreenPoint(
Offset contentPoint) → Offset - Convert a point from content coordinates to screen coordinates
-
detach(
Object owner) → void - Detach this controller from the owning widget.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
fitToScreen(
Size contentSize, Size viewportSize, {double padding = 20.0, bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Fit the content to the screen size
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pan(
Offset offset, {bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Pans the view by the given offset
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reset(
{bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Resets the view to initial values
-
resolveInteraction(
InteractionRequest request, {TransformationState? baseState}) → TransformationState - Resolves a target state for the given interaction request.
-
rotate(
double angleRadians, {Offset? focalPoint, bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Rotates the view by the given angle in radians
-
rotateTo(
double angleRadians, {Offset? focalPoint, bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Rotates the view to the given absolute angle in radians
-
screenToContentPoint(
Offset screenPoint) → Offset - Convert a point from screen coordinates to content coordinates
-
setPanning(
bool value) → void - Sets panning state - for internal use
-
setScaleLimits(
{double? minScale, double? maxScale}) → void - Update scale limits used for programmatic zooming.
-
setScaling(
bool value) → void - Sets scaling state - for internal use
-
stopAnimation(
{bool shouldNotify = true}) → void - Stops any active animation. Can be called externally to cancel animations.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{double? newScale, Offset? newOffset, double? newRotation}) → void - Updates the transformation state
-
updateState(
TransformationState newState) → void - Updates the complete transformation state at once
-
zoom(
{required double factor, Offset? focalPoint, bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Future< void> - Zooms the view by the given factor, keeping the focal point visually fixed.
-
zoomToRegion(
Rect region, Size viewportSize, {bool animate = true, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, double padding = 20.0}) → Future< void> - Zooms to a specific region of the content
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited