mirror of
https://github.com/immich-app/immich.git
synced 2025-01-09 13:26:47 +01:00
49c4d7cff9
fix orientation for remote assets wip separate widget separate video loader widget fixed memory leak optimized seeking, cleanup debug context pop use global key back to one widget fixed rebuild wait for swipe animation to finish smooth hero animation for remote videos faster scroll animation
18 lines
458 B
Dart
18 lines
458 B
Dart
import 'dart:async';
|
|
import 'dart:ui';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
|
// https://github.com/rrousselGit/flutter_hooks/issues/233#issuecomment-840416638
|
|
void useInterval(Duration delay, VoidCallback callback) {
|
|
final savedCallback = useRef(callback);
|
|
savedCallback.value = callback;
|
|
|
|
useEffect(
|
|
() {
|
|
final timer = Timer.periodic(delay, (_) => savedCallback.value());
|
|
return timer.cancel;
|
|
},
|
|
[delay],
|
|
);
|
|
}
|