approach to identify taps on different sections of a image? (2D point & click)

363 views
Skip to first unread message

Greg

unread,
Jan 12, 2021, 11:56:41 PM1/12/21
to Flutter Development (flutter-dev)
Any advice regarding the approach to build a small app with a background image, and with specific areas on the image (can define using polygon points/coordinates) that would detect a "tap".  For simple 2D point & click game/puzzle?   Few questions if I can: 

Q1 - Would the only approach be to use CustomPaint (canvas), or just use normal non-canvas flutter image widget?   In either case assuming you can detect a tap and get the coordinates of the tap position relative to the image.  Recommend approach?

Q2 - (an aside) - happen to know a tool that would one create a polygon over an image, then export the data in the right format to copy/paste into a flutter app to be used in a "was point clicked within this polygon" routine

Q3 - Any other general advice / links associated with what I'm trying to do (2D point & click) appreciated.  Have not seen many so perhaps Flutter isn't going to be ideally suited for this?   (but would be nice re cross platform and supported by a large company).


Graham Dickinson

unread,
Jan 13, 2021, 1:27:26 AM1/13/21
to Greg, Flutter Development (flutter-dev)
I would look at using a Stack widget with the image as the bottom child and the (invisible, I guess) polygons being positioned, tappable widgets as the rest of the children. There are probably other ways but I have used that method to implement multiple tappable markers on an image. 



--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/3983a1f7-651d-4b66-a859-14ed8940b833n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages