mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
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:
parent
9b3718120b
commit
e52b9d15b5
643 changed files with 32561 additions and 35292 deletions
|
|
@ -97,10 +97,7 @@ class EndpointInputState extends ConsumerState<EndpointInput> {
|
|||
color: Colors.red,
|
||||
alignment: Alignment.centerRight,
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: const Icon(
|
||||
Icons.delete,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: const Icon(Icons.delete, color: Colors.white),
|
||||
),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
|
|
@ -120,27 +117,19 @@ class EndpointInputState extends ConsumerState<EndpointInput> {
|
|||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: validateUrl,
|
||||
keyboardType: TextInputType.url,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Inconsolata',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
style: const TextStyle(fontFamily: 'Inconsolata', fontWeight: FontWeight.w600, fontSize: 14),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'http(s)://immich.domain.com',
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
filled: true,
|
||||
fillColor: context.colorScheme.surfaceContainer,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
),
|
||||
border: const OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red[300]!),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: context.isDarkTheme ? Colors.grey[900]! : Colors.grey[300]!,
|
||||
),
|
||||
borderSide: BorderSide(color: context.isDarkTheme ? Colors.grey[900]! : Colors.grey[300]!),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final entries = useState(
|
||||
[const AuxilaryEndpoint(url: '', status: AuxCheckStatus.unknown)],
|
||||
);
|
||||
final entries = useState([const AuxilaryEndpoint(url: '', status: AuxCheckStatus.unknown)]);
|
||||
final canSave = useState(false);
|
||||
|
||||
saveEndpointList() {
|
||||
|
|
@ -29,10 +27,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
|
||||
final jsonString = jsonEncode(endpointList);
|
||||
|
||||
Store.put(
|
||||
StoreKey.externalEndpointList,
|
||||
jsonString,
|
||||
);
|
||||
Store.put(StoreKey.externalEndpointList, jsonString);
|
||||
}
|
||||
|
||||
updateValidationStatus(String url, int index, AuxCheckStatus status) {
|
||||
|
|
@ -59,11 +54,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
saveEndpointList();
|
||||
}
|
||||
|
||||
Widget proxyDecorator(
|
||||
Widget child,
|
||||
int index,
|
||||
Animation<double> animation,
|
||||
) {
|
||||
Widget proxyDecorator(Widget child, int index, Animation<double> animation) {
|
||||
return AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
|
|
@ -77,20 +68,17 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
);
|
||||
}
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
final jsonString = Store.tryGet(StoreKey.externalEndpointList);
|
||||
useEffect(() {
|
||||
final jsonString = Store.tryGet(StoreKey.externalEndpointList);
|
||||
|
||||
if (jsonString == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<dynamic> jsonList = jsonDecode(jsonString);
|
||||
entries.value = jsonList.map((e) => AuxilaryEndpoint.fromJson(e)).toList();
|
||||
if (jsonString == null) {
|
||||
return null;
|
||||
},
|
||||
const [],
|
||||
);
|
||||
}
|
||||
|
||||
final List<dynamic> jsonList = jsonDecode(jsonString);
|
||||
entries.value = jsonList.map((e) => AuxilaryEndpoint.fromJson(e)).toList();
|
||||
return null;
|
||||
}, const []);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
|
|
@ -99,21 +87,14 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
color: context.colorScheme.surfaceContainerLow,
|
||||
border: Border.all(
|
||||
color: context.colorScheme.surfaceContainerHighest,
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(color: context.colorScheme.surfaceContainerHighest, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: -36,
|
||||
right: -36,
|
||||
child: Icon(
|
||||
Icons.dns_rounded,
|
||||
size: 120,
|
||||
color: context.primaryColor.withValues(alpha: 0.05),
|
||||
),
|
||||
child: Icon(Icons.dns_rounded, size: 120, color: context.primaryColor.withValues(alpha: 0.05)),
|
||||
),
|
||||
ListView(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
|
|
@ -121,14 +102,8 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
shrinkWrap: true,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4.0,
|
||||
horizontal: 24,
|
||||
),
|
||||
child: Text(
|
||||
"external_network_sheet_info".tr(),
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 24),
|
||||
child: Text("external_network_sheet_info".tr(), style: context.textTheme.bodyMedium),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Divider(color: context.colorScheme.surfaceContainerHighest),
|
||||
|
|
@ -165,10 +140,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
|
|||
? () {
|
||||
entries.value = [
|
||||
...entries.value,
|
||||
const AuxilaryEndpoint(
|
||||
url: '',
|
||||
status: AuxCheckStatus.unknown,
|
||||
),
|
||||
const AuxilaryEndpoint(url: '', status: AuxCheckStatus.unknown),
|
||||
];
|
||||
}
|
||||
: null,
|
||||
|
|
|
|||
|
|
@ -7,19 +7,11 @@ import 'package:immich_mobile/providers/auth.provider.dart';
|
|||
import 'package:immich_mobile/providers/network.provider.dart';
|
||||
|
||||
class LocalNetworkPreference extends HookConsumerWidget {
|
||||
const LocalNetworkPreference({
|
||||
super.key,
|
||||
required this.enabled,
|
||||
});
|
||||
const LocalNetworkPreference({super.key, required this.enabled});
|
||||
|
||||
final bool enabled;
|
||||
|
||||
Future<String?> _showEditDialog(
|
||||
BuildContext context,
|
||||
String title,
|
||||
String hintText,
|
||||
String initialValue,
|
||||
) {
|
||||
Future<String?> _showEditDialog(BuildContext context, String title, String hintText, String initialValue) {
|
||||
final controller = TextEditingController(text: initialValue);
|
||||
|
||||
return showDialog<String>(
|
||||
|
|
@ -29,23 +21,14 @@ class LocalNetworkPreference extends HookConsumerWidget {
|
|||
content: TextField(
|
||||
controller: controller,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
hintText: hintText,
|
||||
),
|
||||
decoration: InputDecoration(border: const OutlineInputBorder(), hintText: hintText),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(
|
||||
'cancel'.tr().toUpperCase(),
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, controller.text),
|
||||
child: Text('save'.tr().toUpperCase()),
|
||||
child: Text('cancel'.tr().toUpperCase(), style: const TextStyle(color: Colors.red)),
|
||||
),
|
||||
TextButton(onPressed: () => Navigator.pop(context, controller.text), child: Text('save'.tr().toUpperCase())),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -56,23 +39,20 @@ class LocalNetworkPreference extends HookConsumerWidget {
|
|||
final wifiNameText = useState("");
|
||||
final localEndpointText = useState("");
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
final wifiName = ref.read(authProvider.notifier).getSavedWifiName();
|
||||
final localEndpoint = ref.read(authProvider.notifier).getSavedLocalEndpoint();
|
||||
useEffect(() {
|
||||
final wifiName = ref.read(authProvider.notifier).getSavedWifiName();
|
||||
final localEndpoint = ref.read(authProvider.notifier).getSavedLocalEndpoint();
|
||||
|
||||
if (wifiName != null) {
|
||||
wifiNameText.value = wifiName;
|
||||
}
|
||||
if (wifiName != null) {
|
||||
wifiNameText.value = wifiName;
|
||||
}
|
||||
|
||||
if (localEndpoint != null) {
|
||||
localEndpointText.value = localEndpoint;
|
||||
}
|
||||
if (localEndpoint != null) {
|
||||
localEndpointText.value = localEndpoint;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
[],
|
||||
);
|
||||
return null;
|
||||
}, []);
|
||||
|
||||
saveWifiName(String wifiName) {
|
||||
wifiNameText.value = wifiName;
|
||||
|
|
@ -85,12 +65,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
|
|||
}
|
||||
|
||||
handleEditWifiName() async {
|
||||
final wifiName = await _showEditDialog(
|
||||
context,
|
||||
"wifi_name".tr(),
|
||||
"your_wifi_name".tr(),
|
||||
wifiNameText.value,
|
||||
);
|
||||
final wifiName = await _showEditDialog(context, "wifi_name".tr(), "your_wifi_name".tr(), wifiNameText.value);
|
||||
|
||||
if (wifiName != null) {
|
||||
await saveWifiName(wifiName);
|
||||
|
|
@ -146,21 +121,14 @@ class LocalNetworkPreference extends HookConsumerWidget {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
color: context.colorScheme.surfaceContainerLow,
|
||||
border: Border.all(
|
||||
color: context.colorScheme.surfaceContainerHighest,
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(color: context.colorScheme.surfaceContainerHighest, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: -36,
|
||||
right: -36,
|
||||
child: Icon(
|
||||
Icons.home_outlined,
|
||||
size: 120,
|
||||
color: context.primaryColor.withValues(alpha: 0.05),
|
||||
),
|
||||
child: Icon(Icons.home_outlined, size: 120, color: context.primaryColor.withValues(alpha: 0.05)),
|
||||
),
|
||||
ListView(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
|
|
@ -168,19 +136,11 @@ class LocalNetworkPreference extends HookConsumerWidget {
|
|||
shrinkWrap: true,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4.0,
|
||||
horizontal: 24,
|
||||
),
|
||||
child: Text(
|
||||
"local_network_sheet_info".tr(),
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 24),
|
||||
child: Text("local_network_sheet_info".tr(), style: context.textTheme.bodyMedium),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Divider(
|
||||
color: context.colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
Divider(color: context.colorScheme.surfaceContainerHighest),
|
||||
ListTile(
|
||||
enabled: enabled,
|
||||
contentPadding: const EdgeInsets.only(left: 24, right: 8),
|
||||
|
|
@ -223,9 +183,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
|
|||
),
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 24.0,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: SizedBox(
|
||||
height: 48,
|
||||
child: OutlinedButton.icon(
|
||||
|
|
|
|||
|
|
@ -77,15 +77,12 @@ class NetworkingSettings extends HookConsumerWidget {
|
|||
}
|
||||
}
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
if (featureEnabled.value == true) {
|
||||
checkWifiReadPermission();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
[featureEnabled.value],
|
||||
);
|
||||
useEffect(() {
|
||||
if (featureEnabled.value == true) {
|
||||
checkWifiReadPermission();
|
||||
}
|
||||
return null;
|
||||
}, [featureEnabled.value]);
|
||||
|
||||
return ListView(
|
||||
padding: const EdgeInsets.only(bottom: 96),
|
||||
|
|
@ -104,20 +101,12 @@ class NetworkingSettings extends HookConsumerWidget {
|
|||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
side: BorderSide(
|
||||
color: context.colorScheme.surfaceContainerHighest,
|
||||
width: 1,
|
||||
),
|
||||
side: BorderSide(color: context.colorScheme.surfaceContainerHighest, width: 1),
|
||||
),
|
||||
child: ListTile(
|
||||
leading: currentEndpoint != null
|
||||
? const Icon(
|
||||
Icons.check_circle_rounded,
|
||||
color: Colors.green,
|
||||
)
|
||||
: const Icon(
|
||||
Icons.circle_outlined,
|
||||
),
|
||||
? const Icon(Icons.check_circle_rounded, color: Colors.green)
|
||||
: const Icon(Icons.circle_outlined),
|
||||
title: Text(
|
||||
currentEndpoint ?? "--",
|
||||
style: TextStyle(
|
||||
|
|
@ -132,9 +121,7 @@ class NetworkingSettings extends HookConsumerWidget {
|
|||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Divider(
|
||||
color: context.colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
child: Divider(color: context.colorScheme.surfaceContainerHighest),
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
enabled: true,
|
||||
|
|
@ -144,35 +131,21 @@ class NetworkingSettings extends HookConsumerWidget {
|
|||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8, left: 16, bottom: 16),
|
||||
child: NetworkPreferenceTitle(
|
||||
title: "local_network".tr().toUpperCase(),
|
||||
icon: Icons.home_outlined,
|
||||
),
|
||||
),
|
||||
LocalNetworkPreference(
|
||||
enabled: featureEnabled.value,
|
||||
child: NetworkPreferenceTitle(title: "local_network".tr().toUpperCase(), icon: Icons.home_outlined),
|
||||
),
|
||||
LocalNetworkPreference(enabled: featureEnabled.value),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 32, left: 16, bottom: 16),
|
||||
child: NetworkPreferenceTitle(
|
||||
title: "external_network".tr().toUpperCase(),
|
||||
icon: Icons.dns_outlined,
|
||||
),
|
||||
),
|
||||
ExternalNetworkPreference(
|
||||
enabled: featureEnabled.value,
|
||||
child: NetworkPreferenceTitle(title: "external_network".tr().toUpperCase(), icon: Icons.dns_outlined),
|
||||
),
|
||||
ExternalNetworkPreference(enabled: featureEnabled.value),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NetworkPreferenceTitle extends StatelessWidget {
|
||||
const NetworkPreferenceTitle({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.title,
|
||||
});
|
||||
const NetworkPreferenceTitle({super.key, required this.icon, required this.title});
|
||||
|
||||
final IconData icon;
|
||||
final String title;
|
||||
|
|
@ -181,10 +154,7 @@ class NetworkPreferenceTitle extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: context.colorScheme.onSurface.withAlpha(150),
|
||||
),
|
||||
Icon(icon, color: context.colorScheme.onSurface.withAlpha(150)),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
title,
|
||||
|
|
@ -199,58 +169,37 @@ class NetworkPreferenceTitle extends StatelessWidget {
|
|||
}
|
||||
|
||||
class NetworkStatusIcon extends StatelessWidget {
|
||||
const NetworkStatusIcon({
|
||||
super.key,
|
||||
required this.status,
|
||||
this.enabled = true,
|
||||
}) : super();
|
||||
const NetworkStatusIcon({super.key, required this.status, this.enabled = true}) : super();
|
||||
|
||||
final AuxCheckStatus status;
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: _buildIcon(context),
|
||||
);
|
||||
return AnimatedSwitcher(duration: const Duration(milliseconds: 200), child: _buildIcon(context));
|
||||
}
|
||||
|
||||
Widget _buildIcon(BuildContext context) => switch (status) {
|
||||
AuxCheckStatus.loading => Padding(
|
||||
padding: const EdgeInsets.only(left: 4.0),
|
||||
child: SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(
|
||||
color: context.primaryColor,
|
||||
strokeWidth: 2,
|
||||
key: const ValueKey('loading'),
|
||||
),
|
||||
AuxCheckStatus.loading => Padding(
|
||||
padding: const EdgeInsets.only(left: 4.0),
|
||||
child: SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(color: context.primaryColor, strokeWidth: 2, key: const ValueKey('loading')),
|
||||
),
|
||||
),
|
||||
AuxCheckStatus.valid =>
|
||||
enabled
|
||||
? const Icon(Icons.check_circle_rounded, color: Colors.green, key: ValueKey('success'))
|
||||
: Icon(
|
||||
Icons.check_circle_rounded,
|
||||
color: context.colorScheme.onSurface.withAlpha(100),
|
||||
key: const ValueKey('success'),
|
||||
),
|
||||
),
|
||||
AuxCheckStatus.valid => enabled
|
||||
? const Icon(
|
||||
Icons.check_circle_rounded,
|
||||
color: Colors.green,
|
||||
key: ValueKey('success'),
|
||||
)
|
||||
: Icon(
|
||||
Icons.check_circle_rounded,
|
||||
color: context.colorScheme.onSurface.withAlpha(100),
|
||||
key: const ValueKey('success'),
|
||||
),
|
||||
AuxCheckStatus.error => enabled
|
||||
? const Icon(
|
||||
Icons.error_rounded,
|
||||
color: Colors.red,
|
||||
key: ValueKey('error'),
|
||||
)
|
||||
: const Icon(
|
||||
Icons.error_rounded,
|
||||
color: Colors.grey,
|
||||
key: ValueKey('error'),
|
||||
),
|
||||
_ => const Icon(Icons.circle_outlined, key: ValueKey('unknown')),
|
||||
};
|
||||
AuxCheckStatus.error =>
|
||||
enabled
|
||||
? const Icon(Icons.error_rounded, color: Colors.red, key: ValueKey('error'))
|
||||
: const Icon(Icons.error_rounded, color: Colors.grey, key: ValueKey('error')),
|
||||
_ => const Icon(Icons.circle_outlined, key: ValueKey('unknown')),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue