-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Open
Labels
c: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework team
Description
Use case
InteractiveViewer
has boundary logic baked in, which makes it inflexible and blocks important features. The current approach forces clamping inside constraints, with no way for users to define custom boundary behavior.
- [#57698](InteractiveViewer should support rotation #57698): Rotation requires complex, fragile math that attempt to fit the content into the boundary box. Most common use cases don't want rotated content to be box-clamped.
- [#58042](InteractiveViewer overscroll #58042): Overscroll/overpanning cannot be implemented with the current API because correction is applied immediately and hardcoded into the transform pipeline
- [#145725](Add the ability to define a pan area different from the zoom area for InteractiveViewer #145725): Users cannot implement standard photo-viewer behavior, where panning is constrained to the child/image rect instead of the widget constraints.
Proposal
Introduce a lower-level widget (e.g. RawInteractiveViewer
or UnconstrainedInteractiveViewer
) that:
- Handles gesture detection and transform math.
- Does not enforce boundaries.
- Expose the raw transform before boundary correction, so users can implement their own policy (e.g. clamp to parent, clamp to child rect, allow overscroll, soft bounce-back, etc.). This goes beyond TransformationController, which only exposes the post-corrected transform.
InteractiveViewer
could then be built on top of this with the current “clamp to constraints” behavior to avoid breaking changes.
MichealReed, LongCatIsLooong, RocksteadyDog and khoadng
Metadata
Metadata
Assignees
Labels
c: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework team