Add auto complete. Close #24

This commit is contained in:
2025-08-10 15:33:28 +08:00
parent 5dad6910fc
commit 1cf4da66ad
6 changed files with 566 additions and 113 deletions

28
lib/utils/debounce.dart Normal file
View File

@@ -0,0 +1,28 @@
import 'dart:async';
import 'dart:ui';
class Debounce {
final Duration delay;
VoidCallback? _action;
Timer? _timer;
Debounce({required this.delay});
void call(VoidCallback action) {
_action = action;
_timer?.cancel();
_timer = Timer(delay, _execute);
}
void _execute() {
if (_action != null) {
_action!();
_action = null;
}
}
void cancel() {
_timer?.cancel();
_action = null;
}
}