Skip to content

Expose InteractiveViewer properties on GraphView.builder - #156

Open
4rthurmonteiro wants to merge 2 commits into
nabil6391:masterfrom
4rthurmonteiro:feat/interactive_viewer_expose
Open

Expose InteractiveViewer properties on GraphView.builder#156
4rthurmonteiro wants to merge 2 commits into
nabil6391:masterfrom
4rthurmonteiro:feat/interactive_viewer_expose

Conversation

@4rthurmonteiro

Copy link
Copy Markdown

Summary

  • GraphView.builder wraps its content in an InteractiveViewer to provide pan/zoom, but its configuration (zoom limits, pan/scale enablement, interaction callbacks, etc.) was hardcoded. This PR exposes the most commonly used InteractiveViewer properties directly on GraphView.builderclipBehavior, panAxis, boundaryMargin, minScale, maxScale, interactionEndFrictionCoefficient, onInteractionStart/Update/End, panEnabled, scaleEnabled, scaleFactor, alignment, and trackpadScrollCausesScale — so consumers can customize pan/zoom behavior without reaching into the widget tree.
  • Defaults match the previous hardcoded values, so this is backward compatible.
  • Converted several previously mutable GraphView fields (panAnimationDuration, toggleAnimationDuration, initialNode, autoZoomToFit, delegate) to final, since they were only ever set through the constructor.
  • Updated Matrix4 transform calls (translate/scale) to their newer translateByDouble/scaleByDouble equivalents, and fixed Edge.operator== to take a non-nullable Object per the standard Object.== signature.
  • Ran dart format across the touched files (GraphView.dart, Graph.dart, SugiyamaAlgorithm.dart, SugiyamaEdgeRenderer.dart, and example files), which accounts for most of the diff noise.
  • Documented the new properties with a usage example in README.md.

Test plan

  • flutter test passes
  • Manually verified pan/zoom still works with default settings in the example app
  • Manually verified scaleEnabled: false / panEnabled: false disable the respective gestures

4rthurmonteiro and others added 2 commits July 2, 2026 16:23
- Added customization options for InteractiveViewer in README.md
- Cleaned up analysis_options.yaml by removing unnecessary comments
- Updated force_directed_graphview.dart to ensure proper state initialization
- Refined graph_cluster_animated.dart by making graph and algorithm final
- Updated pubspec.lock with new package versions
- Improved Graph.dart and GraphView.dart for better readability and structure
- Enhanced SugiyamaAlgorithm.dart and SugiyamaEdgeRenderer.dart for code clarity
- Removed unused code in controller_tests.dart and graph_test.dart
New backward-compatible InteractiveViewer properties on GraphView.builder.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hiSandog

hiSandog commented Jul 3, 2026

Copy link
Copy Markdown

Exposing the InteractiveViewer knobs makes sense, but this PR also includes formatting noise and unrelated equality/API cleanups, which will make review harder. It may be worth splitting the mechanical dart format / Edge.operator== changes from the new builder parameters. For the feature itself, a small widget test that passes non-default minScale, maxScale, panEnabled, and scaleEnabled through GraphView.builder would prove the wrapper preserves the previous defaults while honoring overrides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants