flutter_image_map 0.9.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

flutter_image_map #

A simple but useful(hopefully) package that implemented the image map in HTML.

How to use ROI selecting tool #

  1. Select an image image
  2. Click on the image to add vertices of ROIs image
  3. If you want to create a new ROI, click on "New Polygon" image
  4. When you are done, press "Export" image
  5. It will pop up a dialog image

The format of the data is:
List<List

Change Log #

0.9.2 #

  • Added a ROI selecting tool, and updated relative documents(In README.md).

0.9.1 #

  • Changed the file structure.

0.9.0 #

  • Overhaul the entire class, easier to use.
  • Added example.

0.2.0 #

Version used in my app

0.1.1 #

Add example

0.1.0 #

Very initial pub

example/main.dart

import 'package:flutter/material.dart';
import '../lib/flutter_image_map.dart';

void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return ImageMapExample();
  }
}

class ImageMapExample extends State<MyApp> {
  static List<List<Offset>> points = [
    [
      Offset(178, 152),
      Offset(148, 179),
      Offset(125, 173),
      Offset(129, 191),
      Offset(87, 191),
      Offset(130, 226),
      Offset(121, 270),
      Offset(182, 285),
      Offset(185, 272),
      Offset(219, 276),
      Offset(239, 260),
      Offset(218, 225),
      Offset(245, 186),
    ]
  ];
  final List<Path> polygonRegions = points.map((e){
    Path p = Path();
    p.addPolygon(e, true);
    return p;}
  ).toList();
  final List<Color> colors = List.generate(points.length, (index) => Color.fromRGBO(50, 50, 200, 0.5));

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("flutter_image_map Example")
        ),
        body: ImageMap(
          imagePath: 'assets/worldmap.png',
          imageSize: Size(698,566),
          onTap: (i){
            colors[i] = colors[i]==Color.fromRGBO(50, 50, 200, 0.5)?Color.fromRGBO(50, 200, 50, 0.5):Color.fromRGBO(50, 50, 200, 0.5);
            print(i);
            setState(() {});
          },
          regions: polygonRegions,
          regionColors: colors
        )
      )
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_image_map: ^0.9.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_image_map/flutter_image_map.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_image_map that is a package requiring null.

Health suggestions

Format lib/src/ImageMap.dart.

Run flutter format to format lib/src/ImageMap.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety