【问题标题】:Implemented flare animation and now animation and text both not showing up when running app实施了耀斑动画,现在动画和文本在运行应用程序时均不显示
【发布时间】:2019-10-05 08:38:34
【问题描述】:

我正在尝试在我的颤振应用程序中运行耀斑动画,但由于某种原因它没有显示出来。我没有得到 linting/run time 错误,所以我无法找出问题所在。我是错误地实现了这个动画还是在“容器”中使用“扩展”有问题?

@override
  Widget build(BuildContext context) {
    double deviceWidth = MediaQuery.of(context).size.width;
    return Scaffold(
      appBar: AppBar(
        title: Text('Let\'s Start Eating!'),
      ),

      drawer: DrawerPage(),

      body: Padding(
        padding: const EdgeInsets.all(10.0),
        child: Column(
          children: <Widget>[
            Container(
              child: Column(
                children: <Widget>[

                  Expanded(
                    flex: 1,
                    child:
                    FlareActor(
                      "assets/animations/finding-pizza.flr",
                      alignment: Alignment.center,
                      fit: BoxFit.contain,
                      animation: _animationName,
                    ),
                  ),

                  Container(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[
                        SizedBox(
                          height: MediaQuery.of(context).size.height/35,
                        ),
                        Text(
                          "Got a question?",
                          style: Theme.of(context).textTheme.title.copyWith(fontSize: 0.1 * deviceWidth),
                          textAlign: TextAlign.center,
                          softWrap: true,
                        ),

【问题讨论】:

    标签: flutter dart flare


    【解决方案1】:

    我认为没有必要将ColumnContainer 包装起来,然后再用Column 包装。

    试试这个:

    Padding(
      padding: const EdgeInsets.all(10.0),
      child: Column(
        children: <Widget>[
          Expanded(
            child: FlareActor(
              "assets/animations/finding-pizza.flr",
              alignment: Alignment.center,
              fit: BoxFit.contain,
              animation: _animationName,
            ),
          ),
          SizedBox(
            height: MediaQuery.of(context).size.height / 35,
          ),
          Text(
            "Got a question?",
            style: Theme.of(context)
                .textTheme
                .title
                .copyWith(fontSize: 0.1 * deviceWidth),
            textAlign: TextAlign.center,
            softWrap: true,
          ),
        ],
      ),
    )
    

    【讨论】:

      猜你喜欢
      • 2020-04-13
      • 2019-06-24
      • 2020-05-24
      • 2016-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-20
      • 2020-08-26
      相关资源
      最近更新 更多