From f548db83b1aa38f54295b40e35512ffc866b26e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Wed, 31 Aug 2022 21:32:17 +0800 Subject: [PATCH] flutter 3.3 --- .metadata | 12 +++++----- lib/src/main.dart | 35 +++++++++++++++------------ pubspec.lock | 45 ++++++++++++++++++++--------------- pubspec.yaml | 9 ++++--- windows.sh | 2 +- windows/runner/CMakeLists.txt | 22 +++++++++++++++++ windows/runner/Runner.rc | 12 +++++----- 7 files changed, 87 insertions(+), 50 deletions(-) diff --git a/.metadata b/.metadata index f5dde3d5..bb31f8dc 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled. version: - revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 channel: stable project_type: app @@ -13,11 +13,11 @@ project_type: app migration: platforms: - platform: root - create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 - base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 - - platform: linux - create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 - base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + - platform: windows + create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 # User provided section diff --git a/lib/src/main.dart b/lib/src/main.dart index 5eb8ee84..f315ab3a 100644 --- a/lib/src/main.dart +++ b/lib/src/main.dart @@ -39,22 +39,11 @@ import 'network/eh_cache_interceptor.dart'; import 'network/eh_cookie_manager.dart'; void main() async { - FlutterError.onError = (FlutterErrorDetails details) { - Log.error(details.exception, null, details.stack); - Log.upload(details.exception, stackTrace: details.stack); - }; + await init(); - runZonedGuarded(() async { - await init(); - runApp(const MyApp()); - _doForDesktop(); - }, (Object error, StackTrace stack) { - if (error is NotUploadException) { - return; - } - Log.error(error, null, stack); - Log.upload(error, stackTrace: stack); - }); + runApp(const MyApp()); + + _doForDesktop(); } class MyApp extends StatelessWidget { @@ -84,6 +73,21 @@ class MyApp extends StatelessWidget { } Future init() async { + FlutterError.onError = (FlutterErrorDetails details) { + Log.error(details.exception, null, details.stack); + Log.upload(details.exception, stackTrace: details.stack); + }; + + PlatformDispatcher.instance.onError = (error, stack) { + if (error is NotUploadException) { + return true; + } + + Log.error('PlatformDispatcher Error', error, stack); + Log.upload(error, stackTrace: stack); + return false; + }; + WidgetsFlutterBinding.ensureInitialized(); if (SentryConfig.dsn.isNotEmpty && !kDebugMode) { @@ -137,6 +141,7 @@ void _doForDesktop() { if (!GetPlatform.isDesktop) { return; } + doWhenWindowReady(() { appWindow.title = 'JHenTai'; appWindow.show(); diff --git a/pubspec.lock b/pubspec.lock index 26827e0c..7d3a9679 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -49,7 +49,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.8.2" + version: "2.9.0" audio_session: dependency: transitive description: @@ -205,7 +205,7 @@ packages: source: hosted version: "8.3.3" cached_network_image: - dependency: "direct main" + dependency: "direct overridden" description: name: cached_network_image url: "https://pub.flutter-io.cn" @@ -231,7 +231,7 @@ packages: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -273,7 +273,7 @@ packages: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -429,7 +429,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: @@ -621,12 +621,12 @@ packages: source: hosted version: "0.7.2" fwfh_text_style: - dependency: transitive + dependency: "direct overridden" description: name: fwfh_text_style url: "https://pub.flutter-io.cn" source: hosted - version: "2.7.3+2" + version: "2.22.08+1" fwfh_url_launcher: dependency: transitive description: @@ -635,7 +635,7 @@ packages: source: hosted version: "0.6.1+3" fwfh_webview: - dependency: "direct main" + dependency: "direct overridden" description: name: fwfh_webview url: "https://pub.flutter-io.cn" @@ -669,6 +669,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" + grouped_list: + dependency: "direct main" + description: + name: grouped_list + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.1.2" hashcodes: dependency: transitive description: @@ -815,21 +822,21 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -913,7 +920,7 @@ packages: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.1" + version: "1.8.2" path_drawing: dependency: transitive description: @@ -1235,7 +1242,7 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.2" + version: "1.9.0" sqflite: dependency: transitive description: @@ -1298,7 +1305,7 @@ packages: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.1.1" syncfusion_flutter_charts: dependency: "direct main" description: @@ -1326,28 +1333,28 @@ packages: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "1.2.1" test: dependency: "direct dev" description: name: test url: "https://pub.flutter-io.cn" source: hosted - version: "1.21.1" + version: "1.21.4" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.9" + version: "0.4.12" test_core: dependency: transitive description: name: test_core url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.13" + version: "0.4.16" throttling: dependency: "direct main" description: @@ -1475,7 +1482,7 @@ packages: source: hosted version: "2.0.10" visibility_detector: - dependency: "direct main" + dependency: "direct overridden" description: name: visibility_detector url: "https://pub.flutter-io.cn" diff --git a/pubspec.yaml b/pubspec.yaml index 2df00991..fc098d42 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,7 +34,6 @@ dependencies: clipboard: ^0.1.3 scrollable_positioned_list: ^0.3.2 flutter_list_view: ^1.1.18 - fwfh_webview: ^0.6.2+3 # todo: remove executor: ^2.2.2 retry: ^3.1.0 path: ^1.8.0 @@ -43,8 +42,6 @@ dependencies: path_provider: ^2.0.9 flutter_slidable: ^2.0.0 flutter_widget_from_html: ^0.8.5 - cached_network_image: ^3.2.1 # todo: remove - visibility_detector: ^0.3.3 # todo: remove url_launcher: ^6.1.5 like_button: ^2.0.4 webview_flutter: ^3.0.4 @@ -68,12 +65,18 @@ dependencies: receive_sharing_intent: ^1.4.5 bitsdojo_window: ^0.1.2 permission_handler: 9.2.0 + grouped_list: ^5.1.2 dependency_overrides: dio: git: url: https://gitee.com/jiangtian616/dio path: dio + visibility_detector: ^0.3.3 + cached_network_image: ^3.2.1 + fwfh_webview: ^0.6.2+3 + fwfh_text_style: ^2.22.8+1 + dev_dependencies: flutter_test: diff --git a/windows.sh b/windows.sh index 79f751d5..b7cacbc4 100644 --- a/windows.sh +++ b/windows.sh @@ -1,6 +1,6 @@ version=$(head -n 5 pubspec.yaml | tail -n 1 | cut -d ' ' -f 2) -flutter build windows -t lib/src/main.dart \ +flutter build windows --build-name=JHenTai --build-number=${version} -t lib/src/main.dart \ && cp -r build/windows/runner/Release/ ~/Desktop/JHenTai_${version}_windows/ \ && cd ~/Desktop \ && zip -ro JHenTai_${version}_windows.zip JHenTai_${version}_windows \ diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt index de2d8916..17411a8a 100644 --- a/windows/runner/CMakeLists.txt +++ b/windows/runner/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" @@ -10,8 +15,25 @@ add_executable(${BINARY_NAME} WIN32 "Runner.rc" "runner.exe.manifest" ) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 392d0489..b153de47 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -60,16 +60,16 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" // Version // -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD #else -#define VERSION_AS_NUMBER 3,3,0 +#define VERSION_AS_NUMBER 1,0,0,0 #endif -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION #else -#define VERSION_AS_STRING "3.3.0" +#define VERSION_AS_STRING "1.0.0" #endif VS_VERSION_INFO VERSIONINFO