flutterflutter-layoutflutter-webflare

Flutter Web: Stack and Flare Issue


I was trying to create a simple web page on Flutter Web (dev channel - v1.13.2) and this weird issue occured. When I tried to place a Flare animation in stack widget which have 2 additional widget, a background and a centered text respectively, the Flare didn't seems to appear. But when I remove the background container, flare works and positioned perfectly. Here is the code;

    import 'package:flutter/material.dart';
    import "package:flare_flutter/flare_actor.dart";

    void main() => runApp(MyApp());

    class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.green,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Stack(
        children: <Widget>[
          new Container(
            decoration: new BoxDecoration(
                image: new DecorationImage(
                    image: new AssetImage('images/bckg.jpeg'),
                    fit: BoxFit.cover)),
          ),
          new Center(
            child: new Text('TEST',
                style: new TextStyle(
                    color: Colors.white,
                    fontSize: 200.0,
                    fontWeight: FontWeight.bold,
                    letterSpacing: 5.0)),
          ),
          new Align(
            alignment: Alignment.bottomCenter,
            child: new ConstrainedBox(
              constraints: new BoxConstraints(
                maxHeight: 100,
                maxWidth: 100,
              ),
              child: new FlareActor("images/arrowdown.flr",
                  color: Colors.white,
                  alignment: Alignment.center,
                  fit: BoxFit.contain,
                  animation: "idle"),
            ),
          )
        ],
      ),
    );
  }
}

Solution

  • I think you're seeing this bug. See if the RepaintBoundary workaround works for you in the meantime.