Giter Site home page Giter Site logo

biocarl / drawing_animation Goto Github PK

View Code? Open in Web Editor NEW
479.0 14.0 116.0 353 KB

A Flutter library for gradually painting SVG path objects on canvas (drawing line animation).

Home Page: https://pub.dartlang.org/packages/drawing_animation

License: BSD 2-Clause "Simplified" License

Java 0.19% Objective-C 0.05% Dart 32.87% Ruby 2.12% Shell 0.44% Kotlin 0.17% Swift 1.67% CMake 21.73% C++ 33.71% C 1.96% HTML 5.09%
flutter dart svg svg-animations svg-path

drawing_animation's Introduction

drawing_animation Pub awesome

From static SVG assets See more examples in the showcasing app.

Dynamically created from Path objects which are animated over time
more coming soon
...

The rendering library exposes a central widget called AnimatedDrawing which allows to render SVG paths (via AnimatedDrawing.svg) or Flutter Path objects (via AnimatedDrawing.paths) in a drawing like fashion.

Getting Started - AnimatedDrawing.svg

To get started with the drawing_animation package you need a valid Svg file. Currently only simple path elements without transforms are supported (see Supported SVG specifications)

  1. Add dependency in your pubspec.yaml
dependencies:
  drawing_animation: ^1.0.1
  1. Add the SVG asset
assets:
  - assets/my_drawing.svg
  1. Use the widget

    An AnimatedDrawing widget can be initiated in two ways:

    1. Simplified - without animation controller (See Example_01)

      By default every animation repeats infinitely. For running an animation only once you can use a callback to set run to false after the first animation cycle completed (see field onFinish).

      AnimatedDrawing.svg(
        "assets/my_drawing.svg",
        run: this.run,
        duration: new Duration(seconds: 3),
        onFinish: () => setState(() {
          this.run  = false;
        }),
      )
    2. Standard - with animation controller (See Example_02)

      The simplified version will be sufficient in most of the use cases. If you wish to controll the animation furthermore or you want to syncronize it with other existing animations, you might consider using an custom animation controller:

      AnimatedDrawing.svg(
        "assets/test.svg",
        controller: this.controller,
      )
  2. Check out examples in the examples folder. It seems that antialising for the Paint/Canvas is switched off when using debug mode. For pretty results use flutter run --release.

Getting Started - AnimatedDrawing.paths (still experimental)

By providing Path objects directly to the widget, elements can be changed dynamically, even during the animation. The internal data structure is rebuild every time the state changes, therefore the animation performance might suffer if the amount of elements in paths is very high (see Limitations). More examples will be provided soon (for now see Example_01 and Example_04).

AnimatedDrawing.paths(
    [
    ///Path objects
    ],
    paints:[
    ///Paint objects (optional), specifies a [Paint] object for each [Path] element in `paths`.
    ],
    run: this.run,
    duration: new Duration(seconds: 3),
    onFinish: () => setState(() {
      this.run  = false;
    }),
  )

Current limitations:

As stated, for every state change of the widget, the internal data structure for the path objects is rebuilt. When the amount of provided path objects is high and a custom animationOrder is defined (which triggers a sorting operation over the data structure) it can result in lags. This becomes especially apparent when the state is rebuild at 60fps by another animation (e.g. rotating the path objects at every frame). Any suggestions on how to elegantly solve this are very welcome :-)

Option list

Here is increasingly growing list with all available parameters and their visual effect.

Field Type
 ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ 
Example
 ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ 
lineAnimation

Specifies in which way the path elements are drawn to the canvas. When allAtOnce selected all path segments are drawn simultaneously. oneByOne paints every path segment one after another.
LineAnimation.oneByOne
LineAnimation.allAtOnce
animationOrder

Denotes the order in which the path elements are drawn to canvas when lineAnimation is set to LineAnimation.oneByOne. When no animationOrder is specified it defaults to the same order specified in the Svg asset or path array (PathOrder.original).
PathOrders.original
PathOrders.bottomToTop
PathOrders.decreasingLength
PathOrders.increasingLength
PathOrders.leftToRight
PathOrders.rightToLeft
PathOrders.topToBottom
animationCurve

Easing curves are used to adjust the rate of change of an animation over time, allowing them to speed up and slow down, rather than moving at a constant rate. See Flutter docs.
Curves.linear
Curves.elasticOut
Curves.bounceInOut
Curves.decelerate
Other
onFinish

