mobile_skt/lib/widgets/want_keep_alive.dart

25 lines
510 B
Dart
Raw Normal View History

2024-10-16 09:48:17 +08:00
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;
}