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:
shenlong
2025-06-25 13:06:24 +05:30
committed by GitHub
parent 05064f87f0
commit 5b0575b956
130 changed files with 338 additions and 264 deletions
@@ -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();
+1 -1
View File
@@ -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>{},
+2 -2
View File
@@ -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,
+1 -1
View File
@@ -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);
}
}
+9 -10
View File
@@ -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,
),
+6 -2
View File
@@ -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');