📅  最后修改于: 2022-03-11 14:58:13.053000             🧑  作者: Mango
import 'package:flutter/material.dart';
class KeepAlivePage extends StatefulWidget {
KeepAlivePage({
Key key,
@required this.child,
}) : super(key: key);
final Widget child;
@override
_KeepAlivePageState createState() => _KeepAlivePageState();
}
class _KeepAlivePageState extends State
with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
/// Dont't forget this
super.build(context);
return widget.child;
}
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
}