Callback when one animation cycle is finished. By default every animation repeats infinitely.
onPaint

Callback when a complete path is painted to the canvas. Returns with the relative index and the Path element itself.
range

Start and stop a animation from a certain moment in time by defining a AnimationRange object.
scaleToViewport

Path objects are scaled to the available viewport while maintaining the aspect ratio. Defaults to true.

Supported SVG specifications

  • Only path elements (<path d="M3m1....">) are supported for now. I'm currently considering to add flutter_svg as dependency for more complete SVG parsing.
  • Attributes
    • stroke, only Hex-Color without alpha for now
    • stroke-width
    • style, but only the both fields above
  • No transforms are supported, yet.

How can I use my own SVG files?

A lot of tools can convert existing SVG files to the supported format. For example with Inkscape:

  1. Select all objects and ungroup till there is no group left (Ctrl+U)
  2. Convert selection to paths: Path>>Object to Path and hit save
  3. Afterwards remove transforms with svgo or the webversion svgomg.
  4. Now it should work, if not feel free to write an issue!

Examples:

  • Example_01: Set up simplfied AnimatedDrawing with AnimatedDrawing.svg and AnimatedDrawing.paths
  • Example_02: Set up AnimatedDrawing with an custom animation controller
  • Example_03: Small artistic showcasing app with vectorizied drawings of old book scans provided by the British Library
  • Example_04: Show how to create Gifs with high resolution using the debug field.

Todo

  • Better test coverage
  • Improve SVG parsing capabilities
    • Circles, rect etc.
    • Better color parsing incl. alpha for hex code and RGB(A)
    • Subsitute SVG parsing logic with an mature parsering library as flutter_svg
  • Provide a way to overwrite color/brush etc. for AnimatedDrawing.svg - maybe also over paints object?
  • Define a [PathOrder] which maintains each Path and only sorts them relative to each other
  • Improve performance AnimatedDrawing.paths, for every rebuild all provided paths have to be parsed again. Is there a way to check Path-Objects for equality like Keys for widget? Idea: implementing a proxy for Path which creates a unique hash when command evoked
  • Showcase: write "drawing_animation" in different ways + 3 cirlcles + color it and one gif and put it at the top
  • Showcase: Create fractals with L-Systems
  • AnimatedDrawing.paths:
    • Provide some kind of fixed boundingBox since Paths and the overall bounding box can dynamically change (e.g. rotating circle pulses in size)
    • Also custom viewport

Credits

Thank you to maxwellito for his vivus project which served me as initial inspiration for this library. Thank you also to dnfield for the path_parsing library.

Credits to the British Library for their awesome collection of old book scans which I used for the showcasing app.

drawing_animation's People

Contributors

abbasghomi avatar biocarl avatar fasihferoze avatar mgallo avatar musaddiq625 avatar nana-kwame-bot 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drawing_animation's Issues

NoSuchMethodError: The getter 'isNotEmpty' was called on null

Hi I'm trying to run example apps (in this case example_01) and following error occurs:

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following NoSuchMethodError was thrown building AnimatedDrawing(dirty, state:
flutter: _AnimatedDrawingWithTickerState#93952(ticker active)):
flutter: The getter 'isNotEmpty' was called on null.
flutter: Receiver: null
flutter: Tried calling: isNotEmpty
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      Object.noSuchMethod (dart:core/runtime/lib/object_patch.dart:50:5)
flutter: #1      _AbstractAnimatedDrawingState.getPathPainter 
package:drawing_animation/src/drawing_widget.dart:387
flutter: #2      _AbstractAnimatedDrawingState.getCustomPaint 
package:drawing_animation/src/drawing_widget.dart:427
flutter: #3      _AnimatedDrawingWithTickerState.build 
package:drawing_animation/src/drawing_widget.dart:562
flutter: #4      StatefulElement.build 
package:flutter/…/widgets/framework.dart:3830
flutter: #5      ComponentElement.performRebuild 
package:flutter/…/widgets/framework.dart:3741
flutter: #6      Element.rebuild 
package:flutter/…/widgets/framework.dart:3564
flutter: #7      ComponentElement._firstBuild 

This is my flutter doctor output (censored a bit)

[✓] Flutter (Channel beta, v1.3.8, on Mac OS X 10.14.3 18D109, locale pl-PL)
    • Flutter version 1.3.8 at /Users/.../Library/flutter
    • Framework revision e5b1ed7a7f (3 weeks ago), 2019-03-06 14:23:37 -0800
    • Engine revision f4951df193
    • Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at ...
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: ...
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
    • Android Studio at ...
    • Flutter plugin version 33.1.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.32.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.24.0

[✓] Connected device (1 available)
    • iPhone XS • ... • ios • iOS 12.1 (simulator)

• No issues found!

Do you know what may be the issue here?

Unhandled Exception: NoSuchMethodError: The getter 'isNotEmpty' was called on null.

Flutter Application Displaying white screen after installing.... same result on emulator and device

main.dart import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:testing_tabs/BookingHistory.dart';

void main() {
runApp(
MultiProvider(child: MyApp()),
);
}

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
initialRoute: '/',
routes: {
'/': (context) => BookingHistory(),
},
);
}
}

