Skip to content

Commit 3907806

Browse files
committed
Update sample
1 parent 41baa55 commit 3907806

50 files changed

Lines changed: 544 additions & 193 deletions

Some content is hidden

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

example/.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
migrate_working_dir/
1112

1213
# IntelliJ related
1314
*.iml
@@ -26,19 +27,17 @@
2627
.dart_tool/
2728
.flutter-plugins
2829
.flutter-plugins-dependencies
29-
.packages
3030
.pub-cache/
3131
.pub/
3232
/build/
3333

34-
# Web related
35-
lib/generated_plugin_registrant.dart
36-
3734
# Symbolication related
3835
app.*.symbols
3936

4037
# Obfuscation related
4138
app.*.map.json
4239

43-
# Exceptions to above rules.
44-
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
40+
# Android Studio will place build artifacts here
41+
/android/app/debug
42+
/android/app/profile
43+
/android/app/release

example/.metadata

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,39 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 216dee60c0cc9449f0b29bcf922974d612263e24
8-
channel: stable
7+
revision: "b0850beeb25f6d5b10426284f506557f66181b36"
8+
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: b0850beeb25f6d5b10426284f506557f66181b36
17+
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
18+
- platform: android
19+
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
20+
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
21+
- platform: ios
22+
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
23+
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
24+
- platform: macos
25+
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
26+
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
27+
- platform: web
28+
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
29+
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
30+
- platform: windows
31+
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
32+
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
33+
34+
# User provided section
35+
36+
# List of Local paths (relative to this file) that should be
37+
# ignored by the migrate tool.
38+
#
39+
# Files that are not part of the templates will be ignored by default.
40+
unmanaged_files:
41+
- 'lib/main.dart'
42+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/analysis_options.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options

example/android/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
99
# Remember to never publicly share your keystore.
1010
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
1111
key.properties
12+
**/*.keystore
13+
**/*.jks

example/android/app/build.gradle

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,58 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id "dev.flutter.flutter-gradle-plugin"
6+
}
7+
18
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
9+
def localPropertiesFile = rootProject.file("local.properties")
310
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
11+
localPropertiesFile.withReader("UTF-8") { reader ->
512
localProperties.load(reader)
613
}
714
}
815

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-
14-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16+
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
1517
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
18+
flutterVersionCode = "1"
1719
}
1820

19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
21+
def flutterVersionName = localProperties.getProperty("flutter.versionName")
2022
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
23+
flutterVersionName = "1.0"
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2826
android {
29-
compileSdkVersion 33
27+
namespace = "com.example.example"
28+
compileSdk = flutter.compileSdkVersion
29+
ndkVersion = flutter.ndkVersion
3030

31-
sourceSets {
32-
main.java.srcDirs += 'src/main/kotlin'
33-
}
34-
35-
lintOptions {
36-
disable 'InvalidPackage'
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_1_8
3734
}
3835

3936
defaultConfig {
4037
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41-
applicationId "com.example.example"
42-
minSdkVersion 16
43-
targetSdkVersion 33
44-
versionCode flutterVersionCode.toInteger()
45-
versionName flutterVersionName
38+
applicationId = "com.example.example"
39+
// You can update the following values to match your application needs.
40+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
41+
minSdk = flutter.minSdkVersion
42+
targetSdk = flutter.targetSdkVersion
43+
versionCode = flutterVersionCode.toInteger()
44+
versionName = flutterVersionName
4645
}
4746

4847
buildTypes {
4948
release {
5049
// TODO: Add your own signing config for the release build.
5150
// Signing with the debug keys for now, so `flutter run --release` works.
52-
signingConfig signingConfigs.debug
51+
signingConfig = signingConfigs.debug
5352
}
5453
}
5554
}
5655

5756
flutter {
58-
source '../..'
59-
}
60-
61-
dependencies {
62-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
57+
source = "../.."
6358
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.example">
3-
<!-- Flutter needs it to communicate with the running application
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
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.example">
3-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
4-
calls FlutterMain.startInitialization(this); in its onCreate method.
5-
In most cases you can leave this as-is, but you if you want to provide
6-
additional functionality it is fine to subclass or reimplement
7-
FlutterApplication and put your custom class here. -->
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
82
<application
9-
android:name="${applicationName}"
103
android:label="example"
4+
android:name="${applicationName}"
115
android:icon="@mipmap/ic_launcher">
126
<activity
137
android:name=".MainActivity"
8+
android:exported="true"
149
android:launchMode="singleTop"
10+
android:taskAffinity=""
1511
android:theme="@style/LaunchTheme"
1612
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1713
android:hardwareAccelerated="true"
18-
android:exported="true"
1914
android:windowSoftInputMode="adjustResize">
2015
<!-- Specifies an Android theme to apply to this Activity as soon as
2116
the Android process has started. This theme is visible to the user
@@ -25,15 +20,6 @@
2520
android:name="io.flutter.embedding.android.NormalTheme"
2621
android:resource="@style/NormalTheme"
2722
/>
28-
<!-- Displays an Android View that continues showing the launch screen
29-
Drawable until Flutter paints its first frame, then this splash
30-
screen fades out. A splash screen is useful to avoid any visual
31-
gap between the end of Android's launch screen and the painting of
32-
Flutter's first frame. -->
33-
<meta-data
34-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
35-
android:resource="@drawable/launch_background"
36-
/>
3723
<intent-filter>
3824
<action android:name="android.intent.action.MAIN"/>
3925
<category android:name="android.intent.category.LAUNCHER"/>
@@ -45,12 +31,15 @@
4531
android:name="flutterEmbedding"
4632
android:value="2" />
4733
</application>
34+
<!-- Required to query activities that can process text, see:
35+
https://developer.android.com/training/package-visibility and
36+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
4837
38+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
4939
<queries>
5040
<intent>
51-
<action android:name="android.intent.action.VIEW" />
52-
<category android:name="android.intent.category.BROWSABLE" />
53-
<data android:scheme="https" />
41+
<action android:name="android.intent.action.PROCESS_TEXT"/>
42+
<data android:mimeType="text/plain"/>
5443
</intent>
5544
</queries>
5645
</manifest>

example/android/app/src/main/kotlin/com/example/example/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ package com.example.example
22

33
import io.flutter.embedding.android.FlutterActivity
44

5-
class MainActivity: FlutterActivity() {
6-
}
5+
class MainActivity: FlutterActivity()
Lines changed: 12 additions & 0 deletions
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>
Lines changed: 18 additions & 0 deletions
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+
the Flutter engine 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>

0 commit comments

Comments
 (0)