Skip to content

Commit 60036f9

Browse files
committed
🎨 调整代码结构
1 parent 9bc00d8 commit 60036f9

Some content is hidden

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

49 files changed

+166
-426
lines changed

android/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
.DS_Store
77
/build
88
/captures
9-
.cxx

android/build.gradle

+3-22
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:7.3.0'
11+
classpath 'com.android.tools.build:gradle:4.1.0'
1212
}
1313
}
1414

@@ -22,33 +22,14 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
if (project.android.hasProperty("namespace")) {
26-
namespace 'com.zero.flutter_adcontent'
27-
}
28-
29-
compileSdkVersion 33
25+
compileSdkVersion 31
3026

3127
compileOptions {
3228
sourceCompatibility JavaVersion.VERSION_1_8
3329
targetCompatibility JavaVersion.VERSION_1_8
3430
}
3531

3632
defaultConfig {
37-
minSdkVersion 19
38-
}
39-
40-
dependencies {
41-
testImplementation 'junit:junit:4.13.2'
42-
testImplementation 'org.mockito:mockito-core:5.0.0'
43-
}
44-
45-
testOptions {
46-
unitTests.all {
47-
testLogging {
48-
events "passed", "skipped", "failed", "standardOut", "standardError"
49-
outputs.upToDateWhen {false}
50-
showStandardStreams = true
51-
}
52-
}
33+
minSdkVersion 16
5334
}
5435
}

android/src/test/java/com/zero/flutter_adcontent/FlutterAdcontentPluginTest.java

-29
This file was deleted.

example/.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
.buildlog/
99
.history
1010
.svn/
11-
migrate_working_dir/
1211

1312
# IntelliJ related
1413
*.iml
@@ -27,10 +26,14 @@ migrate_working_dir/
2726
.dart_tool/
2827
.flutter-plugins
2928
.flutter-plugins-dependencies
29+
.packages
3030
.pub-cache/
3131
.pub/
3232
/build/
3333

34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
3437
# Symbolication related
3538
app.*.symbols
3639

example/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ This project is a starting point for a Flutter application.
88

99
A few resources to get you started if this is your first Flutter project:
1010

11-
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
11+
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
1313

14-
For help getting started with Flutter development, view the
15-
[online documentation](https://docs.flutter.dev/), which offers tutorials,
14+
For help getting started with Flutter, view our
15+
[online documentation](https://flutter.dev/docs), which offers tutorials,
1616
samples, guidance on mobile development, and a full API reference.

example/analysis_options.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ linter:
1313
# The lint rules applied to this project can be customized in the
1414
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
1515
# included above or to enable additional rules. A list of all available lints
16-
# and their documentation is published at https://dart.dev/lints.
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
1718
#
1819
# Instead of disabling a lint rule for the entire project in the
1920
# section below, it can also be suppressed for a single line of code

example/android/app/build.gradle

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
plugins {
2-
id "com.android.application"
3-
id "kotlin-android"
4-
id "dev.flutter.flutter-gradle-plugin"
5-
}
6-
71
def localProperties = new Properties()
82
def localPropertiesFile = rootProject.file('local.properties')
93
if (localPropertiesFile.exists()) {
@@ -12,6 +6,11 @@ if (localPropertiesFile.exists()) {
126
}
137
}
148

9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
1514
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1615
if (flutterVersionCode == null) {
1716
flutterVersionCode = '1'
@@ -22,10 +21,12 @@ if (flutterVersionName == null) {
2221
flutterVersionName = '1.0'
2322
}
2423

24+
apply plugin: 'com.android.application'
25+
apply plugin: 'kotlin-android'
26+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27+
2528
android {
26-
namespace "com.zero.flutter_adcontent_example"
2729
compileSdkVersion flutter.compileSdkVersion
28-
ndkVersion flutter.ndkVersion
2930

3031
compileOptions {
3132
sourceCompatibility JavaVersion.VERSION_1_8
@@ -35,8 +36,6 @@ android {
3536
defaultConfig {
3637
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3738
applicationId "com.zero.flutter_adcontent_example"
38-
// You can update the following values to match your application needs.
39-
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
4039
minSdkVersion flutter.minSdkVersion
4140
targetSdkVersion flutter.targetSdkVersion
4241
versionCode flutterVersionCode.toInteger()

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- The INTERNET permission is required for development. Specifically,
3-
the Flutter tool needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.zero.flutter_adcontent_example">
3+
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.zero.flutter_adcontent_example">
3+
<application
34
android:label="flutter_adcontent_example"
45
android:name="${applicationName}"
56
android:icon="@mipmap/ic_launcher">

example/android/app/src/main/res/values-night/styles.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
the Flutter engine draws its first frame -->
6+
Flutter draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.

example/android/app/src/main/res/values/styles.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
the Flutter engine draws its first frame -->
6+
Flutter draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- The INTERNET permission is required for development. Specifically,
3-
the Flutter tool needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.zero.flutter_adcontent_example">
3+
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>

example/android/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.7.10'
2+
ext.kotlin_version = '1.6.10'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9+
classpath 'com.android.tools.build:gradle:4.1.0'
910
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1011
}
1112
}
@@ -25,6 +26,6 @@ subprojects {
2526
project.evaluationDependsOn(':app')
2627
}
2728

28-
tasks.register("clean", Delete) {
29+
task clean(type: Delete) {
2930
delete rootProject.buildDir
3031
}

example/android/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx4G
1+
org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
33
android.enableJetifier=true
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Fri Jun 23 08:50:38 CEST 2017
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

example/android/settings.gradle

+8-26
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
1-
pluginManagement {
2-
def flutterSdkPath = {
3-
def properties = new Properties()
4-
file("local.properties").withInputStream { properties.load(it) }
5-
def flutterSdkPath = properties.getProperty("flutter.sdk")
6-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7-
return flutterSdkPath
8-
}
9-
settings.ext.flutterSdkPath = flutterSdkPath()
1+
include ':app'
102

11-
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
3+
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4+
def properties = new Properties()
125

13-
repositories {
14-
google()
15-
mavenCentral()
16-
gradlePluginPortal()
17-
}
6+
assert localPropertiesFile.exists()
7+
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
188

19-
plugins {
20-
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
21-
}
22-
}
23-
24-
plugins {
25-
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
26-
id "com.android.application" version "7.3.0" apply false
27-
}
28-
29-
include ":app"
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/integration_test/plugin_integration_test.dart

-25
This file was deleted.

example/ios/Flutter/AppFrameworkInfo.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>9.0</string>
2525
</dict>
2626
</plist>

example/ios/Flutter/Debug.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Flutter/Release.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Podfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32+
end
33+
34+
post_install do |installer|
35+
installer.pods_project.targets.each do |target|
36+
flutter_additional_ios_build_settings(target)
37+
end
38+
end

0 commit comments

Comments
 (0)