Skip to content

Commit 670cb36

Browse files
josxhaJaffaKetchup
andauthored
chore: refactor example app (#1734)
Co-authored-by: JaffaKetchup <github@jaffaketchup.dev>
1 parent 2ba0c99 commit 670cb36

File tree

68 files changed

+1389
-1547
lines changed

Some content is hidden

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

68 files changed

+1389
-1547
lines changed

analysis_options.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ linter:
2727
type_annotate_public_apis: true
2828
unnecessary_statements: true
2929
use_named_constants: true
30-
use_super_parameters: true
3130
cast_nullable_to_non_nullable: true
3231
only_throw_errors: true
3332
sort_unnamed_constructors_first: true

example/.metadata

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

66
version:
7-
revision: "2524052335ec76bb03e04ede244b071f1b86d190"
8-
channel: "stable"
7+
revision: "0b591f2c82e9f59276ed68c7d4cbd63196f7c865"
8+
channel: "beta"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 2524052335ec76bb03e04ede244b071f1b86d190
17-
base_revision: 2524052335ec76bb03e04ede244b071f1b86d190
18-
- platform: windows
19-
create_revision: 2524052335ec76bb03e04ede244b071f1b86d190
20-
base_revision: 2524052335ec76bb03e04ede244b071f1b86d190
16+
create_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865
17+
base_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865
18+
- platform: android
19+
create_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865
20+
base_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865
2121

2222
# User provided section
2323

example/analysis_options.yaml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
1-
include: package:flutter_lints/flutter.yaml
2-
3-
analyzer:
4-
language:
5-
strict-casts: true
6-
strict-inference: true
7-
strict-raw-types: true
8-
errors:
9-
missing_required_param: error
10-
missing_return: error
1+
# match the lint rules from flutter_map
2+
include: ./../analysis_options.yaml
113

4+
# only specify things that should be different from the package
125
linter:
136
rules:
14-
library_private_types_in_public_api: false # Not relevant to the example
15-
16-
always_declare_return_types: true
17-
always_use_package_imports: true
18-
avoid_dynamic_calls: true
19-
cancel_subscriptions: true
20-
close_sinks: false
21-
package_api_docs: true
22-
prefer_constructors_over_static_methods: true
23-
prefer_final_in_for_each: true
24-
prefer_final_locals: true
25-
prefer_int_literals: true
26-
test_types_in_equals: true
27-
throw_in_finally: true
28-
type_annotate_public_apis: true
29-
unnecessary_statements: true
30-
use_named_constants: true
7+
# using the default parameter values are used as explanation and for showcase
8+
avoid_redundant_argument_values: false

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: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

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-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '6'
@@ -21,21 +22,27 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '6.0.1'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
29-
compileSdkVersion 33
26+
namespace "dev.fleaflet.flutter_map.example"
27+
compileSdk flutter.compileSdkVersion
28+
ndkVersion flutter.ndkVersion
29+
30+
compileOptions {
31+
sourceCompatibility JavaVersion.VERSION_1_8
32+
targetCompatibility JavaVersion.VERSION_1_8
33+
}
34+
35+
kotlinOptions {
36+
jvmTarget = '1.8'
37+
}
3038

3139
sourceSets {
3240
main.java.srcDirs += 'src/main/kotlin'
3341
}
3442

3543
defaultConfig {
36-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37-
applicationId "me.jpryan.flutter_map_example"
38-
minSdkVersion 16
44+
applicationId "dev.fleaflet.flutter_map.example"
45+
minSdkVersion flutter.minSdkVersion
3946
targetSdkVersion 31
4047
versionCode flutterVersionCode.toInteger()
4148
versionName flutterVersionName
@@ -48,13 +55,10 @@ android {
4855
signingConfig signingConfigs.debug
4956
}
5057
}
51-
namespace 'me.jpryan.flutter_map_example'
5258
}
5359

5460
flutter {
5561
source '../..'
5662
}
5763

58-
dependencies {
59-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
60-
}
64+
dependencies {}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- Flutter needs it to communicate with the running application
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
34
to allow setting breakpoints, to provide hot reload, etc.
45
-->
56
<uses-permission android:name="android.permission.INTERNET"/>

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<!-- Requried for fetching tiles -->
33
<uses-permission android:name="android.permission.INTERNET"/>
4-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
5-
<queries>
6-
<intent>
7-
<action android:name="android.intent.action.VIEW" />
8-
<data android:scheme="https" />
9-
</intent>
10-
</queries>
11-
<application
4+
<application
125
android:label="flutter_map Demo"
6+
android:name="${applicationName}"
137
android:icon="@mipmap/ic_launcher">
148
<activity
159
android:name=".MainActivity"
10+
android:exported="true"
1611
android:launchMode="singleTop"
1712
android:theme="@style/LaunchTheme"
1813
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
19-
android:exported="true"
2014
android:hardwareAccelerated="true"
2115
android:windowSoftInputMode="adjustResize">
2216
<!-- Specifies an Android theme to apply to this Activity as soon as

example/android/app/src/main/kotlin/me/jpryan/example/MainActivity.kt renamed to example/android/app/src/main/kotlin/dev/fleaflet/flutter_map/example/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.jpryan.example
1+
package dev.fleaflet.flutter_map.example
22

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

example/android/app/src/main/kotlin/me/jpryan/flutter_map_example/MainActivity.kt

Lines changed: 0 additions & 6 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
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-
Flutter draws its first frame -->
6+
the Flutter engine 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.
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. -->
1515
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
1616
<item name="android:windowBackground">?android:colorBackground</item>

0 commit comments

Comments
 (0)