Skip to content

A package that implements the JSON Canvas in Dart! You can easily use it in Flutter projects.

License

Notifications You must be signed in to change notification settings

jg-l/json_canvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Features

A package that implements the JSON Canvas in Dart! You can easily use it in Flutter projects.

Usage

import 'package:json_canvas/json_canvas.dart';

// Create your Canvas
final myCanvas = Canvas();

// Create a text node
final myTextNode = TextNode(
    id: 'unique-id-123',
    x: 0,
    y: 0,
    width: 100,
    height: 100,
    text: 'Hello Word!',
);

// Add the node to th
myCanvas.addNode(myTextNode);

final myOtherTextNode = TextNode(
    id: 'unique-id-999',
    x: 100,
    y: 100,
    width: 100,
    height: 100,
    text: 'Hello Again, World!',
);

// Add Another one
myCanvas.addNode(myOtherTextNode);

// Make a connection between the two nodes
myCanvas.addEdge(Edge(
    id: "edge-1",
    fromNode: myTextNode.id,
    toNode: myOtherTextNode.id,
    label: "Connection 1",
));

// Remove a node and all of its connections
myCanvas.removeNode(myTextNode.id);

// Export to JSON Canvas
myCanvas.toJson();

Additional information

About

A package that implements the JSON Canvas in Dart! You can easily use it in Flutter projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages