diff --git a/lib/main_graph.dart b/lib/main_graph.dart index 4074a509..bd072e2d 100644 --- a/lib/main_graph.dart +++ b/lib/main_graph.dart @@ -4,8 +4,6 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:touchable/touchable.dart'; - class MyExampleWidget extends StatefulWidget { @override _MyExampleWidgetState createState() => _MyExampleWidgetState(); @@ -56,65 +54,22 @@ class _MyExampleWidgetState extends State { } class MyPainter extends CustomPainter { - final BuildContext context; final Graph graph; - MyPainter(this.context, this.graph) : super(repaint: graph); + MyPainter(this.graph) : super(repaint: graph); @override void paint(Canvas canvas, Size size) { - var myCanvas = TouchyCanvas(context, canvas); - // Draw all the edges for (var edge in graph.edges) { - myCanvas.drawLine( + canvas.drawLine( Offset(edge.a.x, edge.a.y), Offset(edge.b.x, edge.b.y), Paint() ..color = Colors.grey ..strokeWidth = 2.5, - onPanUpdate: (detail) { + /*onPanUpdate: (detail) { print('Edge ${edge.a.label} -> ${edge.b.label} Swiped'); - }, - ); - } - - // Draw all the nodes - for (var node in graph.nodes) { - myCanvas.drawCircle( - Offset(node.x, node.y), - 20, - Paint()..color = Colors.orange, - onPanStart: (tapdetail) { - node.pressed = true; - print('$node Pan start - $tapdetail'); - - node.x = tapdetail.localPosition.dx; - node.y = tapdetail.localPosition.dy; - - graph.notify(); - }, - onPanDown: (tapdetail) { - node.pressed = false; - print('$node PanEnd - $tapdetail'); - node.x = tapdetail.localPosition.dx; - node.y = tapdetail.localPosition.dy; - - graph.notify(); - }, - onPanUpdate: (tapdetail) { - print('$node PanUpdate - $tapdetail'); - - node.x = tapdetail.localPosition.dx; - node.y = tapdetail.localPosition.dy; - graph.notify(); - }, - /* - onTapDown: (details) { - print("$node onTapDown - $details"); - }, - onTapUp: (details) { - print("$node onTapUp - $details"); },*/ ); } @@ -528,6 +483,9 @@ class _GraphStackViewState extends State { @override Widget build(BuildContext context) { var children = []; + + children.add(CustomPaint(painter: MyPainter(widget.graph))); + for (var node in widget.graph.nodes) { var w = Positioned( child: GestureDetector( diff --git a/pubspec.lock b/pubspec.lock index 31705d03..9468ffaa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -924,13 +924,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.5+1" - touchable: - dependency: "direct main" - description: - name: touchable - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.7" tuple: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 7ba51002..1d81bba3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,7 +56,6 @@ dependencies: receive_sharing_intent: ^1.4.0+2 in_app_purchase: ^0.3.4+1 flutter_plugin_android_lifecycle: ^1.0.8 # for fixing the build - touchable: ^0.1.7 dev_dependencies: flutter_launcher_icons: "^0.7.2"