mobile_skt/lib/widgets/want_keep_alive.dart

25 lines
510 B
Dart

import 'package:flutter/cupertino.dart';
class WantKeepAlive extends StatefulWidget {
final Widget child;
const WantKeepAlive({super.key, required this.child});
@override
State<StatefulWidget> createState() {
return WantKeepAliveState();
}
}
class WantKeepAliveState extends State<WantKeepAlive>
with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
super.build(context);
return widget.child;
}
@override
bool get wantKeepAlive => true;
}