forked from immich-app/immich
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(album): album view sort order (immich-app#14648)
* feat(mobile): album view sort order * feat: add error message * refactor(mobile): album page (immich-app#14659) * refactor album page * update lint rule * const record * fix: updating sort order when pull to refresh --------- Co-authored-by: Alex <[email protected]> * Move sort toggle button to bottom sheet menu * chore: revert multiselectgrid loading status * chore: revert multiselectgrid loading status --------- Co-authored-by: Mert <[email protected]>
- Loading branch information
Showing
32 changed files
with
711 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
enum SortOrder { | ||
asc, | ||
desc, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import 'package:immich_mobile/providers/album/current_album.provider.dart'; | ||
import 'package:immich_mobile/providers/auth.provider.dart'; | ||
import 'package:immich_mobile/widgets/album/album_action_filled_button.dart'; | ||
|
||
// ignore: must_be_immutable | ||
class AlbumControlButton extends ConsumerWidget { | ||
void Function() onAddPhotosPressed; | ||
void Function() onAddUsersPressed; | ||
|
||
AlbumControlButton({ | ||
super.key, | ||
required this.onAddPhotosPressed, | ||
required this.onAddUsersPressed, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final userId = ref.watch(authProvider).userId; | ||
final isOwner = ref.watch( | ||
currentAlbumProvider.select((album) { | ||
return album?.ownerId == userId; | ||
}), | ||
); | ||
|
||
return Padding( | ||
padding: const EdgeInsets.only(left: 16.0, top: 8, bottom: 16), | ||
child: SizedBox( | ||
height: 40, | ||
child: ListView( | ||
scrollDirection: Axis.horizontal, | ||
children: [ | ||
AlbumActionFilledButton( | ||
key: const ValueKey('add_photos_button'), | ||
iconData: Icons.add_photo_alternate_outlined, | ||
onPressed: onAddPhotosPressed, | ||
labelText: "share_add_photos".tr(), | ||
), | ||
if (isOwner) | ||
AlbumActionFilledButton( | ||
key: const ValueKey('add_users_button'), | ||
iconData: Icons.person_add_alt_rounded, | ||
onPressed: onAddUsersPressed, | ||
labelText: "album_viewer_page_share_add_users".tr(), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import 'package:immich_mobile/extensions/build_context_extensions.dart'; | ||
import 'package:immich_mobile/providers/album/current_album.provider.dart'; | ||
|
||
class AlbumDateRange extends ConsumerWidget { | ||
const AlbumDateRange({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final data = ref.watch( | ||
currentAlbumProvider.select((album) { | ||
if (album == null || album.assets.isEmpty) { | ||
return null; | ||
} | ||
|
||
final startDate = album.startDate; | ||
final endDate = album.endDate; | ||
if (startDate == null || endDate == null) { | ||
return null; | ||
} | ||
return (startDate, endDate, album.shared); | ||
}), | ||
); | ||
|
||
if (data == null) { | ||
return const SizedBox(); | ||
} | ||
final (startDate, endDate, shared) = data; | ||
|
||
return Padding( | ||
padding: shared | ||
? const EdgeInsets.only( | ||
left: 16.0, | ||
bottom: 0.0, | ||
) | ||
: const EdgeInsets.only(left: 16.0, bottom: 8.0), | ||
child: Text( | ||
_getDateRangeText(startDate, endDate), | ||
style: context.textTheme.labelLarge, | ||
), | ||
); | ||
} | ||
|
||
@pragma('vm:prefer-inline') | ||
String _getDateRangeText(DateTime startDate, DateTime endDate) { | ||
if (startDate.day == endDate.day && | ||
startDate.month == endDate.month && | ||
startDate.year == endDate.year) { | ||
return DateFormat.yMMMd().format(startDate); | ||
} | ||
|
||
final String startDateText = (startDate.year == endDate.year | ||
? DateFormat.MMMd() | ||
: DateFormat.yMMMd()) | ||
.format(startDate); | ||
final String endDateText = DateFormat.yMMMd().format(endDate); | ||
return "$startDateText - $endDateText"; | ||
} | ||
} |
Oops, something went wrong.