mobile_skt/lib/widgets/want_keep_alive.dart

25 lines
493 B
Dart

import 'package:flutter/cupertino.dart';
class WantKeepAlive extends StatefulWidget {
final Widget child;
WantKeepAlive({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;
}