26 lines
595 B
Dart
26 lines
595 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// keep alive
|
|
class NovyKeepAlive extends StatefulWidget {
|
|
final Widget child;
|
|
final bool? wantKeepAlive;
|
|
|
|
const NovyKeepAlive(
|
|
{super.key, required this.child, this.wantKeepAlive = true});
|
|
|
|
@override
|
|
State<NovyKeepAlive> createState() => _CmKeepAlivePageState();
|
|
}
|
|
|
|
class _CmKeepAlivePageState extends State<NovyKeepAlive>
|
|
with AutomaticKeepAliveClientMixin {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
super.build(context);
|
|
return widget.child;
|
|
}
|
|
|
|
@override
|
|
bool get wantKeepAlive => widget.wantKeepAlive!;
|
|
}
|