Flutter Web:堆积和火光问题

问题描述 投票:1回答:1

我试图在Flutter Web上创建一个简单的网页(开发频道-v1.13.2),并且发生了这个奇怪的问题。当我尝试将Flare动画放置在具有两个附加小部件(分别是背景和居中文本)的堆栈小部件中时,Flare似乎没有出现。但是,当我移除背景容器时,耀斑可以正常工作并且定位完美。这是代码;

    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"),
            ),
          )
        ],
      ),
    );
  }
}
flutter flutter-layout flutter-web flare
1个回答
0
投票

我认为您正在看到this bug。同时查看RepaintBoundary解决方法是否对您有用。

© www.soinside.com 2019 - 2024. All rights reserved.