opt: better docs

This commit is contained in:
Kingtous 2023-03-15 15:20:50 +08:00
parent b627a0d6c1
commit 33ca87718b
2 changed files with 11 additions and 11 deletions

View File

@ -95,7 +95,7 @@ class FileModel {
}
Future<void> postOverrideFileConfirm(Map<String, dynamic> evt) async {
evtLoop.push_event(
evtLoop.pushEvent(
_FileDialogEvent(WeakReference(this), FileDialogType.overwrite, evt));
}
@ -1233,27 +1233,27 @@ class _FileDialogEvent extends BaseEvent<FileDialogType, Map<String, dynamic>> {
class FileDialogEventLoop
extends BaseEventLoop<FileDialogType, Map<String, dynamic>> {
bool? overrideConfirm;
bool? _overrideConfirm;
bool _skip = false;
@override
Future<void> onPreConsume(
BaseEvent<FileDialogType, Map<String, dynamic>> evt) async {
var event = evt as _FileDialogEvent;
event.setOverrideConfirm(overrideConfirm);
event.setOverrideConfirm(_overrideConfirm);
event.setSkip(_skip);
debugPrint("FileDialogEventLoop: consuming<jobId:${evt.data['id']} overrideConfirm: $overrideConfirm, skip:$_skip>");
debugPrint("FileDialogEventLoop: consuming<jobId:${evt.data['id']} overrideConfirm: $_overrideConfirm, skip:$_skip>");
}
@override
Future<void> onEventsClear() {
overrideConfirm = null;
_overrideConfirm = null;
_skip = false;
return super.onEventsClear();
}
void setOverrideConfirm(bool? confirm) {
overrideConfirm = confirm;
_overrideConfirm = confirm;
}
void setSkip(bool skip) {

View File

@ -8,10 +8,10 @@ abstract class BaseEvent<EventType, Data> {
EventType type;
Data data;
/// Constructor
/// Constructor.
BaseEvent(this.type, this.data);
/// Consume this event
/// Consume this event.
@visibleForTesting
Future<dynamic> consume() async {
final cb = findCallback(type);
@ -51,7 +51,7 @@ abstract class BaseEventLoop<EventType, Data> {
}
timer.cancel();
_timer = null;
// handle logic
// Handle the logic.
await onEventsStartConsuming();
while (_evts.isNotEmpty) {
final evt = _evts.first;
@ -61,7 +61,7 @@ abstract class BaseEventLoop<EventType, Data> {
await onPostConsume(evt);
}
await onEventsClear();
// Now events are all processed
// Now events are all processed.
_timer = Timer.periodic(Duration(milliseconds: 100), _handleTimer);
}
@ -69,7 +69,7 @@ abstract class BaseEventLoop<EventType, Data> {
_timer?.cancel();
}
void push_event(BaseEvent<EventType, Data> evt) {
void pushEvent(BaseEvent<EventType, Data> evt) {
_evts.add(evt);
}