mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
chore(mobile): clean up linter problems (#1000)
This commit is contained in:
parent
bc9ee1d611
commit
39b7ab66d4
@ -69,7 +69,10 @@ class AlbumService {
|
|||||||
Iterable<Asset> assets,
|
Iterable<Asset> assets,
|
||||||
) async {
|
) async {
|
||||||
return createAlbum(
|
return createAlbum(
|
||||||
_getNextAlbumName(await getAlbums(isShared: false)), assets, []);
|
_getNextAlbumName(await getAlbums(isShared: false)),
|
||||||
|
assets,
|
||||||
|
[],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AlbumResponseDto?> getAlbumDetail(String albumId) async {
|
Future<AlbumResponseDto?> getAlbumDetail(String albumId) async {
|
||||||
|
@ -34,7 +34,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
final newAlbumTitle = ref.watch(albumViewerProvider).editTitleText;
|
final newAlbumTitle = ref.watch(albumViewerProvider).editTitleText;
|
||||||
final isEditAlbum = ref.watch(albumViewerProvider).isEditAlbum;
|
final isEditAlbum = ref.watch(albumViewerProvider).isEditAlbum;
|
||||||
|
|
||||||
void _onDeleteAlbumPressed(String albumId) async {
|
void onDeleteAlbumPressed(String albumId) async {
|
||||||
ImmichLoadingOverlayController.appLoader.show();
|
ImmichLoadingOverlayController.appLoader.show();
|
||||||
|
|
||||||
bool isSuccess =
|
bool isSuccess =
|
||||||
@ -62,7 +62,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
ImmichLoadingOverlayController.appLoader.hide();
|
ImmichLoadingOverlayController.appLoader.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onLeaveAlbumPressed(String albumId) async {
|
void onLeaveAlbumPressed(String albumId) async {
|
||||||
ImmichLoadingOverlayController.appLoader.show();
|
ImmichLoadingOverlayController.appLoader.show();
|
||||||
|
|
||||||
bool isSuccess =
|
bool isSuccess =
|
||||||
@ -84,7 +84,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
ImmichLoadingOverlayController.appLoader.hide();
|
ImmichLoadingOverlayController.appLoader.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onRemoveFromAlbumPressed(String albumId) async {
|
void onRemoveFromAlbumPressed(String albumId) async {
|
||||||
ImmichLoadingOverlayController.appLoader.show();
|
ImmichLoadingOverlayController.appLoader.show();
|
||||||
|
|
||||||
bool isSuccess =
|
bool isSuccess =
|
||||||
@ -110,7 +110,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
ImmichLoadingOverlayController.appLoader.hide();
|
ImmichLoadingOverlayController.appLoader.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildBottomSheetActionButton() {
|
buildBottomSheetActionButton() {
|
||||||
if (isMultiSelectionEnable) {
|
if (isMultiSelectionEnable) {
|
||||||
if (albumInfo.ownerId == userId) {
|
if (albumInfo.ownerId == userId) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
@ -119,7 +119,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
'album_viewer_appbar_share_remove',
|
'album_viewer_appbar_share_remove',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
).tr(),
|
).tr(),
|
||||||
onTap: () => _onRemoveFromAlbumPressed(albumId),
|
onTap: () => onRemoveFromAlbumPressed(albumId),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
@ -132,7 +132,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
'album_viewer_appbar_share_delete',
|
'album_viewer_appbar_share_delete',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
).tr(),
|
).tr(),
|
||||||
onTap: () => _onDeleteAlbumPressed(albumId),
|
onTap: () => onDeleteAlbumPressed(albumId),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
@ -141,13 +141,13 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
'album_viewer_appbar_share_leave',
|
'album_viewer_appbar_share_leave',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
).tr(),
|
).tr(),
|
||||||
onTap: () => _onLeaveAlbumPressed(albumId),
|
onTap: () => onLeaveAlbumPressed(albumId),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _buildBottomSheet() {
|
void buildBottomSheet() {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
isScrollControlled: false,
|
isScrollControlled: false,
|
||||||
@ -157,7 +157,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
_buildBottomSheetActionButton(),
|
buildBottomSheetActionButton(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -165,7 +165,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildLeadingButton() {
|
buildLeadingButton() {
|
||||||
if (isMultiSelectionEnable) {
|
if (isMultiSelectionEnable) {
|
||||||
return IconButton(
|
return IconButton(
|
||||||
onPressed: () => ref
|
onPressed: () => ref
|
||||||
@ -204,7 +204,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
|
|
||||||
return AppBar(
|
return AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
leading: _buildLeadingButton(),
|
leading: buildLeadingButton(),
|
||||||
title: isMultiSelectionEnable
|
title: isMultiSelectionEnable
|
||||||
? Text('${selectedAssetsInAlbum.length}')
|
? Text('${selectedAssetsInAlbum.length}')
|
||||||
: null,
|
: null,
|
||||||
@ -212,7 +212,7 @@ class AlbumViewerAppbar extends HookConsumerWidget with PreferredSizeWidget {
|
|||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
splashRadius: 25,
|
splashRadius: 25,
|
||||||
onPressed: _buildBottomSheet,
|
onPressed: buildBottomSheet,
|
||||||
icon: const Icon(Icons.more_horiz_rounded),
|
icon: const Icon(Icons.more_horiz_rounded),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -27,7 +27,7 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
|||||||
final isMultiSelectionEnable =
|
final isMultiSelectionEnable =
|
||||||
ref.watch(assetSelectionProvider).isMultiselectEnable;
|
ref.watch(assetSelectionProvider).isMultiselectEnable;
|
||||||
|
|
||||||
_viewAsset() {
|
viewAsset() {
|
||||||
AutoRouter.of(context).push(
|
AutoRouter.of(context).push(
|
||||||
GalleryViewerRoute(
|
GalleryViewerRoute(
|
||||||
asset: asset,
|
asset: asset,
|
||||||
@ -47,18 +47,18 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_enableMultiSelection() {
|
enableMultiSelection() {
|
||||||
ref.watch(assetSelectionProvider.notifier).enableMultiselection();
|
ref.watch(assetSelectionProvider.notifier).enableMultiselection();
|
||||||
ref
|
ref
|
||||||
.watch(assetSelectionProvider.notifier)
|
.watch(assetSelectionProvider.notifier)
|
||||||
.addAssetsInAlbumViewer([asset]);
|
.addAssetsInAlbumViewer([asset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_disableMultiSelection() {
|
disableMultiSelection() {
|
||||||
ref.watch(assetSelectionProvider.notifier).disableMultiselection();
|
ref.watch(assetSelectionProvider.notifier).disableMultiselection();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildVideoLabel() {
|
buildVideoLabel() {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: 5,
|
top: 5,
|
||||||
right: 5,
|
right: 5,
|
||||||
@ -80,7 +80,7 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildAssetStoreLocationIcon() {
|
buildAssetStoreLocationIcon() {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 5,
|
bottom: 5,
|
||||||
@ -94,7 +94,7 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildAssetSelectionIcon() {
|
buildAssetSelectionIcon() {
|
||||||
bool isSelected = selectedAssetsInAlbumViewer.contains(asset);
|
bool isSelected = selectedAssetsInAlbumViewer.contains(asset);
|
||||||
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
@ -112,21 +112,21 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildThumbnailImage() {
|
buildThumbnailImage() {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(border: drawBorderColor()),
|
decoration: BoxDecoration(border: drawBorderColor()),
|
||||||
child: ImmichImage(asset, width: 300, height: 300),
|
child: ImmichImage(asset, width: 300, height: 300),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleSelectionGesture() {
|
handleSelectionGesture() {
|
||||||
if (selectedAssetsInAlbumViewer.contains(asset)) {
|
if (selectedAssetsInAlbumViewer.contains(asset)) {
|
||||||
ref
|
ref
|
||||||
.watch(assetSelectionProvider.notifier)
|
.watch(assetSelectionProvider.notifier)
|
||||||
.removeAssetsInAlbumViewer([asset]);
|
.removeAssetsInAlbumViewer([asset]);
|
||||||
|
|
||||||
if (selectedAssetsInAlbumViewer.isEmpty) {
|
if (selectedAssetsInAlbumViewer.isEmpty) {
|
||||||
_disableMultiSelection();
|
disableMultiSelection();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ref
|
ref
|
||||||
@ -136,14 +136,14 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: isMultiSelectionEnable ? _handleSelectionGesture : _viewAsset,
|
onTap: isMultiSelectionEnable ? handleSelectionGesture : viewAsset,
|
||||||
onLongPress: _enableMultiSelection,
|
onLongPress: enableMultiSelection,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
_buildThumbnailImage(),
|
buildThumbnailImage(),
|
||||||
if (showStorageIndicator) _buildAssetStoreLocationIcon(),
|
if (showStorageIndicator) buildAssetStoreLocationIcon(),
|
||||||
if (!asset.isImage) _buildVideoLabel(),
|
if (!asset.isImage) buildVideoLabel(),
|
||||||
if (isMultiSelectionEnable) _buildAssetSelectionIcon(),
|
if (isMultiSelectionEnable) buildAssetSelectionIcon(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -21,7 +21,7 @@ class MonthGroupTitle extends HookConsumerWidget {
|
|||||||
ref.watch(assetSelectionProvider).selectedNewAssetsForAlbum;
|
ref.watch(assetSelectionProvider).selectedNewAssetsForAlbum;
|
||||||
final isAlbumExist = ref.watch(assetSelectionProvider).isAlbumExist;
|
final isAlbumExist = ref.watch(assetSelectionProvider).isAlbumExist;
|
||||||
|
|
||||||
_handleTitleIconClick() {
|
handleTitleIconClick() {
|
||||||
HapticFeedback.heavyImpact();
|
HapticFeedback.heavyImpact();
|
||||||
|
|
||||||
if (isAlbumExist) {
|
if (isAlbumExist) {
|
||||||
@ -61,7 +61,7 @@ class MonthGroupTitle extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSimplifiedMonth() {
|
getSimplifiedMonth() {
|
||||||
var monthAndYear = month.split(',');
|
var monthAndYear = month.split(',');
|
||||||
var yearText = monthAndYear[1].trim();
|
var yearText = monthAndYear[1].trim();
|
||||||
var monthText = monthAndYear[0].trim();
|
var monthText = monthAndYear[0].trim();
|
||||||
@ -85,7 +85,7 @@ class MonthGroupTitle extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: _handleTitleIconClick,
|
onTap: handleTitleIconClick,
|
||||||
child: selectedDateGroup.contains(month)
|
child: selectedDateGroup.contains(month)
|
||||||
? Icon(
|
? Icon(
|
||||||
Icons.check_circle_rounded,
|
Icons.check_circle_rounded,
|
||||||
@ -97,11 +97,11 @@ class MonthGroupTitle extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: _handleTitleIconClick,
|
onTap: handleTitleIconClick,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
_getSimplifiedMonth(),
|
getSimplifiedMonth(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
|
@ -18,7 +18,7 @@ class SelectionThumbnailImage extends HookConsumerWidget {
|
|||||||
ref.watch(assetSelectionProvider).selectedAdditionalAssetsForAlbum;
|
ref.watch(assetSelectionProvider).selectedAdditionalAssetsForAlbum;
|
||||||
var isAlbumExist = ref.watch(assetSelectionProvider).isAlbumExist;
|
var isAlbumExist = ref.watch(assetSelectionProvider).isAlbumExist;
|
||||||
|
|
||||||
Widget _buildSelectionIcon(Asset asset) {
|
Widget buildSelectionIcon(Asset asset) {
|
||||||
var isSelected = selectedAsset.map((item) => item.id).contains(asset.id);
|
var isSelected = selectedAsset.map((item) => item.id).contains(asset.id);
|
||||||
var isNewlySelected =
|
var isNewlySelected =
|
||||||
newAssetsForAlbum.map((item) => item.id).contains(asset.id);
|
newAssetsForAlbum.map((item) => item.id).contains(asset.id);
|
||||||
@ -111,7 +111,7 @@ class SelectionThumbnailImage extends HookConsumerWidget {
|
|||||||
padding: const EdgeInsets.all(3.0),
|
padding: const EdgeInsets.all(3.0),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: _buildSelectionIcon(asset),
|
child: buildSelectionIcon(asset),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!asset.isImage)
|
if (!asset.isImage)
|
||||||
|
@ -37,7 +37,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
/// Find out if the assets in album exist on the device
|
/// Find out if the assets in album exist on the device
|
||||||
/// If they exist, add to selected asset state to show they are already selected.
|
/// If they exist, add to selected asset state to show they are already selected.
|
||||||
void _onAddPhotosPressed(AlbumResponseDto albumInfo) async {
|
void onAddPhotosPressed(AlbumResponseDto albumInfo) async {
|
||||||
if (albumInfo.assets.isNotEmpty == true) {
|
if (albumInfo.assets.isNotEmpty == true) {
|
||||||
ref.watch(assetSelectionProvider.notifier).addNewAssets(
|
ref.watch(assetSelectionProvider.notifier).addNewAssets(
|
||||||
albumInfo.assets.map((e) => Asset.remote(e)).toList(),
|
albumInfo.assets.map((e) => Asset.remote(e)).toList(),
|
||||||
@ -60,7 +60,8 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
albumId,
|
albumId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (addAssetsResult != null && addAssetsResult.successfullyAdded > 0) {
|
if (addAssetsResult != null &&
|
||||||
|
addAssetsResult.successfullyAdded > 0) {
|
||||||
ref.refresh(sharedAlbumDetailProvider(albumId));
|
ref.refresh(sharedAlbumDetailProvider(albumId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onAddUsersPressed(AlbumResponseDto albumInfo) async {
|
void onAddUsersPressed(AlbumResponseDto albumInfo) async {
|
||||||
List<String>? sharedUserIds =
|
List<String>? sharedUserIds =
|
||||||
await AutoRouter.of(context).push<List<String>?>(
|
await AutoRouter.of(context).push<List<String>?>(
|
||||||
SelectAdditionalUserForSharingRoute(albumInfo: albumInfo),
|
SelectAdditionalUserForSharingRoute(albumInfo: albumInfo),
|
||||||
@ -94,7 +95,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTitle(AlbumResponseDto albumInfo) {
|
Widget buildTitle(AlbumResponseDto albumInfo) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 8, right: 8, top: 16),
|
padding: const EdgeInsets.only(left: 8, right: 8, top: 16),
|
||||||
child: userId == albumInfo.ownerId
|
child: userId == albumInfo.ownerId
|
||||||
@ -115,7 +116,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAlbumDateRange(AlbumResponseDto albumInfo) {
|
Widget buildAlbumDateRange(AlbumResponseDto albumInfo) {
|
||||||
String startDate = "";
|
String startDate = "";
|
||||||
DateTime parsedStartDate =
|
DateTime parsedStartDate =
|
||||||
DateTime.parse(albumInfo.assets.first.createdAt);
|
DateTime.parse(albumInfo.assets.first.createdAt);
|
||||||
@ -148,14 +149,14 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildHeader(AlbumResponseDto albumInfo) {
|
Widget buildHeader(AlbumResponseDto albumInfo) {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildTitle(albumInfo),
|
buildTitle(albumInfo),
|
||||||
if (albumInfo.assets.isNotEmpty == true)
|
if (albumInfo.assets.isNotEmpty == true)
|
||||||
_buildAlbumDateRange(albumInfo),
|
buildAlbumDateRange(albumInfo),
|
||||||
if (albumInfo.shared)
|
if (albumInfo.shared)
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
@ -188,7 +189,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildImageGrid(AlbumResponseDto albumInfo) {
|
Widget buildImageGrid(AlbumResponseDto albumInfo) {
|
||||||
final appSettingService = ref.watch(appSettingsServiceProvider);
|
final appSettingService = ref.watch(appSettingsServiceProvider);
|
||||||
final bool showStorageIndicator =
|
final bool showStorageIndicator =
|
||||||
appSettingService.getSetting(AppSettingsEnum.storageIndicator);
|
appSettingService.getSetting(AppSettingsEnum.storageIndicator);
|
||||||
@ -220,7 +221,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
return const SliverToBoxAdapter();
|
return const SliverToBoxAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildControlButton(AlbumResponseDto albumInfo) {
|
Widget buildControlButton(AlbumResponseDto albumInfo) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 16.0, top: 8, bottom: 8),
|
padding: const EdgeInsets.only(left: 16.0, top: 8, bottom: 8),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -230,13 +231,13 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
AlbumActionOutlinedButton(
|
AlbumActionOutlinedButton(
|
||||||
iconData: Icons.add_photo_alternate_outlined,
|
iconData: Icons.add_photo_alternate_outlined,
|
||||||
onPressed: () => _onAddPhotosPressed(albumInfo),
|
onPressed: () => onAddPhotosPressed(albumInfo),
|
||||||
labelText: "share_add_photos".tr(),
|
labelText: "share_add_photos".tr(),
|
||||||
),
|
),
|
||||||
if (userId == albumInfo.ownerId)
|
if (userId == albumInfo.ownerId)
|
||||||
AlbumActionOutlinedButton(
|
AlbumActionOutlinedButton(
|
||||||
iconData: Icons.person_add_alt_rounded,
|
iconData: Icons.person_add_alt_rounded,
|
||||||
onPressed: () => _onAddUsersPressed(albumInfo),
|
onPressed: () => onAddUsersPressed(albumInfo),
|
||||||
labelText: "album_viewer_page_share_add_users".tr(),
|
labelText: "album_viewer_page_share_add_users".tr(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -245,7 +246,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody(AlbumResponseDto albumInfo) {
|
Widget buildBody(AlbumResponseDto albumInfo) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
titleFocusNode.unfocus();
|
titleFocusNode.unfocus();
|
||||||
@ -257,7 +258,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
_buildHeader(albumInfo),
|
buildHeader(albumInfo),
|
||||||
SliverPersistentHeader(
|
SliverPersistentHeader(
|
||||||
pinned: true,
|
pinned: true,
|
||||||
delegate: ImmichSliverPersistentAppBarDelegate(
|
delegate: ImmichSliverPersistentAppBarDelegate(
|
||||||
@ -265,11 +266,11 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
maxHeight: 50,
|
maxHeight: 50,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
child: _buildControlButton(albumInfo),
|
child: buildControlButton(albumInfo),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_buildImageGrid(albumInfo)
|
buildImageGrid(albumInfo)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -293,7 +294,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: albumInfo.when(
|
body: albumInfo.when(
|
||||||
data: (albumInfo) => albumInfo != null
|
data: (albumInfo) => albumInfo != null
|
||||||
? _buildBody(albumInfo)
|
? buildBody(albumInfo)
|
||||||
: const Center(
|
: const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
),
|
),
|
||||||
|
@ -25,7 +25,7 @@ class AssetSelectionPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
List<Widget> imageGridGroup = [];
|
List<Widget> imageGridGroup = [];
|
||||||
|
|
||||||
String _buildAssetCountText() {
|
String buildAssetCountText() {
|
||||||
if (isAlbumExist) {
|
if (isAlbumExist) {
|
||||||
return (selectedAssets.length + newAssetsForAlbum.length).toString();
|
return (selectedAssets.length + newAssetsForAlbum.length).toString();
|
||||||
} else {
|
} else {
|
||||||
@ -33,7 +33,7 @@ class AssetSelectionPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody() {
|
Widget buildBody() {
|
||||||
assetGroupMonthYear.forEach((monthYear, assetGroup) {
|
assetGroupMonthYear.forEach((monthYear, assetGroup) {
|
||||||
imageGridGroup
|
imageGridGroup
|
||||||
.add(MonthGroupTitle(month: monthYear, assetGroup: assetGroup));
|
.add(MonthGroupTitle(month: monthYear, assetGroup: assetGroup));
|
||||||
@ -71,7 +71,7 @@ class AssetSelectionPage extends HookConsumerWidget {
|
|||||||
style: TextStyle(fontSize: 18),
|
style: TextStyle(fontSize: 18),
|
||||||
).tr()
|
).tr()
|
||||||
: Text(
|
: Text(
|
||||||
_buildAssetCountText(),
|
buildAssetCountText(),
|
||||||
style: const TextStyle(fontSize: 18),
|
style: const TextStyle(fontSize: 18),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
@ -94,7 +94,7 @@ class AssetSelectionPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: _buildBody(),
|
body: buildBody(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,11 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
ref.watch(assetSelectionProvider).selectedNewAssetsForAlbum;
|
ref.watch(assetSelectionProvider).selectedNewAssetsForAlbum;
|
||||||
final isDarkTheme = Theme.of(context).brightness == Brightness.dark;
|
final isDarkTheme = Theme.of(context).brightness == Brightness.dark;
|
||||||
|
|
||||||
_showSelectUserPage() {
|
showSelectUserPage() {
|
||||||
AutoRouter.of(context).push(const SelectUserForSharingRoute());
|
AutoRouter.of(context).push(const SelectUserForSharingRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onBackgroundTapped() {
|
void onBackgroundTapped() {
|
||||||
albumTitleTextFieldFocusNode.unfocus();
|
albumTitleTextFieldFocusNode.unfocus();
|
||||||
isAlbumTitleTextFieldFocus.value = false;
|
isAlbumTitleTextFieldFocus.value = false;
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSelectPhotosButtonPressed() async {
|
onSelectPhotosButtonPressed() async {
|
||||||
ref.watch(assetSelectionProvider.notifier).setIsAlbumExist(false);
|
ref.watch(assetSelectionProvider.notifier).setIsAlbumExist(false);
|
||||||
|
|
||||||
AssetSelectionPageResult? selectedAsset = await AutoRouter.of(context)
|
AssetSelectionPageResult? selectedAsset = await AutoRouter.of(context)
|
||||||
@ -56,7 +56,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildTitleInputField() {
|
buildTitleInputField() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
right: 10,
|
right: 10,
|
||||||
@ -71,7 +71,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildTitle() {
|
buildTitle() {
|
||||||
if (selectedAssets.isEmpty) {
|
if (selectedAssets.isEmpty) {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -90,7 +90,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
return const SliverToBoxAdapter();
|
return const SliverToBoxAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildSelectPhotosButton() {
|
buildSelectPhotosButton() {
|
||||||
if (selectedAssets.isEmpty) {
|
if (selectedAssets.isEmpty) {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -109,7 +109,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: _onSelectPhotosButtonPressed,
|
onPressed: onSelectPhotosButtonPressed,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.add_rounded,
|
Icons.add_rounded,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
@ -132,7 +132,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
return const SliverToBoxAdapter();
|
return const SliverToBoxAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildControlButton() {
|
buildControlButton() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 12.0, top: 16, bottom: 16),
|
padding: const EdgeInsets.only(left: 12.0, top: 16, bottom: 16),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -142,7 +142,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
AlbumActionOutlinedButton(
|
AlbumActionOutlinedButton(
|
||||||
iconData: Icons.add_photo_alternate_outlined,
|
iconData: Icons.add_photo_alternate_outlined,
|
||||||
onPressed: _onSelectPhotosButtonPressed,
|
onPressed: onSelectPhotosButtonPressed,
|
||||||
labelText: "share_add_photos".tr(),
|
labelText: "share_add_photos".tr(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -151,7 +151,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildSelectedImageGrid() {
|
buildSelectedImageGrid() {
|
||||||
if (selectedAssets.isNotEmpty) {
|
if (selectedAssets.isNotEmpty) {
|
||||||
return SliverPadding(
|
return SliverPadding(
|
||||||
padding: const EdgeInsets.only(top: 16),
|
padding: const EdgeInsets.only(top: 16),
|
||||||
@ -164,7 +164,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: _onBackgroundTapped,
|
onTap: onBackgroundTapped,
|
||||||
child: SharedAlbumThumbnailImage(
|
child: SharedAlbumThumbnailImage(
|
||||||
asset: selectedAssets.elementAt(index),
|
asset: selectedAssets.elementAt(index),
|
||||||
),
|
),
|
||||||
@ -179,7 +179,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
return const SliverToBoxAdapter();
|
return const SliverToBoxAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
_createNonSharedAlbum() async {
|
createNonSharedAlbum() async {
|
||||||
var newAlbum = await ref.watch(albumProvider.notifier).createAlbum(
|
var newAlbum = await ref.watch(albumProvider.notifier).createAlbum(
|
||||||
ref.watch(albumTitleProvider),
|
ref.watch(albumTitleProvider),
|
||||||
ref.watch(assetSelectionProvider).selectedNewAssetsForAlbum,
|
ref.watch(assetSelectionProvider).selectedNewAssetsForAlbum,
|
||||||
@ -216,7 +216,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
if (isSharedAlbum)
|
if (isSharedAlbum)
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: albumTitleController.text.isNotEmpty
|
onPressed: albumTitleController.text.isNotEmpty
|
||||||
? _showSelectUserPage
|
? showSelectUserPage
|
||||||
: null,
|
: null,
|
||||||
child: Text(
|
child: Text(
|
||||||
'create_shared_album_page_share'.tr(),
|
'create_shared_album_page_share'.tr(),
|
||||||
@ -230,7 +230,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
TextButton(
|
TextButton(
|
||||||
onPressed: albumTitleController.text.isNotEmpty &&
|
onPressed: albumTitleController.text.isNotEmpty &&
|
||||||
selectedAssets.isNotEmpty
|
selectedAssets.isNotEmpty
|
||||||
? _createNonSharedAlbum
|
? createNonSharedAlbum
|
||||||
: null,
|
: null,
|
||||||
child: Text(
|
child: Text(
|
||||||
'create_shared_album_page_create'.tr(),
|
'create_shared_album_page_create'.tr(),
|
||||||
@ -242,7 +242,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: _onBackgroundTapped,
|
onTap: onBackgroundTapped,
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
@ -255,15 +255,15 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
preferredSize: const Size.fromHeight(66.0),
|
preferredSize: const Size.fromHeight(66.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildTitleInputField(),
|
buildTitleInputField(),
|
||||||
if (selectedAssets.isNotEmpty) _buildControlButton(),
|
if (selectedAssets.isNotEmpty) buildControlButton(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_buildTitle(),
|
buildTitle(),
|
||||||
_buildSelectPhotosButton(),
|
buildSelectPhotosButton(),
|
||||||
_buildSelectedImageGrid(),
|
buildSelectedImageGrid(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -19,12 +19,12 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
ref.watch(suggestedSharedUsersProvider);
|
ref.watch(suggestedSharedUsersProvider);
|
||||||
final sharedUsersList = useState<Set<UserResponseDto>>({});
|
final sharedUsersList = useState<Set<UserResponseDto>>({});
|
||||||
|
|
||||||
_addNewUsersHandler() {
|
addNewUsersHandler() {
|
||||||
AutoRouter.of(context)
|
AutoRouter.of(context)
|
||||||
.pop(sharedUsersList.value.map((e) => e.id).toList());
|
.pop(sharedUsersList.value.map((e) => e.id).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildTileIcon(UserResponseDto user) {
|
buildTileIcon(UserResponseDto user) {
|
||||||
if (sharedUsersList.value.contains(user)) {
|
if (sharedUsersList.value.contains(user)) {
|
||||||
return CircleAvatar(
|
return CircleAvatar(
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
@ -42,7 +42,7 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildUserList(List<UserResponseDto> users) {
|
buildUserList(List<UserResponseDto> users) {
|
||||||
List<Widget> usersChip = [];
|
List<Widget> usersChip = [];
|
||||||
|
|
||||||
for (var user in sharedUsersList.value) {
|
for (var user in sharedUsersList.value) {
|
||||||
@ -84,7 +84,7 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemBuilder: ((context, index) {
|
itemBuilder: ((context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: _buildTileIcon(users[index]),
|
leading: buildTileIcon(users[index]),
|
||||||
title: Text(
|
title: Text(
|
||||||
users[index].email,
|
users[index].email,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@ -131,7 +131,7 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed:
|
onPressed:
|
||||||
sharedUsersList.value.isEmpty ? null : _addNewUsersHandler,
|
sharedUsersList.value.isEmpty ? null : addNewUsersHandler,
|
||||||
child: const Text(
|
child: const Text(
|
||||||
"share_add",
|
"share_add",
|
||||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
||||||
@ -147,7 +147,7 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _buildUserList(users);
|
return buildUserList(users);
|
||||||
},
|
},
|
||||||
error: (e, _) => Text("Error loading suggested users $e"),
|
error: (e, _) => Text("Error loading suggested users $e"),
|
||||||
loading: () => const Center(
|
loading: () => const Center(
|
||||||
|
@ -20,7 +20,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
AsyncValue<List<UserResponseDto>> suggestedShareUsers =
|
AsyncValue<List<UserResponseDto>> suggestedShareUsers =
|
||||||
ref.watch(suggestedSharedUsersProvider);
|
ref.watch(suggestedSharedUsersProvider);
|
||||||
|
|
||||||
_createSharedAlbum() async {
|
createSharedAlbum() async {
|
||||||
var newAlbum =
|
var newAlbum =
|
||||||
await ref.watch(sharedAlbumProvider.notifier).createSharedAlbum(
|
await ref.watch(sharedAlbumProvider.notifier).createSharedAlbum(
|
||||||
ref.watch(albumTitleProvider),
|
ref.watch(albumTitleProvider),
|
||||||
@ -44,7 +44,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildTileIcon(UserResponseDto user) {
|
buildTileIcon(UserResponseDto user) {
|
||||||
if (sharedUsersList.value.contains(user)) {
|
if (sharedUsersList.value.contains(user)) {
|
||||||
return CircleAvatar(
|
return CircleAvatar(
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
@ -62,7 +62,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildUserList(List<UserResponseDto> users) {
|
buildUserList(List<UserResponseDto> users) {
|
||||||
List<Widget> usersChip = [];
|
List<Widget> usersChip = [];
|
||||||
|
|
||||||
for (var user in sharedUsersList.value) {
|
for (var user in sharedUsersList.value) {
|
||||||
@ -104,7 +104,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemBuilder: ((context, index) {
|
itemBuilder: ((context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: _buildTileIcon(users[index]),
|
leading: buildTileIcon(users[index]),
|
||||||
title: Text(
|
title: Text(
|
||||||
users[index].email,
|
users[index].email,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@ -153,8 +153,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
foregroundColor: Theme.of(context).primaryColor,
|
foregroundColor: Theme.of(context).primaryColor,
|
||||||
),
|
),
|
||||||
onPressed:
|
onPressed: sharedUsersList.value.isEmpty ? null : createSharedAlbum,
|
||||||
sharedUsersList.value.isEmpty ? null : _createSharedAlbum,
|
|
||||||
child: const Text(
|
child: const Text(
|
||||||
"share_create_album",
|
"share_create_album",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -168,7 +167,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: suggestedShareUsers.when(
|
body: suggestedShareUsers.when(
|
||||||
data: (users) {
|
data: (users) {
|
||||||
return _buildUserList(users);
|
return buildUserList(users);
|
||||||
},
|
},
|
||||||
error: (e, _) => Text("Error loading suggested users $e"),
|
error: (e, _) => Text("Error loading suggested users $e"),
|
||||||
loading: () => const Center(
|
loading: () => const Center(
|
||||||
|
@ -28,7 +28,7 @@ class SharingPage extends HookConsumerWidget {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
_buildAlbumList() {
|
buildAlbumList() {
|
||||||
return SliverList(
|
return SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
@ -71,7 +71,7 @@ class SharingPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildEmptyListIndication() {
|
buildEmptyListIndication() {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -136,8 +136,8 @@ class SharingPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
sharedAlbums.isNotEmpty
|
sharedAlbums.isNotEmpty
|
||||||
? _buildAlbumList()
|
? buildAlbumList()
|
||||||
: _buildEmptyListIndication()
|
: buildEmptyListIndication()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -64,5 +64,7 @@ class ImageViewerStateNotifier extends StateNotifier<ImageViewerPageState> {
|
|||||||
final imageViewerStateProvider =
|
final imageViewerStateProvider =
|
||||||
StateNotifierProvider<ImageViewerStateNotifier, ImageViewerPageState>(
|
StateNotifierProvider<ImageViewerStateNotifier, ImageViewerPageState>(
|
||||||
((ref) => ImageViewerStateNotifier(
|
((ref) => ImageViewerStateNotifier(
|
||||||
ref.watch(imageViewerServiceProvider), ref.watch(shareServiceProvider))),
|
ref.watch(imageViewerServiceProvider),
|
||||||
|
ref.watch(shareServiceProvider),
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ class ExifBottomSheet extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
_buildMap() {
|
buildMap() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -66,7 +66,7 @@ class ExifBottomSheet extends ConsumerWidget {
|
|||||||
|
|
||||||
ExifResponseDto? exifInfo = assetDetail.remote?.exifInfo;
|
ExifResponseDto? exifInfo = assetDetail.remote?.exifInfo;
|
||||||
|
|
||||||
_buildLocationText() {
|
buildLocationText() {
|
||||||
return Text(
|
return Text(
|
||||||
"${exifInfo?.city}, ${exifInfo?.state}",
|
"${exifInfo?.city}, ${exifInfo?.state}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -120,11 +120,11 @@ class ExifBottomSheet extends ConsumerWidget {
|
|||||||
).tr(),
|
).tr(),
|
||||||
if (assetDetail.latitude != null &&
|
if (assetDetail.latitude != null &&
|
||||||
assetDetail.longitude != null)
|
assetDetail.longitude != null)
|
||||||
_buildMap(),
|
buildMap(),
|
||||||
if (exifInfo != null &&
|
if (exifInfo != null &&
|
||||||
exifInfo.city != null &&
|
exifInfo.city != null &&
|
||||||
exifInfo.state != null)
|
exifInfo.state != null)
|
||||||
_buildLocationText(),
|
buildLocationText(),
|
||||||
Text(
|
Text(
|
||||||
"${assetDetail.latitude?.toStringAsFixed(4)}, ${assetDetail.longitude?.toStringAsFixed(4)}",
|
"${assetDetail.latitude?.toStringAsFixed(4)}, ${assetDetail.longitude?.toStringAsFixed(4)}",
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:easy_localization/src/asset_loader.dart';
|
import 'package:easy_localization/src/asset_loader.dart';
|
||||||
import 'package:easy_localization/src/easy_localization_controller.dart';
|
import 'package:easy_localization/src/easy_localization_controller.dart';
|
||||||
|
@ -33,7 +33,7 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
ColorFilter unselectedFilter =
|
ColorFilter unselectedFilter =
|
||||||
const ColorFilter.mode(Colors.black, BlendMode.color);
|
const ColorFilter.mode(Colors.black, BlendMode.color);
|
||||||
|
|
||||||
_buildSelectedTextBox() {
|
buildSelectedTextBox() {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return Chip(
|
return Chip(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
@ -67,7 +67,7 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildImageFilter() {
|
buildImageFilter() {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return selectedFilter;
|
return selectedFilter;
|
||||||
} else if (isExcluded) {
|
} else if (isExcluded) {
|
||||||
@ -163,7 +163,7 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
topRight: Radius.circular(12),
|
topRight: Radius.circular(12),
|
||||||
),
|
),
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
colorFilter: _buildImageFilter(),
|
colorFilter: buildImageFilter(),
|
||||||
image: imageData != null
|
image: imageData != null
|
||||||
? MemoryImage(imageData!)
|
? MemoryImage(imageData!)
|
||||||
: const AssetImage(
|
: const AssetImage(
|
||||||
@ -177,7 +177,7 @@ class AlbumInfoCard extends HookConsumerWidget {
|
|||||||
Positioned(
|
Positioned(
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
left: 25,
|
left: 25,
|
||||||
child: _buildSelectedTextBox(),
|
child: buildSelectedTextBox(),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -15,14 +15,16 @@ class AlbumPreviewPage extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final assets = useState<List<AssetEntity>>([]);
|
final assets = useState<List<AssetEntity>>([]);
|
||||||
|
|
||||||
_getAssetsInAlbum() async {
|
getAssetsInAlbum() async {
|
||||||
assets.value = await album.getAssetListRange(
|
assets.value = await album.getAssetListRange(
|
||||||
start: 0, end: await album.assetCountAsync);
|
start: 0,
|
||||||
|
end: await album.assetCountAsync,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() {
|
() {
|
||||||
_getAssetsInAlbum();
|
getAssetsInAlbum();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
|
@ -27,7 +27,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
_buildAlbumSelectionList() {
|
buildAlbumSelectionList() {
|
||||||
if (availableAlbums.isEmpty) {
|
if (availableAlbums.isEmpty) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: ImmichLoadingIndicator(),
|
child: ImmichLoadingIndicator(),
|
||||||
@ -56,7 +56,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildSelectedAlbumNameChip() {
|
buildSelectedAlbumNameChip() {
|
||||||
return selectedBackupAlbums.map((album) {
|
return selectedBackupAlbums.map((album) {
|
||||||
void removeSelection() {
|
void removeSelection() {
|
||||||
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1) {
|
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1) {
|
||||||
@ -104,7 +104,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
}).toSet();
|
}).toSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildExcludedAlbumNameChip() {
|
buildExcludedAlbumNameChip() {
|
||||||
return excludedBackupAlbums.map((album) {
|
return excludedBackupAlbums.map((album) {
|
||||||
void removeSelection() {
|
void removeSelection() {
|
||||||
ref
|
ref
|
||||||
@ -177,8 +177,8 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
children: [
|
children: [
|
||||||
..._buildSelectedAlbumNameChip(),
|
...buildSelectedAlbumNameChip(),
|
||||||
..._buildExcludedAlbumNameChip()
|
...buildExcludedAlbumNameChip()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -286,7 +286,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 16.0),
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
child: _buildAlbumSelectionList(),
|
child: buildAlbumSelectionList(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -45,7 +45,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildStorageInformation() {
|
Widget buildStorageInformation() {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.storage_rounded,
|
Icons.storage_rounded,
|
||||||
@ -84,7 +84,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTile _buildAutoBackupController() {
|
ListTile buildAutoBackupController() {
|
||||||
var backUpOption = authenticationState.deviceInfo.isAutoBackup
|
var backUpOption = authenticationState.deviceInfo.isAutoBackup
|
||||||
? "backup_controller_page_status_on".tr()
|
? "backup_controller_page_status_on".tr()
|
||||||
: "backup_controller_page_status_off".tr();
|
: "backup_controller_page_status_off".tr();
|
||||||
@ -143,7 +143,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showErrorToUser(String msg) {
|
void showErrorToUser(String msg) {
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
msg.tr(),
|
msg.tr(),
|
||||||
@ -153,7 +153,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showBatteryOptimizationInfoToUser() {
|
void showBatteryOptimizationInfoToUser() {
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@ -193,7 +193,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTile _buildBackgroundBackupController() {
|
ListTile buildBackgroundBackupController() {
|
||||||
final bool isBackgroundEnabled = backupState.backgroundBackup;
|
final bool isBackgroundEnabled = backupState.backgroundBackup;
|
||||||
final bool isWifiRequired = backupState.backupRequireWifi;
|
final bool isWifiRequired = backupState.backupRequireWifi;
|
||||||
final bool isChargingRequired = backupState.backupRequireCharging;
|
final bool isChargingRequired = backupState.backupRequireCharging;
|
||||||
@ -238,8 +238,8 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
.read(backupProvider.notifier)
|
.read(backupProvider.notifier)
|
||||||
.configureBackgroundBackup(
|
.configureBackgroundBackup(
|
||||||
requireWifi: isChecked,
|
requireWifi: isChecked,
|
||||||
onError: _showErrorToUser,
|
onError: showErrorToUser,
|
||||||
onBatteryInfo: _showBatteryOptimizationInfoToUser,
|
onBatteryInfo: showBatteryOptimizationInfoToUser,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
@ -259,8 +259,8 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
.read(backupProvider.notifier)
|
.read(backupProvider.notifier)
|
||||||
.configureBackgroundBackup(
|
.configureBackgroundBackup(
|
||||||
requireCharging: isChecked,
|
requireCharging: isChecked,
|
||||||
onError: _showErrorToUser,
|
onError: showErrorToUser,
|
||||||
onBatteryInfo: _showBatteryOptimizationInfoToUser,
|
onBatteryInfo: showBatteryOptimizationInfoToUser,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
@ -268,8 +268,8 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
ref.read(backupProvider.notifier).configureBackgroundBackup(
|
ref.read(backupProvider.notifier).configureBackgroundBackup(
|
||||||
enabled: !isBackgroundEnabled,
|
enabled: !isBackgroundEnabled,
|
||||||
onError: _showErrorToUser,
|
onError: showErrorToUser,
|
||||||
onBatteryInfo: _showBatteryOptimizationInfoToUser,
|
onBatteryInfo: showBatteryOptimizationInfoToUser,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
isBackgroundEnabled
|
isBackgroundEnabled
|
||||||
@ -284,7 +284,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSelectedAlbumName() {
|
Widget buildSelectedAlbumName() {
|
||||||
var text = "backup_controller_page_backup_selected".tr();
|
var text = "backup_controller_page_backup_selected".tr();
|
||||||
var albums = ref.watch(backupProvider).selectedBackupAlbums;
|
var albums = ref.watch(backupProvider).selectedBackupAlbums;
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildExcludedAlbumName() {
|
Widget buildExcludedAlbumName() {
|
||||||
var text = "backup_controller_page_excluded".tr();
|
var text = "backup_controller_page_excluded".tr();
|
||||||
var albums = ref.watch(backupProvider).excludedBackupAlbums;
|
var albums = ref.watch(backupProvider).excludedBackupAlbums;
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildFolderSelectionTile() {
|
buildFolderSelectionTile() {
|
||||||
return Card(
|
return Card(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(5), // if you need this
|
borderRadius: BorderRadius.circular(5), // if you need this
|
||||||
@ -374,8 +374,8 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
"backup_controller_page_to_backup",
|
"backup_controller_page_to_backup",
|
||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 12),
|
||||||
).tr(),
|
).tr(),
|
||||||
_buildSelectedAlbumName(),
|
buildSelectedAlbumName(),
|
||||||
_buildExcludedAlbumName()
|
buildExcludedAlbumName()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -398,7 +398,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildCurrentBackupAssetInfoCard() {
|
buildCurrentBackupAssetInfoCard() {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.info_outline_rounded,
|
Icons.info_outline_rounded,
|
||||||
@ -606,7 +606,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_buildFolderSelectionTile(),
|
buildFolderSelectionTile(),
|
||||||
BackupInfoCard(
|
BackupInfoCard(
|
||||||
title: "backup_controller_page_total".tr(),
|
title: "backup_controller_page_total".tr(),
|
||||||
subtitle: "backup_controller_page_total_sub".tr(),
|
subtitle: "backup_controller_page_total_sub".tr(),
|
||||||
@ -624,13 +624,13 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
"${backupState.allUniqueAssets.length - backupState.selectedAlbumsBackupAssetsIds.length}",
|
"${backupState.allUniqueAssets.length - backupState.selectedAlbumsBackupAssetsIds.length}",
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
_buildAutoBackupController(),
|
buildAutoBackupController(),
|
||||||
if (Platform.isAndroid) const Divider(),
|
if (Platform.isAndroid) const Divider(),
|
||||||
if (Platform.isAndroid) _buildBackgroundBackupController(),
|
if (Platform.isAndroid) buildBackgroundBackupController(),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
_buildStorageInformation(),
|
buildStorageInformation(),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
_buildCurrentBackupAssetInfoCard(),
|
buildCurrentBackupAssetInfoCard(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 24,
|
top: 24,
|
||||||
|
@ -11,7 +11,7 @@ import 'package:immich_mobile/shared/models/asset.dart';
|
|||||||
import 'package:immich_mobile/shared/providers/api.provider.dart';
|
import 'package:immich_mobile/shared/providers/api.provider.dart';
|
||||||
import 'package:immich_mobile/shared/services/api.service.dart';
|
import 'package:immich_mobile/shared/services/api.service.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:photo_manager/src/types/entity.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
|
|
||||||
final assetServiceProvider = Provider(
|
final assetServiceProvider = Provider(
|
||||||
(ref) => AssetService(
|
(ref) => AssetService(
|
||||||
|
@ -15,7 +15,7 @@ class ProfileDrawer extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
_buildSignoutButton() {
|
buildSignoutButton() {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
horizontalTitleGap: 0,
|
horizontalTitleGap: 0,
|
||||||
leading: SizedBox(
|
leading: SizedBox(
|
||||||
@ -46,7 +46,7 @@ class ProfileDrawer extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildSettingButton() {
|
buildSettingButton() {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
horizontalTitleGap: 0,
|
horizontalTitleGap: 0,
|
||||||
leading: SizedBox(
|
leading: SizedBox(
|
||||||
@ -79,8 +79,8 @@ class ProfileDrawer extends HookConsumerWidget {
|
|||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
children: [
|
children: [
|
||||||
const ProfileDrawerHeader(),
|
const ProfileDrawerHeader(),
|
||||||
_buildSettingButton(),
|
buildSettingButton(),
|
||||||
_buildSignoutButton(),
|
buildSignoutButton(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const ServerInfoBox()
|
const ServerInfoBox()
|
||||||
|
@ -25,7 +25,7 @@ class ProfileDrawerHeader extends HookConsumerWidget {
|
|||||||
var dummmy = Random().nextInt(1024);
|
var dummmy = Random().nextInt(1024);
|
||||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||||
|
|
||||||
_buildUserProfileImage() {
|
buildUserProfileImage() {
|
||||||
if (authState.profileImagePath.isEmpty) {
|
if (authState.profileImagePath.isEmpty) {
|
||||||
return const CircleAvatar(
|
return const CircleAvatar(
|
||||||
radius: 35,
|
radius: 35,
|
||||||
@ -77,7 +77,7 @@ class ProfileDrawerHeader extends HookConsumerWidget {
|
|||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
_pickUserProfileImage() async {
|
pickUserProfileImage() async {
|
||||||
final XFile? image = await ImagePicker().pickImage(
|
final XFile? image = await ImagePicker().pickImage(
|
||||||
source: ImageSource.gallery,
|
source: ImageSource.gallery,
|
||||||
maxHeight: 1024,
|
maxHeight: 1024,
|
||||||
@ -98,7 +98,7 @@ class ProfileDrawerHeader extends HookConsumerWidget {
|
|||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() {
|
() {
|
||||||
_buildUserProfileImage();
|
buildUserProfileImage();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
@ -129,12 +129,12 @@ class ProfileDrawerHeader extends HookConsumerWidget {
|
|||||||
Stack(
|
Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
_buildUserProfileImage(),
|
buildUserProfileImage(),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
right: -5,
|
right: -5,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: _pickUserProfileImage,
|
onTap: pickUserProfileImage,
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.grey[100],
|
color: Colors.grey[100],
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
|
@ -17,7 +17,7 @@ class ServerInfoBox extends HookConsumerWidget {
|
|||||||
|
|
||||||
final appInfo = useState({});
|
final appInfo = useState({});
|
||||||
|
|
||||||
_getPackageInfo() async {
|
getPackageInfo() async {
|
||||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
|
|
||||||
appInfo.value = {
|
appInfo.value = {
|
||||||
@ -28,7 +28,7 @@ class ServerInfoBox extends HookConsumerWidget {
|
|||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() {
|
() {
|
||||||
_getPackageInfo();
|
getPackageInfo();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
|
@ -2,5 +2,5 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
import 'package:immich_mobile/modules/login/services/oauth.service.dart';
|
import 'package:immich_mobile/modules/login/services/oauth.service.dart';
|
||||||
import 'package:immich_mobile/shared/providers/api.provider.dart';
|
import 'package:immich_mobile/shared/providers/api.provider.dart';
|
||||||
|
|
||||||
final OAuthServiceProvider =
|
final oAuthServiceProvider =
|
||||||
Provider((ref) => OAuthService(ref.watch(apiServiceProvider)));
|
Provider((ref) => OAuthService(ref.watch(apiServiceProvider)));
|
||||||
|
@ -349,7 +349,7 @@ class OAuthLoginButton extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
var oAuthService = ref.watch(OAuthServiceProvider);
|
var oAuthService = ref.watch(oAuthServiceProvider);
|
||||||
|
|
||||||
void performOAuthLogin() async {
|
void performOAuthLogin() async {
|
||||||
ref.watch(assetProvider.notifier).clearAllAsset();
|
ref.watch(assetProvider.notifier).clearAllAsset();
|
||||||
|
@ -39,14 +39,14 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
_onSearchSubmitted(String searchTerm) async {
|
onSearchSubmitted(String searchTerm) async {
|
||||||
searchFocusNode.unfocus();
|
searchFocusNode.unfocus();
|
||||||
ref.watch(searchPageStateProvider.notifier).disableSearch();
|
ref.watch(searchPageStateProvider.notifier).disableSearch();
|
||||||
|
|
||||||
AutoRouter.of(context).push(SearchResultRoute(searchTerm: searchTerm));
|
AutoRouter.of(context).push(SearchResultRoute(searchTerm: searchTerm));
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildPlaces() {
|
buildPlaces() {
|
||||||
return curatedLocation.when(
|
return curatedLocation.when(
|
||||||
loading: () => SizedBox(
|
loading: () => SizedBox(
|
||||||
height: imageSize,
|
height: imageSize,
|
||||||
@ -97,7 +97,7 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildThings() {
|
buildThings() {
|
||||||
return curatedObjects.when(
|
return curatedObjects.when(
|
||||||
loading: () => SizedBox(
|
loading: () => SizedBox(
|
||||||
height: imageSize,
|
height: imageSize,
|
||||||
@ -155,7 +155,7 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: SearchBar(
|
appBar: SearchBar(
|
||||||
searchFocusNode: searchFocusNode,
|
searchFocusNode: searchFocusNode,
|
||||||
onSubmitted: _onSearchSubmitted,
|
onSubmitted: onSearchSubmitted,
|
||||||
),
|
),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -174,7 +174,7 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||||
).tr(),
|
).tr(),
|
||||||
),
|
),
|
||||||
_buildPlaces(),
|
buildPlaces(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: const Text(
|
child: const Text(
|
||||||
@ -182,11 +182,11 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||||
).tr(),
|
).tr(),
|
||||||
),
|
),
|
||||||
_buildThings()
|
buildThings()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (isSearchEnabled)
|
if (isSearchEnabled)
|
||||||
SearchSuggestionList(onSubmitted: _onSearchSubmitted),
|
SearchSuggestionList(onSubmitted: onSearchSubmitted),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -38,7 +38,7 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
_onSearchSubmitted(String newSearchTerm) {
|
onSearchSubmitted(String newSearchTerm) {
|
||||||
debugPrint("Re-Search with $newSearchTerm");
|
debugPrint("Re-Search with $newSearchTerm");
|
||||||
searchFocusNode?.unfocus();
|
searchFocusNode?.unfocus();
|
||||||
isNewSearch.value = false;
|
isNewSearch.value = false;
|
||||||
@ -46,7 +46,7 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
ref.watch(searchResultPageProvider.notifier).search(newSearchTerm);
|
ref.watch(searchResultPageProvider.notifier).search(newSearchTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildTextField() {
|
buildTextField() {
|
||||||
return TextField(
|
return TextField(
|
||||||
controller: searchTermController,
|
controller: searchTermController,
|
||||||
focusNode: searchFocusNode,
|
focusNode: searchFocusNode,
|
||||||
@ -60,7 +60,7 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
onSubmitted: (searchTerm) {
|
onSubmitted: (searchTerm) {
|
||||||
if (searchTerm.isNotEmpty) {
|
if (searchTerm.isNotEmpty) {
|
||||||
searchTermController.clear();
|
searchTermController.clear();
|
||||||
_onSearchSubmitted(searchTerm);
|
onSearchSubmitted(searchTerm);
|
||||||
} else {
|
} else {
|
||||||
isNewSearch.value = false;
|
isNewSearch.value = false;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildChip() {
|
buildChip() {
|
||||||
return Chip(
|
return Chip(
|
||||||
label: Wrap(
|
label: Wrap(
|
||||||
spacing: 5,
|
spacing: 5,
|
||||||
@ -108,7 +108,7 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildSearchResult() {
|
buildSearchResult() {
|
||||||
var searchResultPageState = ref.watch(searchResultPageProvider);
|
var searchResultPageState = ref.watch(searchResultPageProvider);
|
||||||
var searchResultRenderList = ref.watch(searchRenderListProvider);
|
var searchResultRenderList = ref.watch(searchRenderListProvider);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
isNewSearch.value = true;
|
isNewSearch.value = true;
|
||||||
searchFocusNode?.requestFocus();
|
searchFocusNode?.requestFocus();
|
||||||
},
|
},
|
||||||
child: isNewSearch.value ? _buildTextField() : _buildChip(),
|
child: isNewSearch.value ? buildTextField() : buildChip(),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
),
|
),
|
||||||
@ -168,9 +168,9 @@ class SearchResultPage extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
_buildSearchResult(),
|
buildSearchResult(),
|
||||||
if (isNewSearch.value)
|
if (isNewSearch.value)
|
||||||
SearchSuggestionList(onSubmitted: _onSearchSubmitted),
|
SearchSuggestionList(onSubmitted: onSearchSubmitted),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -4,7 +4,6 @@ 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/modules/settings/ui/asset_list_settings/asset_list_settings.dart';
|
import 'package:immich_mobile/modules/settings/ui/asset_list_settings/asset_list_settings.dart';
|
||||||
import 'package:immich_mobile/modules/settings/ui/experimental_settings/experimental_settings.dart';
|
|
||||||
import 'package:immich_mobile/modules/settings/ui/image_viewer_quality_setting/image_viewer_quality_setting.dart';
|
import 'package:immich_mobile/modules/settings/ui/image_viewer_quality_setting/image_viewer_quality_setting.dart';
|
||||||
import 'package:immich_mobile/modules/settings/ui/notification_setting/notification_setting.dart';
|
import 'package:immich_mobile/modules/settings/ui/notification_setting/notification_setting.dart';
|
||||||
import 'package:immich_mobile/modules/settings/ui/theme_setting/theme_setting.dart';
|
import 'package:immich_mobile/modules/settings/ui/theme_setting/theme_setting.dart';
|
||||||
|
@ -39,7 +39,8 @@ class AssetNotifier extends StateNotifier<List<Asset>> {
|
|||||||
stopwatch.start();
|
stopwatch.start();
|
||||||
state = await _assetCacheService.get();
|
state = await _assetCacheService.get();
|
||||||
debugPrint(
|
debugPrint(
|
||||||
"Reading assets from cache: ${stopwatch.elapsedMilliseconds}ms");
|
"Reading assets from cache: ${stopwatch.elapsedMilliseconds}ms",
|
||||||
|
);
|
||||||
stopwatch.reset();
|
stopwatch.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +146,9 @@ class AssetNotifier extends StateNotifier<List<Asset>> {
|
|||||||
|
|
||||||
final assetProvider = StateNotifierProvider<AssetNotifier, List<Asset>>((ref) {
|
final assetProvider = StateNotifierProvider<AssetNotifier, List<Asset>>((ref) {
|
||||||
return AssetNotifier(
|
return AssetNotifier(
|
||||||
ref.watch(assetServiceProvider), ref.watch(assetCacheServiceProvider));
|
ref.watch(assetServiceProvider),
|
||||||
|
ref.watch(assetCacheServiceProvider),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
final assetGroupByDateTimeProvider = StateProvider((ref) {
|
final assetGroupByDateTimeProvider = StateProvider((ref) {
|
||||||
|
@ -17,10 +17,11 @@ class ReleaseInfoNotifier extends StateNotifier<String> {
|
|||||||
try {
|
try {
|
||||||
String? localReleaseVersion = box.get(githubReleaseInfoKey);
|
String? localReleaseVersion = box.get(githubReleaseInfoKey);
|
||||||
final res = await client.get(
|
final res = await client.get(
|
||||||
Uri.parse(
|
Uri.parse(
|
||||||
"https://api.github.com/repos/immich-app/immich/releases/latest",
|
"https://api.github.com/repos/immich-app/immich/releases/latest",
|
||||||
),
|
),
|
||||||
headers: {"Accept": "application/vnd.github.v3+json"});
|
headers: {"Accept": "application/vnd.github.v3+json"},
|
||||||
|
);
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
final data = jsonDecode(res.body);
|
final data = jsonDecode(res.body);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// ignore: depend_on_referenced_packages
|
||||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart';
|
import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart';
|
||||||
|
@ -15,7 +15,7 @@ class ImmichToast {
|
|||||||
final fToast = FToast();
|
final fToast = FToast();
|
||||||
fToast.init(context);
|
fToast.init(context);
|
||||||
|
|
||||||
Color _getColor(ToastType type, BuildContext context) {
|
Color getColor(ToastType type, BuildContext context) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ToastType.info:
|
case ToastType.info:
|
||||||
return Theme.of(context).primaryColor;
|
return Theme.of(context).primaryColor;
|
||||||
@ -26,7 +26,7 @@ class ImmichToast {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon _getIcon(ToastType type) {
|
Icon getIcon(ToastType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ToastType.info:
|
case ToastType.info:
|
||||||
return Icon(
|
return Icon(
|
||||||
@ -60,7 +60,7 @@ class ImmichToast {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
_getIcon(toastType),
|
getIcon(toastType),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12.0,
|
width: 12.0,
|
||||||
),
|
),
|
||||||
@ -68,7 +68,7 @@ class ImmichToast {
|
|||||||
child: Text(
|
child: Text(
|
||||||
msg,
|
msg,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _getColor(toastType, context),
|
color: getColor(toastType, context),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// ignore_for_file: depend_on_referenced_packages, implementation_imports
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user