Skip to content

Commit

Permalink
Add support for Flutter 3.22 (#1250)
Browse files Browse the repository at this point in the history
* [core] Drop support for Flutter@3.7: Implement const constructor for sub-class of `MultiChildRenderObjectWidget`
* [fwfh_just_audio] Drop support for Flutter@3.7
* Replace the deprecated `ImageProvider.loadBuffer` with `.loadImage`
* Sync `html_flex.dart`
* Build demo web app with WebAssembly support
  • Loading branch information
daohoangson authored May 18, 2024
1 parent 168a0de commit cb1ebc5
Show file tree
Hide file tree
Showing 387 changed files with 244 additions and 288 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/demo_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
working-directory: demo_app
environment:
name: vercel
url: ${{ steps.now.outputs.url }}
permissions:
# write permissions are needed for `comment-on-github` step
contents: write
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:
_url=$( cat build/appetize.json | jq -r .publicURL )
echo "url=${_url}" >> $GITHUB_OUTPUT
- run: flutter build web
- run: flutter build web --wasm
- name: Generate supported/tags.html
run: |
set -e
Expand All @@ -62,30 +63,28 @@ jobs:
run: cp -R build/app/outputs/apk/release build/web/apks

- name: Deploy via Vercel
# https://github.com/vercel/vercel/discussions/4468
id: now
env:
PROJECT_JSON: ${{ secrets.EXAMPLE_PROJECT_JSON }}
TOKEN: ${{ secrets.ZEIT_TOKEN }}
if: env.PROJECT_JSON != null && env.TOKEN != null
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.ZEIT_TOKEN }}
run: |
set -e
cd ./build/web
{ \
echo '{'; \
echo ' "version": 2,'; \
echo ' "builds": ['; \
echo ' { "src": "./**/*", "use": "@now/static" }'; \
echo ' ]'; \
echo '}'; \
} > ./now.json
mkdir -p ./.now && echo "$PROJECT_JSON" > ./.now/project.json
echo '{' >vercel.json
echo ' "headers": [ { "source": "/(.*)", "headers": [' >>vercel.json
echo ' { "key": "Cross-Origin-Embedder-Policy", "value": "credentialless" },' >>vercel.json
echo ' { "key": "Cross-Origin-Opener-Policy", "value": "same-origin" }' >>vercel.json
echo ' ] } ],' >>vercel.json
echo ' "rewrites":[ { "source": "/(.*)", "destination":"/" } ]' >>vercel.json
echo '}' >>vercel.json
if [ $GITHUB_REF == 'refs/heads/master' ]; then
_url=$( now --prod --token "$TOKEN" )
_url=$( vercel --prod --token "${VERCEL_TOKEN}" )
else
_url=$( now --token "$TOKEN" )
_url=$( vercel --token "${VERCEL_TOKEN}" )
fi
echo "url=${_url}" >> $GITHUB_OUTPUT
- name: Create comment
Expand All @@ -102,7 +101,7 @@ jobs:
- [app-x86_64-release.apk](${{ steps.now.outputs.url }}/apks/app-x86_64-release.apk)
- [Debug APK](${{ steps.appetize.outputs.url }}) via https://appetize.io
Web build has been deployed to ${{ steps.now.outputs.url }}. Quick links:
WebAssembly build has been deployed to ${{ steps.now.outputs.url }}. Quick links:
- [supported/tags.html](${{ steps.now.outputs.url }}/supported/tags.html)
- [Hello World](${{ steps.now.outputs.url }}/#/helloworld)
Expand Down
22 changes: 11 additions & 11 deletions demo_app/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "54e66469a933b60ddf175f858f82eaeb97e48c8d"
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
channel: "stable"

project_type: app
Expand All @@ -13,20 +13,20 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: android
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: ios
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: macos
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: web
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1

# User provided section

Expand Down
45 changes: 21 additions & 24 deletions demo_app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,58 +1,55 @@
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')
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = '1'
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = '1.0'
flutterVersionName = "1.0"
}

android {
namespace "dev.fwfh.demo_app"
compileSdk flutter.compileSdkVersion
namespace = "dev.fwfh.demo_app"
compileSdk = flutter.compileSdkVersion

// TODO: remove hard-coded value when `flutter.ndkVersion` is sufficient
// open $(dirname $(dirname $(which flutter)))/packages/flutter_tools
ndkVersion "26.1.10909125"
ndkVersion = "26.1.10909125"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
jvmTarget = "1.8"
}

defaultConfig {
applicationId "dev.fwfh.demo_app"
applicationId = "dev.fwfh.demo_app"

// TODO: remove hard-coded value when `flutter.minSdkVersion` is sufficient
// open $(dirname $(dirname $(which flutter)))/packages/flutter_tools
minSdkVersion 21
minSdk = 21

targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName

// https://patrol.leancode.co/getting-started
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
Expand All @@ -70,10 +67,10 @@ android {

buildTypes {
debug {
signingConfig signingConfigs.demo
signingConfig = signingConfigs.demo
}
release {
signingConfig signingConfigs.demo
signingConfig = signingConfigs.demo
}
}

Expand All @@ -84,7 +81,7 @@ android {
}

flutter {
source '../..'
source = "../.."
}

dependencies {
Expand Down
3 changes: 2 additions & 1 deletion demo_app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
Expand All @@ -33,7 +34,7 @@
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
Expand Down
4 changes: 2 additions & 2 deletions demo_app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,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) {
Expand Down
2 changes: 1 addition & 1 deletion demo_app/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
5 changes: 2 additions & 3 deletions demo_app/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ pluginManagement {
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
}()

includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
Expand Down
6 changes: 3 additions & 3 deletions demo_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
patrol: 3e21d514020dbee24b3e3383caac9e8e051292ac
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
video_player_avfoundation: 2b4384f3b157206b5e150a0083cdc0c905d260d3
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36

Expand Down
2 changes: 1 addition & 1 deletion demo_app/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIKit
import Flutter
import UIKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
Expand Down
6 changes: 3 additions & 3 deletions demo_app/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
just_audio: 9b67ca7b97c61cfc9784ea23cd8cc55eb226d489
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
patrol: 3e21d514020dbee24b3e3383caac9e8e051292ac
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
video_player_avfoundation: 2b4384f3b157206b5e150a0083cdc0c905d260d3
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
Expand Down
2 changes: 1 addition & 1 deletion demo_app/macos/RunnerTests/RunnerTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import FlutterMacOS
import Cocoa
import FlutterMacOS
import XCTest

class RunnerTests: XCTestCase {
Expand Down
Loading

1 comment on commit cb1ebc5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.