mirror of
https://github.com/immich-app/immich.git
synced 2025-09-29 15:31:13 -04:00
* reduce timeline rebuilds * feat: adds bottom sheet map and actions (#19692) * adds bottom sheet map and actions * PR feedbacks * only reload the asset viewer if asset is changed * styling tweak --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com> * rename singleton and remove event prefix --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
37 lines
963 B
Dart
37 lines
963 B
Dart
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
|
|
|
final currentAssetNotifier =
|
|
AutoDisposeNotifierProvider<CurrentAssetNotifier, BaseAsset>(
|
|
CurrentAssetNotifier.new,
|
|
);
|
|
|
|
class CurrentAssetNotifier extends AutoDisposeNotifier<BaseAsset> {
|
|
KeepAliveLink? _keepAliveLink;
|
|
|
|
@override
|
|
BaseAsset build() {
|
|
throw UnimplementedError(
|
|
'An asset must be set before using the currentAssetProvider.',
|
|
);
|
|
}
|
|
|
|
void setAsset(BaseAsset asset) {
|
|
_keepAliveLink?.close();
|
|
state = asset;
|
|
_keepAliveLink = ref.keepAlive();
|
|
}
|
|
|
|
void dispose() {
|
|
_keepAliveLink?.close();
|
|
}
|
|
}
|
|
|
|
final currentAssetExifProvider = FutureProvider.autoDispose(
|
|
(ref) {
|
|
final currentAsset = ref.watch(currentAssetNotifier);
|
|
return ref.watch(assetServiceProvider).getExif(currentAsset);
|
|
},
|
|
);
|