1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 15:47:54 +02:00

feat(mobile): hide storage indicator outside main timeline (#19835)

* feat(mobile): hide storage indicator outside main timeline

* fix: lint

* set default as false

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Daimolean
2025-07-11 00:59:52 +08:00
committed by GitHub
parent 68db17028b
commit 4ddd3764b4
5 changed files with 18 additions and 6 deletions

View File

@ -16,17 +16,18 @@ class MainTimelinePage extends ConsumerWidget {
return memoryLaneProvider.when( return memoryLaneProvider.when(
data: (memories) { data: (memories) {
return memories.isEmpty return memories.isEmpty
? const Timeline() ? const Timeline(showStorageIndicator: true)
: 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,
); );
}, },
loading: () => const Timeline(), loading: () => const Timeline(showStorageIndicator: true),
error: (error, stackTrace) => const Timeline(), error: (error, stackTrace) => const Timeline(showStorageIndicator: true),
); );
} }
} }

View File

@ -33,7 +33,7 @@ class DriftAssetSelectionTimelinePage extends ConsumerWidget {
final user = ref.watch(currentUserProvider); final user = ref.watch(currentUserProvider);
if (user == null) { if (user == null) {
throw Exception( throw Exception(
'User must be logged in to access recently taken', 'User must be logged in to access asset selection timeline',
); );
} }

View File

@ -206,6 +206,9 @@ class _AssetTileWidget extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final lockSelection = _getLockSelectionStatus(ref); final lockSelection = _getLockSelectionStatus(ref);
final showStorageIndicator = ref.watch(
timelineArgsProvider.select((args) => args.showStorageIndicator),
);
return RepaintBoundary( return RepaintBoundary(
child: GestureDetector( child: GestureDetector(
@ -217,6 +220,7 @@ class _AssetTileWidget extends ConsumerWidget {
child: ThumbnailTile( child: ThumbnailTile(
asset, asset,
lockSelection: lockSelection, lockSelection: lockSelection,
showStorageIndicator: showStorageIndicator,
), ),
), ),
); );

View File

@ -14,12 +14,14 @@ class TimelineArgs {
final double maxHeight; final double maxHeight;
final double spacing; final double spacing;
final int columnCount; final int columnCount;
final bool showStorageIndicator;
const TimelineArgs({ const TimelineArgs({
required this.maxWidth, required this.maxWidth,
required this.maxHeight, required this.maxHeight,
this.spacing = kTimelineSpacing, this.spacing = kTimelineSpacing,
this.columnCount = kTimelineColumnCount, this.columnCount = kTimelineColumnCount,
this.showStorageIndicator = false,
}); });
@override @override
@ -27,7 +29,8 @@ class TimelineArgs {
return spacing == other.spacing && return spacing == other.spacing &&
maxWidth == other.maxWidth && maxWidth == other.maxWidth &&
maxHeight == other.maxHeight && maxHeight == other.maxHeight &&
columnCount == other.columnCount; columnCount == other.columnCount &&
showStorageIndicator == other.showStorageIndicator;
} }
@override @override
@ -35,7 +38,8 @@ class TimelineArgs {
maxWidth.hashCode ^ maxWidth.hashCode ^
maxHeight.hashCode ^ maxHeight.hashCode ^
spacing.hashCode ^ spacing.hashCode ^
columnCount.hashCode; columnCount.hashCode ^
showStorageIndicator.hashCode;
} }
class TimelineState { class TimelineState {

View File

@ -26,11 +26,13 @@ class Timeline extends StatelessWidget {
super.key, super.key,
this.topSliverWidget, this.topSliverWidget,
this.topSliverWidgetHeight, this.topSliverWidgetHeight,
this.showStorageIndicator = false,
this.appBar, this.appBar,
}); });
final Widget? topSliverWidget; final Widget? topSliverWidget;
final double? topSliverWidgetHeight; final double? topSliverWidgetHeight;
final bool showStorageIndicator;
final Widget? appBar; final Widget? appBar;
@override @override
@ -46,6 +48,7 @@ class Timeline extends StatelessWidget {
columnCount: ref.watch( columnCount: ref.watch(
settingsProvider.select((s) => s.get(Setting.tilesPerRow)), settingsProvider.select((s) => s.get(Setting.tilesPerRow)),
), ),
showStorageIndicator: showStorageIndicator,
), ),
), ),
], ],