Giter Site home page Giter Site logo

dholasain / interactable_svg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from husseincopol/interactable_svg

0.0 0.0 0.0 289 KB

A flutter package for interact with different parts of a SVG.

License: Other

C++ 36.96% C 2.52% Objective-C 0.07% Kotlin 0.22% Dart 21.97% Swift 2.05% HTML 3.21% CMake 33.01%

interactable_svg's Introduction

interactable SVG

A flutter package for interacting with different parts of an SVG.

example

Getting Started

In the pubspec.yaml of your Flutter project, add the following dependency:

dependencies:
  ...
  interactable_svg: any

In your library file add the following import:

import 'package:interactable_svg/interactable_svg/interactable_svg.dart';

Usage

        InteractiveViewer(
          scaleEnabled: true,
          panEnabled: true,
          constrained: true,
          child:InteractableSvg(
            svgAddress: "assets/floor_map.svg",
            onChanged: (region) {
              setState(() {
                selectedRegion = region;

              });
            },

            width: double.infinity,
            height: double.infinity,
            toggleEnable: true,
            dotColor: Colors.black,
            selectedColor: Colors.red.withOpacity(0.5),
            strokeColor: Colors.blue,
            unSelectableId: "bg",
            centerDotEnable:true ,
            centerTextEnable:true ,
            strokeWidth: 2.0,
            centerTextStyle: const TextStyle(fontSize: 12,color: Colors.black),


          ),
        )

Also your SVG must follow the following pattern.For better understanding see the example SVG.

'.* id="(.*)" name="(.*)" .* d="(.*)"'
for example:
  <path id="118" name="room 9" class="st0" d="M55 508h101.26v330H55Z" />;

Props

props types description
key Key?
svgAddress String Address of an SVG like "assets/floor_map.svg"
width double? SVG width. Default value is double.infinity
height double? SVG height. Default value is double.infinity
strokeColor Color? Color of the region borders
selectedColor Color? Color of the selected region
strokeWidth double? Width of the region borders
toggleEnable bool? Region selecting act as like toggle button
onChanged Function(Region? region) Returns new region value when it changed
unSelectableId String? Makes that region wi that id non selective
centerDotEnable bool? place a dot in the center of the region
centerTextEnable bool? place name of the region at the center of the region
centerTextStyle TextStyle? Style of name of the region
dotColor Color? Color of the dot in the center of the region

Author

interactable_svg's People

Contributors

husseincopol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.