Flutter Image Map 通过允许用户在图像上定义可点击区域并自定义颜色,实现交互式图像映射。受 HTML 图像映射的启发,它支持跨多个平台的触摸和点击交互。开发者可以轻松创建响应式、视觉吸引人的地图,适用于导航、产品热点或教育工具等应用。该包可无缝集成到 Flutter 项目中,并提供简单的 API 来定义区域和处理用户输入。
适合场景
交互式产品图片
教育图表
基于地图的导航
热点教程
用户界面叠加层
主要特点
可自定义颜色的区域
触摸和点击事件处理
跨平台支持
简单区域定义 API
响应式设计集成
适合对象
寻求交互式图像的UI设计师
教育类应用开发者
电子商务产品展示
Web 和移动应用开发者
交互式文档
使用建议
需要手动设置区域坐标
仅限静态图像交互
不适用于动态或动画地图
性能可能因复杂形状而有所不同
无内置缩放或平移功能
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
flutter_image_map
A simple but (hopefully) useful package that implements the HTML image map standard.
What is an Image Map?
Originally introduced in HTML 3.2 as a replacement for server side imagemaps. Server side image maps were clunky requiring a round trip to the web server to determine where to go based on the coordinates clicked in the image. Thus client side image-maps were born!
An imagemap is a graphic image where a user can click on different parts of the image and be directed to different destinations. imagemaps are made by defining each of the hot areas in terms of their x and y coordinates (relative to the top left hand corner). With each set of coordinates, you specify a link that users will be directed to when they click within the area.
As an example, say you have a map of the World that you wish to act as an image map. Each country could have their hot areas defined on the map to take you to different pages.
Examples
Check out the Example project for a full example code of all the differents ways to define image map regions.
Tools
https://www.image-map.net/ makes it extremely easy to create free HTML based image maps.
There is also a ROI(Region of interest) selecting tool in this project! ROI select tool link: http://www.jiayizhang.me
Website down. Source code of the tool is in this repo (index.html in root folder). Just open it in browser should be fine.
How to use ROI selecting tool
Select an image
Click on the image to add vertices of ROIs
If you want to create a new ROI, click on "New Polygon"
When you are done, press "Export"
It will pop up a dialog
The format of the data is:
List<List>, each sub-list describes a polygon. To adjacent numbers represent a position.
e.g.
[
[x1,y1,x2,y2,x3,y3,...],//Polygon 1
[x1,y1,x2,y2,x3,y3,...],//Polygon 2
[x1,y1,x2,y2,x3,y3,...],//Polygon 3
]