Skip to content

Commit 0e9d4ea

Browse files
committed
Flutter v3 Upgrade
1 parent cd3fea0 commit 0e9d4ea

File tree

12 files changed

+150
-85
lines changed

12 files changed

+150
-85
lines changed

.metadata

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c
7+
revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
88
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
17+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
18+
- platform: android
19+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
20+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
21+
- platform: ios
22+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
23+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
24+
- platform: linux
25+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
26+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
27+
- platform: macos
28+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
29+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
30+
- platform: web
31+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
32+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
33+
- platform: windows
34+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
35+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@
4343
</array>
4444
<key>UIViewControllerBasedStatusBarAppearance</key>
4545
<false/>
46+
<key>CADisableMinimumFrameDurationOnPhone</key>
47+
<true/>
4648
</dict>
4749
</plist>

linux/CMakeLists.txt

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
# Project-level configuration.
12
cmake_minimum_required(VERSION 3.10)
23
project(runner LANGUAGES CXX)
34

5+
# The name of the executable created for the application. Change this to change
6+
# the on-disk name of your application.
47
set(BINARY_NAME "minimal")
8+
# The unique GTK application identifier for this application. See:
9+
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
510
set(APPLICATION_ID "com.minimal")
611

12+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13+
# versions of CMake.
714
cmake_policy(SET CMP0063 NEW)
815

16+
# Load bundled libraries from the lib/ directory relative to the binary.
917
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
1018

1119
# Root filesystem for cross-building.
@@ -18,7 +26,7 @@ if(FLUTTER_TARGET_PLATFORM_SYSROOT)
1826
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
1927
endif()
2028

21-
# Configure build options.
29+
# Define build configuration options.
2230
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2331
set(CMAKE_BUILD_TYPE "Debug" CACHE
2432
STRING "Flutter build mode" FORCE)
@@ -27,16 +35,19 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2735
endif()
2836

2937
# Compilation settings that should be applied to most targets.
38+
#
39+
# Be cautious about adding new options here, as plugins use this function by
40+
# default. In most cases, you should add new options to specific targets instead
41+
# of modifying this function.
3042
function(APPLY_STANDARD_SETTINGS TARGET)
3143
target_compile_features(${TARGET} PUBLIC cxx_std_14)
3244
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
3345
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
3446
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
3547
endfunction()
3648

37-
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
38-
3949
# Flutter library and tool build rules.
50+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
4051
add_subdirectory(${FLUTTER_MANAGED_DIR})
4152

4253
# System-level dependencies.
@@ -45,16 +56,27 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
4556

4657
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
4758

48-
# Application build
59+
# Define the application target. To change its name, change BINARY_NAME above,
60+
# not the value here, or `flutter run` will no longer work.
61+
#
62+
# Any new source files that you add to the application should be added here.
4963
add_executable(${BINARY_NAME}
5064
"main.cc"
5165
"my_application.cc"
5266
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
5367
)
68+
69+
# Apply the standard set of build settings. This can be removed for applications
70+
# that need different build settings.
5471
apply_standard_settings(${BINARY_NAME})
72+
73+
# Add dependency libraries. Add any application-specific dependencies here.
5574
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
5675
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76+
77+
# Run the Flutter tool portions of the build. This must not be removed.
5778
add_dependencies(${BINARY_NAME} flutter_assemble)
79+
5880
# Only the install-generated bundle's copy of the executable will launch
5981
# correctly, since the resources must in the right relative locations. To avoid
6082
# people trying to run the unbundled copy, put it in a subdirectory instead of
@@ -94,11 +116,11 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}
94116
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
95117
COMPONENT Runtime)
96118

97-
if(PLUGIN_BUNDLED_LIBRARIES)
98-
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
119+
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
120+
install(FILES "${bundled_library}"
99121
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
100122
COMPONENT Runtime)
101-
endif()
123+
endforeach(bundled_library)
102124

103125
# Fully re-copy the assets directory on each build to avoid having stale files
104126
# from a previous install.

linux/flutter/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This file controls Flutter-level build steps. It should not be edited.
12
cmake_minimum_required(VERSION 3.10)
23

34
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")

linux/flutter/generated_plugins.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
list(APPEND FLUTTER_PLUGIN_LIST
66
)
77

8+
list(APPEND FLUTTER_FFI_PLUGIN_LIST
9+
)
10+
811
set(PLUGIN_BUNDLED_LIBRARIES)
912

1013
foreach(plugin ${FLUTTER_PLUGIN_LIST})
@@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
1316
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
1417
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
1518
endforeach(plugin)
19+
20+
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23+
endforeach(ffi_plugin)

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ dependencies:
1111
# responsive_framework:
1212
# path: ../
1313
# Uncomment to build standalone project.
14-
responsive_framework: ^0.1.6
15-
google_fonts: ^2.3.1
14+
responsive_framework: ^0.1.7
15+
google_fonts: ^2.3.2
1616
animations: ^2.0.2
1717
loading_gifs: ^0.3.0
1818

web/index.html

Lines changed: 31 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<!--
5+
If you are serving your web app in a path other than the root, change the
6+
href value below to reflect the base path you are serving from.
7+
8+
The path provided below has to start and end with a slash "/" in order for
9+
it to work correctly.
10+
11+
For more details:
12+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13+
14+
This is a placeholder for base href that will be replaced by the value of
15+
the `--base-href` argument provided to `flutter build`.
16+
-->
417
<base href="$FLUTTER_BASE_HREF">
518

619
<meta charset="UTF-8">
@@ -18,74 +31,28 @@
1831

