From 861be9954605dda0d2570fc886e953a867787256 Mon Sep 17 00:00:00 2001 From: wanghongenpin Date: Mon, 26 Jan 2026 18:21:03 +0800 Subject: [PATCH] flutter-3.19.6 --- lib/ui/content/headers.dart | 2 +- lib/ui/desktop/desktop.dart | 4 ++-- lib/ui/desktop/setting/request_crypto.dart | 22 ++++++++++----------- lib/ui/desktop/setting/request_rewrite.dart | 2 -- lib/ui/desktop/setting/script.dart | 2 +- lib/ui/mobile/menu/bottom_navigation.dart | 2 +- lib/ui/mobile/setting/request_crypto.dart | 14 ++++++------- lib/ui/mobile/setting/request_rewrite.dart | 2 -- lib/ui/mobile/setting/script.dart | 12 +++++------ lib/ui/mobile/widgets/about.dart | 4 ++-- 10 files changed, 31 insertions(+), 35 deletions(-) diff --git a/lib/ui/content/headers.dart b/lib/ui/content/headers.dart index 239437f..8572c72 100644 --- a/lib/ui/content/headers.dart +++ b/lib/ui/content/headers.dart @@ -132,7 +132,7 @@ class _HeadersWidgetState extends State { return [ CodeTheme( data: CodeThemeData( - styles: Theme.brightnessOf(context) == Brightness.light ? atomOneLightTheme : atomOneDarkTheme), + styles: Theme.of(context).brightness == Brightness.light ? atomOneLightTheme : atomOneDarkTheme), child: CodeField( background: Colors.transparent, readOnly: Platforms.isMobile(), diff --git a/lib/ui/desktop/desktop.dart b/lib/ui/desktop/desktop.dart index bfa4f40..1ab579e 100644 --- a/lib/ui/desktop/desktop.dart +++ b/lib/ui/desktop/desktop.dart @@ -47,7 +47,7 @@ class DesktopHomePage extends StatefulWidget { final Configuration configuration; final AppConfiguration appConfiguration; - const DesktopHomePage(this.configuration, this.appConfiguration, {super.key, required}); + const DesktopHomePage(this.configuration, this.appConfiguration, {super.key}); @override State createState() => _DesktopHomePagePageState(); @@ -120,7 +120,7 @@ class _DesktopHomePagePageState extends State implements EventL // color: Theme.of(context).brightness == Brightness.dark ? null : Color(0xFFF9F9F9), border: Border( bottom: BorderSide( - color: Theme.of(context).dividerColor.withValues(alpha: 0.3), + color: Theme.of(context).dividerColor.withOpacity(0.3), width: Platform.isMacOS ? 0.2 : 0.55))), child: Platform.isMacOS ? Toolbar(proxyServer, requestListStateKey) diff --git a/lib/ui/desktop/setting/request_crypto.dart b/lib/ui/desktop/setting/request_crypto.dart index fa21a11..1cf85f2 100644 --- a/lib/ui/desktop/setting/request_crypto.dart +++ b/lib/ui/desktop/setting/request_crypto.dart @@ -215,7 +215,7 @@ class _CryptoRuleListState extends State { child: Container( padding: const EdgeInsets.only(top: 10), constraints: const BoxConstraints(minHeight: 200, maxHeight: 600), - decoration: BoxDecoration(border: Border.all(color: Colors.grey.withAlpha((0.2 * 255).round()))), + decoration: BoxDecoration(border: Border.all(color: Colors.grey.withOpacity(0.2))), child: Column( children: [ Padding( @@ -508,10 +508,10 @@ class _CryptoRuleDialogState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withAlpha((0.5 * 255).round()), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( - side: BorderSide(color: Theme.of(context).dividerColor.withAlpha((0.2 * 255).round())), + side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)), borderRadius: BorderRadius.circular(8), ), child: Padding( @@ -544,10 +544,10 @@ class _CryptoRuleDialogState extends State { ), const SizedBox(height: 12), Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withAlpha((0.5 * 255).round()), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( - side: BorderSide(color: Theme.of(context).dividerColor.withAlpha((0.2 * 255).round())), + side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)), borderRadius: BorderRadius.circular(8), ), child: Padding( @@ -562,7 +562,7 @@ class _CryptoRuleDialogState extends State { height: 42, padding: const EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withAlpha((0.12 * 255).round())), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.12)), borderRadius: BorderRadius.circular(6), ), child: DropdownButtonHideUnderline( @@ -584,7 +584,7 @@ class _CryptoRuleDialogState extends State { height: 42, padding: const EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withAlpha((0.12 * 255).round())), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.12)), borderRadius: BorderRadius.circular(6), ), child: DropdownButtonHideUnderline( @@ -606,7 +606,7 @@ class _CryptoRuleDialogState extends State { height: 42, padding: const EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withAlpha((0.12 * 255).round())), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.12)), borderRadius: BorderRadius.circular(6), ), child: DropdownButtonHideUnderline( @@ -631,7 +631,7 @@ class _CryptoRuleDialogState extends State { width: 92, padding: const EdgeInsets.symmetric(horizontal: 6), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withAlpha((0.12 * 255).round())), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.12)), borderRadius: BorderRadius.circular(6), ), child: DropdownButtonHideUnderline( @@ -668,7 +668,7 @@ class _CryptoRuleDialogState extends State { constraints: const BoxConstraints(minWidth: 92), padding: const EdgeInsets.symmetric(horizontal: 6), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withAlpha((0.12 * 255).round())), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.12)), borderRadius: BorderRadius.circular(6), ), child: DropdownButtonHideUnderline( @@ -710,7 +710,7 @@ class _CryptoRuleDialogState extends State { if (ivSource == 'prefix') Container( decoration: BoxDecoration( - border: Border.all(color: theme.dividerColor.withAlpha(0x40)), + border: Border.all(color: theme.dividerColor.withOpacity(0.25)), borderRadius: BorderRadius.circular(4)), child: Row(children: [ IconButton( diff --git a/lib/ui/desktop/setting/request_rewrite.dart b/lib/ui/desktop/setting/request_rewrite.dart index 88f9613..a47bf59 100644 --- a/lib/ui/desktop/setting/request_rewrite.dart +++ b/lib/ui/desktop/setting/request_rewrite.dart @@ -616,8 +616,6 @@ class _RewriteRuleEditState extends State { child: Text(isCN ? e.label : e.name, style: const TextStyle(fontSize: 14)))) .toList(), onChanged: onChangeType, - // older Flutter versions expect `value` instead of `initialValue` - value: ruleType, )), const SizedBox(width: 10), ]), diff --git a/lib/ui/desktop/setting/script.dart b/lib/ui/desktop/setting/script.dart index 3424173..cdf9647 100644 --- a/lib/ui/desktop/setting/script.dart +++ b/lib/ui/desktop/setting/script.dart @@ -583,7 +583,7 @@ class _ScriptEditState extends State { width: 155, height: 34, child: DropdownButtonFormField( - initialValue: _useRemote, + value: _useRemote, items: [ DropdownMenuItem(value: false, child: Text(localizations.local)), DropdownMenuItem(value: true, child: Text(localizations.remoteUrl)), diff --git a/lib/ui/mobile/menu/bottom_navigation.dart b/lib/ui/mobile/menu/bottom_navigation.dart index 57a4c76..76e1e0f 100644 --- a/lib/ui/mobile/menu/bottom_navigation.dart +++ b/lib/ui/mobile/menu/bottom_navigation.dart @@ -149,7 +149,7 @@ class _ConfigPageState extends State { leading: Icon(Icons.lock_outline, color: color), trailing: arrow, onTap: () => navigator(context, const MobileRequestCryptoPage())), - Divider(height: 0, thickness: 0.3, color: Theme.of(context).dividerColor.withValues(alpha: 0.22)), + Divider(height: 0, thickness: 0.3, color: Theme.of(context).dividerColor.withOpacity(0.22)), ListTile( title: Text(localizations.script), leading: Icon(Icons.javascript_outlined, color: color), diff --git a/lib/ui/mobile/setting/request_crypto.dart b/lib/ui/mobile/setting/request_crypto.dart index f65148b..bb19245 100644 --- a/lib/ui/mobile/setting/request_crypto.dart +++ b/lib/ui/mobile/setting/request_crypto.dart @@ -494,10 +494,10 @@ class _MobileCryptoRuleEditPageState extends State { padding: const EdgeInsets.all(12), children: [ Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withAlpha((0.5 * 255).round()), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( - side: BorderSide(color: Theme.of(context).dividerColor.withAlpha((0.2 * 255).round())), + side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)), borderRadius: BorderRadius.circular(8), ), child: Padding( @@ -536,10 +536,10 @@ class _MobileCryptoRuleEditPageState extends State { ), const SizedBox(height: 12), Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withAlpha((0.5 * 255).round()), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( - side: BorderSide(color: Theme.of(context).dividerColor.withAlpha((0.2 * 255).round())), + side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)), borderRadius: BorderRadius.circular(8), ), child: Padding( @@ -667,7 +667,7 @@ class _MobileCryptoRuleEditPageState extends State { height: 40, padding: const EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withValues(alpha: 0.25)), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.25)), borderRadius: BorderRadius.circular(8), ), child: DropdownButtonHideUnderline(child: child), @@ -686,7 +686,7 @@ class _MobileCryptoRuleEditPageState extends State { constraints: const BoxConstraints(minWidth: 95), padding: const EdgeInsets.symmetric(horizontal: 6), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withValues(alpha: 0.25)), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.25)), borderRadius: BorderRadius.circular(6)), child: DropdownButtonHideUnderline( child: DropdownButton( @@ -703,7 +703,7 @@ class _MobileCryptoRuleEditPageState extends State { height: 40, padding: const EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( - border: Border.all(color: Theme.of(context).dividerColor.withValues(alpha: 0.25)), + border: Border.all(color: Theme.of(context).dividerColor.withOpacity(0.25)), borderRadius: BorderRadius.circular(8), ), child: Row( diff --git a/lib/ui/mobile/setting/request_rewrite.dart b/lib/ui/mobile/setting/request_rewrite.dart index 385f1ee..1982b58 100644 --- a/lib/ui/mobile/setting/request_rewrite.dart +++ b/lib/ui/mobile/setting/request_rewrite.dart @@ -574,8 +574,6 @@ class _RewriteRuleState extends State { rule.type = val!; }); }, - // use `value` for compatibility with older SDKs - value: rule.type, )), const SizedBox(width: 10), ]), diff --git a/lib/ui/mobile/setting/script.dart b/lib/ui/mobile/setting/script.dart index f65fb79..a74d388 100644 --- a/lib/ui/mobile/setting/script.dart +++ b/lib/ui/mobile/setting/script.dart @@ -550,7 +550,7 @@ class _ScriptEditState extends State { children: [ // Name section Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withOpacity(0.5), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.4)), @@ -561,7 +561,7 @@ class _ScriptEditState extends State { // URLs section Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withOpacity(0.5), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.4)), @@ -615,7 +615,7 @@ class _ScriptEditState extends State { // Source section Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withOpacity(0.5), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.4)), @@ -626,7 +626,7 @@ class _ScriptEditState extends State { SizedBox(width: 55, child: Text('${localizations.type}:')), Expanded( child: DropdownButtonFormField( - initialValue: _useRemote, + value: _useRemote, items: [ DropdownMenuItem(value: false, child: Text(localizations.local)), DropdownMenuItem(value: true, child: Text(localizations.remoteUrl)), @@ -649,7 +649,7 @@ class _ScriptEditState extends State { // Remote URL section if (_useRemote) Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withOpacity(0.5), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.4)), @@ -702,7 +702,7 @@ class _ScriptEditState extends State { // Script section Card( - color: Theme.of(context).colorScheme.surfaceContainerLow.withOpacity(0.5), + color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), elevation: 0, shape: RoundedRectangleBorder( side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.4)), diff --git a/lib/ui/mobile/widgets/about.dart b/lib/ui/mobile/widgets/about.dart index 60876a0..d2dbf81 100644 --- a/lib/ui/mobile/widgets/about.dart +++ b/lib/ui/mobile/widgets/about.dart @@ -94,7 +94,7 @@ class _AboutState extends State { final url = "$gitHub/releases"; _safeLaunch(Uri.parse(url)); }), - Divider(height: 0, thickness: 0.4, color: Theme.of(context).dividerColor.withValues(alpha: 0.22)), + Divider(height: 0, thickness: 0.4, color: Theme.of(context).dividerColor.withOpacity(0.22)), ListTile( title: Text(localizations.privacyPolicy), trailing: const Icon(Icons.privacy_tip_outlined, size: 22), @@ -113,7 +113,7 @@ class _AboutState extends State { ), ); }), - Divider(height: 0, thickness: 0.4, color: Theme.of(context).dividerColor.withValues(alpha: 0.22)), + Divider(height: 0, thickness: 0.4, color: Theme.of(context).dividerColor.withOpacity(0.22)), // Sponsor / Donate entry ListTile( title: Text(localizations.sponsorDonate),