Line data Source code
1 : // Copyright 2023 The terCAD team. All rights reserved. 2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file. 3 : 4 : import 'package:flutter/material.dart'; 5 : 6 : class KeepAliveWrapper extends StatefulWidget { 7 : final Widget child; 8 : 9 0 : const KeepAliveWrapper({super.key, required this.child}); 10 : 11 0 : @override 12 0 : KeepAliveWrapperState createState() => KeepAliveWrapperState(); 13 : } 14 : 15 : class KeepAliveWrapperState extends State<KeepAliveWrapper> with AutomaticKeepAliveClientMixin { 16 0 : @override 17 : Widget build(BuildContext context) { 18 0 : super.build(context); 19 0 : return widget.child; 20 : } 21 : 22 0 : @override 23 : bool get wantKeepAlive => true; 24 : }