flare_flutter 1.5.8

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.8] - 2019-09-04 08:47:31

  • Bump flare_dart dependency version to get fix for iterating null children. Issue #146.

[1.5.7] - 2019-08-26 10:39:49

  • Clip the artboard based on settings from Flare.

[1.5.6] - 2019-08-23 09:52:13

  • Clamp opacity values into 0..1 range before creating color for paint.

[1.5.5] - 2019-07-24 11:44:36

  • Adding artboard option to FlareActor. Use this to change which artboard gets displayed by the FlareActor widget.
  • Fixed incorrect signature of load method. If you were deriving FlareRenderBox, you'll need to update it to match. It's a minor change from void to Future
  • Added some documentation to the FlareActor parameters.

[1.5.4] - 2019-07-08 21:10:50

  • Using Uint16List for vertex indices now that Flutter Stable has been updated.

[1.5.3] - 2019-07-06 11:09:44

  • Fixing an intialization error when a node has null children.
  • FlareActor widget can now size itself via the sizeFromArtboard named parameter, based on feedback from issue #104.

[1.5.2] - 2019-06-20 16:33:52

Using latest version of flare_dart which has fixes for rounded rectangles and clipping paths.

[1.5.1] - 2019-05-20 10:38:30

Added missing call to setViewTransform for controllers. This is now done more efficiently as it is only called when the view transform changes.

[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.8

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: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';
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 Sep 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flare.dart.

Run flutter format to format lib/flare.dart.

Format lib/flare_render_box.dart.

Run flutter format to format lib/flare_render_box.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.6 1.4.6
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies