mirror of
https://github.com/immich-app/immich.git
synced 2024-11-28 09:33:27 +02:00
cb391342d7
* feat(mobile): map page - add map view * map: add map-markers * feat(map): add relative date filter * fix: do not let users scroll past map bounds * fix: fetch relative date from store to state on init * feat(mobile):re-fetch markers only on filter change * feat(mobile) - asset bottom sheet in map page * feat(mobile): display markers based on bottom sheet scroll * fix: exif-bottom-sheet - rebase conflict * feat(mobile): map-view - strongly typed map page events * feat(map): zoom to asset * chore: dart analyzer fixes * map-page move attribution to top-right * feat(mobile): map view - asset selection handling * feat(mobile): map-view display map in places row * fix: make asset marker icon responsive * optimise map page rebuilds * refactor(mobile): map page * feat(mobile): map-view: Go to location * map-view(mobile): minor refactor * fix(mobile): Handle invalid coords gracefully * small styling --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
27 lines
506 B
Dart
27 lines
506 B
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Debounce {
|
|
Debounce(Duration interval) : _interval = interval.inMilliseconds;
|
|
final int _interval;
|
|
Timer? _timer;
|
|
VoidCallback? action;
|
|
|
|
void call(VoidCallback? action) {
|
|
this.action = action;
|
|
_timer?.cancel();
|
|
_timer = Timer(Duration(milliseconds: _interval), _callAndRest);
|
|
}
|
|
|
|
void _callAndRest() {
|
|
action?.call();
|
|
_timer = null;
|
|
}
|
|
|
|
void dispose() {
|
|
_timer?.cancel();
|
|
_timer = null;
|
|
}
|
|
}
|