美文网首页
Flutter中使用TabBar遇到的坑

Flutter中使用TabBar遇到的坑

作者: 吃梨不洗皮 | 来源:发表于2019-06-07 12:25 被阅读0次

    1.对TabController的监听在点击Tab后会执行两次

    每点击一次,监听都有两次回调

    解决:

                

    对indexIsChanging进行判断

    2.使用SingleTickerProviderStateMixin报错

        根据官方文档使用(自己也敲了些其他代码),但是报了个错

    I/flutter ( 9971): A SingleTickerProviderStateMixin can only be used as a TickerProvider once. If a State is used for

    I/flutter ( 9971): multiple AnimationController objects, or if it is passed to other objects and those objects might

    I/flutter ( 9971): use it more than one time in total, then instead of mixing in a SingleTickerProviderStateMixin, use

    I/flutter ( 9971): a regular TickerProviderStateMixin.

        解决:

                 将SingleTickerProviderStateMixin换成TickerProviderStateMixin

    相关文章

      网友评论

          本文标题:Flutter中使用TabBar遇到的坑

          本文链接:https://www.haomeiwen.com/subject/ztlbtctx.html