Files
MWClash/lib/manager/tile_manager.dart

49 lines
884 B
Dart
Raw Normal View History

2024-04-30 23:38:49 +08:00
import 'package:fl_clash/plugins/tile.dart';
import 'package:fl_clash/state.dart';
2024-04-30 23:38:49 +08:00
import 'package:flutter/material.dart';
class TileManager extends StatefulWidget {
2024-04-30 23:38:49 +08:00
final Widget child;
const TileManager({
2024-04-30 23:38:49 +08:00
super.key,
required this.child,
});
@override
State<TileManager> createState() => _TileContainerState();
2024-04-30 23:38:49 +08:00
}
class _TileContainerState extends State<TileManager> with TileListener {
2024-04-30 23:38:49 +08:00
@override
Widget build(BuildContext context) {
return widget.child;
}
@override
void onStart() {
globalState.appController.updateStatus(true);
2024-04-30 23:38:49 +08:00
super.onStart();
}
@override
void onStop() {
globalState.appController.updateStatus(false);
2024-04-30 23:38:49 +08:00
super.onStop();
}
@override
void initState() {
super.initState();
tile?.addListener(this);
}
@override
void dispose() {
tile?.removeListener(this);
super.dispose();
}
}