chore: bump dart sdk to 3.8 (#20355)

* chore: bump dart sdk to 3.8

* chore: make build

* make pigeon

* chore: format files

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-07-29 00:34:03 +05:30 committed by GitHub
parent 9b3718120b
commit e52b9d15b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
643 changed files with 32561 additions and 35292 deletions

View file

@ -24,12 +24,7 @@ class BackgroundBackupSettings extends ConsumerWidget {
void showErrorToUser(String msg) {
final snackBar = SnackBar(
content: Text(
msg.tr(),
style: context.textTheme.bodyLarge?.copyWith(
color: context.primaryColor,
),
),
content: Text(msg.tr(), style: context.textTheme.bodyLarge?.copyWith(color: context.primaryColor)),
backgroundColor: Colors.red,
);
context.scaffoldMessenger.showSnackBar(snackBar);
@ -41,20 +36,14 @@ class BackgroundBackupSettings extends ConsumerWidget {
barrierDismissible: false,
builder: (BuildContext ctx) {
return AlertDialog(
title: const Text(
'backup_controller_page_background_battery_info_title',
).tr(),
title: const Text('backup_controller_page_background_battery_info_title').tr(),
content: SingleChildScrollView(
child: const Text(
'backup_controller_page_background_battery_info_message',
).tr(),
child: const Text('backup_controller_page_background_battery_info_message').tr(),
),
actions: [
ElevatedButton(
onPressed: () => launchUrl(
Uri.parse('https://dontkillmyapp.com'),
mode: LaunchMode.externalApplication,
),
onPressed: () =>
launchUrl(Uri.parse('https://dontkillmyapp.com'), mode: LaunchMode.externalApplication),
child: const Text(
"backup_controller_page_background_battery_info_link",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
@ -79,7 +68,9 @@ 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(
onButtonTap: () => ref
.read(backupProvider.notifier)
.configureBackgroundBackup(
enabled: true,
onError: showErrorToUser,
onBatteryInfo: showBatteryOptimizationInfoToUser,
@ -90,10 +81,7 @@ class BackgroundBackupSettings extends ConsumerWidget {
return Column(
children: [
if (!Platform.isIOS || iosSettings?.appRefreshEnabled == true)
_BackgroundSettingsEnabled(
onError: showErrorToUser,
onBatteryInfo: showBatteryOptimizationInfoToUser,
),
_BackgroundSettingsEnabled(onError: showErrorToUser, onBatteryInfo: showBatteryOptimizationInfoToUser),
if (Platform.isIOS && iosSettings?.appRefreshEnabled != true) const _IOSBackgroundRefreshDisabled(),
if (Platform.isIOS && iosSettings != null) IosDebugInfoTile(settings: iosSettings),
],
@ -120,10 +108,7 @@ class _BackgroundSettingsEnabled extends HookConsumerWidget {
final void Function(String msg) onError;
final void Function() onBatteryInfo;
const _BackgroundSettingsEnabled({
required this.onError,
required this.onBatteryInfo,
});
const _BackgroundSettingsEnabled({required this.onError, required this.onBatteryInfo});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -131,41 +116,45 @@ class _BackgroundSettingsEnabled extends HookConsumerWidget {
final isWifiRequiredNotifier = useValueNotifier(isWifiRequired);
useValueChanged(
isWifiRequired,
(_, __) => WidgetsBinding.instance.addPostFrameCallback(
(_) => isWifiRequiredNotifier.value = isWifiRequired,
),
(_, __) => WidgetsBinding.instance.addPostFrameCallback((_) => isWifiRequiredNotifier.value = isWifiRequired),
);
final isChargingRequired = ref.watch(backupProvider.select((s) => s.backupRequireCharging));
final isChargingRequiredNotifier = useValueNotifier(isChargingRequired);
useValueChanged(
isChargingRequired,
(_, __) => WidgetsBinding.instance.addPostFrameCallback(
(_) => isChargingRequiredNotifier.value = isChargingRequired,
),
(_, __) =>
WidgetsBinding.instance.addPostFrameCallback((_) => isChargingRequiredNotifier.value = isChargingRequired),
);
int backupDelayToSliderValue(int ms) => switch (ms) {
5000 => 0,
30000 => 1,
120000 => 2,
_ => 3,
};
5000 => 0,
30000 => 1,
120000 => 2,
_ => 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 triggerDelay = useState(backupDelayToSliderValue(backupTriggerDelay));
useValueChanged(
triggerDelay.value,
(_, __) => ref.read(backupProvider.notifier).configureBackgroundBackup(
(_, __) => ref
.read(backupProvider.notifier)
.configureBackgroundBackup(
triggerDelay: backupDelayToMilliseconds(triggerDelay.value),
onError: onError,
onBatteryInfo: onBatteryInfo,
@ -177,40 +166,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(
valueNotifier: triggerDelay,
text: 'backup_controller_page_background_delay'.tr(
namedArgs: {
'duration': formatBackupDelaySliderValue(triggerDelay.value),
},
namedArgs: {'duration': formatBackupDelaySliderValue(triggerDelay.value)},
),
maxValue: 3.0,
noDivisons: 3,

View file

@ -15,9 +15,7 @@ import 'package:immich_mobile/widgets/settings/settings_switch_list_tile.dart';
import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
class BackupSettings extends HookConsumerWidget {
const BackupSettings({
super.key,
});
const BackupSettings({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -71,22 +69,14 @@ class BackupSettings extends HookConsumerWidget {
SettingsButtonListTile(
icon: Icons.photo_album_outlined,
title: 'sync_albums'.tr(),
subtitle: Text(
"sync_albums_manual_subtitle".tr(),
),
subtitle: Text("sync_albums_manual_subtitle".tr()),
buttonText: 'sync_albums'.tr(),
child: isAlbumSyncInProgress.value
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: syncAlbums,
child: Text('sync'.tr()),
),
: ElevatedButton(onPressed: syncAlbums, child: Text('sync'.tr())),
),
];
return SettingsSubPageScaffold(
settings: backupSettings,
showDivider: true,
);
return SettingsSubPageScaffold(settings: backupSettings, showDivider: true);
}
}