chore: bump line length to 120 (#20191)

This commit is contained in:
shenlong 2025-07-25 08:07:22 +05:30 committed by GitHub
parent 977c9b96ba
commit ad65e9011a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
517 changed files with 4520 additions and 9514 deletions

View file

@ -25,23 +25,18 @@ class AdvancedSettings extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
bool isLoggedIn = ref.read(currentUserProvider) != null;
final advancedTroubleshooting =
useAppSettingsState(AppSettingsEnum.advancedTroubleshooting);
final manageLocalMediaAndroid =
useAppSettingsState(AppSettingsEnum.manageLocalMediaAndroid);
final advancedTroubleshooting = useAppSettingsState(AppSettingsEnum.advancedTroubleshooting);
final manageLocalMediaAndroid = useAppSettingsState(AppSettingsEnum.manageLocalMediaAndroid);
final levelId = useAppSettingsState(AppSettingsEnum.logLevel);
final preferRemote = useAppSettingsState(AppSettingsEnum.preferRemoteImage);
final allowSelfSignedSSLCert =
useAppSettingsState(AppSettingsEnum.allowSelfSignedSSLCert);
final useAlternatePMFilter =
useAppSettingsState(AppSettingsEnum.photoManagerCustomFilter);
final allowSelfSignedSSLCert = useAppSettingsState(AppSettingsEnum.allowSelfSignedSSLCert);
final useAlternatePMFilter = useAppSettingsState(AppSettingsEnum.photoManagerCustomFilter);
final logLevel = Level.LEVELS[levelId.value].name;
useValueChanged(
levelId.value,
(_, __) =>
LogService.I.setLogLevel(Level.LEVELS[levelId.value].toLogLevel()),
(_, __) => LogService.I.setLogLevel(Level.LEVELS[levelId.value].toLogLevel()),
);
Future<bool> checkAndroidVersion() async {
@ -72,9 +67,7 @@ class AdvancedSettings extends HookConsumerWidget {
subtitle: "advanced_settings_sync_remote_deletions_subtitle".tr(),
onChanged: (value) async {
if (value) {
final result = await ref
.read(localFilesManagerRepositoryProvider)
.requestManageMediaPermission();
final result = await ref.read(localFilesManagerRepositoryProvider).requestManageMediaPermission();
manageLocalMediaAndroid.value = result;
}
},
@ -85,8 +78,7 @@ class AdvancedSettings extends HookConsumerWidget {
},
),
SettingsSliderListTile(
text: "advanced_settings_log_level_title"
.tr(namedArgs: {'level': logLevel}),
text: "advanced_settings_log_level_title".tr(namedArgs: {'level': logLevel}),
valueNotifier: levelId,
maxValue: 8,
minValue: 1,
@ -111,8 +103,7 @@ class AdvancedSettings extends HookConsumerWidget {
SettingsSwitchListTile(
valueNotifier: useAlternatePMFilter,
title: "advanced_settings_enable_alternate_media_filter_title".tr(),
subtitle:
"advanced_settings_enable_alternate_media_filter_subtitle".tr(),
subtitle: "advanced_settings_enable_alternate_media_filter_subtitle".tr(),
),
];

View file

@ -29,8 +29,7 @@ class LayoutSettings extends HookConsumerWidget {
),
SettingsSliderListTile(
valueNotifier: tilesPerRow,
text: 'theme_setting_asset_list_tiles_per_row_title'
.tr(namedArgs: {'count': "${tilesPerRow.value}"}),
text: 'theme_setting_asset_list_tiles_per_row_title'.tr(namedArgs: {'count': "${tilesPerRow.value}"}),
label: "${tilesPerRow.value}",
maxValue: 6,
minValue: 2,

View file

@ -16,8 +16,7 @@ class AssetListSettings extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final showStorageIndicator =
useAppSettingsState(AppSettingsEnum.storageIndicator);
final showStorageIndicator = useAppSettingsState(AppSettingsEnum.storageIndicator);
final assetListSetting = [
SettingsSwitchListTile(

View file

@ -15,8 +15,7 @@ class VideoViewerSettings extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final useLoopVideo = useAppSettingsState(AppSettingsEnum.loopVideo);
final useOriginalVideo =
useAppSettingsState(AppSettingsEnum.loadOriginalVideo);
final useOriginalVideo = useAppSettingsState(AppSettingsEnum.loadOriginalVideo);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,

View file

@ -19,8 +19,7 @@ class BackgroundBackupSettings extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final isBackgroundEnabled =
ref.watch(backupProvider.select((s) => s.backgroundBackup));
final isBackgroundEnabled = ref.watch(backupProvider.select((s) => s.backgroundBackup));
final iosSettings = ref.watch(iOSBackgroundSettingsProvider);
void showErrorToUser(String msg) {
@ -80,12 +79,11 @@ class BackgroundBackupSettings extends ConsumerWidget {
title: 'backup_controller_page_background_is_off'.tr(),
subtileText: 'backup_controller_page_background_description'.tr(),
buttonText: 'backup_controller_page_background_turn_on'.tr(),
onButtonTap: () =>
ref.read(backupProvider.notifier).configureBackgroundBackup(
enabled: true,
onError: showErrorToUser,
onBatteryInfo: showBatteryOptimizationInfoToUser,
),
onButtonTap: () => ref.read(backupProvider.notifier).configureBackgroundBackup(
enabled: true,
onError: showErrorToUser,
onBatteryInfo: showBatteryOptimizationInfoToUser,
),
);
}
@ -96,10 +94,8 @@ class BackgroundBackupSettings extends ConsumerWidget {
onError: showErrorToUser,
onBatteryInfo: showBatteryOptimizationInfoToUser,
),
if (Platform.isIOS && iosSettings?.appRefreshEnabled != true)
const _IOSBackgroundRefreshDisabled(),
if (Platform.isIOS && iosSettings != null)
IosDebugInfoTile(settings: iosSettings),
if (Platform.isIOS && iosSettings?.appRefreshEnabled != true) const _IOSBackgroundRefreshDisabled(),
if (Platform.isIOS && iosSettings != null) IosDebugInfoTile(settings: iosSettings),
],
);
}
@ -112,13 +108,9 @@ class _IOSBackgroundRefreshDisabled extends StatelessWidget {
Widget build(BuildContext context) {
return SettingsButtonListTile(
icon: Icons.task_outlined,
title:
'backup_controller_page_background_app_refresh_disabled_title'.tr(),
subtileText:
'backup_controller_page_background_app_refresh_disabled_content'.tr(),
buttonText:
'backup_controller_page_background_app_refresh_enable_button_text'
.tr(),
title: 'backup_controller_page_background_app_refresh_disabled_title'.tr(),
subtileText: 'backup_controller_page_background_app_refresh_disabled_content'.tr(),
buttonText: 'backup_controller_page_background_app_refresh_enable_button_text'.tr(),
onButtonTap: () => openAppSettings(),
);
}
@ -135,8 +127,7 @@ class _BackgroundSettingsEnabled extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final isWifiRequired =
ref.watch(backupProvider.select((s) => s.backupRequireWifi));
final isWifiRequired = ref.watch(backupProvider.select((s) => s.backupRequireWifi));
final isWifiRequiredNotifier = useValueNotifier(isWifiRequired);
useValueChanged(
isWifiRequired,
@ -145,8 +136,7 @@ class _BackgroundSettingsEnabled extends HookConsumerWidget {
),
);
final isChargingRequired =
ref.watch(backupProvider.select((s) => s.backupRequireCharging));
final isChargingRequired = ref.watch(backupProvider.select((s) => s.backupRequireCharging));
final isChargingRequiredNotifier = useValueNotifier(isChargingRequired);
useValueChanged(
isChargingRequired,
@ -162,22 +152,16 @@ class _BackgroundSettingsEnabled extends HookConsumerWidget {
_ => 3,
};
int backupDelayToMilliseconds(int v) =>
switch (v) { 0 => 5000, 1 => 30000, 2 => 120000, _ => 600000 };
int backupDelayToMilliseconds(int v) => switch (v) { 0 => 5000, 1 => 30000, 2 => 120000, _ => 600000 };
String formatBackupDelaySliderValue(int v) => switch (v) {
0 => 'setting_notifications_notify_seconds'
.tr(namedArgs: {'count': '5'}),
1 => 'setting_notifications_notify_seconds'
.tr(namedArgs: {'count': '30'}),
2 => 'setting_notifications_notify_minutes'
.tr(namedArgs: {'count': '2'}),
_ => 'setting_notifications_notify_minutes'
.tr(namedArgs: {'count': '10'}),
0 => 'setting_notifications_notify_seconds'.tr(namedArgs: {'count': '5'}),
1 => 'setting_notifications_notify_seconds'.tr(namedArgs: {'count': '30'}),
2 => 'setting_notifications_notify_minutes'.tr(namedArgs: {'count': '2'}),
_ => 'setting_notifications_notify_minutes'.tr(namedArgs: {'count': '10'}),
};
final backupTriggerDelay =
ref.watch(backupProvider.select((s) => s.backupTriggerDelay));
final backupTriggerDelay = ref.watch(backupProvider.select((s) => s.backupTriggerDelay));
final triggerDelay = useState(backupDelayToSliderValue(backupTriggerDelay));
useValueChanged(
triggerDelay.value,
@ -193,35 +177,32 @@ class _BackgroundSettingsEnabled extends HookConsumerWidget {
iconColor: context.primaryColor,
title: 'backup_controller_page_background_is_on'.tr(),
buttonText: 'backup_controller_page_background_turn_off'.tr(),
onButtonTap: () =>
ref.read(backupProvider.notifier).configureBackgroundBackup(
enabled: false,
onError: onError,
onBatteryInfo: onBatteryInfo,
),
onButtonTap: () => ref.read(backupProvider.notifier).configureBackgroundBackup(
enabled: false,
onError: onError,
onBatteryInfo: onBatteryInfo,
),
subtitle: Column(
children: [
SettingsSwitchListTile(
valueNotifier: isWifiRequiredNotifier,
title: 'backup_controller_page_background_wifi'.tr(),
icon: Icons.wifi,
onChanged: (enabled) =>
ref.read(backupProvider.notifier).configureBackgroundBackup(
requireWifi: enabled,
onError: onError,
onBatteryInfo: onBatteryInfo,
),
onChanged: (enabled) => ref.read(backupProvider.notifier).configureBackgroundBackup(
requireWifi: enabled,
onError: onError,
onBatteryInfo: onBatteryInfo,
),
),
SettingsSwitchListTile(
valueNotifier: isChargingRequiredNotifier,
title: 'backup_controller_page_background_charging'.tr(),
icon: Icons.charging_station,
onChanged: (enabled) =>
ref.read(backupProvider.notifier).configureBackgroundBackup(
requireCharging: enabled,
onError: onError,
onBatteryInfo: onBatteryInfo,
),
onChanged: (enabled) => ref.read(backupProvider.notifier).configureBackgroundBackup(
requireCharging: enabled,
onError: onError,
onBatteryInfo: onBatteryInfo,
),
),
if (Platform.isAndroid)
SettingsSliderListTile(

View file

@ -21,10 +21,8 @@ class BackupSettings extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final ignoreIcloudAssets =
useAppSettingsState(AppSettingsEnum.ignoreIcloudAssets);
final isAdvancedTroubleshooting =
useAppSettingsState(AppSettingsEnum.advancedTroubleshooting);
final ignoreIcloudAssets = useAppSettingsState(AppSettingsEnum.ignoreIcloudAssets);
final isAdvancedTroubleshooting = useAppSettingsState(AppSettingsEnum.advancedTroubleshooting);
final albumSync = useAppSettingsState(AppSettingsEnum.syncAlbums);
final isCorruptCheckInProgress = ref.watch(backupVerificationProvider);
final isAlbumSyncInProgress = useState(false);
@ -63,14 +61,10 @@ class BackupSettings extends HookConsumerWidget {
],
)
: null,
subtileText: !isCorruptCheckInProgress
? 'check_corrupt_asset_backup_description'.tr()
: null,
subtileText: !isCorruptCheckInProgress ? 'check_corrupt_asset_backup_description'.tr() : null,
buttonText: 'check_corrupt_asset_backup_button'.tr(),
onButtonTap: !isCorruptCheckInProgress
? () => ref
.read(backupVerificationProvider.notifier)
.performBackupCheck(context)
? () => ref.read(backupVerificationProvider.notifier).performBackupCheck(context)
: null,
),
if (albumSync.value)

View file

@ -12,8 +12,7 @@ class ForegroundBackupSettings extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final isAutoBackup = ref.watch(backupProvider.select((s) => s.autoBackup));
void onButtonTap() =>
ref.read(backupProvider.notifier).setAutoBackup(!isAutoBackup);
void onButtonTap() => ref.read(backupProvider.notifier).setAutoBackup(!isAutoBackup);
if (isAutoBackup) {
return SettingsButtonListTile(

View file

@ -68,8 +68,7 @@ class BetaSyncSettings extends HookConsumerWidget {
// Refresh all stream queries
database.notifyUpdates({
for (final table in database.allTables)
drift_db.TableUpdate.onTable(table),
for (final table in database.allTables) drift_db.TableUpdate.onTable(table),
});
});
}
@ -77,9 +76,7 @@ class BetaSyncSettings extends HookConsumerWidget {
Future<void> exportDatabase() async {
try {
// WAL Checkpoint to ensure all changes are written to the database
await ref
.read(driftProvider)
.customStatement("pragma wal_checkpoint(truncate)");
await ref.read(driftProvider).customStatement("pragma wal_checkpoint(truncate)");
final documentsDir = await getApplicationDocumentsDirectory();
final dbFile = File(path.join(documentsDir.path, 'immich.sqlite'));
@ -118,8 +115,7 @@ class BetaSyncSettings extends HookConsumerWidget {
if (context.mounted) {
context.scaffoldMessenger.showSnackBar(
SnackBar(
content:
Text("Database exported successfully".t(context: context)),
content: Text("Database exported successfully".t(context: context)),
),
);
}
@ -127,8 +123,7 @@ class BetaSyncSettings extends HookConsumerWidget {
if (context.mounted) {
context.scaffoldMessenger.showSnackBar(
SnackBar(
content:
Text("Failed to export database: $e".t(context: context)),
content: Text("Failed to export database: $e".t(context: context)),
),
);
}

View file

@ -16,9 +16,7 @@ class EntitiyCountTile extends StatelessWidget {
String zeroPadding(int number, int targetWidth) {
final numStr = number.toString();
return numStr.length < targetWidth
? "0" * (targetWidth - numStr.length)
: "";
return numStr.length < targetWidth ? "0" * (targetWidth - numStr.length) : "";
}
int calculateMaxDigits(double availableWidth) {
@ -77,8 +75,7 @@ class EntitiyCountTile extends StatelessWidget {
TextSpan(
text: zeroPadding(count, maxDigits),
style: TextStyle(
color: context.colorScheme.onSurfaceSecondary
.withAlpha(75),
color: context.colorScheme.onSurfaceSecondary.withAlpha(75),
),
),
TextSpan(

View file

@ -18,12 +18,10 @@ class BetaTimelineListTile extends ConsumerStatefulWidget {
});
@override
ConsumerState<BetaTimelineListTile> createState() =>
_BetaTimelineListTileState();
ConsumerState<BetaTimelineListTile> createState() => _BetaTimelineListTileState();
}
class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
with SingleTickerProviderStateMixin {
class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile> with SingleTickerProviderStateMixin {
late AnimationController _animationController;
late Animation<double> _rotationAnimation;
late Animation<double> _pulseAnimation;
@ -69,14 +67,11 @@ class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
@override
Widget build(BuildContext context) {
final betaTimelineValue = ref
.watch(appSettingsServiceProvider)
.getSetting<bool>(AppSettingsEnum.betaTimeline);
final betaTimelineValue = ref.watch(appSettingsServiceProvider).getSetting<bool>(AppSettingsEnum.betaTimeline);
final serverInfo = ref.watch(serverInfoProvider);
final auth = ref.watch(authProvider);
if (!auth.isAuthenticated ||
(serverInfo.serverVersion.minor < 136 && kReleaseMode)) {
if (!auth.isAuthenticated || (serverInfo.serverVersion.minor < 136 && kReleaseMode)) {
return const SizedBox.shrink();
}
@ -88,9 +83,7 @@ class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
context: context,
builder: (context) {
return AlertDialog(
title: value
? const Text("Enable Beta Timeline")
: const Text("Disable Beta Timeline"),
title: value ? const Text("Enable Beta Timeline") : const Text("Disable Beta Timeline"),
content: value
? const Text(
"Are you sure you want to enable the beta timeline?",
@ -182,8 +175,7 @@ class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
borderRadius: const BorderRadius.all(Radius.circular(10.5)),
onTap: () => onSwitchChanged(!betaTimelineValue),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
child: Row(
children: [
Transform.scale(
@ -218,10 +210,8 @@ class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"advanced_settings_beta_timeline_title"
.t(context: context),
style:
context.textTheme.titleMedium?.copyWith(
"advanced_settings_beta_timeline_title".t(context: context),
style: context.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
),
@ -237,17 +227,14 @@ class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
),
gradient: LinearGradient(
colors: [
context.primaryColor
.withValues(alpha: 0.8),
context.primaryColor
.withValues(alpha: 0.6),
context.primaryColor.withValues(alpha: 0.8),
context.primaryColor.withValues(alpha: 0.6),
],
),
),
child: Text(
'NEW',
style:
context.textTheme.labelSmall?.copyWith(
style: context.textTheme.labelSmall?.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 10,
@ -259,11 +246,9 @@ class _BetaTimelineListTileState extends ConsumerState<BetaTimelineListTile>
),
const SizedBox(height: 4),
Text(
"advanced_settings_beta_timeline_subtitle"
.t(context: context),
"advanced_settings_beta_timeline_subtitle".t(context: context),
style: context.textTheme.labelLarge?.copyWith(
color: context.textTheme.labelLarge?.color
?.withValues(alpha: 0.9),
color: context.textTheme.labelLarge?.color?.withValues(alpha: 0.9),
),
maxLines: 2,
),

View file

@ -31,13 +31,11 @@ class LanguageSettings extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final localeEntries = useMemoized(() => locales.entries.toList(), const []);
final currentLocale = context.locale;
final filteredLocaleEntries =
useState<List<MapEntry<String, Locale>>>(localeEntries);
final filteredLocaleEntries = useState<List<MapEntry<String, Locale>>>(localeEntries);
final selectedLocale = useState<Locale>(currentLocale);
final isLoading = useState<bool>(false);
final isButtonDisabled =
selectedLocale.value == currentLocale || isLoading.value;
final isButtonDisabled = selectedLocale.value == currentLocale || isLoading.value;
final searchController = useTextEditingController();
final searchFocusNode = useFocusNode();
@ -51,8 +49,7 @@ class LanguageSettings extends HookConsumerWidget {
} else {
filteredLocaleEntries.value = localeEntries
.where(
(entry) =>
entry.key.toLowerCase().contains(searchTerm.toLowerCase()),
(entry) => entry.key.toLowerCase().contains(searchTerm.toLowerCase()),
)
.toList();
}
@ -94,12 +91,9 @@ class LanguageSettings extends HookConsumerWidget {
itemExtent: 64.0,
cacheExtent: 100,
itemBuilder: (context, index) {
final countryName =
filteredLocaleEntries.value[index].key;
final localeValue =
filteredLocaleEntries.value[index].value;
final bool isSelected =
selectedLocale.value == localeValue;
final countryName = filteredLocaleEntries.value[index].key;
final localeValue = filteredLocaleEntries.value[index].value;
final bool isSelected = selectedLocale.value == localeValue;
return _LanguageItem(
key: ValueKey(localeValue.toString()),
@ -285,8 +279,7 @@ class _LanguageItem extends StatelessWidget {
),
child: DecoratedBox(
decoration: BoxDecoration(
color:
context.colorScheme.surfaceContainerLowest.withValues(alpha: .6),
color: context.colorScheme.surfaceContainerLowest.withValues(alpha: .6),
borderRadius: const BorderRadius.all(
Radius.circular(16.0),
),
@ -300,9 +293,7 @@ class _LanguageItem extends StatelessWidget {
countryName,
style: context.textTheme.titleSmall?.copyWith(
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
color: isSelected
? context.colorScheme.primary
: context.colorScheme.onSurfaceVariant,
color: isSelected ? context.colorScheme.primary : context.colorScheme.onSurfaceVariant,
),
),
trailing: isSelected

View file

@ -61,8 +61,7 @@ class EndpointInputState extends ConsumerState<EndpointInput> {
final url = controller.text;
setState(() => auxCheckStatus = AuxCheckStatus.loading);
final isValid =
await ref.read(authProvider.notifier).validateAuxilaryServerUrl(url);
final isValid = await ref.read(authProvider.notifier).validateAuxilaryServerUrl(url);
setState(() {
if (mounted) {
@ -140,8 +139,7 @@ class EndpointInputState extends ConsumerState<EndpointInput> {
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color:
context.isDarkTheme ? Colors.grey[900]! : Colors.grey[300]!,
color: context.isDarkTheme ? Colors.grey[900]! : Colors.grey[300]!,
),
borderRadius: const BorderRadius.all(Radius.circular(16)),
),

View file

@ -23,12 +23,9 @@ class ExternalNetworkPreference extends HookConsumerWidget {
final canSave = useState(false);
saveEndpointList() {
canSave.value =
entries.value.every((e) => e.status == AuxCheckStatus.valid);
canSave.value = entries.value.every((e) => e.status == AuxCheckStatus.valid);
final endpointList = entries.value
.where((url) => url.status == AuxCheckStatus.valid)
.toList();
final endpointList = entries.value.where((url) => url.status == AuxCheckStatus.valid).toList();
final jsonString = jsonEncode(endpointList);
@ -39,8 +36,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
}
updateValidationStatus(String url, int index, AuxCheckStatus status) {
entries.value[index] =
entries.value[index].copyWith(url: url, status: status);
entries.value[index] = entries.value[index].copyWith(url: url, status: status);
saveEndpointList();
}
@ -90,8 +86,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
}
final List<dynamic> jsonList = jsonDecode(jsonString);
entries.value =
jsonList.map((e) => AuxilaryEndpoint.fromJson(e)).toList();
entries.value = jsonList.map((e) => AuxilaryEndpoint.fromJson(e)).toList();
return null;
},
const [],

View file

@ -59,8 +59,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
useEffect(
() {
final wifiName = ref.read(authProvider.notifier).getSavedWifiName();
final localEndpoint =
ref.read(authProvider.notifier).getSavedLocalEndpoint();
final localEndpoint = ref.read(authProvider.notifier).getSavedLocalEndpoint();
if (wifiName != null) {
wifiNameText.value = wifiName;
@ -131,8 +130,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
saveWifiName(wifiName);
}
final serverEndpoint =
ref.read(authProvider.notifier).getServerEndpoint();
final serverEndpoint = ref.read(authProvider.notifier).getServerEndpoint();
if (serverEndpoint != null) {
saveLocalEndpoint(serverEndpoint);
@ -194,10 +192,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
wifiNameText.value,
style: context.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.bold,
color: enabled
? context.primaryColor
: context.colorScheme.onSurface
.withAlpha(100),
color: enabled ? context.primaryColor : context.colorScheme.onSurface.withAlpha(100),
fontFamily: 'Inconsolata',
),
),
@ -217,10 +212,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
localEndpointText.value,
style: context.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.bold,
color: enabled
? context.primaryColor
: context.colorScheme.onSurface
.withAlpha(100),
color: enabled ? context.primaryColor : context.colorScheme.onSurface.withAlpha(100),
fontFamily: 'Inconsolata',
),
),
@ -238,8 +230,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
height: 48,
child: OutlinedButton.icon(
icon: const Icon(Icons.wifi_find_rounded),
label:
Text('use_current_connection'.tr().toUpperCase()),
label: Text('use_current_connection'.tr().toUpperCase()),
onPressed: enabled ? autofillCurrentNetwork : null,
),
),

View file

@ -18,8 +18,7 @@ class NetworkingSettings extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final currentEndpoint = getServerUrl();
final featureEnabled =
useAppSettingsState(AppSettingsEnum.autoEndpointSwitching);
final featureEnabled = useAppSettingsState(AppSettingsEnum.autoEndpointSwitching);
Future<void> checkWifiReadPermission() async {
final [hasLocationInUse, hasLocationAlways] = await Future.wait([
@ -39,9 +38,7 @@ class NetworkingSettings extends HookConsumerWidget {
actions: [
TextButton(
onPressed: () async {
final isGrant = await ref
.read(networkProvider.notifier)
.requestWifiReadPermission();
final isGrant = await ref.read(networkProvider.notifier).requestWifiReadPermission();
Navigator.pop(context, isGrant);
},
@ -63,9 +60,7 @@ class NetworkingSettings extends HookConsumerWidget {
actions: [
TextButton(
onPressed: () async {
final isGrant = await ref
.read(networkProvider.notifier)
.requestWifiReadBackgroundPermission();
final isGrant = await ref.read(networkProvider.notifier).requestWifiReadBackgroundPermission();
Navigator.pop(context, isGrant);
},
@ -77,8 +72,7 @@ class NetworkingSettings extends HookConsumerWidget {
);
}
if (isGrantLocationAlwaysPermission != null &&
!isGrantLocationAlwaysPermission) {
if (isGrantLocationAlwaysPermission != null && !isGrantLocationAlwaysPermission) {
await ref.read(networkProvider.notifier).openSettings();
}
}
@ -101,9 +95,7 @@ class NetworkingSettings extends HookConsumerWidget {
padding: const EdgeInsets.only(top: 8, left: 16, bottom: 8),
child: NetworkPreferenceTitle(
title: "current_server_address".tr().toUpperCase(),
icon: (currentEndpoint?.startsWith('https') ?? false)
? Icons.https_outlined
: Icons.http_outlined,
icon: (currentEndpoint?.startsWith('https') ?? false) ? Icons.https_outlined : Icons.http_outlined,
),
),
Padding(

View file

@ -20,12 +20,9 @@ class NotificationSetting extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final permissionService = ref.watch(notificationPermissionProvider);
final sliderValue =
useAppSettingsState(AppSettingsEnum.uploadErrorNotificationGracePeriod);
final totalProgressValue =
useAppSettingsState(AppSettingsEnum.backgroundBackupTotalProgress);
final singleProgressValue =
useAppSettingsState(AppSettingsEnum.backgroundBackupSingleProgress);
final sliderValue = useAppSettingsState(AppSettingsEnum.uploadErrorNotificationGracePeriod);
final totalProgressValue = useAppSettingsState(AppSettingsEnum.backgroundBackupTotalProgress);
final singleProgressValue = useAppSettingsState(AppSettingsEnum.backgroundBackupSingleProgress);
final hasPermission = permissionService == PermissionStatus.granted;
@ -55,8 +52,7 @@ class NotificationSetting extends HookConsumerWidget {
);
}
final String formattedValue =
_formatSliderValue(sliderValue.value.toDouble());
final String formattedValue = _formatSliderValue(sliderValue.value.toDouble());
final notificationSettings = [
if (!hasPermission)
@ -65,10 +61,8 @@ class NotificationSetting extends HookConsumerWidget {
title: 'notification_permission_list_tile_title'.tr(),
subtileText: 'notification_permission_list_tile_content'.tr(),
buttonText: 'notification_permission_list_tile_enable_button'.tr(),
onButtonTap: () => ref
.watch(notificationPermissionProvider.notifier)
.requestNotificationPermission()
.then((permission) {
onButtonTap: () =>
ref.watch(notificationPermissionProvider.notifier).requestNotificationPermission().then((permission) {
if (permission == PermissionStatus.permanentlyDenied) {
showPermissionsDialog();
}
@ -89,8 +83,7 @@ class NotificationSetting extends HookConsumerWidget {
SettingsSliderListTile(
enabled: hasPermission,
valueNotifier: sliderValue,
text: 'setting_notifications_notify_failures_grace_period'
.tr(namedArgs: {'duration': formattedValue}),
text: 'setting_notifications_notify_failures_grace_period'.tr(namedArgs: {'duration': formattedValue}),
maxValue: 5.0,
noDivisons: 5,
label: formattedValue,
@ -105,8 +98,7 @@ String _formatSliderValue(double v) {
if (v == 0.0) {
return 'setting_notifications_notify_immediately'.tr();
} else if (v == 1.0) {
return 'setting_notifications_notify_minutes'
.tr(namedArgs: {'count': '30'});
return 'setting_notifications_notify_minutes'.tr(namedArgs: {'count': '30'});
} else if (v == 2.0) {
return 'setting_notifications_notify_hours'.tr(namedArgs: {'count': '2'});
} else if (v == 3.0) {

View file

@ -14,10 +14,8 @@ class HapticSetting extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final hapticFeedbackSetting =
useAppSettingsState(AppSettingsEnum.enableHapticFeedback);
final isHapticFeedbackEnabled =
useValueNotifier(hapticFeedbackSetting.value);
final hapticFeedbackSetting = useAppSettingsState(AppSettingsEnum.enableHapticFeedback);
final isHapticFeedbackEnabled = useValueNotifier(hapticFeedbackSetting.value);
onHapticFeedbackChange(bool isEnabled) {
hapticFeedbackSetting.value = isEnabled;

View file

@ -20,18 +20,15 @@ class PrimaryColorSetting extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final themeProvider = ref.read(immichThemeProvider);
final primaryColorSetting =
useAppSettingsState(AppSettingsEnum.primaryColor);
final systemPrimaryColorSetting =
useAppSettingsState(AppSettingsEnum.dynamicTheme);
final primaryColorSetting = useAppSettingsState(AppSettingsEnum.primaryColor);
final systemPrimaryColorSetting = useAppSettingsState(AppSettingsEnum.dynamicTheme);
final currentPreset = useValueNotifier(ref.read(immichThemePresetProvider));
const tileSize = 55.0;
useValueChanged(
primaryColorSetting.value,
(_, __) => currentPreset.value = ImmichColorPreset.values
.firstWhere((e) => e.name == primaryColorSetting.value),
(_, __) => currentPreset.value = ImmichColorPreset.values.firstWhere((e) => e.name == primaryColorSetting.value),
);
void popBottomSheet() {
@ -131,8 +128,7 @@ class PrimaryColorSetting extends HookConsumerWidget {
padding: const EdgeInsets.symmetric(horizontal: 20),
margin: const EdgeInsets.only(top: 10),
child: SwitchListTile.adaptive(
contentPadding:
const EdgeInsets.symmetric(vertical: 6, horizontal: 20),
contentPadding: const EdgeInsets.symmetric(vertical: 6, horizontal: 20),
dense: true,
activeColor: context.primaryColor,
tileColor: context.colorScheme.surfaceContainerHigh,
@ -164,8 +160,7 @@ class PrimaryColorSetting extends HookConsumerWidget {
topColor: theme.light.primary,
bottomColor: theme.dark.primary,
tileSize: tileSize,
showSelector: currentPreset.value == preset &&
!systemPrimaryColorSetting.value,
showSelector: currentPreset.value == preset && !systemPrimaryColorSetting.value,
),
);
}).toList(),
@ -201,8 +196,7 @@ class PrimaryColorSetting extends HookConsumerWidget {
),
Text(
"theme_setting_primary_color_subtitle".tr(),
style: context.textTheme.bodyMedium
?.copyWith(color: context.colorScheme.onSurfaceSecondary),
style: context.textTheme.bodyMedium?.copyWith(color: context.colorScheme.onSurfaceSecondary),
),
],
),

View file

@ -20,13 +20,10 @@ class ThemeSetting extends HookConsumerWidget {
final currentThemeString = useAppSettingsState(AppSettingsEnum.themeMode);
final currentTheme = useValueNotifier(ref.read(immichThemeModeProvider));
final isDarkTheme = useValueNotifier(currentTheme.value == ThemeMode.dark);
final isSystemTheme =
useValueNotifier(currentTheme.value == ThemeMode.system);
final isSystemTheme = useValueNotifier(currentTheme.value == ThemeMode.system);
final applyThemeToBackgroundSetting =
useAppSettingsState(AppSettingsEnum.colorfulInterface);
final applyThemeToBackgroundProvider =
useValueNotifier(ref.read(colorfulInterfaceSettingProvider));
final applyThemeToBackgroundSetting = useAppSettingsState(AppSettingsEnum.colorfulInterface);
final applyThemeToBackgroundProvider = useValueNotifier(ref.read(colorfulInterfaceSettingProvider));
useValueChanged(
currentThemeString.value,
@ -39,8 +36,7 @@ class ThemeSetting extends HookConsumerWidget {
useValueChanged(
applyThemeToBackgroundSetting.value,
(_, __) => applyThemeToBackgroundProvider.value =
applyThemeToBackgroundSetting.value,
(_, __) => applyThemeToBackgroundProvider.value = applyThemeToBackgroundSetting.value,
);
void onThemeChange(bool isDark) {
@ -74,8 +70,7 @@ class ThemeSetting extends HookConsumerWidget {
void onSurfaceColorSettingChange(bool useColorfulInterface) {
applyThemeToBackgroundSetting.value = useColorfulInterface;
ref.watch(colorfulInterfaceSettingProvider.notifier).state =
useColorfulInterface;
ref.watch(colorfulInterfaceSettingProvider.notifier).state = useColorfulInterface;
}
return Column(

View file

@ -50,8 +50,7 @@ class SettingsButtonListTile extends StatelessWidget {
),
if (subtitle != null) subtitle!,
const SizedBox(height: 6),
child ??
ElevatedButton(onPressed: onButtonTap, child: Text(buttonText)),
child ?? ElevatedButton(onPressed: onButtonTap, child: Text(buttonText)),
],
),
);

View file

@ -37,9 +37,7 @@ class SettingsCard extends StatelessWidget {
leading: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(16)),
color: context.isDarkTheme
? Colors.black26
: Colors.white.withAlpha(100),
color: context.isDarkTheme ? Colors.black26 : Colors.white.withAlpha(100),
),
padding: const EdgeInsets.all(16.0),
child: Icon(icon, color: context.primaryColor),

View file

@ -40,8 +40,7 @@ class SettingsSwitchListTile extends StatelessWidget {
selectedTileColor: enabled ? null : context.themeData.disabledColor,
value: valueNotifier.value,
onChanged: onSwitchChanged,
activeColor:
enabled ? context.primaryColor : context.themeData.disabledColor,
activeColor: enabled ? context.primaryColor : context.themeData.disabledColor,
dense: true,
secondary: icon != null
? Icon(
@ -63,9 +62,7 @@ class SettingsSwitchListTile extends StatelessWidget {
subtitle!,
style: subtitleStyle ??
context.textTheme.bodyMedium?.copyWith(
color: enabled
? context.colorScheme.onSurfaceSecondary
: context.themeData.disabledColor,
color: enabled ? context.colorScheme.onSurfaceSecondary : context.themeData.disabledColor,
),
)
: null,

View file

@ -20,8 +20,7 @@ class SslClientCertSettings extends StatefulWidget {
}
class _SslClientCertSettingsState extends State<SslClientCertSettings> {
_SslClientCertSettingsState()
: isCertExist = SSLClientCertStoreVal.load() != null;
_SslClientCertSettingsState() : isCertExist = SSLClientCertStoreVal.load() != null;
bool isCertExist;
@ -62,9 +61,7 @@ class _SslClientCertSettingsState extends State<SslClientCertSettings> {
width: 15,
),
ElevatedButton(
onPressed: widget.isLoggedIn || !isCertExist
? null
: () => removeCert(context),
onPressed: widget.isLoggedIn || !isCertExist ? null : () => removeCert(context),
child: Text("remove".tr()),
),
],
@ -127,8 +124,7 @@ class _SslClientCertSettingsState extends State<SslClientCertSettings> {
),
actions: [
TextButton(
onPressed: () =>
{ctx.pop(), storeCert(context, data, password.text)},
onPressed: () => {ctx.pop(), storeCert(context, data, password.text)},
child: Text("client_cert_dialog_msg_confirm".tr()),
),
],