Closed rjanakiramayya closed 4 years ago
You wrap the widget as with a GestureDetector
Widget getNodeText(int i) {
return GestureDetector(
onLongPressStart: (details){
var x = details.globalPosition.dx;
var y = details.globalPosition.dy;
Offset(x,y);
},
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(color: Colors.blue[100], spreadRadius: 1),
],
),
child: Text("Node $i")),
);
}
Thank you Working perfect 💐
On Wed, Aug 26, 2020 at 10:43 AM Nabil Mosharraf notifications@github.com wrote:
You wrap the widget as with a GestureDetector
` Widget getNodeText(int i) { return GestureDetector( onLongPressStart: (details){ var x = details.globalPosition.dx; var y = details.globalPosition.dy; Offset(x,y); },
onPanStart: (details){ var x = details.globalPosition.dx; var y = details.globalPosition.dy; setState(() { builder.setFocusedNode(graph.getNodeAtPosition(i-1)); graph.getNodeAtPosition(i-1).position = Offset(x,y); }); }, onPanUpdate: (details) { var x = details.globalPosition.dx; var y = details.globalPosition.dy; setState(() { builder.setFocusedNode(graph.getNodeAtPosition(i-1)); graph.getNodeAtPosition(i-1).position = Offset(x,y); }); }, onPanEnd: (details){ builder.setFocusedNode(null); }, child: Container( padding: EdgeInsets.all(16), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), boxShadow: [ BoxShadow(color: Colors.blue[100], spreadRadius: 1), ], ), child: Text("Node $i")), );
} `
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nabil6391/graphview/issues/2#issuecomment-680649014, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFK7TFNP3RN2UGSMMKLSDDLSCSKWPANCNFSM4QKV5XLQ .
-- janakiram
Welcome.
how can implement onTap node and onLongtap on node tree graph