From a19d4d668694fe40602fa777e70baaf570743c25 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sun, 11 Feb 2024 00:15:11 +0800 Subject: [PATCH] upgrade flutter to 3.16.9 (#7099) Signed-off-by: 21pages --- .github/workflows/bridge.yml | 2 +- .github/workflows/flutter-build.yml | 10 +++++----- .github/workflows/history.yml | 2 +- build.py | 2 +- flutter/lib/common.dart | 3 +++ flutter/lib/desktop/widgets/remote_toolbar.dart | 17 +++++++++-------- flutter/windows/flutter/CMakeLists.txt | 7 ++++++- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/bridge.yml b/.github/workflows/bridge.yml index 5cc4bb788..c50d55025 100644 --- a/.github/workflows/bridge.yml +++ b/.github/workflows/bridge.yml @@ -6,7 +6,7 @@ on: workflow_call: env: - FLUTTER_VERSION: "3.13.9" + FLUTTER_VERSION: "3.16.9" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" jobs: diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index 7027dbb45..6b115c2af 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -13,11 +13,11 @@ on: env: CARGO_NDK_VERSION: "3.1.2" LLVM_VERSION: "15.0.6" - FLUTTER_VERSION: "3.13.9" + FLUTTER_VERSION: "3.16.9" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" # for arm64 linux because official Dart SDK does not work - FLUTTER_ELINUX_VERSION: "3.13.9" - FLUTTER_ELINUX_COMMIT_ID: "f4d4205893c16b0aa9cb6ba46b9f32b639d3b057" + FLUTTER_ELINUX_VERSION: "3.16.9" + FLUTTER_ELINUX_COMMIT_ID: "c02bd16e1630f5bd690b85c5c2456ac1920e25af" TAG_NAME: "${{ inputs.upload-tag }}" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # vcpkg version: 2023.10.19 @@ -73,7 +73,7 @@ jobs: run: | flutter doctor -v flutter precache --windows - Invoke-WebRequest -Uri https://github.com/fufesou/flutter-engine/releases/download/bugfix-crash-windows-angle-context-frameBuffer/windows-x64-release.zip -OutFile windows-x64-flutter-release.zip + Invoke-WebRequest -Uri https://github.com/fufesou/flutter-engine/releases/download/bugfix-subwindow-crash-3.16.9-apply-pull-47787/windows-x64-release.zip -OutFile windows-x64-flutter-release.zip Expand-Archive windows-x64-flutter-release.zip -DestinationPath . mv -Force windows-x64-release/* C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ @@ -141,7 +141,7 @@ jobs: if: env.UPLOAD_ARTIFACT == 'true' run: | pushd ./libs/portable - python3 ./generate.py -f ../../flutter/build/windows/runner/Release/ -o . -e ../../flutter/build/windows/runner/Release/rustdesk.exe + python3 ./generate.py -f ../../flutter/build/windows/x64/runner/Release/ -o . -e ../../flutter/build/windows/x64/runner/Release/rustdesk.exe popd mkdir -p ./SignOutput mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe diff --git a/.github/workflows/history.yml b/.github/workflows/history.yml index 5d7842fd4..f016494a8 100644 --- a/.github/workflows/history.yml +++ b/.github/workflows/history.yml @@ -4,7 +4,7 @@ on: [workflow_dispatch] env: LLVM_VERSION: "10.0" - FLUTTER_VERSION: "3.13.9" + FLUTTER_VERSION: "3.16.9" TAG_NAME: "tmp" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" diff --git a/build.py b/build.py index 58ea83464..e47835dee 100755 --- a/build.py +++ b/build.py @@ -16,7 +16,7 @@ osx = platform.platform().startswith( hbb_name = 'rustdesk' + ('.exe' if windows else '') exe_path = 'target/release/' + hbb_name if windows: - flutter_build_dir = 'build/windows/runner/Release/' + flutter_build_dir = 'build/windows/x64/runner/Release/' elif osx: flutter_build_dir = 'build/macos/Build/Products/Release/' else: diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 49c74cadb..287bc3c0b 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -326,6 +326,8 @@ class MyTheme { ); static ThemeData lightTheme = ThemeData( + // https://stackoverflow.com/questions/77537315/after-upgrading-to-flutter-3-16-the-app-bar-background-color-button-size-and + useMaterial3: false, brightness: Brightness.light, hoverColor: Color.fromARGB(255, 224, 224, 224), scaffoldBackgroundColor: Colors.white, @@ -418,6 +420,7 @@ class MyTheme { ], ); static ThemeData darkTheme = ThemeData( + useMaterial3: false, brightness: Brightness.dark, hoverColor: Color.fromARGB(255, 45, 46, 53), scaffoldBackgroundColor: Color(0xFF18191E), diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index ab937787c..e035578e6 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -1327,7 +1327,8 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { } } - _onChanged(BuildContext context, String? value) async { + // This widget has been unmounted, so the State no longer has a context + _onChanged(String? value) async { if (pi.currentDisplay == kAllDisplayValue) { return; } @@ -1350,12 +1351,12 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { if (w != null && h != null) { if (w != rect?.width.toInt() || h != rect?.height.toInt()) { - await _changeResolution(context, w, h); + await _changeResolution(w, h); } } } - _changeResolution(BuildContext context, int w, int h) async { + _changeResolution(int w, int h) async { if (pi.currentDisplay == kAllDisplayValue) { return; } @@ -1387,8 +1388,8 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { return Offstage( offstage: !showOriginalBtn, child: MenuButton( - onPressed: () => _changeResolution( - context, display.originalWidth, display.originalHeight), + onPressed: () => + _changeResolution(display.originalWidth, display.originalHeight), ffi: widget.ffi, child: Text( '${translate('resolution_original_tip')} ${display.originalWidth}x${display.originalHeight}'), @@ -1404,7 +1405,7 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { onPressed: () { final resolution = _getBestFitResolution(); if (resolution != null) { - _changeResolution(context, resolution.width, resolution.height); + _changeResolution(resolution.width, resolution.height); } }, ffi: widget.ffi, @@ -1420,7 +1421,7 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { child: RdoMenuButton( value: _kCustomResolutionValue, groupValue: _groupValue, - onChanged: (String? value) => _onChanged(context, value), + onChanged: (String? value) => _onChanged(value), ffi: widget.ffi, child: Row( children: [ @@ -1461,7 +1462,7 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { .map((e) => RdoMenuButton( value: '${e.width}x${e.height}', groupValue: _groupValue, - onChanged: (String? value) => _onChanged(context, value), + onChanged: (String? value) => _onChanged(value), ffi: widget.ffi, child: Text('${e.width}x${e.height}'))) .toList(); diff --git a/flutter/windows/flutter/CMakeLists.txt b/flutter/windows/flutter/CMakeLists.txt index b5655b2fa..27ecd3108 100644 --- a/flutter/windows/flutter/CMakeLists.txt +++ b/flutter/windows/flutter/CMakeLists.txt @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -92,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS