diagram_editor 0.0.2 diagram_editor: ^0.0.2 copied to clipboard
A flutter diagram editor library that provides DiagramEditor widget and a possibility to customize all editor design and behavior.
import 'package:diagram_editor/diagram_editor.dart';
import 'package:flutter/material.dart';
import 'my_policy_set.dart';
void main() => runApp(DiagramApp());
class DiagramApp extends StatefulWidget {
@override
_DiagramAppState createState() => _DiagramAppState();
}
class _DiagramAppState extends State<DiagramApp> {
MyPolicySet myPolicySet = MyPolicySet();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Stack(
children: [
Container(color: Colors.grey),
Padding(
padding: EdgeInsets.all(16),
child: Container(
color: Colors.green,
child: DiagramEditor(
diagramEditorContext: DiagramEditorContext(
policySet: myPolicySet,
),
),
),
),
GestureDetector(
onTap: () => myPolicySet.deleteAllComponents(),
child: Container(
width: 64,
height: 32,
color: Colors.red,
child: Center(child: Text('delete all')),
),
),
],
),
),
),
);
}
}