Handle pages with multiple debouncers
This commit is contained in:
parent
e5fb62efc4
commit
aa5f5dfcc6
|
|
@ -378,7 +378,7 @@ Middleware<AppState> _createPersistData(
|
|||
};
|
||||
}
|
||||
|
||||
final _persistUIDebouncer = PersistUIDebouncer();
|
||||
final _persistUIDebouncer = SimpleDebouncer();
|
||||
Middleware<AppState> _createPersistUI(PersistenceRepository uiRepository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as PersistUI;
|
||||
|
|
|
|||
|
|
@ -51,9 +51,10 @@ class _DesignEditState extends State<DesignEdit>
|
|||
static final GlobalKey<FormState> _formKey =
|
||||
GlobalKey<FormState>(debugLabel: '_designEdit');
|
||||
|
||||
final _pdfDebouncer = Debouncer(milliseconds: kMillisecondsToDebounceSave);
|
||||
final _debouncer = Debouncer();
|
||||
final _htmlDebouncer = Debouncer();
|
||||
final _pdfDebouncer =
|
||||
SimpleDebouncer(milliseconds: kMillisecondsToDebounceSave);
|
||||
final _htmlDebouncer = SimpleDebouncer();
|
||||
|
||||
final _nameController = TextEditingController();
|
||||
final _htmlController = TextEditingController();
|
||||
|
|
|
|||
|
|
@ -1124,7 +1124,8 @@ class _PdfPreview extends StatefulWidget {
|
|||
}
|
||||
|
||||
class __PdfPreviewState extends State<_PdfPreview> {
|
||||
final _pdfDebouncer = Debouncer(milliseconds: kMillisecondsToDebounceSave);
|
||||
final _pdfDebouncer =
|
||||
SimpleDebouncer(milliseconds: kMillisecondsToDebounceSave);
|
||||
|
||||
int _pageCount = 1;
|
||||
int _currentPage = 1;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class _ClientPortalState extends State<ClientPortal>
|
|||
bool _isCheckingSubdomain = false;
|
||||
|
||||
final _subdomainDebouncer =
|
||||
Debouncer(milliseconds: kMillisecondsToDebounceSave);
|
||||
SimpleDebouncer(milliseconds: kMillisecondsToDebounceSave);
|
||||
final _debouncer = Debouncer();
|
||||
|
||||
final _subdomainController = TextEditingController();
|
||||
|
|
|
|||
|
|
@ -118,8 +118,12 @@ class Debouncer {
|
|||
}
|
||||
}
|
||||
|
||||
class PersistUIDebouncer {
|
||||
PersistUIDebouncer();
|
||||
class SimpleDebouncer {
|
||||
SimpleDebouncer({
|
||||
this.milliseconds = kMillisecondsToDebounceWrite,
|
||||
});
|
||||
|
||||
final int milliseconds;
|
||||
|
||||
static VoidCallback action;
|
||||
static Timer timer;
|
||||
|
|
@ -132,7 +136,7 @@ class PersistUIDebouncer {
|
|||
Debouncer.action = action;
|
||||
}
|
||||
|
||||
timer = Timer(Duration(milliseconds: kMillisecondsToDebounceWrite), () {
|
||||
timer = Timer(Duration(milliseconds: milliseconds), () {
|
||||
if (action != null) {
|
||||
action();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue