【问题标题】:Flutter Animation Coming After each otherFlutter 动画相继出现
【发布时间】:2023-02-23 05:41:29
【问题描述】:

我希望两个动画文本依次发生,但它们是同时发生的。什么东西能让他们互相工作。

这是代码

import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:animated_text_kit/animated_text_kit.dart';

class SignupScreen extends StatefulWidget {
  const SignupScreen({super.key});

  @override
  State<SignupScreen> createState() => _SignupScreenState();
}

class _SignupScreenState extends State<SignupScreen> {
  // Future.delayed(const Duration(milliseconds: 500), () {

  bool work = false;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            body: Column(
      children: [
        Container(
          height: 80,
        ),
        AnimatedTextKit(
          animatedTexts: [
            TyperAnimatedText(
              'It all started with an',
              textStyle: TextStyle(fontFamily: "Itim", fontSize: 40),
            )
          ],
          isRepeatingAnimation: false,
           // I WANT THE SAME ANIMATED TEXT TO HAPPEN AFTER THIS
        ),
      ],
    )));
  }
}
 

【问题讨论】:

    标签: flutter animation flutter-animation


    【解决方案1】:

    这是包文档中的 sn-p:https://pub.dev/packages/animated_text_kit#typer

    return SizedBox(
      width: 250.0,
      child: DefaultTextStyle(
        style: const TextStyle(
          fontSize: 30.0,
          fontFamily: 'Bobbers',
        ),
        child: AnimatedTextKit(
          animatedTexts: [
            TyperAnimatedText('It is not enough to do your best,'),
            TyperAnimatedText('you must know what to do,'),
            TyperAnimatedText('and then do your best'),
            TyperAnimatedText('- W.Edwards Deming'),
          ],
          onTap: () {
            print("Tap Event");
          },
        ),
      ),
    );
    

    请像这样使用它:

    Column(
                  children: [
                    AnimatedTextKit(
                      animatedTexts: [
                        TyperAnimatedText('It is not enough to do your best,'),
                        TyperAnimatedText('you must know what to do,'),
                        TyperAnimatedText('and then do your best'),
                        TyperAnimatedText('- W.Edwards Deming'),
                      ],
                      onTap: () {
                        print("Tap Event");
                      },
                    ),
                    AnimatedTextKit(
                      animatedTexts: [
                        TyperAnimatedText('It is not enough to do your best,'),
                        TyperAnimatedText('you must know what to do,'),
                        TyperAnimatedText('and then do your best'),
                        TyperAnimatedText('- W.Edwards Deming'),
                      ],
                      onTap: () {
                        print("Tap Event");
                      },
                    ),
                  ],
    

    【讨论】:

    • 对不起,当我问我的问题时我不清楚。我希望它们同时出现,如果我使用这种方式,第一个会在第二个出现时出现。
    • 我已经相应地编辑了我的答案。
    猜你喜欢
    • 2012-10-31
    • 1970-01-01
    • 2019-12-24
    • 2019-05-23
    • 1970-01-01
    • 2022-08-17
    • 2021-06-22
    • 2022-06-22
    • 1970-01-01
    相关资源
    最近更新 更多