Skip to content

Commit 44541cc

Browse files
committed
null-safety
1 parent 9e2baae commit 44541cc

File tree

80 files changed

+1814
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1814
-413
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ pubspec.lock
7272
!**/ios/**/default.pbxuser
7373
!**/ios/**/default.perspectivev3
7474
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
75+
76+
pubspec.lock
77+
example/pubspec.lock

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.0
2+
> 2021-08-08
3+
4+
- 支持 null-safety
5+
16
## 0.1.1
27
> 移除无用代码
38

example/android/.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
key.properties

example/android/app/build.gradle

+3-11
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,19 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 28
29+
compileSdkVersion 30
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
3333
}
3434

35-
lintOptions {
36-
disable 'InvalidPackage'
37-
}
38-
3935
defaultConfig {
4036
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41-
applicationId "cn.yshye.mini_canvas_example"
37+
applicationId "com.example.example"
4238
minSdkVersion 16
43-
targetSdkVersion 28
39+
targetSdkVersion 30
4440
versionCode flutterVersionCode.toInteger()
4541
versionName flutterVersionName
46-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
4742
}
4843

4944
buildTypes {
@@ -61,7 +56,4 @@ flutter {
6156

6257
dependencies {
6358
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64-
testImplementation 'junit:junit:4.12'
65-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
66-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
6759
}

example/android/app/src/debug/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="cn.yshye.mini_canvas_example">
2+
package="com.example.example">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="cn.yshye.mini_canvas_example">
3-
4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5-
calls FlutterMain.startInitialization(this); in its onCreate method.
6-
In most cases you can leave this as-is, but you if you want to provide
7-
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
9-
<application
10-
android:name="io.flutter.app.FlutterApplication"
11-
android:label="mini_canvas_example"
2+
package="com.example.example">
3+
<application
4+
android:label="example"
125
android:icon="@mipmap/ic_launcher">
136
<activity
147
android:name=".MainActivity"
158
android:launchMode="singleTop"
169
android:theme="@style/LaunchTheme"
17-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
10+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1811
android:hardwareAccelerated="true"
1912
android:windowSoftInputMode="adjustResize">
20-
<!-- This keeps the window background of the activity showing
21-
until Flutter renders its first frame. It can be removed if
22-
there is no splash screen (such as the default splash screen
23-
defined in @style/LaunchTheme). -->
13+
<!-- Specifies an Android theme to apply to this Activity as soon as
14+
the Android process has started. This theme is visible to the user
15+
while the Flutter UI initializes. After that, this theme continues
16+
to determine the Window background behind the Flutter UI. -->
2417
<meta-data
25-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
26-
android:value="true" />
18+
android:name="io.flutter.embedding.android.NormalTheme"
19+
android:resource="@style/NormalTheme"
20+
/>
21+
<!-- Displays an Android View that continues showing the launch screen
22+
Drawable until Flutter paints its first frame, then this splash
23+
screen fades out. A splash screen is useful to avoid any visual
24+
gap between the end of Android's launch screen and the painting of
25+
Flutter's first frame. -->
26+
<meta-data
27+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
28+
android:resource="@drawable/launch_background"
29+
/>
2730
<intent-filter>
2831
<action android:name="android.intent.action.MAIN"/>
2932
<category android:name="android.intent.category.LAUNCHER"/>
3033
</intent-filter>
3134
</activity>
35+
<!-- Don't delete the meta-data below.
36+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
37+
<meta-data
38+
android:name="flutterEmbedding"
39+
android:value="2" />
3240
</application>
3341
</manifest>

example/android/app/src/main/kotlin/cn/yshye/mini_canvas_example/MainActivity.kt

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.example.example
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity() {
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
Flutter draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
45
<!-- Show a splash screen on the activity. Automatically removed when
56
Flutter draws its first frame -->
67
<item name="android:windowBackground">@drawable/launch_background</item>
78
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
818
</resources>

example/android/app/src/profile/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="cn.yshye.mini_canvas_example">
2+
package="com.example.example">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->

example/android/build.gradle

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.2.71'
2+
ext.kotlin_version = '1.3.50'
33
repositories {
44
google()
55
jcenter()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.2.1'
9+
classpath 'com.android.tools.build:gradle:4.1.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
@@ -21,8 +21,6 @@ allprojects {
2121
rootProject.buildDir = '../build'
2222
subprojects {
2323
project.buildDir = "${rootProject.buildDir}/${project.name}"
24-
}
25-
subprojects {
2624
project.evaluationDependsOn(':app')
2725
}
2826

example/android/gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
3-
android.enableR8=true
2+
android.useAndroidX=true
3+
android.enableJetifier=true

example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

example/android/settings.gradle

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
include ':app'
22

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
3+
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4+
def properties = new Properties()
45

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9-
}
6+
assert localPropertiesFile.exists()
7+
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
108

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
15-
}
9+
def flutterSdkPath = properties.getProperty("flutter.sdk")
10+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11+
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

example/ios/.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
*.mode1v3
2+
*.mode2v3
3+
*.moved-aside
4+
*.pbxuser
5+
*.perspectivev3
6+
**/*sync/
7+
.sconsign.dblite
8+
.tags*
9+
**/.vagrant/
10+
**/DerivedData/
11+
Icon?
12+
**/Pods/
13+
**/.symlinks/
14+
profile
15+
xcuserdata
16+
**/.generated/
17+
Flutter/App.framework
18+
Flutter/Flutter.framework
19+
Flutter/Flutter.podspec
20+
Flutter/Generated.xcconfig
21+
Flutter/ephemeral/
22+
Flutter/app.flx
23+
Flutter/app.zip
24+
Flutter/flutter_assets/
25+
Flutter/flutter_export_environment.sh
26+
ServiceDefinitions.json
27+
Runner/GeneratedPluginRegistrant.*
28+
29+
# Exceptions to above rules.
30+
!default.mode1v3
31+
!default.mode2v3
32+
!default.pbxuser
33+
!default.perspectivev3

example/ios/Flutter/AppFrameworkInfo.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleDevelopmentRegion</key>
6-
<string>$(DEVELOPMENT_LANGUAGE)</string>
6+
<string>en</string>
77
<key>CFBundleExecutable</key>
88
<string>App</string>
99
<key>CFBundleIdentifier</key>

0 commit comments

Comments
 (0)