mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
fix(mobile): use storageIndicator setting for beta timeline (#20639)
* fix: use storageIndicator setting for beta timeline * fix: reactively update the storage indicator icons when setting is changed * Update drift_trash.page.dart * override to bool for storageIndicator
This commit is contained in:
parent
990d9ba9a8
commit
750d21aeba
@ -16,17 +16,16 @@ class MainTimelinePage extends ConsumerWidget {
|
|||||||
return memoryLaneProvider.maybeWhen(
|
return memoryLaneProvider.maybeWhen(
|
||||||
data: (memories) {
|
data: (memories) {
|
||||||
return memories.isEmpty
|
return memories.isEmpty
|
||||||
? const Timeline(showStorageIndicator: true)
|
? const Timeline()
|
||||||
: Timeline(
|
: Timeline(
|
||||||
topSliverWidget: SliverToBoxAdapter(
|
topSliverWidget: SliverToBoxAdapter(
|
||||||
key: Key('memory-lane-${memories.first.assets.first.id}'),
|
key: Key('memory-lane-${memories.first.assets.first.id}'),
|
||||||
child: DriftMemoryLane(memories: memories),
|
child: DriftMemoryLane(memories: memories),
|
||||||
),
|
),
|
||||||
topSliverWidgetHeight: 200,
|
topSliverWidgetHeight: 200,
|
||||||
showStorageIndicator: true,
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
orElse: () => const Timeline(showStorageIndicator: true),
|
orElse: () => const Timeline(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ class DriftTrashPage extends StatelessWidget {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
child: Timeline(
|
child: Timeline(
|
||||||
showStorageIndicator: true,
|
|
||||||
appBar: SliverAppBar(
|
appBar: SliverAppBar(
|
||||||
title: Text('trash'.t(context: context)),
|
title: Text('trash'.t(context: context)),
|
||||||
floating: true,
|
floating: true,
|
||||||
|
@ -26,7 +26,6 @@ class LocalTimelinePage extends StatelessWidget {
|
|||||||
child: Timeline(
|
child: Timeline(
|
||||||
appBar: MesmerizingSliverAppBar(title: album.name),
|
appBar: MesmerizingSliverAppBar(title: album.name),
|
||||||
bottomSheet: const LocalAlbumBottomSheet(),
|
bottomSheet: const LocalAlbumBottomSheet(),
|
||||||
showStorageIndicator: true,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ import 'package:auto_route/auto_route.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/setting.model.dart';
|
||||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||||
import 'package:immich_mobile/extensions/duration_extensions.dart';
|
import 'package:immich_mobile/extensions/duration_extensions.dart';
|
||||||
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
||||||
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
|
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
|
||||||
|
import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
|
||||||
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
|
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
|
||||||
|
|
||||||
class ThumbnailTile extends ConsumerWidget {
|
class ThumbnailTile extends ConsumerWidget {
|
||||||
@ -13,7 +15,7 @@ class ThumbnailTile extends ConsumerWidget {
|
|||||||
this.asset, {
|
this.asset, {
|
||||||
this.size = const Size.square(256),
|
this.size = const Size.square(256),
|
||||||
this.fit = BoxFit.cover,
|
this.fit = BoxFit.cover,
|
||||||
this.showStorageIndicator = true,
|
this.showStorageIndicator,
|
||||||
this.lockSelection = false,
|
this.lockSelection = false,
|
||||||
this.heroOffset,
|
this.heroOffset,
|
||||||
super.key,
|
super.key,
|
||||||
@ -22,7 +24,7 @@ class ThumbnailTile extends ConsumerWidget {
|
|||||||
final BaseAsset asset;
|
final BaseAsset asset;
|
||||||
final Size size;
|
final Size size;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final bool showStorageIndicator;
|
final bool? showStorageIndicator;
|
||||||
final bool lockSelection;
|
final bool lockSelection;
|
||||||
final int? heroOffset;
|
final int? heroOffset;
|
||||||
|
|
||||||
@ -52,6 +54,9 @@ class ThumbnailTile extends ConsumerWidget {
|
|||||||
|
|
||||||
final hasStack = asset is RemoteAsset && (asset as RemoteAsset).stackId != null;
|
final hasStack = asset is RemoteAsset && (asset as RemoteAsset).stackId != null;
|
||||||
|
|
||||||
|
final bool storageIndicator =
|
||||||
|
showStorageIndicator ?? ref.watch(settingsProvider.select((s) => s.get(Setting.showStorageIndicator)));
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
AnimatedContainer(
|
AnimatedContainer(
|
||||||
@ -86,7 +91,7 @@ class ThumbnailTile extends ConsumerWidget {
|
|||||||
child: _VideoIndicator(asset.duration),
|
child: _VideoIndicator(asset.duration),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (showStorageIndicator)
|
if (storageIndicator)
|
||||||
switch (asset.storage) {
|
switch (asset.storage) {
|
||||||
AssetState.local => const Align(
|
AssetState.local => const Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
|
@ -14,7 +14,7 @@ class TimelineArgs {
|
|||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
final double spacing;
|
final double spacing;
|
||||||
final int columnCount;
|
final int columnCount;
|
||||||
final bool showStorageIndicator;
|
final bool? showStorageIndicator;
|
||||||
final bool withStack;
|
final bool withStack;
|
||||||
final GroupAssetsBy? groupBy;
|
final GroupAssetsBy? groupBy;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class TimelineArgs {
|
|||||||
required this.maxHeight,
|
required this.maxHeight,
|
||||||
this.spacing = kTimelineSpacing,
|
this.spacing = kTimelineSpacing,
|
||||||
this.columnCount = kTimelineColumnCount,
|
this.columnCount = kTimelineColumnCount,
|
||||||
this.showStorageIndicator = false,
|
this.showStorageIndicator,
|
||||||
this.withStack = false,
|
this.withStack = false,
|
||||||
this.groupBy,
|
this.groupBy,
|
||||||
});
|
});
|
||||||
|
@ -31,7 +31,7 @@ class Timeline extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
this.topSliverWidget,
|
this.topSliverWidget,
|
||||||
this.topSliverWidgetHeight,
|
this.topSliverWidgetHeight,
|
||||||
this.showStorageIndicator = false,
|
this.showStorageIndicator,
|
||||||
this.withStack = false,
|
this.withStack = false,
|
||||||
this.appBar = const ImmichSliverAppBar(floating: true, pinned: false, snap: false),
|
this.appBar = const ImmichSliverAppBar(floating: true, pinned: false, snap: false),
|
||||||
this.bottomSheet = const GeneralBottomSheet(),
|
this.bottomSheet = const GeneralBottomSheet(),
|
||||||
@ -40,7 +40,7 @@ class Timeline extends StatelessWidget {
|
|||||||
|
|
||||||
final Widget? topSliverWidget;
|
final Widget? topSliverWidget;
|
||||||
final double? topSliverWidgetHeight;
|
final double? topSliverWidgetHeight;
|
||||||
final bool showStorageIndicator;
|
final bool? showStorageIndicator;
|
||||||
final Widget? appBar;
|
final Widget? appBar;
|
||||||
final Widget? bottomSheet;
|
final Widget? bottomSheet;
|
||||||
final bool withStack;
|
final bool withStack;
|
||||||
|
@ -2,11 +2,13 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
||||||
|
import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
|
||||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||||
|
import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
|
||||||
import 'package:immich_mobile/widgets/settings/asset_list_settings/asset_list_group_settings.dart';
|
import 'package:immich_mobile/widgets/settings/asset_list_settings/asset_list_group_settings.dart';
|
||||||
import 'package:immich_mobile/widgets/settings/settings_sub_page_scaffold.dart';
|
import 'package:immich_mobile/widgets/settings/settings_sub_page_scaffold.dart';
|
||||||
import 'package:immich_mobile/widgets/settings/settings_switch_list_tile.dart';
|
import 'package:immich_mobile/widgets/settings/settings_switch_list_tile.dart';
|
||||||
import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
|
|
||||||
import 'asset_list_layout_settings.dart';
|
import 'asset_list_layout_settings.dart';
|
||||||
|
|
||||||
class AssetListSettings extends HookConsumerWidget {
|
class AssetListSettings extends HookConsumerWidget {
|
||||||
@ -20,7 +22,10 @@ class AssetListSettings extends HookConsumerWidget {
|
|||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile(
|
||||||
valueNotifier: showStorageIndicator,
|
valueNotifier: showStorageIndicator,
|
||||||
title: 'theme_setting_asset_list_storage_indicator_title'.tr(),
|
title: 'theme_setting_asset_list_storage_indicator_title'.tr(),
|
||||||
onChanged: (_) => ref.invalidate(appSettingsServiceProvider),
|
onChanged: (_) {
|
||||||
|
ref.invalidate(appSettingsServiceProvider);
|
||||||
|
ref.invalidate(settingsProvider);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const LayoutSettings(),
|
const LayoutSettings(),
|
||||||
const GroupSettings(),
|
const GroupSettings(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user