mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
refactor: DCM - const border radius, constructor & switch expressions (#19515)
* enable border radius, switch exp, const constructor * regenerate provider * more formatting --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
05064f87f0
commit
5b0575b956
2
.github/workflows/static_analysis.yml
vendored
2
.github/workflows/static_analysis.yml
vendored
@ -109,7 +109,7 @@ jobs:
|
||||
working-directory: ./mobile
|
||||
|
||||
- name: Run DCM
|
||||
run: dcm analyze lib
|
||||
run: dcm analyze lib --fatal-style --fatal-warnings
|
||||
working-directory: ./mobile
|
||||
|
||||
zizmor:
|
||||
|
@ -146,6 +146,7 @@ dart_code_metrics:
|
||||
# - no-empty-block
|
||||
# - no-equal-then-else
|
||||
# - prefer-correct-test-file-name
|
||||
- prefer-const-border-radius
|
||||
# - prefer-match-file-name
|
||||
# - prefer-return-await
|
||||
# - avoid-self-assignment
|
||||
@ -290,7 +291,8 @@ dart_code_metrics:
|
||||
# Style
|
||||
# - prefer-trailing-comma
|
||||
# - unnecessary-trailing-comma
|
||||
# - prefer-declaring-const-constructor
|
||||
- prefer-declaring-const-constructor
|
||||
# - prefer-single-widget-per-file
|
||||
- prefer-switch-expression
|
||||
# - prefer-prefixed-global-constants
|
||||
# - prefer-correct-callback-field-name
|
||||
|
@ -7,7 +7,7 @@ import 'general_helper.dart';
|
||||
class ImmichTestLoginHelper {
|
||||
final WidgetTester tester;
|
||||
|
||||
ImmichTestLoginHelper(this.tester);
|
||||
const ImmichTestLoginHelper(this.tester);
|
||||
|
||||
Future<void> waitForLoginScreen() async {
|
||||
await pumpUntilFound(tester, find.text("Login"));
|
||||
@ -60,11 +60,11 @@ class ImmichTestLoginHelper {
|
||||
await tester.tap(button);
|
||||
}
|
||||
|
||||
Future<void> assertLoginSuccess({int timeoutSeconds = 15}) async {
|
||||
Future<void> assertLoginSuccess() async {
|
||||
await pumpUntilFound(tester, find.text("home_page_building_timeline".tr()));
|
||||
}
|
||||
|
||||
Future<void> assertLoginFailed({int timeoutSeconds = 15}) async {
|
||||
Future<void> assertLoginFailed() async {
|
||||
await pumpUntilFound(tester, find.text("login_form_failed_login".tr()));
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ sealed class ImmichErrors {
|
||||
}
|
||||
|
||||
class NoResponseDtoError extends ImmichErrors implements Exception {
|
||||
const NoResponseDtoError();
|
||||
|
||||
@override
|
||||
String toString() => "Response Dto is null";
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Person {
|
||||
Person({
|
||||
const Person({
|
||||
required this.id,
|
||||
this.birthDate,
|
||||
required this.isHidden,
|
||||
|
@ -554,18 +554,12 @@ class Asset {
|
||||
}""";
|
||||
}
|
||||
|
||||
static getVisibility(AssetVisibility visibility) {
|
||||
switch (visibility) {
|
||||
case AssetVisibility.timeline:
|
||||
return AssetVisibilityEnum.timeline;
|
||||
case AssetVisibility.archive:
|
||||
return AssetVisibilityEnum.archive;
|
||||
case AssetVisibility.hidden:
|
||||
return AssetVisibilityEnum.hidden;
|
||||
case AssetVisibility.locked:
|
||||
return AssetVisibilityEnum.locked;
|
||||
}
|
||||
}
|
||||
static getVisibility(AssetVisibility visibility) => switch (visibility) {
|
||||
AssetVisibility.archive => AssetVisibilityEnum.archive,
|
||||
AssetVisibility.hidden => AssetVisibilityEnum.hidden,
|
||||
AssetVisibility.locked => AssetVisibilityEnum.locked,
|
||||
AssetVisibility.timeline || _ => AssetVisibilityEnum.timeline,
|
||||
};
|
||||
}
|
||||
|
||||
enum AssetType {
|
||||
|
@ -11,7 +11,7 @@ class SSLClientCertStoreVal {
|
||||
final Uint8List data;
|
||||
final String? password;
|
||||
|
||||
SSLClientCertStoreVal(this.data, this.password);
|
||||
const SSLClientCertStoreVal(this.data, this.password);
|
||||
|
||||
void save() {
|
||||
final b64Str = base64Encode(data);
|
||||
|
@ -5,7 +5,7 @@ class ApiRepository {
|
||||
|
||||
Future<T> checkNull<T>(Future<T?> future) async {
|
||||
final response = await future;
|
||||
if (response == null) throw NoResponseDtoError();
|
||||
if (response == null) throw const NoResponseDtoError();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ class AlbumViewerPageState {
|
||||
final String editTitleText;
|
||||
final String editDescriptionText;
|
||||
|
||||
AlbumViewerPageState({
|
||||
const AlbumViewerPageState({
|
||||
required this.isEditAlbum,
|
||||
required this.editTitleText,
|
||||
required this.editDescriptionText,
|
||||
|
@ -4,7 +4,7 @@ import 'package:immich_mobile/entities/asset.entity.dart';
|
||||
class AssetSelectionPageResult {
|
||||
final Set<Asset> selectedAssets;
|
||||
|
||||
AssetSelectionPageResult({
|
||||
const AssetSelectionPageResult({
|
||||
required this.selectedAssets,
|
||||
});
|
||||
@override
|
||||
|
@ -7,7 +7,7 @@ class AuthState {
|
||||
final bool isAdmin;
|
||||
final String profileImagePath;
|
||||
|
||||
AuthState({
|
||||
const AuthState({
|
||||
required this.deviceId,
|
||||
required this.userId,
|
||||
required this.userEmail,
|
||||
|
@ -5,7 +5,7 @@ class AuxilaryEndpoint {
|
||||
final String url;
|
||||
final AuxCheckStatus status;
|
||||
|
||||
AuxilaryEndpoint({
|
||||
const AuxilaryEndpoint({
|
||||
required this.url,
|
||||
required this.status,
|
||||
});
|
||||
@ -55,7 +55,7 @@ class AuxilaryEndpoint {
|
||||
|
||||
class AuxCheckStatus {
|
||||
final String name;
|
||||
AuxCheckStatus({
|
||||
const AuxCheckStatus({
|
||||
required this.name,
|
||||
});
|
||||
const AuxCheckStatus._(this.name);
|
||||
|
@ -13,7 +13,7 @@ class LoginResponse {
|
||||
|
||||
final String userId;
|
||||
|
||||
LoginResponse({
|
||||
const LoginResponse({
|
||||
required this.accessToken,
|
||||
required this.isAdmin,
|
||||
required this.name,
|
||||
|
@ -4,7 +4,7 @@ class AvailableAlbum {
|
||||
final Album album;
|
||||
final int assetCount;
|
||||
final DateTime? lastBackup;
|
||||
AvailableAlbum({
|
||||
const AvailableAlbum({
|
||||
required this.album,
|
||||
required this.assetCount,
|
||||
this.lastBackup,
|
||||
|
@ -9,7 +9,7 @@ class CurrentUploadAsset {
|
||||
final int? fileSize;
|
||||
final bool? iCloudAsset;
|
||||
|
||||
CurrentUploadAsset({
|
||||
const CurrentUploadAsset({
|
||||
required this.id,
|
||||
required this.fileCreatedAt,
|
||||
required this.fileName,
|
||||
|
@ -5,7 +5,7 @@ class SuccessUploadAsset {
|
||||
final String remoteAssetId;
|
||||
final bool isDuplicate;
|
||||
|
||||
SuccessUploadAsset({
|
||||
const SuccessUploadAsset({
|
||||
required this.candidate,
|
||||
required this.remoteAssetId,
|
||||
required this.isDuplicate,
|
||||
|
@ -10,7 +10,7 @@ class DownloadInfo {
|
||||
// enum
|
||||
final TaskStatus status;
|
||||
|
||||
DownloadInfo({
|
||||
const DownloadInfo({
|
||||
required this.fileName,
|
||||
required this.progress,
|
||||
required this.status,
|
||||
@ -71,7 +71,7 @@ class DownloadState {
|
||||
final TaskStatus downloadStatus;
|
||||
final Map<String, DownloadInfo> taskProgress;
|
||||
final bool showProgress;
|
||||
DownloadState({
|
||||
const DownloadState({
|
||||
required this.downloadStatus,
|
||||
required this.taskProgress,
|
||||
required this.showProgress,
|
||||
|
@ -3,7 +3,7 @@ import 'package:immich_mobile/models/folder/root_folder.model.dart';
|
||||
class RecursiveFolder extends RootFolder {
|
||||
final String name;
|
||||
|
||||
RecursiveFolder({
|
||||
const RecursiveFolder({
|
||||
required this.name,
|
||||
required super.path,
|
||||
required super.subfolders,
|
||||
|
@ -4,7 +4,7 @@ class RootFolder {
|
||||
final List<RecursiveFolder> subfolders;
|
||||
final String path;
|
||||
|
||||
RootFolder({
|
||||
const RootFolder({
|
||||
required this.subfolders,
|
||||
required this.path,
|
||||
});
|
||||
|
@ -8,4 +8,6 @@ class MapAssetsInBoundsUpdated extends MapEvent {
|
||||
const MapAssetsInBoundsUpdated(this.assetRemoteIds);
|
||||
}
|
||||
|
||||
class MapCloseBottomSheet extends MapEvent {}
|
||||
class MapCloseBottomSheet extends MapEvent {
|
||||
const MapCloseBottomSheet();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import 'package:openapi/api.dart';
|
||||
class MapMarker {
|
||||
final LatLng latLng;
|
||||
final String assetRemoteId;
|
||||
MapMarker({
|
||||
const MapMarker({
|
||||
required this.latLng,
|
||||
required this.assetRemoteId,
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ class MapState {
|
||||
final AsyncValue<String> lightStyleFetched;
|
||||
final AsyncValue<String> darkStyleFetched;
|
||||
|
||||
MapState({
|
||||
const MapState({
|
||||
this.themeMode = ThemeMode.system,
|
||||
this.showFavoriteOnly = false,
|
||||
this.includeArchived = false,
|
||||
|
@ -7,7 +7,7 @@ import 'package:immich_mobile/entities/asset.entity.dart';
|
||||
class Memory {
|
||||
final String title;
|
||||
final List<Asset> assets;
|
||||
Memory({
|
||||
const Memory({
|
||||
required this.title,
|
||||
required this.assets,
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ class SearchCuratedContent {
|
||||
/// The id to lookup the asset from the server
|
||||
final String id;
|
||||
|
||||
SearchCuratedContent({
|
||||
const SearchCuratedContent({
|
||||
required this.label,
|
||||
required this.id,
|
||||
this.subtitle,
|
||||
|
@ -6,7 +6,7 @@ class SearchResult {
|
||||
final List<Asset> assets;
|
||||
final int? nextPage;
|
||||
|
||||
SearchResult({
|
||||
const SearchResult({
|
||||
required this.assets,
|
||||
this.nextPage,
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ class SearchResultPageState {
|
||||
final bool isSmart;
|
||||
final List<Asset> searchResult;
|
||||
|
||||
SearchResultPageState({
|
||||
const SearchResultPageState({
|
||||
required this.isLoading,
|
||||
required this.isSuccess,
|
||||
required this.isError,
|
||||
|
@ -13,7 +13,7 @@ class ServerInfo {
|
||||
final bool isNewReleaseAvailable;
|
||||
final String versionMismatchErrorMessage;
|
||||
|
||||
ServerInfo({
|
||||
const ServerInfo({
|
||||
required this.serverVersion,
|
||||
required this.latestVersion,
|
||||
required this.serverFeatures,
|
||||
|
@ -105,7 +105,9 @@ class AlbumsPage extends HookConsumerWidget {
|
||||
color: context.colorScheme.onSurface.withAlpha(0),
|
||||
width: 0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(24),
|
||||
),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
context.colorScheme.primary.withValues(alpha: 0.075),
|
||||
@ -301,7 +303,9 @@ class QuickFilterButton extends StatelessWidget {
|
||||
),
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
side: BorderSide(
|
||||
color: context.colorScheme.onSurface.withAlpha(25),
|
||||
width: 1,
|
||||
@ -334,8 +338,10 @@ class SortButton extends ConsumerWidget {
|
||||
style: MenuStyle(
|
||||
elevation: const WidgetStatePropertyAll(1),
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(24),
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const WidgetStatePropertyAll(
|
||||
@ -384,8 +390,10 @@ class SortButton extends ConsumerWidget {
|
||||
: Colors.transparent,
|
||||
),
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(24),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -246,8 +246,10 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
),
|
||||
elevation: 5,
|
||||
title: Text(
|
||||
|
@ -147,7 +147,9 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
side: BorderSide(
|
||||
color: context.colorScheme.outlineVariant,
|
||||
width: 1,
|
||||
|
@ -42,9 +42,11 @@ class FailedBackupStatusPage extends HookConsumerWidget {
|
||||
vertical: 4,
|
||||
),
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(15), // if you need this
|
||||
side: const BorderSide(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15), // if you need this
|
||||
),
|
||||
side: BorderSide(
|
||||
color: Colors.black12,
|
||||
width: 1,
|
||||
),
|
||||
|
@ -60,7 +60,9 @@ class AppLogDetailPage extends HookConsumerWidget {
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: context.colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15.0),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@ -99,7 +101,9 @@ class AppLogDetailPage extends HookConsumerWidget {
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: context.colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15.0),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
|
@ -120,8 +120,10 @@ class CreateAlbumPage extends HookConsumerWidget {
|
||||
alignment: Alignment.centerLeft,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 24, horizontal: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
),
|
||||
backgroundColor: context.colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
|
@ -90,8 +90,10 @@ class DownloadTaskTile extends StatelessWidget {
|
||||
width: context.width - 32,
|
||||
child: Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
minVerticalPadding: 18,
|
||||
|
@ -3,6 +3,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
import 'package:immich_mobile/widgets/settings/advanced_settings.dart';
|
||||
import 'package:immich_mobile/widgets/settings/asset_list_settings/asset_list_settings.dart';
|
||||
import 'package:immich_mobile/widgets/settings/asset_viewer_settings/asset_viewer_settings.dart';
|
||||
@ -11,7 +12,6 @@ import 'package:immich_mobile/widgets/settings/language_settings.dart';
|
||||
import 'package:immich_mobile/widgets/settings/networking_settings/networking_settings.dart';
|
||||
import 'package:immich_mobile/widgets/settings/notification_setting.dart';
|
||||
import 'package:immich_mobile/widgets/settings/preference_settings/preference_setting.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
|
||||
enum SettingSection {
|
||||
advanced(
|
||||
@ -85,12 +85,13 @@ class SettingsPage extends StatelessWidget {
|
||||
centerTitle: false,
|
||||
title: const Text('settings').tr(),
|
||||
),
|
||||
body: context.isMobile ? _MobileLayout() : _TabletLayout(),
|
||||
body: context.isMobile ? const _MobileLayout() : const _TabletLayout(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MobileLayout extends StatelessWidget {
|
||||
const _MobileLayout();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
@ -147,6 +148,7 @@ class _MobileLayout extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _TabletLayout extends HookWidget {
|
||||
const _TabletLayout();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final selectedSection =
|
||||
|
@ -124,7 +124,9 @@ class EditImagePage extends ConsumerWidget {
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(7),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.2),
|
||||
@ -135,7 +137,9 @@ class EditImagePage extends ConsumerWidget {
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(7),
|
||||
),
|
||||
child: Image(
|
||||
image: image.image,
|
||||
fit: BoxFit.contain,
|
||||
@ -149,7 +153,9 @@ class EditImagePage extends ConsumerWidget {
|
||||
margin: const EdgeInsets.only(bottom: 60, right: 10, left: 10, top: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: context.scaffoldBackgroundColor,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(30),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
|
@ -162,13 +162,17 @@ class _FilterButton extends StatelessWidget {
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
border: isSelected
|
||||
? Border.all(color: context.primaryColor, width: 3)
|
||||
: null,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
child: ColorFiltered(
|
||||
colorFilter: filter,
|
||||
child: FittedBox(
|
||||
|
@ -105,7 +105,9 @@ class QuickAccessButtons extends ConsumerWidget {
|
||||
color: context.colorScheme.onSurface.withAlpha(10),
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
context.colorScheme.primary.withAlpha(10),
|
||||
@ -240,7 +242,9 @@ class PeopleCollectionCard extends ConsumerWidget {
|
||||
height: size,
|
||||
width: size,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
context.colorScheme.primary.withAlpha(30),
|
||||
|
@ -80,7 +80,9 @@ class PartnerDetailPage extends HookConsumerWidget {
|
||||
color: context.colorScheme.onSurface.withAlpha(10),
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
context.colorScheme.primary.withAlpha(10),
|
||||
|
@ -143,7 +143,9 @@ class PlaceTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
leading: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
width: 80,
|
||||
height: 80,
|
||||
|
@ -156,7 +156,7 @@ class MapPage extends HookConsumerWidget {
|
||||
} else {
|
||||
// If no asset was previously selected and no new asset is available, close the bottom sheet
|
||||
if (selectedMarker.value == null) {
|
||||
bottomSheetStreamController.add(MapCloseBottomSheet());
|
||||
bottomSheetStreamController.add(const MapCloseBottomSheet());
|
||||
}
|
||||
selectedMarker.value = null;
|
||||
}
|
||||
|
@ -511,16 +511,11 @@ class SearchPage extends HookConsumerWidget {
|
||||
search();
|
||||
}
|
||||
|
||||
IconData getSearchPrefixIcon() {
|
||||
switch (textSearchType.value) {
|
||||
case TextSearchType.context:
|
||||
return Icons.image_search_rounded;
|
||||
case TextSearchType.filename:
|
||||
return Icons.abc_rounded;
|
||||
case TextSearchType.description:
|
||||
return Icons.text_snippet_outlined;
|
||||
}
|
||||
}
|
||||
IconData getSearchPrefixIcon() => switch (textSearchType.value) {
|
||||
TextSearchType.context => Icons.image_search_rounded,
|
||||
TextSearchType.filename => Icons.abc_rounded,
|
||||
TextSearchType.description => Icons.text_snippet_outlined,
|
||||
};
|
||||
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
@ -533,8 +528,10 @@ class SearchPage extends HookConsumerWidget {
|
||||
style: MenuStyle(
|
||||
elevation: const WidgetStatePropertyAll(1),
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(24),
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const WidgetStatePropertyAll(
|
||||
@ -631,7 +628,9 @@ class SearchPage extends HookConsumerWidget {
|
||||
color: context.colorScheme.onSurface.withAlpha(0),
|
||||
width: 0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(24),
|
||||
),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
context.colorScheme.primary.withValues(alpha: 0.075),
|
||||
@ -823,7 +822,9 @@ class QuickLinkList extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
border: Border.all(
|
||||
color: context.colorScheme.outline.withAlpha(10),
|
||||
width: 1,
|
||||
|
@ -15,7 +15,7 @@ class RemoteThumbProvider extends ImageProvider<RemoteThumbProvider> {
|
||||
final double width;
|
||||
final CacheManager? cacheManager;
|
||||
|
||||
RemoteThumbProvider({
|
||||
const RemoteThumbProvider({
|
||||
required this.assetId,
|
||||
this.height = kTimelineFixedTileExtent,
|
||||
this.width = kTimelineFixedTileExtent,
|
||||
|
@ -8,7 +8,7 @@ import 'package:thumbhash/thumbhash.dart';
|
||||
class ThumbHashProvider extends ImageProvider<ThumbHashProvider> {
|
||||
final String thumbHash;
|
||||
|
||||
ThumbHashProvider({
|
||||
const ThumbHashProvider({
|
||||
required this.thumbHash,
|
||||
});
|
||||
|
||||
|
@ -15,18 +15,12 @@ abstract class SegmentBuilder {
|
||||
this.groupBy = GroupAssetsBy.day,
|
||||
});
|
||||
|
||||
static double headerExtent(HeaderType header) {
|
||||
switch (header) {
|
||||
case HeaderType.month:
|
||||
return kTimelineHeaderExtent;
|
||||
case HeaderType.day:
|
||||
return kTimelineHeaderExtent * 0.90;
|
||||
case HeaderType.monthAndDay:
|
||||
return kTimelineHeaderExtent * 1.6;
|
||||
case HeaderType.none:
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
static double headerExtent(HeaderType header) => switch (header) {
|
||||
HeaderType.month => kTimelineHeaderExtent,
|
||||
HeaderType.day => kTimelineHeaderExtent * 0.90,
|
||||
HeaderType.monthAndDay => kTimelineHeaderExtent * 1.6,
|
||||
HeaderType.none => 0.0,
|
||||
};
|
||||
|
||||
static Widget buildPlaceholder(
|
||||
BuildContext context,
|
||||
|
@ -1,12 +1,12 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/entities/album.entity.dart';
|
||||
import 'package:immich_mobile/models/albums/album_viewer_page_state.model.dart';
|
||||
import 'package:immich_mobile/services/album.service.dart';
|
||||
import 'package:immich_mobile/entities/album.entity.dart';
|
||||
|
||||
class AlbumViewerNotifier extends StateNotifier<AlbumViewerPageState> {
|
||||
AlbumViewerNotifier(this.ref)
|
||||
: super(
|
||||
AlbumViewerPageState(
|
||||
const AlbumViewerPageState(
|
||||
editTitleText: "",
|
||||
isEditAlbum: false,
|
||||
editDescriptionText: "",
|
||||
|
@ -5,4 +5,4 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'app_settings.provider.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
AppSettingsService appSettingsService(Ref _) => AppSettingsService();
|
||||
AppSettingsService appSettingsService(Ref _) => const AppSettingsService();
|
||||
|
@ -7,7 +7,7 @@ part of 'app_settings.provider.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$appSettingsServiceHash() =>
|
||||
r'2aa16d76a8df869c39486325efc1d08b2d2c284c';
|
||||
r'89cece3a19e06612f5639ae290120e854a0c5a31';
|
||||
|
||||
/// See also [appSettingsService].
|
||||
@ProviderFor(appSettingsService)
|
||||
|
@ -23,7 +23,7 @@ class DownloadStateNotifier extends StateNotifier<DownloadState> {
|
||||
this._shareService,
|
||||
this._albumService,
|
||||
) : super(
|
||||
DownloadState(
|
||||
const DownloadState(
|
||||
downloadStatus: TaskStatus.complete,
|
||||
showProgress: false,
|
||||
taskProgress: <String, DownloadInfo>{},
|
||||
|
@ -45,7 +45,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||
this._secureStorageService,
|
||||
this._widgetService,
|
||||
) : super(
|
||||
AuthState(
|
||||
const AuthState(
|
||||
deviceId: "",
|
||||
userId: "",
|
||||
userEmail: "",
|
||||
@ -89,7 +89,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||
}
|
||||
|
||||
Future<void> _cleanUp() async {
|
||||
state = AuthState(
|
||||
state = const AuthState(
|
||||
deviceId: "",
|
||||
userId: "",
|
||||
userEmail: "",
|
||||
|
@ -7,7 +7,7 @@ class IOSBackgroundSettings {
|
||||
final DateTime? timeOfLastFetch;
|
||||
final DateTime? timeOfLastProcessing;
|
||||
|
||||
IOSBackgroundSettings({
|
||||
const IOSBackgroundSettings({
|
||||
required this.appRefreshEnabled,
|
||||
required this.numberOfBackgroundTasksQueued,
|
||||
this.timeOfLastFetch,
|
||||
|
@ -42,6 +42,6 @@ class ImageLoader {
|
||||
}
|
||||
|
||||
// If we get here, the image failed to load from the cache stream
|
||||
throw ImageLoadingException('Could not load image from stream');
|
||||
throw const ImageLoadingException('Could not load image from stream');
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// An exception for the [ImageLoader] and the Immich image providers
|
||||
class ImageLoadingException implements Exception {
|
||||
final String message;
|
||||
ImageLoadingException(this.message);
|
||||
const ImageLoadingException(this.message);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class ImmichRemoteImageProvider
|
||||
/// The image cache manager
|
||||
final CacheManager? cacheManager;
|
||||
|
||||
ImmichRemoteImageProvider({
|
||||
const ImmichRemoteImageProvider({
|
||||
required this.assetId,
|
||||
this.cacheManager,
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ class ImmichRemoteThumbnailProvider
|
||||
/// The image cache manager
|
||||
final CacheManager? cacheManager;
|
||||
|
||||
ImmichRemoteThumbnailProvider({
|
||||
const ImmichRemoteThumbnailProvider({
|
||||
required this.assetId,
|
||||
this.height,
|
||||
this.width,
|
||||
|
@ -17,7 +17,7 @@ class PaginatedSearchNotifier extends StateNotifier<SearchResult> {
|
||||
final SearchService _searchService;
|
||||
|
||||
PaginatedSearchNotifier(this._searchService)
|
||||
: super(SearchResult(assets: [], nextPage: 1));
|
||||
: super(const SearchResult(assets: [], nextPage: 1));
|
||||
|
||||
Future<bool> search(SearchFilter filter) async {
|
||||
if (state.nextPage == null) {
|
||||
@ -39,7 +39,7 @@ class PaginatedSearchNotifier extends StateNotifier<SearchResult> {
|
||||
}
|
||||
|
||||
clear() {
|
||||
state = SearchResult(assets: [], nextPage: 1);
|
||||
state = const SearchResult(assets: [], nextPage: 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,36 +1,35 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
||||
|
||||
import 'package:immich_mobile/models/server_info/server_info.model.dart';
|
||||
import 'package:immich_mobile/services/server_info.service.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_config.model.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_features.model.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_info.model.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_version.model.dart';
|
||||
import 'package:immich_mobile/services/server_info.service.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class ServerInfoNotifier extends StateNotifier<ServerInfo> {
|
||||
ServerInfoNotifier(this._serverInfoService)
|
||||
: super(
|
||||
ServerInfo(
|
||||
serverVersion: const ServerVersion(
|
||||
const ServerInfo(
|
||||
serverVersion: ServerVersion(
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
),
|
||||
latestVersion: const ServerVersion(
|
||||
latestVersion: ServerVersion(
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
),
|
||||
serverFeatures: const ServerFeatures(
|
||||
serverFeatures: ServerFeatures(
|
||||
map: true,
|
||||
trash: true,
|
||||
oauthEnabled: false,
|
||||
passwordLogin: true,
|
||||
),
|
||||
serverConfig: const ServerConfig(
|
||||
serverConfig: ServerConfig(
|
||||
trashDays: 30,
|
||||
oauthButtonText: '',
|
||||
externalDomain: '',
|
||||
@ -38,7 +37,7 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
|
||||
'https://tiles.immich.cloud/v1/style/light.json',
|
||||
mapDarkStyleUrl: 'https://tiles.immich.cloud/v1/style/dark.json',
|
||||
),
|
||||
serverDiskInfo: const ServerDiskInfo(
|
||||
serverDiskInfo: ServerDiskInfo(
|
||||
diskAvailable: "0",
|
||||
diskSize: "0",
|
||||
diskUse: "0",
|
||||
|
@ -14,7 +14,7 @@ final multiSelectProvider =
|
||||
class MultiSelectState {
|
||||
final Set<BaseAsset> selectedAssets;
|
||||
|
||||
MultiSelectState({
|
||||
const MultiSelectState({
|
||||
required this.selectedAssets,
|
||||
});
|
||||
|
||||
@ -50,7 +50,7 @@ class MultiSelectNotifier extends Notifier<MultiSelectState> {
|
||||
MultiSelectState build() {
|
||||
_timelineService = ref.read(timelineServiceProvider);
|
||||
|
||||
return MultiSelectState(
|
||||
return const MultiSelectState(
|
||||
selectedAssets: {},
|
||||
);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class UploadProfileImageState {
|
||||
// enum
|
||||
final UploadProfileStatus status;
|
||||
final String profileImagePath;
|
||||
UploadProfileImageState({
|
||||
const UploadProfileImageState({
|
||||
required this.status,
|
||||
required this.profileImagePath,
|
||||
});
|
||||
@ -74,7 +74,7 @@ class UploadProfileImageNotifier
|
||||
extends StateNotifier<UploadProfileImageState> {
|
||||
UploadProfileImageNotifier(this._userService)
|
||||
: super(
|
||||
UploadProfileImageState(
|
||||
const UploadProfileImageState(
|
||||
profileImagePath: '',
|
||||
status: UploadProfileStatus.idle,
|
||||
),
|
||||
|
@ -56,7 +56,7 @@ class WebsocketState {
|
||||
final bool isConnected;
|
||||
final List<PendingChange> pendingChanges;
|
||||
|
||||
WebsocketState({
|
||||
const WebsocketState({
|
||||
this.socket,
|
||||
required this.isConnected,
|
||||
required this.pendingChanges,
|
||||
@ -94,7 +94,11 @@ class WebsocketState {
|
||||
class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
WebsocketNotifier(this._ref)
|
||||
: super(
|
||||
WebsocketState(socket: null, isConnected: false, pendingChanges: []),
|
||||
const WebsocketState(
|
||||
socket: null,
|
||||
isConnected: false,
|
||||
pendingChanges: [],
|
||||
),
|
||||
);
|
||||
|
||||
final _log = Logger('WebsocketNotifier');
|
||||
|
@ -18,7 +18,7 @@ final albumRepositoryProvider =
|
||||
Provider((ref) => AlbumRepository(ref.watch(dbProvider)));
|
||||
|
||||
class AlbumRepository extends DatabaseRepository {
|
||||
AlbumRepository(super.db);
|
||||
const AlbumRepository(super.db);
|
||||
|
||||
Future<int> count({bool? local}) {
|
||||
final baseQuery = db.albums.where();
|
||||
|
@ -3,7 +3,7 @@ import 'package:immich_mobile/constants/errors.dart';
|
||||
abstract class ApiRepository {
|
||||
Future<T> checkNull<T>(Future<T?> future) async {
|
||||
final response = await future;
|
||||
if (response == null) throw NoResponseDtoError();
|
||||
if (response == null) throw const NoResponseDtoError();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ final assetRepositoryProvider =
|
||||
Provider((ref) => AssetRepository(ref.watch(dbProvider)));
|
||||
|
||||
class AssetRepository extends DatabaseRepository {
|
||||
AssetRepository(super.db);
|
||||
const AssetRepository(super.db);
|
||||
|
||||
Future<List<Asset>> getByAlbum(
|
||||
Album album, {
|
||||
|
@ -56,18 +56,12 @@ class AssetApiRepository extends ApiRepository {
|
||||
);
|
||||
}
|
||||
|
||||
_mapVisibility(AssetVisibilityEnum visibility) {
|
||||
switch (visibility) {
|
||||
case AssetVisibilityEnum.timeline:
|
||||
return AssetVisibility.timeline;
|
||||
case AssetVisibilityEnum.hidden:
|
||||
return AssetVisibility.hidden;
|
||||
case AssetVisibilityEnum.locked:
|
||||
return AssetVisibility.locked;
|
||||
case AssetVisibilityEnum.archive:
|
||||
return AssetVisibility.archive;
|
||||
}
|
||||
}
|
||||
_mapVisibility(AssetVisibilityEnum visibility) => switch (visibility) {
|
||||
AssetVisibilityEnum.timeline => AssetVisibility.timeline,
|
||||
AssetVisibilityEnum.hidden => AssetVisibility.hidden,
|
||||
AssetVisibilityEnum.locked => AssetVisibility.locked,
|
||||
AssetVisibilityEnum.archive => AssetVisibility.archive,
|
||||
};
|
||||
|
||||
Future<String?> getAssetMIMEType(String assetId) async {
|
||||
final response = await checkNull(_api.getAssetInfo(assetId));
|
||||
|
@ -6,9 +6,11 @@ import 'package:immich_mobile/entities/store.entity.dart';
|
||||
import 'package:immich_mobile/utils/hash.dart';
|
||||
import 'package:photo_manager/photo_manager.dart' hide AssetType;
|
||||
|
||||
final assetMediaRepositoryProvider = Provider((ref) => AssetMediaRepository());
|
||||
final assetMediaRepositoryProvider =
|
||||
Provider((ref) => const AssetMediaRepository());
|
||||
|
||||
class AssetMediaRepository {
|
||||
const AssetMediaRepository();
|
||||
Future<List<String>> deleteAll(List<String> ids) =>
|
||||
PhotoManager.editor.deleteWithIds(ids);
|
||||
|
||||
|
@ -22,7 +22,7 @@ final authRepositoryProvider = Provider<AuthRepository>(
|
||||
class AuthRepository extends DatabaseRepository {
|
||||
final Drift _drift;
|
||||
|
||||
AuthRepository(super.db, this._drift);
|
||||
const AuthRepository(super.db, this._drift);
|
||||
|
||||
Future<void> clearLocalData() {
|
||||
return db.writeTxn(() {
|
||||
|
@ -10,7 +10,7 @@ final backupAlbumRepositoryProvider =
|
||||
Provider((ref) => BackupAlbumRepository(ref.watch(dbProvider)));
|
||||
|
||||
class BackupAlbumRepository extends DatabaseRepository {
|
||||
BackupAlbumRepository(super.db);
|
||||
const BackupAlbumRepository(super.db);
|
||||
|
||||
Future<List<BackupAlbum>> getAll({BackupAlbumSort? sort}) {
|
||||
final baseQuery = db.backupAlbums.where();
|
||||
|
@ -9,7 +9,7 @@ final biometricRepositoryProvider =
|
||||
class BiometricRepository {
|
||||
final LocalAuthentication _localAuth;
|
||||
|
||||
BiometricRepository(this._localAuth);
|
||||
const BiometricRepository(this._localAuth);
|
||||
|
||||
Future<BiometricStatus> getStatus() async {
|
||||
final bool canAuthenticateWithBiometrics =
|
||||
|
@ -7,7 +7,7 @@ const Symbol _zoneTxn = #zoneTxn;
|
||||
|
||||
abstract class DatabaseRepository implements IDatabaseRepository {
|
||||
final Isar db;
|
||||
DatabaseRepository(this.db);
|
||||
const DatabaseRepository(this.db);
|
||||
|
||||
bool get inTxn => Zone.current[_zoneTxn] != null;
|
||||
|
||||
|
@ -8,7 +8,7 @@ final etagRepositoryProvider =
|
||||
Provider((ref) => ETagRepository(ref.watch(dbProvider)));
|
||||
|
||||
class ETagRepository extends DatabaseRepository {
|
||||
ETagRepository(super.db);
|
||||
const ETagRepository(super.db);
|
||||
|
||||
Future<List<String>> getAllIds() => db.eTags.where().idProperty().findAll();
|
||||
|
||||
|
@ -6,9 +6,11 @@ import 'package:immich_mobile/entities/asset.entity.dart';
|
||||
import 'package:immich_mobile/repositories/asset_media.repository.dart';
|
||||
import 'package:photo_manager/photo_manager.dart' hide AssetType;
|
||||
|
||||
final fileMediaRepositoryProvider = Provider((ref) => FileMediaRepository());
|
||||
final fileMediaRepositoryProvider =
|
||||
Provider((ref) => const FileMediaRepository());
|
||||
|
||||
class FileMediaRepository {
|
||||
const FileMediaRepository();
|
||||
Future<Asset?> saveImage(
|
||||
Uint8List data, {
|
||||
required String title,
|
||||
|
@ -7,7 +7,7 @@ final localFilesManagerRepositoryProvider = Provider(
|
||||
);
|
||||
|
||||
class LocalFilesManagerRepository {
|
||||
LocalFilesManagerRepository(this._service);
|
||||
const LocalFilesManagerRepository(this._service);
|
||||
|
||||
final LocalFilesManagerService _service;
|
||||
|
||||
|
@ -12,7 +12,7 @@ final networkRepositoryProvider = Provider((_) {
|
||||
class NetworkRepository {
|
||||
final NetworkInfo _networkInfo;
|
||||
|
||||
NetworkRepository(this._networkInfo);
|
||||
const NetworkRepository(this._networkInfo);
|
||||
|
||||
Future<String?> getWifiName() {
|
||||
if (Platform.isAndroid) {
|
||||
|
@ -11,7 +11,7 @@ final partnerRepositoryProvider = Provider(
|
||||
);
|
||||
|
||||
class PartnerRepository extends DatabaseRepository {
|
||||
PartnerRepository(super.db);
|
||||
const PartnerRepository(super.db);
|
||||
|
||||
Future<List<UserDto>> getSharedBy() async {
|
||||
return (await db.users
|
||||
|
@ -2,11 +2,11 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
final permissionRepositoryProvider = Provider((_) {
|
||||
return PermissionRepository();
|
||||
return const PermissionRepository();
|
||||
});
|
||||
|
||||
class PermissionRepository implements IPermissionRepository {
|
||||
PermissionRepository();
|
||||
const PermissionRepository();
|
||||
|
||||
@override
|
||||
Future<bool> hasLocationWhenInUsePermission() {
|
||||
|
@ -2,12 +2,12 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
final secureStorageRepositoryProvider =
|
||||
Provider((ref) => SecureStorageRepository(const FlutterSecureStorage()));
|
||||
Provider((ref) => const SecureStorageRepository(FlutterSecureStorage()));
|
||||
|
||||
class SecureStorageRepository {
|
||||
final FlutterSecureStorage _secureStorage;
|
||||
|
||||
SecureStorageRepository(this._secureStorage);
|
||||
const SecureStorageRepository(this._secureStorage);
|
||||
|
||||
Future<String?> read(String key) {
|
||||
return _secureStorage.read(key: key);
|
||||
|
@ -13,7 +13,7 @@ final timelineRepositoryProvider =
|
||||
Provider((ref) => TimelineRepository(ref.watch(dbProvider)));
|
||||
|
||||
class TimelineRepository extends DatabaseRepository {
|
||||
TimelineRepository(super.db);
|
||||
const TimelineRepository(super.db);
|
||||
|
||||
Future<List<String>> getTimelineUserIds(String id) {
|
||||
return db.users
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'package:home_widget/home_widget.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
final widgetRepositoryProvider = Provider((_) => WidgetRepository());
|
||||
final widgetRepositoryProvider = Provider((_) => const WidgetRepository());
|
||||
|
||||
class WidgetRepository {
|
||||
WidgetRepository();
|
||||
const WidgetRepository();
|
||||
|
||||
Future<void> saveData(String key, String value) async {
|
||||
await HomeWidget.saveWidgetData<String>(key, value);
|
||||
|
@ -5,7 +5,7 @@ import 'package:immich_mobile/routing/router.dart';
|
||||
class BackupPermissionGuard extends AutoRouteGuard {
|
||||
final GalleryPermissionNotifier _permission;
|
||||
|
||||
BackupPermissionGuard(this._permission);
|
||||
const BackupPermissionGuard(this._permission);
|
||||
|
||||
@override
|
||||
void onNavigation(NavigationResolver resolver, StackRouter router) async {
|
||||
|
@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
|
||||
|
||||
/// Guards against duplicate navigation to this route
|
||||
class DuplicateGuard extends AutoRouteGuard {
|
||||
DuplicateGuard();
|
||||
const DuplicateGuard();
|
||||
@override
|
||||
void onNavigation(NavigationResolver resolver, StackRouter router) async {
|
||||
// Duplicate navigation
|
||||
|
@ -106,7 +106,7 @@ class AppRouter extends RootStackRouter {
|
||||
LocalAuthService localAuthService,
|
||||
) {
|
||||
_authGuard = AuthGuard(apiService);
|
||||
_duplicateGuard = DuplicateGuard();
|
||||
_duplicateGuard = const DuplicateGuard();
|
||||
_lockedGuard =
|
||||
LockedGuard(apiService, secureStorageService, localAuthService);
|
||||
_backupPermissionGuard = BackupPermissionGuard(galleryPermissionNotifier);
|
||||
|
@ -100,6 +100,7 @@ enum AppSettingsEnum<T> {
|
||||
}
|
||||
|
||||
class AppSettingsService {
|
||||
const AppSettingsService();
|
||||
T getSetting<T>(AppSettingsEnum<T> setting) {
|
||||
return Store.get(setting.storeKey, setting.defaultValue);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ final backupAlbumServiceProvider = Provider<BackupAlbumService>((ref) {
|
||||
class BackupAlbumService {
|
||||
final BackupAlbumRepository _backupAlbumRepository;
|
||||
|
||||
BackupAlbumService(this._backupAlbumRepository);
|
||||
const BackupAlbumService(this._backupAlbumRepository);
|
||||
|
||||
Future<List<BackupAlbum>> getAll({BackupAlbumSort? sort}) {
|
||||
return _backupAlbumRepository.getAll(sort: sort);
|
||||
|
@ -25,7 +25,7 @@ class DeepLinkService {
|
||||
final CurrentAsset _currentAsset;
|
||||
final CurrentAlbum _currentAlbum;
|
||||
|
||||
DeepLinkService(
|
||||
const DeepLinkService(
|
||||
this._memoryService,
|
||||
this._assetService,
|
||||
this._albumService,
|
||||
@ -38,16 +38,12 @@ class DeepLinkService {
|
||||
final intent = link.uri.host;
|
||||
final queryParams = link.uri.queryParameters;
|
||||
|
||||
PageRouteInfo<dynamic>? deepLinkRoute;
|
||||
|
||||
switch (intent) {
|
||||
case "memory":
|
||||
deepLinkRoute = await _buildMemoryDeepLink(queryParams['id'] ?? '');
|
||||
case "asset":
|
||||
deepLinkRoute = await _buildAssetDeepLink(queryParams['id'] ?? '');
|
||||
case "album":
|
||||
deepLinkRoute = await _buildAlbumDeepLink(queryParams['id'] ?? '');
|
||||
}
|
||||
PageRouteInfo<dynamic>? deepLinkRoute = switch (intent) {
|
||||
"memory" => await _buildMemoryDeepLink(queryParams['id'] ?? ''),
|
||||
"asset" => await _buildAssetDeepLink(queryParams['id'] ?? ''),
|
||||
"album" => await _buildAlbumDeepLink(queryParams['id'] ?? ''),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Deep link resolution failed, safely handle it based on the app state
|
||||
if (deepLinkRoute == null) {
|
||||
@ -98,7 +94,7 @@ class DeepLinkService {
|
||||
]);
|
||||
}
|
||||
|
||||
Future<MemoryRoute?> _buildMemoryDeepLink(String memoryId) async {
|
||||
Future<PageRouteInfo?> _buildMemoryDeepLink(String memoryId) async {
|
||||
final memory = await _memoryService.getMemoryById(memoryId);
|
||||
|
||||
if (memory == null) {
|
||||
@ -108,7 +104,7 @@ class DeepLinkService {
|
||||
return MemoryRoute(memories: [memory], memoryIndex: 0);
|
||||
}
|
||||
|
||||
Future<GalleryViewerRoute?> _buildAssetDeepLink(String assetId) async {
|
||||
Future<PageRouteInfo?> _buildAssetDeepLink(String assetId) async {
|
||||
final asset = await _assetService.getAssetByRemoteId(assetId);
|
||||
|
||||
if (asset == null) {
|
||||
@ -126,7 +122,7 @@ class DeepLinkService {
|
||||
);
|
||||
}
|
||||
|
||||
Future<AlbumViewerRoute?> _buildAlbumDeepLink(String albumId) async {
|
||||
Future<PageRouteInfo?> _buildAlbumDeepLink(String albumId) async {
|
||||
final album = await _albumService.getAlbumByRemoteId(albumId);
|
||||
|
||||
if (album == null) {
|
||||
|
@ -3,10 +3,10 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||
import 'package:immich_mobile/entities/store.entity.dart';
|
||||
|
||||
final deviceServiceProvider = Provider((ref) => DeviceService());
|
||||
final deviceServiceProvider = Provider((ref) => const DeviceService());
|
||||
|
||||
class DeviceService {
|
||||
DeviceService();
|
||||
const DeviceService();
|
||||
|
||||
createDeviceId() {
|
||||
return FlutterUdid.consistentUdid;
|
||||
|
@ -8,7 +8,7 @@ import 'package:immich_mobile/repositories/asset.repository.dart';
|
||||
class EntityService {
|
||||
final AssetRepository _assetRepository;
|
||||
final IsarUserRepository _isarUserRepository;
|
||||
EntityService(
|
||||
const EntityService(
|
||||
this._assetRepository,
|
||||
this._isarUserRepository,
|
||||
);
|
||||
|
@ -7,7 +7,7 @@ final etagServiceProvider =
|
||||
class ETagService {
|
||||
final ETagRepository _eTagRepository;
|
||||
|
||||
ETagService(this._eTagRepository);
|
||||
const ETagService(this._eTagRepository);
|
||||
|
||||
Future<void> clearTable() {
|
||||
return _eTagRepository.clearTable();
|
||||
|
@ -11,7 +11,7 @@ final localAuthServiceProvider = Provider(
|
||||
class LocalAuthService {
|
||||
final BiometricRepository _biometricRepository;
|
||||
|
||||
LocalAuthService(this._biometricRepository);
|
||||
const LocalAuthService(this._biometricRepository);
|
||||
|
||||
Future<BiometricStatus> getStatus() {
|
||||
return _biometricRepository.getStatus();
|
||||
|
@ -3,10 +3,11 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
final localFileManagerServiceProvider = Provider<LocalFilesManagerService>(
|
||||
(ref) => LocalFilesManagerService(),
|
||||
(ref) => const LocalFilesManagerService(),
|
||||
);
|
||||
|
||||
class LocalFilesManagerService {
|
||||
const LocalFilesManagerService();
|
||||
static final Logger _logger = Logger('LocalFilesManager');
|
||||
static const MethodChannel _channel = MethodChannel('file_trash');
|
||||
|
||||
|
@ -13,7 +13,7 @@ class NetworkService {
|
||||
final NetworkRepository _repository;
|
||||
final IPermissionRepository _permissionRepository;
|
||||
|
||||
NetworkService(this._repository, this._permissionRepository);
|
||||
const NetworkService(this._repository, this._permissionRepository);
|
||||
|
||||
Future<bool> getLocationWhenInUserPermission() {
|
||||
return _permissionRepository.hasLocationWhenInUsePermission();
|
||||
|
@ -10,7 +10,7 @@ final secureStorageServiceProvider = Provider(
|
||||
class SecureStorageService {
|
||||
final SecureStorageRepository _secureStorageRepository;
|
||||
|
||||
SecureStorageService(this._secureStorageRepository);
|
||||
const SecureStorageService(this._secureStorageRepository);
|
||||
|
||||
Future<void> write(String key, String value) async {
|
||||
await _secureStorageRepository.write(key, value);
|
||||
|
@ -16,7 +16,7 @@ final serverInfoServiceProvider = Provider(
|
||||
class ServerInfoService {
|
||||
final ApiService _apiService;
|
||||
|
||||
ServerInfoService(this._apiService);
|
||||
const ServerInfoService(this._apiService);
|
||||
|
||||
Future<ServerDiskInfo?> getDiskInfo() async {
|
||||
try {
|
||||
|
@ -7,7 +7,7 @@ import 'package:immich_mobile/services/api.service.dart';
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
class StackService {
|
||||
StackService(this._api, this._assetRepository);
|
||||
const StackService(this._api, this._assetRepository);
|
||||
|
||||
final ApiService _api;
|
||||
final AssetRepository _assetRepository;
|
||||
|
@ -11,7 +11,7 @@ final widgetServiceProvider = Provider((ref) {
|
||||
class WidgetService {
|
||||
final WidgetRepository _repository;
|
||||
|
||||
WidgetService(this._repository);
|
||||
const WidgetService(this._repository);
|
||||
|
||||
Future<void> writeCredentials(String serverURL, String sessionKey) async {
|
||||
await _repository.setAppGroupId(appShareGroupId);
|
||||
|
@ -4,7 +4,7 @@ import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:immich_mobile/theme/theme_data.dart';
|
||||
|
||||
abstract final class DynamicTheme {
|
||||
DynamicTheme._();
|
||||
const DynamicTheme._();
|
||||
|
||||
static ImmichTheme? _theme;
|
||||
// Method to fetch dynamic system colors
|
||||
|
@ -7,7 +7,7 @@ import 'package:logging/logging.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
|
||||
class MapUtils {
|
||||
MapUtils._();
|
||||
const MapUtils._();
|
||||
|
||||
static final Logger _log = Logger("MapUtils");
|
||||
static const defaultSourceId = 'asset-map-markers';
|
||||
|
@ -106,7 +106,9 @@ class AlbumThumbnailCard extends ConsumerWidget {
|
||||
width: cardSize,
|
||||
height: cardSize,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
child: album.thumbnail.value == null
|
||||
? buildEmptyThumbnail()
|
||||
: buildAlbumThumbnail(),
|
||||
|
@ -59,13 +59,17 @@ class AlbumTitleTextField extends ConsumerWidget {
|
||||
splashRadius: 10,
|
||||
)
|
||||
: null,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
),
|
||||
hintText: 'add_a_title'.tr(),
|
||||
hintStyle: context.themeData.inputDecorationTheme.hintStyle?.copyWith(
|
||||
|
@ -23,7 +23,7 @@ class RenderAssetGridElement {
|
||||
final int offset;
|
||||
final int totalCount;
|
||||
|
||||
RenderAssetGridElement(
|
||||
const RenderAssetGridElement(
|
||||
this.type, {
|
||||
this.title,
|
||||
required this.date,
|
||||
|
@ -210,7 +210,7 @@ class DraggableScrollbar extends StatefulWidget {
|
||||
BoxConstraints? labelConstraints,
|
||||
}) {
|
||||
final scrollThumb = ClipPath(
|
||||
clipper: ArrowClipper(),
|
||||
clipper: const ArrowClipper(),
|
||||
child: Container(
|
||||
height: height,
|
||||
width: 20.0,
|
||||
@ -570,6 +570,7 @@ class ArrowCustomPainter extends CustomPainter {
|
||||
|
||||
///This cut 2 lines in arrow shape
|
||||
class ArrowClipper extends CustomClipper<Path> {
|
||||
const ArrowClipper();
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
Path path = Path();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user