From 470cff2d61d317f324e2f3c041c77cef93015c61 Mon Sep 17 00:00:00 2001 From: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:54:36 +0200 Subject: [PATCH] Update flutter version in CI and fix deprecation warning --- .github/workflows/dart.yaml | 1 - tictactoe_dart/lib/main.dart | 2 +- tictactoe_dart/windows/flutter/CMakeLists.txt | 7 ++++++- tictactoe_dart/windows/runner/flutter_window.cpp | 5 +++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dart.yaml b/.github/workflows/dart.yaml index 57ac49c..63d385f 100644 --- a/.github/workflows/dart.yaml +++ b/.github/workflows/dart.yaml @@ -21,7 +21,6 @@ jobs: with: cache: true channel: stable - flutter-version: 3.19.0 - name: Setup flutter dependencies run: | flutter --version diff --git a/tictactoe_dart/lib/main.dart b/tictactoe_dart/lib/main.dart index 316afee..83b59b9 100644 --- a/tictactoe_dart/lib/main.dart +++ b/tictactoe_dart/lib/main.dart @@ -557,7 +557,7 @@ class BoardTile extends StatelessWidget { child: ElevatedButton( onPressed: buttonFunction, style: ButtonStyle( - shape: MaterialStateProperty.all( + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0), ), diff --git a/tictactoe_dart/windows/flutter/CMakeLists.txt b/tictactoe_dart/windows/flutter/CMakeLists.txt index 930d207..903f489 100644 --- a/tictactoe_dart/windows/flutter/CMakeLists.txt +++ b/tictactoe_dart/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 diff --git a/tictactoe_dart/windows/runner/flutter_window.cpp b/tictactoe_dart/windows/runner/flutter_window.cpp index b25e363..955ee30 100644 --- a/tictactoe_dart/windows/runner/flutter_window.cpp +++ b/tictactoe_dart/windows/runner/flutter_window.cpp @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() { this->Show(); }); + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + return true; }