Skip to content

Proposal: Decouple boundary logic from InteractiveViewer #174052

@khoadng

Description

@khoadng

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions