graph_builder 1.0.4 copy "graph_builder: ^1.0.4" to clipboard
graph_builder: ^1.0.4 copied to clipboard

A flexible Flutter widget for visualizing acyclic graphs (e.g. skill trees) with zoom, pan, and animated interactivity.

📊 Graph Builder #

A highly customizable, interactive Flutter widget for building and visualizing acyclic graphs (like skill trees, organizational charts, or dependency diagrams).

Built on top of graphview, GraphBuilder supports:

  • ✅ Multiple parents per node (true DAG support)
  • 🔍 Pan & Zoom with InteractiveViewer
  • 🧠 Tap and hover animations
  • 📌 Tooltips
  • 🧯 Optional cycle detection to prevent invalid graphs

🚀 Features #

  • Supports any data model (<T>) — just implement == and hashCode
  • Visualize any Directed Acyclic Graph with multiple parents
  • Interactive gestures: zoom, pan, tap, and hover
  • Animated scaling on interaction
  • Tooltip display for nodes
  • Optional cycle detection (helpful for safe game skill trees)

🚀 Screenshot #

image


✨ Example Usage #

final List<SkillModel> rootSkills = [backstab, ambush];

GraphBuilder<SkillModel>(
  data: rootSkills,
  getChildren: (node) => node.dependencies,
  nodeBuilder: (skill) => Container(
    padding: const EdgeInsets.all(8),
    decoration: BoxDecoration(
      color: Colors.indigo.shade700,
      borderRadius: BorderRadius.circular(6),
    ),
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Text(skill.name, style: TextStyle(color: Colors.white)),
        Text('Cost: ${skill.cost}', style: TextStyle(color: Colors.white70)),
      ],
    ),
  ),
)

📦 Installation #

dependencies:
  graph_builder:
    git:
      url: https://github.com/Mohamed50/graph_builder.git

🔧 Constructor Parameters #

Parameter Description
data List of root nodes (List<T>)
nodeBuilder Function to return a widget for each node
getChildren Function to retrieve children/dependencies of a node
width, height Canvas dimensions inside the InteractiveViewer
siblingSeparation Space between sibling nodes (horizontal)
levelSeparation Space between levels (vertical)
boundaryMargin Edge margin inside the viewer
enableCycleCheck Throws an exception if cycles are detected (default: true)


🧑‍💻 Author #

Mohamed Elamin (Fifty)


📄 License #

MIT — Use it, fork it, vibe with it.

Built for flexibility. Perfect for skill trees, progression graphs, or anything DAG-shaped.

2
likes
140
points
354
downloads

Publisher

unverified uploader

Weekly Downloads

A flexible Flutter widget for visualizing acyclic graphs (e.g. skill trees) with zoom, pan, and animated interactivity.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, graphview

More

Packages that depend on graph_builder