Skip to content

Commit 9ffc14d

Browse files
authored
flutter create (#23)
1 parent 704d3bb commit 9ffc14d

37 files changed

+1209
-54
lines changed

android/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
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
12+
**/*.keystore
13+
**/*.jks

android/app/build.gradle

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

2828
android {
29-
compileSdkVersion 30
29+
compileSdkVersion flutter.compileSdkVersion
3030

31-
sourceSets {
32-
main.java.srcDirs += 'src/main/kotlin'
31+
compileOptions {
32+
sourceCompatibility JavaVersion.VERSION_1_8
33+
targetCompatibility JavaVersion.VERSION_1_8
34+
}
35+
36+
kotlinOptions {
37+
jvmTarget = '1.8'
3338
}
3439

35-
lintOptions {
36-
disable 'InvalidPackage'
40+
sourceSets {
41+
main.java.srcDirs += 'src/main/kotlin'
3742
}
3843

3944
defaultConfig {
4045
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4146
applicationId "com.hoc.node_auth"
42-
minSdkVersion 21
43-
targetSdkVersion 30
47+
minSdkVersion flutter.minSdkVersion
48+
targetSdkVersion flutter.targetSdkVersion
4449
versionCode flutterVersionCode.toInteger()
4550
versionName flutterVersionName
4651
}
+17-30
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,28 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.hoc.node_auth">
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. -->
2+
package="com.hoc.node_auth">
3+
84
<uses-permission android:name="android.permission.INTERNET"/>
95

106
<application
11-
android:name="io.flutter.app.FlutterApplication"
12-
android:label="node_auth"
13-
android:requestLegacyExternalStorage="true"
14-
android:icon="@mipmap/ic_launcher">
7+
android:label="node_auth"
8+
android:name="${applicationName}"
9+
android:icon="@mipmap/ic_launcher">
1510
<activity
16-
android:name=".MainActivity"
17-
android:launchMode="singleTop"
18-
android:theme="@style/LaunchTheme"
19-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
20-
android:hardwareAccelerated="true"
21-
android:windowSoftInputMode="adjustResize">
11+
android:name=".MainActivity"
12+
android:exported="true"
13+
android:launchMode="singleTop"
14+
android:theme="@style/LaunchTheme"
15+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
16+
android:hardwareAccelerated="true"
17+
android:windowSoftInputMode="adjustResize">
2218
<!-- Specifies an Android theme to apply to this Activity as soon as
2319
the Android process has started. This theme is visible to the user
2420
while the Flutter UI initializes. After that, this theme continues
2521
to determine the Window background behind the Flutter UI. -->
2622
<meta-data
27-
android:name="io.flutter.embedding.android.NormalTheme"
28-
android:resource="@style/NormalTheme"
29-
/>
30-
<!-- Displays an Android View that continues showing the launch screen
31-
Drawable until Flutter paints its first frame, then this splash
32-
screen fades out. A splash screen is useful to avoid any visual
33-
gap between the end of Android's launch screen and the painting of
34-
Flutter's first frame. -->
35-
<meta-data
36-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
37-
android:resource="@drawable/launch_background"
38-
/>
23+
android:name="io.flutter.embedding.android.NormalTheme"
24+
android:resource="@style/NormalTheme"
25+
/>
3926
<intent-filter>
4027
<action android:name="android.intent.action.MAIN"/>
4128
<category android:name="android.intent.category.LAUNCHER"/>
@@ -44,7 +31,7 @@
4431
<!-- Don't delete the meta-data below.
4532
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
4633
<meta-data
47-
android:name="flutterEmbedding"
48-
android:value="2" />
34+
android:name="flutterEmbedding"
35+
android:value="2"/>
4936
</application>
5037
</manifest>

android/app/src/main/kotlin/com/hoc/node_auth/MainActivity.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ package com.hoc.node_auth
22

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

5-
class MainActivity: FlutterActivity()
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>
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<!-- Theme applied to the Android Window while the process is starting -->
4-
<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">
55
<!-- Show a splash screen on the activity. Automatically removed when
66
Flutter draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
@@ -10,9 +10,9 @@
1010
This theme determines the color of the Android Window while your
1111
Flutter UI initializes, as well as behind your Flutter UI while its
1212
running.
13-
13+
1414
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:color/white</item>
15+
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
1717
</style>
1818
</resources>

android/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
buildscript {
2-
ext.kotlin_version = '1.5.31'
2+
ext.kotlin_version = '1.6.10'
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.2.2'
9+
classpath 'com.android.tools.build:gradle:4.1.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

1414
allprojects {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
1818
}
1919
}
2020

android/gradle.properties

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

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-6.9.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

android/settings.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Copyright 2014 The Flutter Authors. All rights reserved.
2-
// Use of this source code is governed by a BSD-style license that can be
3-
// found in the LICENSE file.
4-
51
include ':app'
62

73
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")

android/settings_aar.gradle

-1
This file was deleted.

web/favicon.png

917 Bytes
Loading

web/icons/Icon-192.png

5.17 KB
Loading

web/icons/Icon-512.png

8.06 KB
Loading

web/icons/Icon-maskable-192.png

5.46 KB
Loading

web/icons/Icon-maskable-512.png

20.5 KB
Loading

web/index.html

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<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+
-->
17+
<base href="$FLUTTER_BASE_HREF">
18+
19+
<meta charset="UTF-8">
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21+
<meta name="description" content="A new Flutter project.">
22+
23+
<!-- iOS meta tags & icons -->
24+
<meta name="apple-mobile-web-app-capable" content="yes">
25+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
26+
<meta name="apple-mobile-web-app-title" content="node_auth">
27+
<link rel="apple-touch-icon" href="icons/Icon-192.png">
28+
29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png"/>
31+
32+
<title>node_auth</title>
33+
<link rel="manifest" href="manifest.json">
34+
</head>
35+
<body>
36+
<!-- This script installs service_worker.js to provide PWA functionality to
37+
application. For more information, see:
38+
https://developers.google.com/web/fundamentals/primers/service-workers -->
39+
<script>
40+
var serviceWorkerVersion = null;
41+
var scriptLoaded = false;
42+
function loadMainDartJs() {
43+
if (scriptLoaded) {
44+
return;
45+
}
46+
scriptLoaded = true;
47+
var scriptTag = document.createElement('script');
48+
scriptTag.src = 'main.dart.js';
49+
scriptTag.type = 'application/javascript';
50+
document.body.append(scriptTag);
51+
}
52+
53+
if ('serviceWorker' in navigator) {
54+
// Service workers are supported. Use them.
55+
window.addEventListener('load', function () {
56+
// Wait for registration to finish before dropping the <script> tag.
57+
// Otherwise, the browser will load the script multiple times,
58+
// potentially different versions.
59+
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
60+
navigator.serviceWorker.register(serviceWorkerUrl)
61+
.then((reg) => {
62+
function waitForActivation(serviceWorker) {
63+
serviceWorker.addEventListener('statechange', () => {
64+
if (serviceWorker.state == 'activated') {
65+
console.log('Installed new service worker.');
66+
loadMainDartJs();
67+
}
68+
});
69+
}
70+
if (!reg.active && (reg.installing || reg.waiting)) {
71+
// No active web worker and we have installed or are installing
72+
// one for the first time. Simply wait for it to activate.
73+
waitForActivation(reg.installing || reg.waiting);
74+
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
75+
// When the app updates the serviceWorkerVersion changes, so we
76+
// need to ask the service worker to update.
77+
console.log('New service worker available.');
78+
reg.update();
79+
waitForActivation(reg.installing);
80+
} else {
81+
// Existing service worker is still good.
82+
console.log('Loading app from service worker.');
83+
loadMainDartJs();
84+
}
85+
});
86+
87+
// If service worker doesn't succeed in a reasonable amount of time,
88+
// fallback to plaint <script> tag.
89+
setTimeout(() => {
90+
if (!scriptLoaded) {
91+
console.warn(
92+
'Failed to load app from service worker. Falling back to plain <script> tag.',
93+
);
94+
loadMainDartJs();
95+
}
96+
}, 4000);
97+
});
98+
} else {
99+
// Service workers not supported. Just drop the <script> tag.
100+
loadMainDartJs();
101+
}
102+
</script>
103+
</body>
104+
</html>

web/manifest.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "node_auth",
3+
"short_name": "node_auth",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#0175C2",
7+
"theme_color": "#0175C2",
8+
"description": "A new Flutter project.",
9+
"orientation": "portrait-primary",
10+
"prefer_related_applications": false,
11+
"icons": [
12+
{
13+
"src": "icons/Icon-192.png",
14+
"sizes": "192x192",
15+
"type": "image/png"
16+
},
17+
{
18+
"src": "icons/Icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png"
21+
},
22+
{
23+
"src": "icons/Icon-maskable-192.png",
24+
"sizes": "192x192",
25+
"type": "image/png",
26+
"purpose": "maskable"
27+
},
28+
{
29+
"src": "icons/Icon-maskable-512.png",
30+
"sizes": "512x512",
31+
"type": "image/png",
32+
"purpose": "maskable"
33+
}
34+
]
35+
}

windows/.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
flutter/ephemeral/
2+
3+
# Visual Studio user-specific files.
4+
*.suo
5+
*.user
6+
*.userosscache
7+
*.sln.docstates
8+
9+
# Visual Studio build-related files.
10+
x64/
11+
x86/
12+
13+
# Visual Studio cache files
14+
# files ending in .cache can be ignored
15+
*.[Cc]ache
16+
# but keep track of directories ending in .cache
17+
!*.[Cc]ache/

0 commit comments

Comments
 (0)