2d-inc/Flare-Flutter

Unable to render JSON flr with FlareActor

MarcoF09 opened this issue · 0 comments

Hi everyone!
I'm facing a problem when I try to render frl files exported as JSON. I tested with the same file exported as binary and it works well but with JSON not and I did not find anywhere that this is a restriction.

Expected Behavior

image

Current Behavior

image

Steps to Reproduce

  1. Export the following file as binary and JSON: https://rive.app/a/JuanCarlos/files/flare/filip
  2. Create a flutter project and add the flare_flutter dependency and the assets:
    image
  3. Put the following code in the main.dart:
import 'package:flutter/material.dart';
import 'package:flare_flutter/flare_actor.dart';

void main() {
  runApp(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,
      ),
      home: FlareDemo(),
    );
  }
}

class FlareDemo extends StatefulWidget {
  @override
  _FlareDemoState createState() => _FlareDemoState();
}

class _FlareDemoState extends State<FlareDemo> {
  bool isOpen = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: InkWell(
        onTap: () {
          setState(() {
            isOpen = !isOpen;
            print('on tap pressed');
          });
        },
        child: Center(
          child: FlareActor('assets/FilipBinary.flr', animation: isOpen ? 'phone_sway' : ''),
        ),
      ),
    );
  }
}
  1. Execute in any device.

Context (Environment)

I'm working in macOS Catalina 10.15.6 and executing in and Iphone 11 simulator and Samsung Galaxy A10.

Possible Solution

I didn't find any workaround yet, I was trying with the different properties of the flare actor without success.
If anyone knows a workaround or which work should be done in the library to make it work it will helpful.
Thanks!