小编Mar*_*ler的帖子

检测动画何时完成(AnimationListener)

我可以在 Kotlin 中使用 lottie 以编程方式启动动画,但我正在努力创建一个 AnimationListener。我到底该怎么做?

首先,我通过animation_view.progress 使用 if 语句进行了尝试,但这不起作用。

        textChanger.setOnClickListener{


                   animation_view.setAnimation("data.json")
                   animation_view.playAnimation()
                   animation_view.loop(false)
        }
Run Code Online (Sandbox Code Playgroud)

我希望它能够检测动画何时完成,这样我就可以制作一个吐司。Kotlin 有什么好的lottie 文档吗?

感谢您的帮助,刚刚开始使用 Android 和 Kotlin。

android kotlin lottie

3
推荐指数
1
解决办法
3339
查看次数

当在 Flutter 中按下/离开时,TextField 重新加载 FutureBuilder

用户可以使用 InputChips 输入答案,也可以在 TextField 中手动输入答案。当我尝试使用 InputChips 时,未检测到正确答案。当我尝试手动输入它时,FutureBuilder 在我进入和离开 TextField 时重新加载。是什么原因?Future 函数应该只被调用一次,因为它从 Firestore 中获取一个随机文档,拆分 String 并打乱不同的部分。这是某种形式的测验。

class _buildPhrases extends State<PhrasesSession>{
  TextEditingController _c;
  String _text = "initial";

  @override
  void initState(){
    _c = new TextEditingController();
    super.initState();
  }

  @override
  void dispose(){
    _c?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {

    final Arguments args = ModalRoute.of(context).settings.arguments;
    var height = MediaQuery.of(context).size.height;
    var width = MediaQuery.of(context).size.width;



    // TODO: implement build
    return Scaffold(
      body: Column(
        children: <Widget>[
          Flexible(flex: 2, child: _buildRest(context),),
          Flexible(flex: 5,
            child: FutureBuilder(
              future: getEverything(args.colName),
              builder: (context, …
Run Code Online (Sandbox Code Playgroud)

dart flutter google-cloud-firestore

2
推荐指数
1
解决办法
1627
查看次数

标签 统计

android ×1

dart ×1

flutter ×1

google-cloud-firestore ×1

kotlin ×1

lottie ×1