1932
<title>Minimal</title>
2033
<link rel="manifest" href="manifest.json">
34+
35+
<script>
36+
// The value below is injected by flutter build, do not touch.
37+
var serviceWorkerVersion = null;
38+
</script>
39+
<!-- This script adds the flutter initialization JS code -->
40+
<script src="flutter.js" defer></script>
2141
</head>
2242
<body>
23-
<!-- This script installs service_worker.js to provide PWA functionality to
24-
application. For more information, see:
25-
https://developers.google.com/web/fundamentals/primers/service-workers -->
2643
<script>
27-
var serviceWorkerVersion = null;
28-
var scriptLoaded = false;
29-
function loadMainDartJs() {
30-
if (scriptLoaded) {
31-
return;
32-
}
33-
scriptLoaded = true;
34-
var scriptTag = document.createElement('script');
35-
scriptTag.src = 'main.dart.js';
36-
scriptTag.type = 'application/javascript';
37-
document.body.append(scriptTag);
38-
}
39-
40-
if ('serviceWorker' in navigator) {
41-
// Service workers are supported. Use them.
42-
window.addEventListener('load', function () {
43-
// Wait for registration to finish before dropping the <script> tag.
44-
// Otherwise, the browser will load the script multiple times,
45-
// potentially different versions.
46-
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
47-
navigator.serviceWorker.register(serviceWorkerUrl)
48-
.then((reg) => {
49-
function waitForActivation(serviceWorker) {
50-
serviceWorker.addEventListener('statechange', () => {
51-
if (serviceWorker.state == 'activated') {
52-
console.log('Installed new service worker.');
53-
loadMainDartJs();
54-
}
55-
});
56-
}
57-
if (!reg.active && (reg.installing || reg.waiting)) {
58-
// No active web worker and we have installed or are installing
59-
// one for the first time. Simply wait for it to activate.
60-
waitForActivation(reg.installing || reg.waiting);
61-
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
62-
// When the app updates the serviceWorkerVersion changes, so we
63-
// need to ask the service worker to update.
64-
console.log('New service worker available.');
65-
reg.update();
66-
waitForActivation(reg.installing);
67-
} else {
68-
// Existing service worker is still good.
69-
console.log('Loading app from service worker.');
70-
loadMainDartJs();
71-
}
72-
});
73-
74-
// If service worker doesn't succeed in a reasonable amount of time,
75-
// fallback to plaint <script> tag.
76-
setTimeout(() => {
77-
if (!scriptLoaded) {
78-
console.warn(
79-
'Failed to load app from service worker. Falling back to plain <script> tag.',
80-
);
81-
loadMainDartJs();
82-
}
83-
}, 4000);
44+
window.addEventListener('load', function(ev) {
45+
// Download main.dart.js
46+
_flutter.loader.loadEntrypoint({
47+
serviceWorker: {
48+
serviceWorkerVersion: serviceWorkerVersion,
49+
}
50+
}).then(function(engineInitializer) {
51+
return engineInitializer.initializeEngine();
52+
}).then(function(appRunner) {
53+
return appRunner.runApp();
8454
});
85-
} else {
86-
// Service workers not supported. Just drop the <script> tag.
87-
loadMainDartJs();
88-
}
55+
});
8956
</script>
9057
</body>
9158
</html>

windows/CMakeLists.txt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
# Project-level configuration.
12
cmake_minimum_required(VERSION 3.14)
23
project(minimal LANGUAGES CXX)
34

5+
# The name of the executable created for the application. Change this to change
6+
# the on-disk name of your application.
47
set(BINARY_NAME "minimal")
58

9+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10+
# versions of CMake.
611
cmake_policy(SET CMP0063 NEW)
712

8-
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9-
10-
# Configure build options.
13+
# Define build configuration option.
1114
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
1215
if(IS_MULTICONFIG)
1316
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
@@ -20,7 +23,7 @@ else()
2023
"Debug" "Profile" "Release")
2124
endif()
2225
endif()
23-
26+
# Define settings for the Profile build mode.
2427
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
2528
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
2629
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
@@ -30,6 +33,10 @@ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
3033
add_definitions(-DUNICODE -D_UNICODE)
3134

3235
# Compilation settings that should be applied to most targets.
36+
#
37+
# Be cautious about adding new options here, as plugins use this function by
38+
# default. In most cases, you should add new options to specific targets instead
39+
# of modifying this function.
3340
function(APPLY_STANDARD_SETTINGS TARGET)
3441
target_compile_features(${TARGET} PUBLIC cxx_std_17)
3542
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
@@ -38,12 +45,11 @@ function(APPLY_STANDARD_SETTINGS TARGET)
3845
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
3946
endfunction()
4047

41-
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42-
4348
# Flutter library and tool build rules.
49+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
4450
add_subdirectory(${FLUTTER_MANAGED_DIR})
4551

46-
# Application build
52+
# Application build; see runner/CMakeLists.txt.
4753
add_subdirectory("runner")
4854

4955
# Generated plugin build rules, which manage building the plugins and adding

windows/flutter/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This file controls Flutter-level build steps. It should not be edited.
12
cmake_minimum_required(VERSION 3.14)
23

34
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")

windows/flutter/generated_plugins.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
list(APPEND FLUTTER_PLUGIN_LIST
66
)
77

8+
list(APPEND FLUTTER_FFI_PLUGIN_LIST
9+
)
10+
811
set(PLUGIN_BUNDLED_LIBRARIES)
912

1013
foreach(plugin ${FLUTTER_PLUGIN_LIST})
@@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
1316
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
1417
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
1518
endforeach(plugin)
19+
20+
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23+
endforeach(ffi_plugin)

0 commit comments

Comments
 (0)