Coder Social home page Coder Social logo

flutter_built_path's Introduction

Built Path

This library can help Flutter applications pre-compile SVG Path data into Flutter (dart:ui) Path objects.

For example:

import 'package:built_path_annotations/built_path_annotations.dart';

part 'example.svg_path.g.dart';

@SvgPath('M10 10 L20 20 Z')
Path get diagonalLine => _$diagonalLine;

Will generate Dart code like the following:

part of 'example.dart'

Path __$diagonalLine;
Path get _$diagonalLine => __$diagonalLine ??
  (__$diagonalLine = new Path()
                      ..moveTo(10.0, 10.0)
                      ..lineTo(20.0, 20.0)
                      ..close());

Note that for a Flutter project, you'll have to run flutter packages pub run build_runner build. Follow flutter/flutter#13360, as this syntax may change in a future version of Flutter.

Also note that there will be an error reported about dart:ui until dart-lang/build#733 is resolved, but the code should still get generated.

The example/ folder contains a full working example for Flutter, including the build.yaml and generated code.

flutter_built_path's People

Contributors

dnfield avatar engineerdeep avatar piotrszych avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_built_path's Issues

Error flutter pub get with Dart SDK 2.9.2 Flutter 1.20.4

Really love this package, but meet problem when using it

The current Dart SDK version is 2.9.2.

Because build_runner >=1.10.2 requires SDK version >=2.10.0-0.0 <3.0.0 and build_runner >=1.10.0 <1.10.2 depends on build >=1.3.0 <1.4.0, build_runner >=1.10.0 requires build >=1.3.0 <1.4.0.
And because every version of built_path depends on build ^0.12.7, build_runner >=1.10.0 is incompatible with built_path.
So, because clarinet_mini depends on both built_path ^0.1.0 and build_runner ^1.10.0, version solving failed.
pub get failed (1; So, because clarinet_mini depends on both built_path ^0.1.0 and build_runner ^1.10.0, version solving failed.)
Process finished with exit code 1

Running from SVG file possible

Thanks for making this. It's a huge time saver.
But I looked at the demo and the SVG was inline and it would be great to be able to reference a folder of SVG files as part of the code gen.

Do you think it's also useful ?

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.