nabil6391 / graphview

Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
MIT License
424 stars 117 forks source link

please help clickable node #2

Closed rjanakiramayya closed 4 years ago

rjanakiramayya commented 4 years ago

how can implement onTap node and onLongtap on node tree graph

nabil6391 commented 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")),
);
}
rjanakiramayya commented 4 years ago

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

nabil6391 commented 4 years ago

Welcome.