Logs

ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The getter 'isNotEmpty' was called on null.
[ ] E/flutter (20114): Receiver: null
[ ] E/flutter (20114): Tried calling: isNotEmpty
[ ] E/flutter (20114): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
[ ] E/flutter (20114): #1 new Nested (package:nested/nested.dart:71:25)
[ ] E/flutter (20114): #2 new MultiProvider (package:provider/src/provider.dart:121:8)
[ ] E/flutter (20114): #3 main (package:testing_tabs/main.dart:7:10)
[ ] E/flutter (20114): #4 _runMainZoned.. (dart:ui/hooks.dart:140:25)
[ ] E/flutter (20114): #5 _rootRun (dart:async/zone.dart:1354:13)
[ ] E/flutter (20114): #6 _CustomZone.run (dart:async/zone.dart:1258:19)
[ ] E/flutter (20114): #7 _runZoned (dart:async/zone.dart:1788:10)
[ ] E/flutter (20114): #8 runZonedGuarded (dart:async/zone.dart:1776:12)
[ ] E/flutter (20114): #9 _runMainZoned. (dart:ui/hooks.dart:133:5)
[ ] E/flutter (20114): #10 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:283:19)
[ ] E/flutter (20114): #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
[ ] E/flutter (20114):

Flutter Doctor

Slashs-MacBook-Pro:testing_tabs slashglobal$ flutter doctor -v
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.1 20C69 darwin-x64, locale en-US)
• Flutter version 2.0.1 at /Users/slashglobal/flutter
• Framework revision c5a4b4029c (2 weeks ago), 2021-03-04 09:47:48 -0800
• Engine revision 40441def69
• Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/slashglobal/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.0

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (2 available)
• SM A305F (mobile) • R58M78MVZNJ • android-arm64 • Android 10 (API 29)
• iPhone 12 Pro Max (mobile) • F02E3034-BDF8-4BDB-8044-1A715AF853CD • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)

• No issues found!

SVG being cropped

Hello, thank you for the great library.

I'm bumping into a weird situation like this: I'm working on a kanji drawing library. Here is the sample SVG:

<svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109">
<g id="kvg:StrokePaths_09924" style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;">
<g id="kvg:09924" kvg:element="">
	<g id="kvg:09924-g1" kvg:element="" kvg:variant="true" kvg:original="" kvg:position="left" kvg:radical="general">
		<path id="kvg:09924-s1" kvg:type="" d="M29.76,11.14c0.06,0.67,0.27,1.78-0.11,2.68c-2.46,5.9-9.55,17.45-19.59,26.14"/>
		<path id="kvg:09924-s2" kvg:type="㇔/㇏" d="M32.27,16.83c4.43,1.83,11.44,7.53,12.54,10.38"/>
		<path id="kvg:09924-s3" kvg:type="" d="M22.25,31.66c0.36,0.15,1.02,0.19,1.39,0.15c2.3-0.25,9.87-2.17,12.1-2c0.6,0.05,0.96,0.07,1.27,0.14"/>
		<path id="kvg:09924-s4" kvg:type="" d="M18.27,39.97c0.39,0.82,0.78,1.75,0.78,2.84c0,1.09-0.13,56.6,0,57.69"/>
		<path id="kvg:09924-s5" kvg:type="" d="M19.19,41.67c2.2-0.14,17.91-2.77,19.92-2.93c1.67-0.14,2.74,1.51,2.61,2.31c-0.26,1.64-2.47,19.28-3.02,22.91"/>
		<path id="kvg:09924-s6" kvg:type="㇐a" d="M19.58,52.26c2.97,0,17.36-2.4,20.72-2.4"/>
		<path id="kvg:09924-s7" kvg:type="㇐a" d="M19.44,64.08c6.06-0.59,11.81-1.65,19.35-2.15"/>
		<path id="kvg:09924-s8" kvg:type="㇐c" d="M19.39,77.1c3.73-0.26,15.96-2.78,19.57-2.6c0.97,0.05,1.56,0.07,2.05,0.15"/>
		<path id="kvg:09924-s9" kvg:type="㇐c" d="M19.89,90.92c3.73-0.26,16.46-2.26,20.07-2.08c0.97,0.05,1.56,0.07,2.05,0.15"/>
	</g>
	<g id="kvg:09924-g2" kvg:element="" kvg:position="right">
		<g id="kvg:09924-g3" kvg:element="" kvg:position="top">
			<path id="kvg:09924-s10" kvg:type="" d="M49.87,23.33c2.71,2.52,6.65,9.67,7.38,12.19"/>
			<path id="kvg:09924-s11" kvg:type="" d="M87,18.53c0.54,0.55,0.14,2.77-0.35,3.62c-0.49,0.85-4.86,5.98-7.3,7.96"/>
			<path id="kvg:09924-s12" kvg:type="" d="M67.28,12.25c0.99,0.42,1.55,2.48,1.49,3.18C66.92,35.86,64.17,45.55,48,54.5"/>
			<path id="kvg:09924-s13" kvg:type="" d="M67.76,28.83C74.81,37.69,83.35,46.7,88,50.39c1.46,1.16,1.8,1.03,3,1.33"/>
		</g>
		<g id="kvg:09924-g4" kvg:element="" kvg:position="bottom">
			<path id="kvg:09924-s14" kvg:type="" d="M49,61.25c4.51,2.47,7.31,8.6,8.54,11.08"/>
			<path id="kvg:09924-s15" kvg:type="" d="M88.71,57.15c0.54,1.33-0.06,2.95-0.68,4.11c-0.62,1.16-4.92,5.51-8,8.21"/>
			<path id="kvg:09924-s16" kvg:type="" d="M68.58,51c0.67,0.75,1.09,2.62,1.06,3.41C68.5,81.25,56.5,91.25,43.18,97.5"/>
			<path id="kvg:09924-s17" kvg:type="" d="M69.39,68.71c7.71,10.63,17.06,21.44,22.15,25.87c1.6,1.39,1.97,1.24,3.28,1.59"/>
		</g>
	</g>
</g>
</g>
<g id="kvg:StrokeNumbers_09924" style="font-size:8;fill:#808080">
	<text transform="matrix(1 0 0 1 22.50 10.50)">1</text>
	<text transform="matrix(1 0 0 1 35.50 16.50)">2</text>
	<text transform="matrix(1 0 0 1 27.50 28.50)">3</text>
	<text transform="matrix(1 0 0 1 12.50 48.50)">4</text>
	<text transform="matrix(1 0 0 1 20.50 38.50)">5</text>
	<text transform="matrix(1 0 0 1 23.11 49.50)">6</text>
	<text transform="matrix(1 0 0 1 23.17 60.50)">7</text>
	<text transform="matrix(1 0 0 1 23.13 73.50)">8</text>
	<text transform="matrix(1 0 0 1 23.12 87.50)">9</text>
	<text transform="matrix(1 0 0 1 46.50 20.50)">10</text>
	<text transform="matrix(1 0 0 1 79.50 15.50)">11</text>
	<text transform="matrix(1 0 0 1 56.50 10.50)">12</text>
	<text transform="matrix(1 0 0 1 79.50 38.50)">13</text>
	<text transform="matrix(1 0 0 1 51.25 61.50)">14</text>
	<text transform="matrix(1 0 0 1 78.50 58.58)">15</text>
	<text transform="matrix(1 0 0 1 58.25 53.50)">16</text>
	<text transform="matrix(1 0 0 1 78.50 78.50)">17</text>
</g>
</svg>

It is this character: 餤

However when I use the lib to draw it, some strokes are cropped at corners like so:

image

Where should I look at? I think it's the problem with canvas size and I would like to extend it a bit more, but no clue still.

Loading SVG via network not possible

At the moment, the library allows loading assets via assets;
We would love to be able to load SVG via web. At the moment; as a workaround we do the following:

Modify drawing_animation.dart:
Add the line

