Fish-Redux with SingleTickerProviderStateMixin

创建一个扩展类State

class AnimationComponentState extends ComponentState
    with SingleTickerProviderStateMixin {}

class AnimationComponent extends Component {
  @override
  AnimationComponentState createState() => AnimationComponentState();
}

在Page.dart文件内重写createState方法

  @override
  ComponentState createState() {
    return AnimationComponentState();
  }

使用的地方

    TickerProvider tickerProvider = ctx.stfState as TickerProvider;
    ctx.state.tabController = TabController(
        length: 3,
        vsync: tickerProvider,
    );

你可能感兴趣的:(Fish-Redux with SingleTickerProviderStateMixin)