Code Monkey home page Code Monkey logo

flutter_force_directed_graph's Introduction

Flutter Force Directed Graph

Flutter Force Directed Graph is a high-performance, customizable Flutter package that helps you create force directed graph visualizations in your Flutter applications.

pub CI codecov

Features

  • Create a force directed graph with customizable nodes and edges.
  • Add, remove or update nodes and edges dynamically.
  • Use the provided ForceDirectedGraphWidget for easy integration into your app.
  • Built-in gesture detection for nodes, edges and graph panning and zooming.
  • Comes with a ForceDirectedGraphController for easy management of the graph’s state.

Demo

control.gif performance.gif position.gif scale.gif serialization.gif

Getting Started

Installation

Add the following in your pubspec.yaml file under dependencies:

dependencies:
  flutter_force_directed_graph: ^1.0.6

Then install it by running flutter pub get in your terminal.

Usage

Here’s a basic example on how to use the ForceDirectedGraphWidget and ForceDirectedGraphController.

import 'package:flutter_force_directed_graph/flutter_force_directed_graph.dart';

ForceDirectedGraphController<int> controller = ForceDirectedGraphController();

final fdgWidget = ForceDirectedGraphWidget(
  controller: controller,
  onDraggingStart: (data) {
    print('Dragging started on node $data');
  },
  onDraggingEnd: (data) {
    print('Dragging ended on node $data');
  },
  onDraggingUpdate: (data) {
    print('Dragging updated on node $data');
  },
  nodesBuilder: (context, data) {
    return Container(
      width: 24,
      height: 24,
      alignment: Alignment.center,
      color: Colors.red,
      child: Text('$data'),
    );
  },
  edgesBuilder: (context, a, b, distance) {
    return Container(
      width: distance,
      height: 16,
      color: Colors.blue,
      alignment: Alignment.center,
      child: Text('$a <-> $b'),
    );
  },
);

For a more detailed example, please view the example directory in this repository. This example includes additional features and gesture support.

Contributing

We welcome contributions! If you find a bug or want a feature that isn't yet implemented, feel free to open an issue. If you want to contribute code, feel free to open a PR.

If you have any questions or need further guidance, please open an issue and we'll be glad to help out.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

flutter_force_directed_graph's People

Contributors

skywalkerdarren avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.