export 'src/parser.dart';

Load the file via network, and parse the content as:

  SvgParser example(filePath) {
     SvgParser parser = SvgParser();
     parser.loadFromString(File(filePath).readAsStringSync());
     return parser;
  }

Then use it as:

AnimatedDrawing.paths(svgParser.getPaths())

While loading file via network might not be a priority, we would like parser.dart to be available to use meanwhile.

Erase animation for SVGs

Hi there
I am using this package and I found it helpful. I liked the way it traces the path and shows the drawing effect. I am facing a problem in doing something similar technically but opposite of this animation i.e. erase animation. I want to show an SVG and then trace the path of SVG to erase it.
Can you help me with this either by providing resources or implementing it in the same package?

Only hex color format currently supported

Hello,

I'm trying to use these animated icons in my app : https://github.com/basmilius/weather-icons

I'm getting this error :

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Only hex color format currently supported. String:  url(#a)
SvgParser.parseColor (package:drawing_animation/src/parser.dart:28:7)
SvgParser.loadFromString.<anonymous closure> (package:drawing_animation/src/parser.dart:91:19)
Iterable.forEach (dart:core/iterable.dart:346:35)
SvgParser.loadFromString (package:drawing_animation/src/parser.dart:63:10)
SvgParser.loadFromFile (package:drawing_animation/src/parser.dart:124:5)
<asynchronous suspension>

Problem with colors

Hi @biocarl!

I tried the example3 but the page with the color example doesn't seem to be working, the lines painting it black. :(

Thanks!

Build getting failed with Flutter version 2.10.2

``

lib\main.dart:1
/C:/Users/user/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/drawing_animation-1.0.1/lib/src/abstract_drawing_state.dart:68:31: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.

  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Users/user/Documents/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    package:flutter/…/scheduler/binding.dart:1
    Try calling using ?. instead.
    SchedulerBinding.instance.addPostFrameCallback((_) {
    ^^^^^^^^^^^^^^^^^^^^
    /C:/Users/user/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/drawing_animation-1.0.1/lib/src/drawing_state.dart:12:35: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.

  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Users/user/Documents/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    package:flutter/…/scheduler/binding.dart:1
    Try calling using ?. instead.
    SchedulerBinding.instance.addPostFrameCallback((_) {

                                ^^^^^^^^^^^^^^^^^^^^
    

/C:/Users/user/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/drawing_animation-1.0.1/lib/src/drawing_state_with_ticker.dart:14:35: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.

  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Users/user/Documents/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    package:flutter/…/scheduler/binding.dart:1
    Try calling using ?. instead.
    SchedulerBinding.instance.addPostFrameCallback((_) {

Unsupported operation: Only hex color format currently supported. String: url(#a)

E/flutter (28747): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Only hex color format currently supported. String:  url(#a)
E/flutter (28747): #0      SvgParser.parseColor
parser.dart:28
E/flutter (28747): #1      SvgParser.loadFromString.<anonymous closure>
parser.dart:91
E/flutter (28747): #2      Iterable.forEach (dart:core/iterable.dart:347:35)
E/flutter (28747): #3      SvgParser.loadFromString
parser.dart:63
E/flutter (28747): #4      SvgParser.loadFromFile
parser.dart:124
E/flutter (28747): <asynchronous suspension>

Throws an exception if the animated svg contains URL in the stroke. The SVG is animated but the package fails.

Upgrade to null safety

Because flutter_svg >=0.21.0-nullsafety.0 depends on xml ^5.0.0 and drawing_animation 0.1.4 depends on xml ^4.1.0, flutter_svg >=0.21.0-nullsafety.0 is incompatible with drawing_animation 0.1.4.

callback while rendering a path

Awesome work on the library.

I was wondering if it is possible to add a callback as a Path is rendered.
The onPaint callback is called after a entire path is completed.

I was trying to achieve results similar to this.

Implement complete SVG parsing

I'm currently considering to add flutter_svg as dependency for more complete SVG parsing.

that would be awesome if you implement it.

Originally posted by @laxxxguy in #4 (comment)

Trouble with colors

Hey @biocarl!
Thanks for the library it's awesome.

Im having trouble making the lines of a given color other than black. I tried the example3 but the page with the color example doesn't seem to be working for me.
I have a svg file with colored strokes but it keeps painting it black.

Thanks!

Update needed!

Please update this package, unable to add latest generated projects

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.