From d2e2555a2159f0a83a0e1e1a07e2cfa6af5dd119 Mon Sep 17 00:00:00 2001 From: mylxsw Date: Wed, 10 Jul 2024 00:17:32 +0800 Subject: [PATCH 1/5] remove unused packages --- lib/page/component/chat/markdown.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/page/component/chat/markdown.dart b/lib/page/component/chat/markdown.dart index 73d0272b..822cf0b6 100644 --- a/lib/page/component/chat/markdown.dart +++ b/lib/page/component/chat/markdown.dart @@ -10,7 +10,6 @@ import 'package:clipboard/clipboard.dart'; import 'package:flutter/material.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_highlight/themes/default.dart'; -import 'package:flutter_highlight/themes/monokai.dart'; import 'package:flutter_markdown/flutter_markdown.dart' as md; import 'package:markdown/markdown.dart' as mm; import 'package:markdown_widget/config/all.dart'; From 867116d4c5b8bcfd6c030de0a411bf78f9eb0b80 Mon Sep 17 00:00:00 2001 From: mylxsw Date: Fri, 12 Jul 2024 14:08:12 +0800 Subject: [PATCH 2/5] Optimize Markdown code block display --- lib/page/component/chat/markdown.dart | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/page/component/chat/markdown.dart b/lib/page/component/chat/markdown.dart index 822cf0b6..911dcca6 100644 --- a/lib/page/component/chat/markdown.dart +++ b/lib/page/component/chat/markdown.dart @@ -143,7 +143,7 @@ class MarkdownPlus extends StatelessWidget { ), margin: const EdgeInsets.symmetric(vertical: 0.0), padding: - const EdgeInsets.only(top: 30, left: 10, right: 10, bottom: 10), + const EdgeInsets.only(top: 35, left: 10, right: 10, bottom: 10), textStyle: const TextStyle(fontSize: 14), wrapper: (child, code, language) { return Stack( @@ -154,10 +154,22 @@ class MarkdownPlus extends StatelessWidget { top: 0, child: IconButton( tooltip: '复制代码', - icon: Icon( - Icons.copy, - size: 12, - color: customColors.weakLinkColor, + icon: Row( + children: [ + Icon( + Icons.copy, + size: 12, + color: customColors.weakLinkColor, + ), + const SizedBox(width: 5), + Text( + 'Copy', + style: TextStyle( + fontSize: 12, + color: customColors.weakLinkColor, + ), + ), + ], ), onPressed: () { FlutterClipboard.copy(code).then((value) { From fdd2d23c922f90548b6719d64bcb75d4e57823ca Mon Sep 17 00:00:00 2001 From: mylxsw Date: Sun, 28 Jul 2024 00:18:12 +0800 Subject: [PATCH 3/5] bugfix The Stop Output button is not centered when the web page is in full screen --- lib/page/chat/home_chat.dart | 9 ++++++++- lib/page/chat/room_chat.dart | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/page/chat/home_chat.dart b/lib/page/chat/home_chat.dart index 9dd503d6..7ac43129 100644 --- a/lib/page/chat/home_chat.dart +++ b/lib/page/chat/home_chat.dart @@ -408,7 +408,7 @@ class _HomeChatPageState extends State { if (!enableInput.value) Positioned( bottom: 10, - width: MediaQuery.of(context).size.width, + width: maxWindowWidth(context), child: Center( child: StopButton( label: '停止输出', @@ -718,4 +718,11 @@ class _HomeChatPageState extends State { return const LocalAvatar(assetName: 'assets/app.png', size: 30); } + + double maxWindowWidth(BuildContext context) { + final windowSize = MediaQuery.of(context).size.width; + return windowSize > CustomSize.maxWindowSize + ? CustomSize.maxWindowSize + : windowSize; + } } diff --git a/lib/page/chat/room_chat.dart b/lib/page/chat/room_chat.dart index 59845bda..a123fa2c 100644 --- a/lib/page/chat/room_chat.dart +++ b/lib/page/chat/room_chat.dart @@ -184,7 +184,7 @@ class _RoomChatPageState extends State { if (!_inputEnabled.value) Positioned( bottom: 10, - width: MediaQuery.of(context).size.width, + width: maxWindowWidth(context), child: Center( child: StopButton( label: '停止输出', @@ -593,6 +593,13 @@ class _RoomChatPageState extends State { .read() .add(RoomLoadEvent(widget.roomId, cascading: false)); } + + double maxWindowWidth(BuildContext context) { + final windowSize = MediaQuery.of(context).size.width; + return windowSize > CustomSize.maxWindowSize + ? CustomSize.maxWindowSize + : windowSize; + } } /// 处理消息删除事件 From f9db6d19282d02916c73d80e94ea7e0b1c576e8b Mon Sep 17 00:00:00 2001 From: mylxsw Date: Mon, 29 Jul 2024 00:40:27 +0800 Subject: [PATCH 4/5] Update Flutter to support the latest version 3.22, resolve compatibility issues, upgrade some libraries to the new version --- android/app/build.gradle | 42 ++------ android/build.gradle | 17 +--- android/gradle.properties | 2 +- android/settings.gradle | 30 ++++-- lib/bloc/account_bloc.dart | 2 +- lib/helper/color.dart | 12 ++- lib/helper/http.dart | 52 ++++++---- lib/page/auth/signin_screen.dart | 23 ++++- lib/page/setting/openai_setting.dart | 8 +- lib/page/setting/setting_screen.dart | 3 +- lib/repo/api_server.dart | 49 ++++----- pubspec.lock | 146 ++++++++++++--------------- pubspec.yaml | 28 ++--- 13 files changed, 201 insertions(+), 213 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index cf7674b5..2c6465e0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,3 +1,10 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -27,12 +29,8 @@ if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 34 + compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { @@ -40,21 +38,13 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "cc.aicode.flutter.askaide.askaide" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // minSdkVersion flutter.minSdkVersion - minSdkVersion 21 + minSdkVersion 24 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -77,16 +67,4 @@ android { flutter { source '../..' -} - -dependencies { - // implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - constraints { - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") { - because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib") - } - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") { - because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib") - } - } -} +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 07f90508..d2ffbffa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.20' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() @@ -18,12 +5,12 @@ allprojects { } } -rootProject.buildDir = '../build' +rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { diff --git a/android/gradle.properties b/android/gradle.properties index 94adc3a3..00485990 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xms1024m -Xmx4096m android.useAndroidX=true android.enableJetifier=true diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bcf..684b763e 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.4.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.20" apply false +} + +include ":app" diff --git a/lib/bloc/account_bloc.dart b/lib/bloc/account_bloc.dart index c9605915..79f09da5 100644 --- a/lib/bloc/account_bloc.dart +++ b/lib/bloc/account_bloc.dart @@ -38,7 +38,7 @@ class AccountBloc extends Bloc { await settings.set(settingAPIServerToken, ''); await settings.set(settingUserInfo, ''); - HttpClient.cacheManager.clearAll(); + await HttpClient.cleanCache(); emit(AccountNeedSignIn()); }); diff --git a/lib/helper/color.dart b/lib/helper/color.dart index 11f32139..af76a998 100644 --- a/lib/helper/color.dart +++ b/lib/helper/color.dart @@ -2,10 +2,18 @@ import 'package:flutter/material.dart'; /// 将颜色转换为字符串 String colorToString(Color color) { - return color.toString().split('(0x')[1].split(')')[0]; + try { + return color.toString().split('(0x')[1].split(')')[0]; + } catch (e) { + return '000000'; + } } /// 将字符串转换为颜色 Color stringToColor(String colorString) { - return Color(int.parse(colorString, radix: 16)); + try { + return Color(int.parse(colorString, radix: 16)); + } catch (e) { + return Colors.black; + } } diff --git a/lib/helper/http.dart b/lib/helper/http.dart index 75babc3e..b39bd2a7 100644 --- a/lib/helper/http.dart +++ b/lib/helper/http.dart @@ -1,23 +1,26 @@ -import 'package:askaide/helper/env.dart'; import 'package:askaide/helper/logger.dart'; -import 'package:askaide/helper/platform.dart'; import 'package:dio/dio.dart'; -import 'package:dio_http_cache_lts/dio_http_cache_lts.dart'; +import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; import 'package:dio_smart_retry/dio_smart_retry.dart'; class HttpClient { - static final cacheManager = DioCacheManager( - CacheConfig( - baseUrl: apiServerURL, - ), - ); static final dio = Dio(); - static init() { - if (!PlatformTool.isWeb()) { - dio.interceptors.add(cacheManager.interceptor); - } + static final cacheStore = MemCacheStore(); + + static final cacheOptions = CacheOptions( + store: cacheStore, + policy: CachePolicy.request, + hitCacheOnErrorExcept: [401, 403], + maxStale: const Duration(days: 7), + allowPostMethod: false, + keyBuilder: CacheOptions.defaultCacheKeyBuilder, + ); + static init() { + dio.interceptors.add(DioCacheInterceptor( + options: cacheOptions, + )); dio.interceptors.add(RetryInterceptor( dio: dio, retries: 3, @@ -50,25 +53,32 @@ class HttpClient { Options? options, }) async { options ??= Options(); + final resp = await dio.get( url, queryParameters: queryParameters, - options: buildCacheOptions( - duration, - subKey: subKey, - options: options.copyWith(sendTimeout: 10000, receiveTimeout: 10000), - forceRefresh: forceRefresh, - maxStale: const Duration(days: 30), - ), + options: options.copyWith( + extra: cacheOptions + .copyWith( + maxStale: Nullable(duration), + policy: forceRefresh + ? CachePolicy.refreshForceCache + : CachePolicy.forceCache, + ) + .toExtra()), ); - // print("======================="); - // print("request: $url"); + print("request: $url [${resp.statusCode}]"); // print("response: ${resp.data}"); return resp; } + // 清空缓存 + static Future cleanCache() async { + return await cacheStore.clean(); + } + static Future post( String url, { Map? queryParameters, diff --git a/lib/page/auth/signin_screen.dart b/lib/page/auth/signin_screen.dart index 99459e22..6ff1c8ac 100644 --- a/lib/page/auth/signin_screen.dart +++ b/lib/page/auth/signin_screen.dart @@ -118,7 +118,7 @@ class _SignInScreenState extends State { await widget.settings.set(settingAPIServerToken, value.token); await widget.settings.set(settingUserInfo, jsonEncode(value)); - await HttpClient.cacheManager.clearAll(); + await HttpClient.cleanCache(); if (value.needBindPhone) { if (context.mounted) { @@ -522,7 +522,7 @@ class _SignInScreenState extends State { await widget.settings.set(settingAPIServerToken, value.token); await widget.settings.set(settingUserInfo, jsonEncode(value)); - HttpClient.cacheManager.clearAll().then((_) { + () { if (value.needBindPhone) { if (context.mounted) { context.push('/bind-phone').then((value) async { @@ -537,7 +537,24 @@ class _SignInScreenState extends State { context.go( '${Ability().homeRoute}?show_initial_dialog=${value.isNewUser ? "true" : "false"}&reward=${value.reward}'); } - }); + }(); + + // HttpClient.cacheManager.clearAll().then((_) { + // if (value.needBindPhone) { + // if (context.mounted) { + // context.push('/bind-phone').then((value) async { + // if (value == 'logout') { + // await widget.settings.set(settingAPIServerToken, ''); + // await widget.settings.set(settingUserInfo, ''); + // } + // }); + // } + // return; + // } else { + // context.go( + // '${Ability().homeRoute}?show_initial_dialog=${value.isNewUser ? "true" : "false"}&reward=${value.reward}'); + // } + // }); }).catchError((e) { Logger.instance.e(e); showErrorMessage(AppLocale.signInFailed.getString(context)); diff --git a/lib/page/setting/openai_setting.dart b/lib/page/setting/openai_setting.dart index 5fdd9cbb..f8c1a9f3 100644 --- a/lib/page/setting/openai_setting.dart +++ b/lib/page/setting/openai_setting.dart @@ -270,7 +270,7 @@ class _OpenAISettingScreenState extends State { final dio = Dio(BaseOptions( baseUrl: url, - connectTimeout: 5 * 1000, + connectTimeout: const Duration(seconds: 5), )); try { @@ -279,8 +279,8 @@ class _OpenAISettingScreenState extends State { options: Options( headers: headers, receiveDataWhenStatusError: true, - sendTimeout: 3 * 1000, - receiveTimeout: 3 * 1000, + sendTimeout: const Duration(seconds: 3), + receiveTimeout: const Duration(seconds: 3), ), ); @@ -302,7 +302,7 @@ class _OpenAISettingScreenState extends State { }); cancelLoading(); - if (e is DioError) { + if (e is DioException) { if (e.response != null && e.response!.data != null) { return Future.error( '验证失败,请检查网络 或 API Key:${e.response!.data["error"]["message"]}'); diff --git a/lib/page/setting/setting_screen.dart b/lib/page/setting/setting_screen.dart index 5e964c46..68a4697b 100644 --- a/lib/page/setting/setting_screen.dart +++ b/lib/page/setting/setting_screen.dart @@ -178,7 +178,8 @@ class _SettingScreenState extends State { AppLocale.confirmClearCache.getString(context), () async { await Cache().clearAll(); - await HttpClient.cacheManager.clearAll(); + await HttpClient.cleanCache(); + showSuccessMessage( // ignore: use_build_context_synchronously AppLocale.operateSuccess.getString(context), diff --git a/lib/repo/api_server.dart b/lib/repo/api_server.dart index ec5109d3..3ab783d5 100644 --- a/lib/repo/api_server.dart +++ b/lib/repo/api_server.dart @@ -71,17 +71,17 @@ class APIServer { }); } - final List _retryableErrors = [ - DioErrorType.connectTimeout, - DioErrorType.sendTimeout, - DioErrorType.receiveTimeout, + final List _retryableErrors = [ + DioExceptionType.connectionTimeout, + DioExceptionType.sendTimeout, + DioExceptionType.receiveTimeout, ]; /// 异常处理 Object _exceptionHandle(Object e, Object? stackTrace) { Logger.instance.e(e, stackTrace: stackTrace as StackTrace?); - if (e is DioError) { + if (e is DioException) { if (e.response != null) { final resp = e.response!; @@ -114,8 +114,12 @@ class APIServer { return Options( headers: _buildAuthHeaders(), receiveDataWhenStatusError: true, - sendTimeout: requestTimeout, - receiveTimeout: requestTimeout, + sendTimeout: requestTimeout != null + ? Duration(milliseconds: requestTimeout) + : null, + receiveTimeout: requestTimeout != null + ? Duration(milliseconds: requestTimeout) + : null, ); } @@ -303,7 +307,7 @@ class APIServer { }) async { try { final resp = await respFuture; - if (resp.statusCode != 200) { + if (resp.statusCode != 200 && resp.statusCode != 304) { return Future.error(resp.data['error']); } @@ -1183,8 +1187,7 @@ class APIServer { 'members': members?.map((e) => e.toJson()).toList(), }, finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v2/rooms', requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } @@ -1206,12 +1209,7 @@ class APIServer { 'members': members?.map((e) => e.toJson()).toList(), }, finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v2/rooms', requestMethod: 'GET'); - - HttpClient.cacheManager.deleteByPrimaryKey( - '$url/v1/group-chat/$groupId', - requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } @@ -1243,8 +1241,7 @@ class APIServer { 'init_message': initMessage, }), finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v2/rooms', requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } @@ -1277,10 +1274,7 @@ class APIServer { 'init_message': initMessage, }), finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v2/rooms', requestMethod: 'GET'); - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v1/rooms/$roomId', requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } @@ -1291,10 +1285,7 @@ class APIServer { '/v1/rooms/$roomId', (resp) {}, finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v2/rooms', requestMethod: 'GET'); - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v1/rooms/$roomId', requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } @@ -1639,8 +1630,7 @@ class APIServer { (resp) {}, formData: {'avatar_url': avatarURL}, finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v1/users/current', requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } @@ -1652,8 +1642,7 @@ class APIServer { (resp) {}, formData: {'realname': realname}, finallyCallback: () { - HttpClient.cacheManager - .deleteByPrimaryKey('$url/v1/users/current', requestMethod: 'GET'); + HttpClient.cleanCache(); }, ); } diff --git a/pubspec.lock b/pubspec.lock index 1047740c..05db4fae 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -415,26 +415,34 @@ packages: dependency: "direct main" description: name: dio - sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8" + sha256: e17f6b3097b8c51b72c74c9f071a605c47bcc8893839bd66732457a5ebe73714 url: "https://pub.dev" source: hosted - version: "4.0.6" - dio_http_cache_lts: + version: "5.5.0+1" + dio_cache_interceptor: dependency: "direct main" description: - name: dio_http_cache_lts - sha256: "331da4c8444203bd3f20db1dc8a560969524a6b6e32e9ba16dad18f992a0b2b3" + name: dio_cache_interceptor + sha256: fb7905c0d12075d8786a6b63bffd64ae062d053f682cfaf28d145a2686507308 url: "https://pub.dev" source: hosted - version: "0.4.1" + version: "3.5.0" dio_smart_retry: dependency: "direct main" description: name: dio_smart_retry - sha256: "7c008542f7a5c5552a0757c7cd0e8c7b3131617120ee3e48456425f673f8ff09" + sha256: "3d71450c19b4d91ef4c7d726a55a284bfc11eb3634f1f25006cdfab3f8595653" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "6.0.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" + url: "https://pub.dev" + source: hosted + version: "1.0.1" extended_list: dependency: transitive description: @@ -503,11 +511,11 @@ packages: dependency: "direct main" description: path: "." - ref: f7259f1d97558251a5c3f81847904b63c08b482b - resolved-ref: f7259f1d97558251a5c3f81847904b63c08b482b - url: "https://github.com/incrediblezayed/file_saver" + ref: customized + resolved-ref: dc033a53cf6afe297396e22f44c0166d251d5ff2 + url: "https://github.com/mylxsw/file_saver" source: git - version: "0.2.10" + version: "0.2.13" fixnum: dependency: transitive description: @@ -715,18 +723,18 @@ packages: dependency: "direct main" description: name: flutter_stripe - sha256: bee4046750d813dc77ef1cdc954c8a0d70a21a7e089b86edf3929aebe33921fe + sha256: "28527923373720fcd39eade306f4acc007df8a3f2c0aeea545f1521dec9399c2" url: "https://pub.dev" source: hosted - version: "10.1.1" + version: "11.0.0" flutter_stripe_web: dependency: "direct main" description: name: flutter_stripe_web - sha256: bcadbce717cacae1c9ade225394c08a15eda682b3579e50adab7f04fcd16d837 + sha256: "24e5b620e38b151eea6e1dda20bedede3785730c812f7bc08ce4ba63d7c69af1" url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "6.0.0" flutter_svg: dependency: transitive description: @@ -869,10 +877,10 @@ packages: dependency: "direct main" description: name: image_gallery_saver - sha256: be812580c7a320d3bf583af89cac6b376f170d48000aca75215a73285a3223a0 + sha256: "0aba74216a4d9b0561510cb968015d56b701ba1bd94aace26aacdd8ae5761816" url: "https://pub.dev" source: hosted - version: "1.7.1" + version: "2.0.3" in_app_purchase: dependency: "direct main" description: @@ -909,10 +917,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" io: dependency: transitive description: @@ -953,38 +961,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.9.0" - json_serializable: - dependency: transitive - description: - name: json_serializable - sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b - url: "https://pub.dev" - source: hosted - version: "6.8.0" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: @@ -1142,10 +1142,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" mime: dependency: transitive description: @@ -1342,18 +1342,18 @@ packages: dependency: "direct main" description: name: qiniu_flutter_sdk - sha256: "3e1aebfba91f9f3252ff2f1d4022dcd146b2a152d28de827267049215a07a800" + sha256: "6a61ea7b2acfa0f4ac2550096b14843ea887db1af9ea533a1da27b8df2c04810" url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.6.0" qiniu_sdk_base: dependency: transitive description: name: qiniu_sdk_base - sha256: "46d2e44ead098248e6315ea529e8263013a5e7a7e2cb6c05c649667b09392aee" + sha256: "01cc53929d03fda7fa816660f9cfa1ccac697dbf1949066d39dadbdce1ff2ebf" url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.6.0" qr: dependency: transitive description: @@ -1374,19 +1374,11 @@ packages: dependency: "direct main" description: path: "." - ref: master - resolved-ref: "26ecde07d3b647f24e991934e5267b41f480d438" + ref: customized + resolved-ref: af9ed0da22b477b303e187d8563fae4012cc6f8f url: "https://github.com/mylxsw/QuickAlert.git" source: git - version: "1.0.1" - quiver: - dependency: transitive - description: - name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 - url: "https://pub.dev" - source: hosted - version: "3.2.1" + version: "1.1.0" random_avatar: dependency: "direct main" description: @@ -1672,22 +1664,6 @@ packages: description: flutter source: sdk version: "0.0.99" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" - url: "https://pub.dev" - source: hosted - version: "1.5.0" - source_helper: - dependency: transitive - description: - name: source_helper - sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" - url: "https://pub.dev" - source: hosted - version: "1.3.4" source_span: dependency: transitive description: @@ -1696,6 +1672,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" sqflite: dependency: "direct main" description: @@ -1772,34 +1756,34 @@ packages: dependency: transitive description: name: stripe_android - sha256: "717a541c025f8a8adbb2cbd8e136b424b4910c4812cc08f5c273bef9ca1ee538" + sha256: "189b8d5c79dfb363540a77e813ba350c9058559673f3df80a2cb87e0983a316e" url: "https://pub.dev" source: hosted - version: "10.1.1" + version: "11.0.0" stripe_ios: dependency: transitive description: name: stripe_ios - sha256: "67994171a29301d12d6a557177d02b12f0d400edd3041ecbdad5fd5c25b43569" + sha256: "680d442b2bb920dd91bec4aba9286de050a76a789e9bc128044f2b3732369be6" url: "https://pub.dev" source: hosted - version: "10.1.0" + version: "11.0.0" stripe_js: dependency: "direct main" description: name: stripe_js - sha256: d203b48167a9a533bbf72049b40c8227bf0557d79e28a7f016e77dddcac8b19b + sha256: "203ee1a87d733c79316a5dc7ce7c3dc050d3bb37179790d667fd95ab5f1a3760" url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "6.0.0" stripe_platform_interface: dependency: transitive description: name: stripe_platform_interface - sha256: "2f01a6d974ab734ba3824c6f7a2fd01fe7b1f899e7bbace26cb1f66a48bee776" + sha256: "3a4e22f0ad461dc47147601d1215f2a72715c6c67f56fb4b8a3cab4b857b9a41" url: "https://pub.dev" source: hosted - version: "10.1.1" + version: "11.0.0" synchronized: dependency: transitive description: @@ -1820,10 +1804,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" tiktoken: dependency: "direct main" description: @@ -1964,10 +1948,10 @@ packages: dependency: "direct main" description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90" url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.4.2" value_layout_builder: dependency: transitive description: @@ -2020,10 +2004,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" volume_controller: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3acf7282..1e841596 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,14 +36,14 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - intl: ^0.18.0 + intl: ^0.19.0 flutter_highlight: ^0.7.0 flutter_bloc: ^8.1.2 path_provider: ^2.0.14 dart_openai: git: url: https://github.com/mylxsw/openai.git - uuid: ^3.0.7 + uuid: ^4.4.2 settings_ui: ^2.0.2 clipboard: ^0.1.3 bot_toast: ^4.0.3 @@ -66,20 +66,19 @@ dependencies: isolate_image_compress: ^2.0.0 image: 4.1.7 flutter_cache_manager: ^3.3.0 - file_saver: + file_saver: git: - url: https://github.com/incrediblezayed/file_saver - ref: f7259f1d97558251a5c3f81847904b63c08b482b - image_gallery_saver: ^1.7.1 + url: https://github.com/mylxsw/file_saver + ref: customized + image_gallery_saver: ^2.0.3 tiktoken: ^1.0.3 flutter_colorpicker: ^1.0.3 singleton: ^0.0.2 url_launcher: ^6.1.10 crypto: ^3.0.2 - dio: ^4.0.0 - dio_http_cache_lts: ^0.4.1 - dio_smart_retry: ^1.4.0 - qiniu_flutter_sdk: ^0.4.0 + dio: ^5.5.0 + dio_smart_retry: ^6.0.0 + qiniu_flutter_sdk: ^0.6.0 sign_in_with_apple: ^4.3.0 record: ^5.0.4 animations: ^2.0.7 @@ -91,7 +90,7 @@ dependencies: quickalert: git: url: https://github.com/mylxsw/QuickAlert.git - ref: master + ref: customized sign_in_button: ^3.2.0 animated_button_bar: ^1.0.0 circular_countdown_timer: ^0.2.3 @@ -126,11 +125,12 @@ dependencies: media_kit_libs_video: ^1.0.4 path: ^1.8.3 autoscale_tabbarview: ^1.0.2 - flutter_stripe: ^10.1.1 - flutter_stripe_web: ^5.1.0 - stripe_js: ^3.4.0 + flutter_stripe: ^11.0.0 + flutter_stripe_web: ^6.0.0 + stripe_js: ^6.0.0 qr_flutter: ^4.1.0 flutter_phoenix: ^1.1.1 + dio_cache_interceptor: ^3.5.0 dev_dependencies: flutter_test: From e01ee605c7d2e58581b62adb028c5a891eb6b6c9 Mon Sep 17 00:00:00 2001 From: mylxsw Date: Mon, 29 Jul 2024 13:45:42 +0800 Subject: [PATCH 5/5] Update some deprecated interfaces, classes, methods, etc. in the code to resolve the issue of iOS compilation failure --- ios/Podfile.lock | 175 +++++++++--------- lib/helper/http.dart | 2 +- lib/helper/path.dart | 3 +- lib/main.dart | 16 +- lib/page/admin/models.dart | 1 - lib/page/admin/user.dart | 7 +- lib/page/auth/signin_or_signup.dart | 2 + lib/page/auth/signin_screen.dart | 1 + lib/page/auth/signup_screen.dart | 2 + lib/page/balance/payment.dart | 13 +- lib/page/balance/payment_history.dart | 6 +- lib/page/chat/component/stop_button.dart | 4 +- lib/page/chat/group/edit.dart | 3 + lib/page/chat/home.dart | 4 +- lib/page/chat/room_chat.dart | 4 +- lib/page/chat/room_create.dart | 9 +- lib/page/component/chat/chat_share.dart | 7 +- lib/page/component/chat/empty.dart | 5 +- lib/page/component/enhanced_error.dart | 2 +- lib/page/component/enhanced_input.dart | 4 +- lib/page/component/enhanced_textfield.dart | 2 +- lib/page/component/gallery_item_share.dart | 9 +- lib/page/component/pagination.dart | 4 +- lib/page/component/prompt_tags_selector.dart | 7 +- lib/page/component/share.dart | 2 +- lib/page/component/sliver_component.dart | 4 +- lib/page/component/social_icon.dart | 4 +- .../creative_island/draw/artistic_qr.dart | 3 +- .../draw/artistic_wordart.dart | 3 +- .../creative_island/draw/draw_create.dart | 6 +- .../draw/image_edit_direct.dart | 2 +- lib/page/lab/prompt.dart | 2 +- lib/page/setting/account_security.dart | 22 +-- lib/page/setting/bind_phone_page.dart | 2 + lib/page/setting/custom_home_models.dart | 5 +- lib/page/setting/destroy_account.dart | 1 + lib/page/setting/diagnosis.dart | 2 +- lib/page/setting/setting_screen.dart | 52 +++--- 38 files changed, 205 insertions(+), 197 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 028ae98c..8c932700 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,35 +1,35 @@ PODS: - audioplayers_darwin (0.0.1): - Flutter - - DKImagePickerController/Core (4.3.4): + - DKImagePickerController/Core (4.3.9): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.4) - - DKImagePickerController/PhotoGallery (4.3.4): + - DKImagePickerController/ImageDataManager (4.3.9) + - DKImagePickerController/PhotoGallery (4.3.9): - DKImagePickerController/Core - DKPhotoGallery - - DKImagePickerController/Resource (4.3.4) - - DKPhotoGallery (0.0.17): - - DKPhotoGallery/Core (= 0.0.17) - - DKPhotoGallery/Model (= 0.0.17) - - DKPhotoGallery/Preview (= 0.0.17) - - DKPhotoGallery/Resource (= 0.0.17) + - DKImagePickerController/Resource (4.3.9) + - DKPhotoGallery (0.0.19): + - DKPhotoGallery/Core (= 0.0.19) + - DKPhotoGallery/Model (= 0.0.19) + - DKPhotoGallery/Preview (= 0.0.19) + - DKPhotoGallery/Resource (= 0.0.19) - SDWebImage - SwiftyGif - - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Core (0.0.19): - DKPhotoGallery/Model - DKPhotoGallery/Preview - SDWebImage - SwiftyGif - - DKPhotoGallery/Model (0.0.17): + - DKPhotoGallery/Model (0.0.19): - SDWebImage - SwiftyGif - - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Preview (0.0.19): - DKPhotoGallery/Model - DKPhotoGallery/Resource - SDWebImage - SwiftyGif - - DKPhotoGallery/Resource (0.0.17): + - DKPhotoGallery/Resource (0.0.19): - SDWebImage - SwiftyGif - file_picker (0.0.1): @@ -54,20 +54,23 @@ PODS: - fluwx (0.0.1): - Flutter - WechatOpenSDK-XCFramework (~> 2.0.2) - - image_gallery_saver (1.5.0): + - image_gallery_saver (2.0.2): - Flutter - in_app_purchase_storekit (0.0.1): - Flutter - FlutterMacOS - - libwebp (1.2.4): - - libwebp/demux (= 1.2.4) - - libwebp/mux (= 1.2.4) - - libwebp/webp (= 1.2.4) - - libwebp/demux (1.2.4): + - libwebp (1.3.2): + - libwebp/demux (= 1.3.2) + - libwebp/mux (= 1.3.2) + - libwebp/sharpyuv (= 1.3.2) + - libwebp/webp (= 1.3.2) + - libwebp/demux (1.3.2): - libwebp/webp - - libwebp/mux (1.2.4): + - libwebp/mux (1.3.2): - libwebp/demux - - libwebp/webp (1.2.4) + - libwebp/sharpyuv (1.3.2) + - libwebp/webp (1.3.2): + - libwebp/sharpyuv - Mantle (2.2.0): - Mantle/extobjc (= 2.2.0) - Mantle/extobjc (2.2.0) @@ -87,12 +90,12 @@ PODS: - FlutterMacOS - screen_brightness_ios (0.1.0): - Flutter - - SDWebImage (5.15.5): - - SDWebImage/Core (= 5.15.5) - - SDWebImage/Core (5.15.5) - - SDWebImageWebPCoder (0.11.0): + - SDWebImage (5.19.4): + - SDWebImage/Core (= 5.19.4) + - SDWebImage/Core (5.19.4) + - SDWebImageWebPCoder (0.14.6): - libwebp (~> 1.0) - - SDWebImage/Core (~> 5.15) + - SDWebImage/Core (~> 5.17) - share_plus (0.0.1): - Flutter - shared_preferences_foundation (0.0.1): @@ -103,43 +106,43 @@ PODS: - sqflite (0.0.3): - Flutter - FlutterMacOS - - Stripe (23.22.1): - - StripeApplePay (= 23.22.1) - - StripeCore (= 23.22.1) - - StripePayments (= 23.22.1) - - StripePaymentsUI (= 23.22.1) - - StripeUICore (= 23.22.1) + - Stripe (23.28.1): + - StripeApplePay (= 23.28.1) + - StripeCore (= 23.28.1) + - StripePayments (= 23.28.1) + - StripePaymentsUI (= 23.28.1) + - StripeUICore (= 23.28.1) - stripe_ios (0.0.1): - Flutter - - Stripe (~> 23.22.0) - - StripeApplePay (~> 23.22.0) - - StripeFinancialConnections (~> 23.22.0) - - StripePayments (~> 23.22.0) - - StripePaymentSheet (~> 23.22.0) - - StripePaymentsUI (~> 23.22.0) - - StripeApplePay (23.22.1): - - StripeCore (= 23.22.1) - - StripeCore (23.22.1) - - StripeFinancialConnections (23.22.1): - - StripeCore (= 23.22.1) - - StripeUICore (= 23.22.1) - - StripePayments (23.22.1): - - StripeCore (= 23.22.1) - - StripePayments/Stripe3DS2 (= 23.22.1) - - StripePayments/Stripe3DS2 (23.22.1): - - StripeCore (= 23.22.1) - - StripePaymentSheet (23.22.1): - - StripeApplePay (= 23.22.1) - - StripeCore (= 23.22.1) - - StripePayments (= 23.22.1) - - StripePaymentsUI (= 23.22.1) - - StripePaymentsUI (23.22.1): - - StripeCore (= 23.22.1) - - StripePayments (= 23.22.1) - - StripeUICore (= 23.22.1) - - StripeUICore (23.22.1): - - StripeCore (= 23.22.1) - - SwiftyGif (5.4.4) + - Stripe (~> 23.28.0) + - StripeApplePay (~> 23.28.0) + - StripeFinancialConnections (~> 23.28.0) + - StripePayments (~> 23.28.0) + - StripePaymentSheet (~> 23.28.0) + - StripePaymentsUI (~> 23.28.0) + - StripeApplePay (23.28.1): + - StripeCore (= 23.28.1) + - StripeCore (23.28.1) + - StripeFinancialConnections (23.28.1): + - StripeCore (= 23.28.1) + - StripeUICore (= 23.28.1) + - StripePayments (23.28.1): + - StripeCore (= 23.28.1) + - StripePayments/Stripe3DS2 (= 23.28.1) + - StripePayments/Stripe3DS2 (23.28.1): + - StripeCore (= 23.28.1) + - StripePaymentSheet (23.28.1): + - StripeApplePay (= 23.28.1) + - StripeCore (= 23.28.1) + - StripePayments (= 23.28.1) + - StripePaymentsUI (= 23.28.1) + - StripePaymentsUI (23.28.1): + - StripeCore (= 23.28.1) + - StripePayments (= 23.28.1) + - StripeUICore (= 23.28.1) + - StripeUICore (23.28.1): + - StripeCore (= 23.28.1) + - SwiftyGif (5.4.5) - tobias (0.0.1): - Flutter - url_launcher_ios (0.0.1): @@ -148,7 +151,7 @@ PODS: - Flutter - wakelock_plus (0.0.1): - Flutter - - WechatOpenSDK-XCFramework (2.0.2) + - WechatOpenSDK-XCFramework (2.0.4) DEPENDENCIES: - audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`) @@ -259,49 +262,49 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 - DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac - DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c + DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 file_picker: ce3938a0df3cc1ef404671531facef740d03f920 file_saver: 503e386464dbe118f630e17b4c2e1190fa0cf808 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433 flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 flutter_localization: f43b18844a2b3d2c71fd64f04ffd6b1e64dd54d4 - flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef + flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d fluwx: e9e728cfdb80e82dac5f4ff974b1901a7939dcd0 - image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2 - in_app_purchase_storekit: 0e4b3c2e43ba1e1281f4f46dd71b0593ce529892 - libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef + image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb + in_app_purchase_storekit: 8c3b0b3eb1b0f04efbff401c3de6266d4258d433 + libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1 media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e - package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 - path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 record_darwin: 1f6619f2abac4d1ca91d3eeab038c980d76f1517 screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625 - SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe - SDWebImageWebPCoder: 295a6573c512f54ad2dd58098e64e17dcf008499 + SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d + SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5 - shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec - Stripe: b65e9f748f8f51b51e015b0d72f5474dc0708788 - stripe_ios: 433385aa051f8965915d495744946ee5a5d657db - StripeApplePay: 4a2fef6cd4e1e9b2c0849919fc7b3a9c5c3684b1 - StripeCore: e1f6cd91d1487c0f6b5db81b42aec860420f75c9 - StripeFinancialConnections: d223a44613e6982cedd552c5950edc9b4901c90a - StripePayments: 76144e9e6b5fee859954238a175f859043562659 - StripePaymentSheet: a25d920bb3bb5e2580696476482dc7df9cb5e4e2 - StripePaymentsUI: 66088abec88754bbdd522ef227dfdbb2265a653e - StripeUICore: b193c7d35e9cd1b04bc9ed4a6fb8c548fcee83fa - SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f + Stripe: 20e24971647daa5750e7764faa1e8aefe4917243 + stripe_ios: 91946e5c07e0a0dc0e1484ee6659e1f90a302cf3 + StripeApplePay: 5b098a0ba6136f4b587e03f5a3776461b4f20dd4 + StripeCore: 880a68482cf78d4745c5213c2fd3446efc73574b + StripeFinancialConnections: 49a19ca17dbb3055a8b559a1e3adfe769784a8f8 + StripePayments: 3af5b03fa1831c301a4d1621eb0e790280dccb46 + StripePaymentSheet: 8321efebb6d104add8fce929286d414545913114 + StripePaymentsUI: 4c35e12ebcd4bd9bd21e379f03f730bee097250d + StripeUICore: 22b314dc9f7ea8814d0f9eeba0ddb5e4b77f34f3 + SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5 - url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586 + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9 - wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47 - WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69 + wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 + WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b diff --git a/lib/helper/http.dart b/lib/helper/http.dart index b39bd2a7..66da66ab 100644 --- a/lib/helper/http.dart +++ b/lib/helper/http.dart @@ -68,7 +68,7 @@ class HttpClient { .toExtra()), ); // print("======================="); - print("request: $url [${resp.statusCode}]"); + Logger.instance.d("request: $url [${resp.statusCode}]"); // print("response: ${resp.data}"); return resp; diff --git a/lib/helper/path.dart b/lib/helper/path.dart index 8e93ffb1..b357a013 100644 --- a/lib/helper/path.dart +++ b/lib/helper/path.dart @@ -1,4 +1,5 @@ import 'dart:io' show Directory, Platform; +import 'package:askaide/helper/logger.dart'; import 'package:askaide/helper/platform.dart'; import 'package:path_provider/path_provider.dart'; @@ -33,7 +34,7 @@ class PathHelper { try { Directory(getHomePath).create(recursive: true); } catch (e) { - print('创建 $getHomePath 目录失败: $e'); + Logger.instance.e('创建 $getHomePath 目录失败: $e'); } } diff --git a/lib/main.dart b/lib/main.dart index 431a824d..9bd38ce4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -146,7 +146,7 @@ void main() async { error: details.exception, stackTrace: details.stack, ); - print(details.stack); + Logger.instance.d(details.stack); }; if (kIsWeb) { @@ -1365,8 +1365,8 @@ class _MyAppState extends State { // 这里设置了全局字体固定大小,不随系统设置变更 // TODO 后面要增加一个设置项,允许用户自定义字体大小 return MediaQuery( - data: - MediaQuery.of(context).copyWith(textScaleFactor: 1.0), + data: MediaQuery.of(context) + .copyWith(textScaler: TextScaler.noScaling), child: BotToastInit()(context, child), ); }, @@ -1394,9 +1394,8 @@ class _MyAppState extends State { } ThemeData createLightThemeData() { - return ThemeData.light().copyWith( + return ThemeData.light(useMaterial3: true).copyWith( extensions: [CustomColors.light], - useMaterial3: true, appBarTheme: const AppBarTheme( // backgroundColor: Color.fromARGB(255, 250, 250, 250), backgroundColor: Colors.transparent, @@ -1405,7 +1404,7 @@ ThemeData createLightThemeData() { iconButtonTheme: PlatformTool.isMacOS() ? IconButtonThemeData( style: ButtonStyle( - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ), ) : null, @@ -1427,9 +1426,8 @@ ThemeData createLightThemeData() { } ThemeData createDarkThemeData() { - return ThemeData.dark().copyWith( + return ThemeData.dark(useMaterial3: true).copyWith( extensions: [CustomColors.dark], - useMaterial3: true, appBarTheme: const AppBarTheme( // backgroundColor: Color.fromARGB(255, 48, 48, 48), backgroundColor: Colors.transparent, @@ -1438,7 +1436,7 @@ ThemeData createDarkThemeData() { iconButtonTheme: PlatformTool.isMacOS() ? IconButtonThemeData( style: ButtonStyle( - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ), ) : null, diff --git a/lib/page/admin/models.dart b/lib/page/admin/models.dart index a9add4b7..55029a43 100644 --- a/lib/page/admin/models.dart +++ b/lib/page/admin/models.dart @@ -12,7 +12,6 @@ import 'package:askaide/repo/api_server.dart'; import 'package:askaide/repo/settings_repo.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_initicon/flutter_initicon.dart'; import 'package:flutter_localization/flutter_localization.dart'; diff --git a/lib/page/admin/user.dart b/lib/page/admin/user.dart index 9eebcff6..78c37eb4 100644 --- a/lib/page/admin/user.dart +++ b/lib/page/admin/user.dart @@ -412,7 +412,8 @@ class _AdminUserPageState extends State { DateFormat( 'yyyy/MM/dd HH:mm', ).format(item.createdAt.toLocal()), - textScaleFactor: 0.8, + textScaler: + const TextScaler.linear(0.8), style: TextStyle( color: Colors.grey[600], ), @@ -431,7 +432,7 @@ class _AdminUserPageState extends State { ), Text( '${DateFormat('yyyy/MM/dd').format(item.periodEndAt.toLocal())} 过期', - textScaleFactor: 0.7, + textScaler: const TextScaler.linear(0.7), ), ], ), @@ -480,7 +481,7 @@ class _AdminUserPageState extends State { ), child: Text( text, - textScaleFactor: 0.6, + textScaler: const TextScaler.linear(0.6), style: const TextStyle(color: Colors.white70), ), ), diff --git a/lib/page/auth/signin_or_signup.dart b/lib/page/auth/signin_or_signup.dart index 78b42792..73d2d472 100644 --- a/lib/page/auth/signin_or_signup.dart +++ b/lib/page/auth/signin_or_signup.dart @@ -401,6 +401,7 @@ class _SigninOrSignupScreenState extends State { if (value.needBindPhone) { if (context.mounted) { + // ignore: use_build_context_synchronously context.push('/bind-phone').then((value) async { if (value == 'logout') { await widget.settings.set(settingAPIServerToken, ''); @@ -412,6 +413,7 @@ class _SigninOrSignupScreenState extends State { return; } else { if (context.mounted) { + // ignore: use_build_context_synchronously context.go( '${Ability().homeRoute}?show_initial_dialog=${value.isNewUser ? "true" : "false"}&reward=${value.reward}'); } diff --git a/lib/page/auth/signin_screen.dart b/lib/page/auth/signin_screen.dart index 6ff1c8ac..ac66432f 100644 --- a/lib/page/auth/signin_screen.dart +++ b/lib/page/auth/signin_screen.dart @@ -122,6 +122,7 @@ class _SignInScreenState extends State { if (value.needBindPhone) { if (context.mounted) { + // ignore: use_build_context_synchronously context.push('/bind-phone').then((value) async { if (value == 'logout') { await widget.settings.set(settingAPIServerToken, ''); diff --git a/lib/page/auth/signup_screen.dart b/lib/page/auth/signup_screen.dart index 0067d234..fb4fe518 100644 --- a/lib/page/auth/signup_screen.dart +++ b/lib/page/auth/signup_screen.dart @@ -547,6 +547,7 @@ class _SignupScreenState extends State { if (value.needBindPhone) { if (context.mounted) { + // ignore: use_build_context_synchronously context.push('/bind-phone').then((value) async { if (value == 'logout') { await widget.settings.set(settingAPIServerToken, ''); @@ -558,6 +559,7 @@ class _SignupScreenState extends State { return; } else { if (context.mounted) { + // ignore: use_build_context_synchronously context.go( '${Ability().homeRoute}?show_initial_dialog=${value.isNewUser ? "true" : "false"}&reward=${value.reward}'); } diff --git a/lib/page/balance/payment.dart b/lib/page/balance/payment.dart index 73d854cd..c249390f 100644 --- a/lib/page/balance/payment.dart +++ b/lib/page/balance/payment.dart @@ -20,7 +20,6 @@ import 'package:askaide/repo/api_server.dart'; import 'package:askaide/repo/settings_repo.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localization/flutter_localization.dart'; import 'package:flutter_stripe/flutter_stripe.dart'; @@ -216,7 +215,7 @@ class _PaymentScreenState extends State { if (Ability().isUserLogon()) TextButton( style: ButtonStyle( - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ), onPressed: () { context.push('/quota-details'); @@ -224,7 +223,7 @@ class _PaymentScreenState extends State { child: Text( AppLocale.paymentHistory.getString(context), style: TextStyle(color: customColors.weakLinkColor), - textScaleFactor: 0.9, + textScaler: const TextScaler.linear(0.9), ), ), ], @@ -984,9 +983,9 @@ class _PaymentScreenState extends State { created.params, evn: env, ).whenComplete(() => _closePaymentLoading()); - print("================="); - print(aliPayRes); - print(aliPayRes["resultStatus"]); + Logger.instance.d("================="); + Logger.instance.d(aliPayRes); + Logger.instance.d(aliPayRes["resultStatus"]); if (aliPayRes['resultStatus'] == '9000') { await APIServer().otherPayClientConfirm( aliPayRes.map((key, value) => MapEntry(key.toString(), value)), @@ -1015,7 +1014,7 @@ class _PaymentScreenState extends State { showErrorMessage('支付失败'); } } - print("-----------------"); + Logger.instance.d("-----------------"); } } diff --git a/lib/page/balance/payment_history.dart b/lib/page/balance/payment_history.dart index 8848a355..ab7f2b78 100644 --- a/lib/page/balance/payment_history.dart +++ b/lib/page/balance/payment_history.dart @@ -122,7 +122,7 @@ class _PaymentHistoryScreenState extends State { DateFormat( 'yyyy/MM/dd HH:mm', ).format(item.createdAt.toLocal()), - textScaleFactor: 0.8, + textScaler: const TextScaler.linear(0.8), style: TextStyle( color: Colors.grey[600], ), @@ -141,7 +141,7 @@ class _PaymentHistoryScreenState extends State { ), Text( '${DateFormat('yyyy/MM/dd').format(item.periodEndAt.toLocal())} 过期', - textScaleFactor: 0.7, + textScaler: const TextScaler.linear(0.7), ), ], ), @@ -190,7 +190,7 @@ class _PaymentHistoryScreenState extends State { ), child: Text( text, - textScaleFactor: 0.6, + textScaler: const TextScaler.linear(0.6), style: const TextStyle(color: Colors.white70), ), ), diff --git a/lib/page/chat/component/stop_button.dart b/lib/page/chat/component/stop_button.dart index f1fb22f4..8ba872ea 100644 --- a/lib/page/chat/component/stop_button.dart +++ b/lib/page/chat/component/stop_button.dart @@ -14,9 +14,9 @@ class StopButton extends StatelessWidget { style: ButtonStyle( // minimumSize: MaterialStateProperty.all(const Size(0, 0)), tapTargetSize: MaterialTapTargetSize.shrinkWrap, - iconColor: const MaterialStatePropertyAll(Colors.red), + iconColor: const WidgetStatePropertyAll(Colors.red), backgroundColor: - MaterialStatePropertyAll(customColors.chatInputPanelBackground), + WidgetStatePropertyAll(customColors.chatInputPanelBackground), ), label: Text( label, diff --git a/lib/page/chat/group/edit.dart b/lib/page/chat/group/edit.dart index b62b99e3..b8eb3c8b 100644 --- a/lib/page/chat/group/edit.dart +++ b/lib/page/chat/group/edit.dart @@ -44,6 +44,9 @@ class ModelWithMemberId { runtimeType == other.runtimeType && model == other.model && memberId == other.memberId; + + @override + int get hashCode => model.hashCode ^ memberId.hashCode; } class GroupEditPage extends StatefulWidget { diff --git a/lib/page/chat/home.dart b/lib/page/chat/home.dart index c1b74e2f..b3748c1b 100644 --- a/lib/page/chat/home.dart +++ b/lib/page/chat/home.dart @@ -658,7 +658,7 @@ class _HomePageState extends State { child: TextButton( style: ButtonStyle( overlayColor: - MaterialStateProperty.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), ), onPressed: () { setState(() { @@ -679,7 +679,7 @@ class _HomePageState extends State { style: TextStyle( color: customColors.weakTextColor, ), - textScaleFactor: 0.9, + textScaler: const TextScaler.linear(0.9), ), ], ), diff --git a/lib/page/chat/room_chat.dart b/lib/page/chat/room_chat.dart index a123fa2c..0e5f91cd 100644 --- a/lib/page/chat/room_chat.dart +++ b/lib/page/chat/room_chat.dart @@ -664,7 +664,7 @@ void handleOpenExampleQuestion( ), child: Text( AppLocale.examples.getString(context), - textScaleFactor: 1.2, + textScaler: const TextScaler.linear(1.2), ), ), Expanded( @@ -717,7 +717,7 @@ void handleOpenExampleQuestion( title: Text( AppLocale.confirmSend.getString(context), textAlign: TextAlign.left, - textScaleFactor: 0.8, + textScaler: const TextScaler.linear(0.8), ), builder: Builder( builder: (context) { diff --git a/lib/page/chat/room_create.dart b/lib/page/chat/room_create.dart index b42aa87b..e0481b43 100644 --- a/lib/page/chat/room_create.dart +++ b/lib/page/chat/room_create.dart @@ -121,9 +121,8 @@ class _RoomCreatePageState extends State { children: [ Theme( data: Theme.of(context).copyWith( - colorScheme: Theme.of(context) - .colorScheme - .copyWith(surfaceVariant: Colors.transparent), + colorScheme: Theme.of(context).colorScheme.copyWith( + surfaceContainerHighest: Colors.transparent), ), child: TabBar( tabs: [ @@ -137,7 +136,7 @@ class _RoomCreatePageState extends State { labelPadding: const EdgeInsets.only(right: 5, left: 10), overlayColor: - MaterialStateProperty.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), tabAlignment: TabAlignment.center, ), ), @@ -706,7 +705,7 @@ void openSystemPromptSelectDialog( style: TextStyle( color: customColors.weakTextColor, ), - textScaleFactor: 0.8, + textScaler: const TextScaler.linear(0.8), ) ], ), diff --git a/lib/page/component/chat/chat_share.dart b/lib/page/component/chat/chat_share.dart index af1fff10..b9e545bd 100644 --- a/lib/page/component/chat/chat_share.dart +++ b/lib/page/component/chat/chat_share.dart @@ -84,8 +84,8 @@ class _ChatShareScreenState extends State { if (data != null) { final file = await writeTempFile('share-image.png', data); cancel(); - // ignore: use_build_context_synchronously await shareTo( + // ignore: use_build_context_synchronously context, content: 'images', images: [ @@ -139,7 +139,7 @@ class _ChatShareScreenState extends State { } else { if (PlatformTool.isWindows()) { FileSaver.instance - .saveAs( + .saveAs( name: randomId(), bytes: data, ext: '.png', @@ -147,7 +147,7 @@ class _ChatShareScreenState extends State { ) .then((value) async { if (value == null) { - return ; + return; } await File(value).writeAsBytes(data); @@ -167,7 +167,6 @@ class _ChatShareScreenState extends State { showSuccessMessage('文件保存成功'); }); } - } } } finally { diff --git a/lib/page/component/chat/empty.dart b/lib/page/component/chat/empty.dart index 878857e5..25666e22 100644 --- a/lib/page/component/chat/empty.dart +++ b/lib/page/component/chat/empty.dart @@ -88,8 +88,7 @@ class _EmptyPreviewState extends State { alignment: Alignment.centerRight, child: TextButton( style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ), onPressed: () { setState(() { @@ -110,7 +109,7 @@ class _EmptyPreviewState extends State { style: TextStyle( color: customColors.chatExampleItemText, ), - textScaleFactor: 0.9, + textScaler: const TextScaler.linear(0.9), ), ], ), diff --git a/lib/page/component/enhanced_error.dart b/lib/page/component/enhanced_error.dart index 0071ff9e..3de8ae44 100644 --- a/lib/page/component/enhanced_error.dart +++ b/lib/page/component/enhanced_error.dart @@ -38,7 +38,7 @@ class EnhancedErrorWidget extends StatelessWidget { padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), child: Text( '点击此处重新登录', - textScaleFactor: 0.8, + textScaler: TextScaler.linear(0.8), style: TextStyle( color: Colors.red, ), diff --git a/lib/page/component/enhanced_input.dart b/lib/page/component/enhanced_input.dart index 624939b9..67d70845 100644 --- a/lib/page/component/enhanced_input.dart +++ b/lib/page/component/enhanced_input.dart @@ -96,9 +96,9 @@ class EnhancedInput extends StatelessWidget { ), const SizedBox(width: 10), icon ?? - Icon( + const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), ], diff --git a/lib/page/component/enhanced_textfield.dart b/lib/page/component/enhanced_textfield.dart index 7428b2d3..a7a76f09 100644 --- a/lib/page/component/enhanced_textfield.dart +++ b/lib/page/component/enhanced_textfield.dart @@ -20,7 +20,7 @@ class InputSelector extends StatelessWidget { return TextButton( onPressed: onTap, style: ButtonStyle( - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ), child: title, ); diff --git a/lib/page/component/gallery_item_share.dart b/lib/page/component/gallery_item_share.dart index 96cc4e57..95a8324c 100644 --- a/lib/page/component/gallery_item_share.dart +++ b/lib/page/component/gallery_item_share.dart @@ -70,8 +70,8 @@ class _GalleryItemShareScreenState extends State { if (data != null) { final file = await writeTempFile('share-image.png', data); cancel(); - // ignore: use_build_context_synchronously await shareTo( + // ignore: use_build_context_synchronously context, content: 'images', images: [ @@ -125,7 +125,7 @@ class _GalleryItemShareScreenState extends State { } else { if (PlatformTool.isWindows()) { FileSaver.instance - .saveAs( + .saveAs( name: randomId(), bytes: data, ext: '.png', @@ -133,7 +133,7 @@ class _GalleryItemShareScreenState extends State { ) .then((value) async { if (value == null) { - return ; + return; } await File(value).writeAsBytes(data); @@ -141,7 +141,7 @@ class _GalleryItemShareScreenState extends State { Logger.instance.d('文件保存成功: $value'); showSuccessMessage('文件保存成功'); }); - } else { + } else { FileSaver.instance .saveFile( name: randomId(), @@ -154,7 +154,6 @@ class _GalleryItemShareScreenState extends State { showSuccessMessage('文件保存成功'); }); } - } } } finally { diff --git a/lib/page/component/pagination.dart b/lib/page/component/pagination.dart index f4382ba6..5201a55f 100644 --- a/lib/page/component/pagination.dart +++ b/lib/page/component/pagination.dart @@ -73,11 +73,11 @@ class _PaginationState extends State { style: i == widget.selectedPage ? ButtonStyle( backgroundColor: - MaterialStateProperty.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), ) : ButtonStyle( backgroundColor: - MaterialStateProperty.all(Colors.transparent)), + WidgetStateProperty.all(Colors.transparent)), onPressed: () => widget.onPageChanged(i), child: Text( '$i', diff --git a/lib/page/component/prompt_tags_selector.dart b/lib/page/component/prompt_tags_selector.dart index 8ef75f60..273c34d4 100644 --- a/lib/page/component/prompt_tags_selector.dart +++ b/lib/page/component/prompt_tags_selector.dart @@ -67,9 +67,8 @@ class _PromptTagsSelectorState extends State { children: [ Theme( data: Theme.of(context).copyWith( - colorScheme: Theme.of(context) - .colorScheme - .copyWith(surfaceVariant: Colors.transparent), + colorScheme: Theme.of(context).colorScheme.copyWith( + surfaceContainerHighest: Colors.transparent), ), child: TabBar( tabs: [ @@ -85,7 +84,7 @@ class _PromptTagsSelectorState extends State { ), indicator: const BoxDecoration(), overlayColor: - MaterialStateProperty.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), ), ), Expanded( diff --git a/lib/page/component/share.dart b/lib/page/component/share.dart index 7638dd90..74be8730 100644 --- a/lib/page/component/share.dart +++ b/lib/page/component/share.dart @@ -24,8 +24,8 @@ Future shareTo( if ((PlatformTool.isIOS() || PlatformTool.isAndroid()) && await isWeChatInstalled) { - // ignore: use_build_context_synchronously openModalBottomSheet( + // ignore: use_build_context_synchronously context, (context) => Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/page/component/sliver_component.dart b/lib/page/component/sliver_component.dart index ebf6677e..459d58ac 100644 --- a/lib/page/component/sliver_component.dart +++ b/lib/page/component/sliver_component.dart @@ -165,7 +165,7 @@ class SliverTabComponent extends StatelessWidget { data: Theme.of(context).copyWith( colorScheme: Theme.of(context) .colorScheme - .copyWith(surfaceVariant: Colors.transparent), + .copyWith(surfaceContainerHighest: Colors.transparent), ), child: SliverOverlapAbsorber( handle: @@ -212,7 +212,7 @@ class SliverTabComponent extends StatelessWidget { isScrollable: true, labelColor: customColors.linkColor, indicator: const BoxDecoration(), - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ), ), ), diff --git a/lib/page/component/social_icon.dart b/lib/page/component/social_icon.dart index 486d6564..42e9b87f 100644 --- a/lib/page/component/social_icon.dart +++ b/lib/page/component/social_icon.dart @@ -110,9 +110,9 @@ class SocialIconGroup extends StatelessWidget { const SizedBox(width: 10), Text(e.name), ]), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (context) { diff --git a/lib/page/creative_island/draw/artistic_qr.dart b/lib/page/creative_island/draw/artistic_qr.dart index 0651b8d3..bd3c1e04 100644 --- a/lib/page/creative_island/draw/artistic_qr.dart +++ b/lib/page/creative_island/draw/artistic_qr.dart @@ -603,8 +603,9 @@ class _ArtisticQRScreenState extends State { stopPeriodQuery = false; cancel(); - // ignore: use_build_context_synchronously + Navigator.push( + // ignore: use_build_context_synchronously context, MaterialPageRoute( fullscreenDialog: true, diff --git a/lib/page/creative_island/draw/artistic_wordart.dart b/lib/page/creative_island/draw/artistic_wordart.dart index d866aef9..2d8c4803 100644 --- a/lib/page/creative_island/draw/artistic_wordart.dart +++ b/lib/page/creative_island/draw/artistic_wordart.dart @@ -24,7 +24,6 @@ import 'package:askaide/repo/api_server.dart'; import 'package:askaide/repo/model/misc.dart'; import 'package:askaide/repo/settings_repo.dart'; import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localization/flutter_localization.dart'; import 'package:go_router/go_router.dart'; @@ -460,8 +459,8 @@ class _ArtisticWordArtScreenState extends State { stopPeriodQuery = false; cancel(); - // ignore: use_build_context_synchronously Navigator.push( + // ignore: use_build_context_synchronously context, MaterialPageRoute( fullscreenDialog: true, diff --git a/lib/page/creative_island/draw/draw_create.dart b/lib/page/creative_island/draw/draw_create.dart index 87ae7f60..917938f9 100644 --- a/lib/page/creative_island/draw/draw_create.dart +++ b/lib/page/creative_island/draw/draw_create.dart @@ -924,8 +924,8 @@ class _DrawCreateScreenState extends State { stopPeriodQuery = false; - // ignore: use_build_context_synchronously Navigator.push( + // ignore: use_build_context_synchronously context, MaterialPageRoute( fullscreenDialog: true, @@ -957,8 +957,10 @@ class _DrawCreateScreenState extends State { if (!res.enough) { if (context.mounted) { showBeautyDialog( + // ignore: use_build_context_synchronously context, type: QuickAlertType.warning, + // ignore: use_build_context_synchronously text: AppLocale.quotaExceeded.getString(context), confirmBtnText: '立即购买', showCancelBtn: true, @@ -972,8 +974,8 @@ class _DrawCreateScreenState extends State { } if (res.cost > 0) { cancel(); - // ignore: use_build_context_synchronously openConfirmDialog( + // ignore: use_build_context_synchronously context, '本次请求预计消耗 ${res.cost} 个智慧果,是否继续操作?', () => request(res.waitDuration ?? 60), diff --git a/lib/page/creative_island/draw/image_edit_direct.dart b/lib/page/creative_island/draw/image_edit_direct.dart index 7344a3c7..751e92d7 100644 --- a/lib/page/creative_island/draw/image_edit_direct.dart +++ b/lib/page/creative_island/draw/image_edit_direct.dart @@ -492,8 +492,8 @@ class _ImageEditDirectScreenState extends State { stopPeriodQuery = false; - // ignore: use_build_context_synchronously Navigator.push( + // ignore: use_build_context_synchronously context, MaterialPageRoute( fullscreenDialog: true, diff --git a/lib/page/lab/prompt.dart b/lib/page/lab/prompt.dart index ddd8c545..ed769f92 100644 --- a/lib/page/lab/prompt.dart +++ b/lib/page/lab/prompt.dart @@ -59,7 +59,7 @@ class _PromptScreenState extends State { title: Text( AppLocale.examples.getString(context), style: TextStyle(color: customColors.linkColor), - textScaleFactor: 0.8, + textScaler: const TextScaler.linear(0.8), ), onTap: () { openSystemPromptSelectDialog( diff --git a/lib/page/setting/account_security.dart b/lib/page/setting/account_security.dart index bfd75d6f..cdb4193a 100644 --- a/lib/page/setting/account_security.dart +++ b/lib/page/setting/account_security.dart @@ -142,9 +142,9 @@ class _AccountSecurityScreenState extends State { fontSize: 13, ), ), - Icon( + const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), ], @@ -186,10 +186,9 @@ class _AccountSecurityScreenState extends State { const SizedBox(width: 5), if (state.user!.user.phone == null || state.user!.user.phone == '') - Icon( + const Icon( CupertinoIcons.chevron_forward, - size: - MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), ], @@ -224,10 +223,9 @@ class _AccountSecurityScreenState extends State { const SizedBox(width: 5), if (state.user!.user.unionId == null || state.user!.user.unionId == '') - Icon( + const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * - 18, + size: 18, color: Colors.grey, ), ], @@ -248,9 +246,9 @@ class _AccountSecurityScreenState extends State { title: Text(state.user!.control.isSetPassword ? '修改密码' : '设置密码'), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (context) { @@ -263,9 +261,9 @@ class _AccountSecurityScreenState extends State { tiles: [ SettingsTile( title: Text(AppLocale.signOut.getString(context)), - trailing: Icon( + trailing: const Icon( Icons.logout, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { diff --git a/lib/page/setting/bind_phone_page.dart b/lib/page/setting/bind_phone_page.dart index 53a9354d..47a349a5 100644 --- a/lib/page/setting/bind_phone_page.dart +++ b/lib/page/setting/bind_phone_page.dart @@ -293,11 +293,13 @@ class _BindPhoneScreenState extends State { if (widget.isSignIn) { if (context.mounted) { + // ignore: use_build_context_synchronously context.go( '${Ability().homeRoute}?show_initial_dialog=${value.isNewUser ? "true" : "false"}&reward=${value.reward}'); } } else { if (context.mounted) { + // ignore: use_build_context_synchronously showSuccessMessage(AppLocale.operateSuccess.getString(context)); } } diff --git a/lib/page/setting/custom_home_models.dart b/lib/page/setting/custom_home_models.dart index 23aaca97..240709ca 100644 --- a/lib/page/setting/custom_home_models.dart +++ b/lib/page/setting/custom_home_models.dart @@ -2,6 +2,7 @@ import 'package:askaide/helper/ability.dart'; import 'package:askaide/helper/constant.dart'; import 'package:askaide/helper/helper.dart'; import 'package:askaide/helper/image.dart'; +import 'package:askaide/helper/logger.dart'; import 'package:askaide/lang/lang.dart'; import 'package:askaide/page/component/background_container.dart'; import 'package:askaide/page/component/column_block.dart'; @@ -360,9 +361,9 @@ class HomeModelItem extends StatelessWidget { itemBuilder: (context, i) { var item = models[i]; if (item.avatarUrl == null) { - // TODO: remove this debug print - print(item.toJson()); + Logger.instance.w(item.toJson()); } + return ListTile( title: Container( alignment: Alignment.center, diff --git a/lib/page/setting/destroy_account.dart b/lib/page/setting/destroy_account.dart index 87c0f033..6eee2df8 100644 --- a/lib/page/setting/destroy_account.dart +++ b/lib/page/setting/destroy_account.dart @@ -144,6 +144,7 @@ class _DestroyAccountScreenState extends State { showSuccessMessage('账号注销成功'); if (context.mounted) { + // ignore: use_build_context_synchronously context.go('/login'); } }).catchError((e) { diff --git a/lib/page/setting/diagnosis.dart b/lib/page/setting/diagnosis.dart index bf132fc0..6f670df7 100644 --- a/lib/page/setting/diagnosis.dart +++ b/lib/page/setting/diagnosis.dart @@ -107,8 +107,8 @@ class _DiagnosisScreenState extends State { .invokeMethod('SystemNavigator.pop'); } catch (e) { Logger.instance.e(e); - // ignore: use_build_context_synchronously showBeautyDialog( + // ignore: use_build_context_synchronously context, type: QuickAlertType.error, text: '数据文件删除失败,请先关闭应用后,手动删除目录 $databasePath 之后再重启应用', diff --git a/lib/page/setting/setting_screen.dart b/lib/page/setting/setting_screen.dart index 68a4697b..339a9c6d 100644 --- a/lib/page/setting/setting_screen.dart +++ b/lib/page/setting/setting_screen.dart @@ -139,9 +139,9 @@ class _SettingScreenState extends State { if (PlatformTool.isWeb()) SettingsTile( title: const Text('APP 下载'), - trailing: Icon( + trailing: const Icon( Icons.download, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (context) { @@ -155,9 +155,9 @@ class _SettingScreenState extends State { if (Ability().serviceStatusPage != '') SettingsTile( title: const Text('服务状态'), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -167,9 +167,9 @@ class _SettingScreenState extends State { // 清空缓存 SettingsTile( title: Text(AppLocale.clearCache.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.refresh, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -198,9 +198,9 @@ class _SettingScreenState extends State { if (!PlatformTool.isIOS()) SettingsTile( title: Text(AppLocale.updateCheck.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -230,9 +230,9 @@ class _SettingScreenState extends State { // 用户协议 SettingsTile( title: Text(AppLocale.userTerms.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -243,9 +243,9 @@ class _SettingScreenState extends State { // 隐私政策 SettingsTile( title: Text(AppLocale.privacyPolicy.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -257,9 +257,9 @@ class _SettingScreenState extends State { // 关于 SettingsTile( title: Text(AppLocale.about.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -422,9 +422,9 @@ class _SettingScreenState extends State { SettingsTile _buildCommonLanguageSetting() { return SettingsTile( title: Text(AppLocale.language.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -515,9 +515,9 @@ class _SettingScreenState extends State { return [ SettingsTile( title: Text(resolveError(context, state.error!)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -541,9 +541,9 @@ class _SettingScreenState extends State { fontSize: 13, ), ), - Icon( + const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), ]), @@ -553,9 +553,9 @@ class _SettingScreenState extends State { ), SettingsTile( title: const Text('免费畅享额度'), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (context) { @@ -575,9 +575,9 @@ class _SettingScreenState extends State { SettingsTile( leading: const Icon(Icons.account_circle), title: Text(AppLocale.signIn.getString(context)), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) { @@ -707,9 +707,9 @@ class _SettingScreenState extends State { SettingsTile _buildServerSelfHostedSetting(CustomColors customColors) { return SettingsTile( title: const Text('自定义服务器'), - trailing: Icon( + trailing: const Icon( CupertinoIcons.chevron_forward, - size: MediaQuery.of(context).textScaleFactor * 18, + size: 18, color: Colors.grey, ), onPressed: (_) {