创建一个扩展类State
class AnimationComponentState extends ComponentState<OrderListState>
with SingleTickerProviderStateMixin {}
class AnimationComponent extends Component<OrderListState> {
@override
AnimationComponentState createState() => AnimationComponentState();
}
在Page.dart文件内重写createState方法
@override
ComponentState<OrderListState> createState() {
return AnimationComponentState();
}
使用的地方
TickerProvider tickerProvider = ctx.stfState as TickerProvider;
ctx.state.tabController = TabController(
length: 3,
vsync: tickerProvider,
);