flare_flutter 1.5.0

  • README.md
  • Installing
  • Versions
  • 94

Flare-Flutter #

Flutter runtime for Flare, depends on flare_dart.

Installation #

Add flare_flutter as a dependency in your pubspec.yaml file. If you plan on writing a custom controller or want access to more of the guts of the library, you will want to also include flare_dart which is the base library responsible for loading, instancing, animating, and doing all the work that happens before rendering in flare_flutter. The examples include use cases for both scenarios.

Exporting for Flutter #

Export from Flare with the "Export to Engine" menu. In the Engine dropdown, choose Flutter, and in the Format dropdown your favorite form of compression.

Adding Assets #

Once you've exported your file, add the .flr file to your project's Flutter assets.

Example #

Take a look at the provided example applications for how to use the FlutterActor widget with an exported Flutter character.

Usage #

The easiest way to get started is by using the provided FlareActor widget. This is a stateless Flutter widget that allows for one Flare file with one active animation playing to be embedded in your Flutter App.

You can change the currently playing animation by changing the animation property's name.

You can also specify the mixSeconds to determine how long it takes for the animation to interpolate from the previous one. A value of 0 means that it will just pop to the new animation. A value of 0.5 will mean it takes half of a second to fully mix the new animation on top of the old one.

import 'package:flare_flutter/flare_actor.dart';
class MyHomePage extends StatefulWidget {
  _MyHomePageState createState() => new _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  Widget build(BuildContext context) {
    return new FlareActor("assets/Filip.flr", alignment:Alignment.center, fit:BoxFit.contain, animation:"idle");

Contributing #

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License #

See the LICENSE file for license rights and limitations (MIT).

[1.5.0] - 2019-04-23 19:41:56

  • New system in place to prevent breaking stable builds.
  • Revert compute load for stable, please see https://github.com/2d-inc/Flare-Flutter for how to use the latest bleeding edge work with dev/master Flutter channels.

[1.4.0] - 2019-04-23 19:41:56

  • Improving load jank by loading the Flare file in an Isolate. This now requires calling Actor.loadImages once the Flare file has been loaded. FlareActor already handles this for you.
  • Bug fix for opacity values going out of 0-1 range.

[1.3.13] - 2019-04-22 09:39:15

Fixes a condition where elapsed time counters were not resetting to 0 when animation stopped. This would cause the elapsed time to be really high when starting to play a subsequent animation.

[1.3.12] - 2019-04-13 18:12:09

Fixes a condition where animations would not advance if they were using an animation driven by FlareActor and one from FlareController.

[1.3.11] - 2019-04-13 17:38:08

We've updated the advance logic (which drives the animations and custom controllers) to work in tandem with painting. This prevents advancing from continuing when the widget is no longer painting. It solves the issue of animations advancing when navigated away from a page containing a FlareActor widget. This was due to the widget still being attached to the widget tree, which would cause the FlareActor to think it would need to continue advancing.

N.B. Breaking Change: if you are implementing FlareController, consider using it as a mixin to avoid having to add your own isActive ValueNotifier. For most cases simply swapping the extends FlareController to with FlareController will suffice.

[1.3.10] - 2019-04-11 09:36:58

Reloading when re-attaching a FlareRenderBox widget.

[1.3.9] - 2019-04-10 16:53:20

Adding arguments for mix and mixSeconds to FlareControls.play().

[1.3.8] - 2019-04-08 08:48:57

Using the latest Flare Dart which fixed an issue with trim path instances.

[1.3.7] - 2019-04-06 19:28:48

New features for caching, custom renderers, and better support for overriding paint operations (allows for mutating paint to add things like color filters).

[1.3.6] - 2019-03-26 15:56:34

Making new snapToEnd functionality default to false to support backwards compatibility.

[1.3.5] - 2019-03-25 20:05:16

Updating flare_dart dependency which fixes a critical draw order issue.

[1.3.4] - 2019-03-18 19:46:52

Ensure rendering state is restored after ActorImage is clipped.

[1.3.3] - 2019-03-12 09:23:54

Apply clip to ActorImage.

[1.3.2] - 2019-03-07 12:46:33

Use the displayColor value exposed by the ActorColor instead of the color value.

[1.3.1] - 2019-03-07 11:23:40

Fixes for issues: https://github.com/2d-inc/Flare-Flutter/issues/51 https://github.com/2d-inc/Flare-Flutter/issues/50 https://github.com/2d-inc/Flare-Flutter/issues/49

The list of animation layers was not getting cleared out when loading a new Flare file. This was causing animations from different files to be applied on Flare files that didn't own the animations.

Use this package as a library

1. Depend on it

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

  flare_flutter: ^1.5.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:flare_flutter/asset_bundle_cache.dart';
import 'package:flare_flutter/cache.dart';
import 'package:flare_flutter/cache_asset.dart';
import 'package:flare_flutter/flare.dart';
import 'package:flare_flutter/flare_actor.dart';
import 'package:flare_flutter/flare_cache.dart';
import 'package:flare_flutter/flare_cache_asset.dart';
import 'package:flare_flutter/flare_controller.dart';
import 'package:flare_flutter/flare_controls.dart';
import 'package:flare_flutter/flare_render_box.dart';
import 'package:flare_flutter/trim_path.dart';
Version Uploaded Documentation Archive
1.5.0 Apr 24, 2019 Go to the documentation of flare_flutter 1.5.0 Download flare_flutter 1.5.0 archive
1.4.0 Apr 24, 2019 Go to the documentation of flare_flutter 1.4.0 Download flare_flutter 1.4.0 archive
1.3.13 Apr 22, 2019 Go to the documentation of flare_flutter 1.3.13 Download flare_flutter 1.3.13 archive
1.3.12 Apr 14, 2019 Go to the documentation of flare_flutter 1.3.12 Download flare_flutter 1.3.12 archive
1.3.11 Apr 14, 2019 Go to the documentation of flare_flutter 1.3.11 Download flare_flutter 1.3.11 archive
1.3.10 Apr 11, 2019 Go to the documentation of flare_flutter 1.3.10 Download flare_flutter 1.3.10 archive
1.3.9 Apr 10, 2019 Go to the documentation of flare_flutter 1.3.9 Download flare_flutter 1.3.9 archive
1.3.8 Apr 8, 2019 Go to the documentation of flare_flutter 1.3.8 Download flare_flutter 1.3.8 archive
1.3.7 Apr 7, 2019 Go to the documentation of flare_flutter 1.3.7 Download flare_flutter 1.3.7 archive
1.3.6 Mar 26, 2019 Go to the documentation of flare_flutter 1.3.6 Download flare_flutter 1.3.6 archive

All 33 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 24, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/flare_actor.dart. (-1.49 points)

Analysis of lib/flare_actor.dart reported 3 hints:

line 5 col 8: Unused import: 'package:flutter/scheduler.dart'.

line 6 col 8: Unused import: 'package:flutter/services.dart'.

line 10 col 8: Unused import: 'package:flare_dart/math/vec2d.dart'.

Fix lib/flare.dart. (-0.50 points)

Analysis of lib/flare.dart reported 1 hint:

line 11 col 8: Unused import: 'package:flutter/foundation.dart'.

Maintenance suggestions

The package description is too short. (-12 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flare_flutter.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flare_dart ^1.4.0 1.4.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies