opt: better docs
This commit is contained in:
parent
b627a0d6c1
commit
33ca87718b
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user