import 'package:flutter/cupertino.dart';

/// 用于PageView的缓存使用的包装组件
class PageKeepAliveWrapper extends StatefulWidget {
  final Widget child;

  const PageKeepAliveWrapper({super.key, required this.child});

  @override
  PageKeepAliveWrapperState createState() => PageKeepAliveWrapperState();
}

class PageKeepAliveWrapperState extends State<PageKeepAliveWrapper>
    with AutomaticKeepAliveClientMixin {
  /// 返回需要缓存
  @override
  bool get wantKeepAlive => true;

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return widget.child;
  }
}
