You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-07 23:03:36 +02:00
feat: adds bottom sheet map and actions (#19726)
* 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 * adds bottom sheet map and actions * PR feedbacks * refactor: use provider for viewer state * feat: adds top and bottom app bar * add safe area to bottom app bar * change app and bottom bar color * viewer - always have black background * use the full width for the bottom sheet on landscape as well * constraint the bottom sheet to not expand all the way * add padding for location details in landscape --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@ -56,7 +56,10 @@ class ActionNotifier extends Notifier<void> {
|
||||
final Set<BaseAsset> assets = switch (source) {
|
||||
ActionSource.timeline =>
|
||||
ref.read(multiSelectProvider.select((s) => s.selectedAssets)),
|
||||
ActionSource.viewer => {ref.read(currentAssetNotifier)},
|
||||
ActionSource.viewer => switch (ref.read(currentAssetNotifier)) {
|
||||
BaseAsset asset => {asset},
|
||||
null => {},
|
||||
},
|
||||
};
|
||||
|
||||
return switch (T) {
|
||||
|
@ -15,5 +15,6 @@ final remoteAssetRepositoryProvider = Provider<RemoteAssetRepository>(
|
||||
final assetServiceProvider = Provider(
|
||||
(ref) => AssetService(
|
||||
remoteAssetRepository: ref.watch(remoteAssetRepositoryProvider),
|
||||
localAssetRepository: ref.watch(localAssetRepository),
|
||||
),
|
||||
);
|
||||
|
@ -1,36 +1,48 @@
|
||||
import 'dart:async';
|
||||
|
||||
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>(
|
||||
AutoDisposeNotifierProvider<CurrentAssetNotifier, BaseAsset?>(
|
||||
CurrentAssetNotifier.new,
|
||||
);
|
||||
|
||||
class CurrentAssetNotifier extends AutoDisposeNotifier<BaseAsset> {
|
||||
class CurrentAssetNotifier extends AutoDisposeNotifier<BaseAsset?> {
|
||||
KeepAliveLink? _keepAliveLink;
|
||||
StreamSubscription<BaseAsset?>? _assetSubscription;
|
||||
|
||||
@override
|
||||
BaseAsset build() {
|
||||
throw UnimplementedError(
|
||||
'An asset must be set before using the currentAssetProvider.',
|
||||
);
|
||||
}
|
||||
BaseAsset? build() => null;
|
||||
|
||||
void setAsset(BaseAsset asset) {
|
||||
_keepAliveLink?.close();
|
||||
_assetSubscription?.cancel();
|
||||
state = asset;
|
||||
_assetSubscription = ref
|
||||
.watch(assetServiceProvider)
|
||||
.watchAsset(asset)
|
||||
.listen((updatedAsset) {
|
||||
if (updatedAsset != null) {
|
||||
state = updatedAsset;
|
||||
}
|
||||
});
|
||||
_keepAliveLink = ref.keepAlive();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
_keepAliveLink?.close();
|
||||
_assetSubscription?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
final currentAssetExifProvider = FutureProvider.autoDispose(
|
||||
(ref) {
|
||||
final currentAsset = ref.watch(currentAssetNotifier);
|
||||
if (currentAsset == null) {
|
||||
return null;
|
||||
}
|
||||
return ref.watch(assetServiceProvider).getExif(currentAsset);
|
||||
},
|
||||
);
|
||||
|
Reference in New Issue
Block a user