added cargo files
This commit is contained in:
34
PinePods-0.8.2/mobile/lib/ui/widgets/restart_widget.dart
Normal file
34
PinePods-0.8.2/mobile/lib/ui/widgets/restart_widget.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// lib/ui/widgets/restart_widget.dart
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class RestartWidget extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
const RestartWidget({Key? key, required this.child}) : super(key: key);
|
||||
|
||||
static void restartApp(BuildContext context) {
|
||||
context.findAncestorStateOfType<_RestartWidgetState>()?.restartApp();
|
||||
}
|
||||
|
||||
@override
|
||||
_RestartWidgetState createState() => _RestartWidgetState();
|
||||
}
|
||||
|
||||
class _RestartWidgetState extends State<RestartWidget> {
|
||||
Key key = UniqueKey();
|
||||
|
||||
void restartApp() {
|
||||
setState(() {
|
||||
key = UniqueKey();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return KeyedSubtree(
|
||||
key: key,
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user