Restore window placement on startup

This commit is contained in:
wgh19
2024-05-22 12:49:58 +08:00
parent 471b319891
commit de26cba0fa
4 changed files with 100 additions and 15 deletions

21
lib/utils/loop.dart Normal file
View File

@@ -0,0 +1,21 @@
import 'dart:async';
class Loop {
static final List<void Function()> _callbacks = [];
static void start() {
Timer.periodic(const Duration(milliseconds: 100), (timer) {
for(var func in _callbacks) {
func.call();
}
});
}
static void register(void Function() func) {
_callbacks.add(func);
}
static void remove(void Function() func) {
_callbacks.remove(func);
}
}