From 670cb36529784fa81aad9ecc061a058022401373 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Fri, 24 Nov 2023 13:18:54 +0100 Subject: [PATCH] chore: refactor example app (#1734) Co-authored-by: JaffaKetchup --- analysis_options.yaml | 1 - example/.metadata | 14 +- example/analysis_options.yaml | 32 +- example/android/.gitignore | 2 + example/android/app/build.gradle | 38 +-- .../android/app/src/debug/AndroidManifest.xml | 3 +- .../android/app/src/main/AndroidManifest.xml | 12 +- .../flutter_map}/example/MainActivity.kt | 2 +- .../flutter_map_example/MainActivity.kt | 6 - .../app/src/main/res/values-night/styles.xml | 4 +- .../app/src/main/res/values/styles.xml | 4 +- .../app/src/profile/AndroidManifest.xml | 3 +- example/android/build.gradle | 6 +- example/android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 1 - example/android/settings.gradle | 30 +- example/lib/main.dart | 17 +- example/lib/misc/tile_providers.dart | 10 + .../lib/pages/animated_map_controller.dart | 36 +-- example/lib/pages/bundled_offline_map.dart | 37 +++ .../lib/pages/cancellable_tile_provider.dart | 42 ++- example/lib/pages/circle.dart | 79 ++--- example/lib/pages/custom_crs/custom_crs.dart | 10 +- example/lib/pages/epsg3413_crs.dart | 28 +- example/lib/pages/epsg4326_crs.dart | 51 ++-- example/lib/pages/fallback_url.dart | 56 ---- .../lib/pages/fallback_url_network_page.dart | 27 -- example/lib/pages/fallback_url_page.dart | 55 ++++ example/lib/pages/home.dart | 140 ++------- example/lib/pages/interactive_test_page.dart | 29 +- example/lib/pages/latlng_to_screen_point.dart | 12 +- example/lib/pages/many_circles.dart | 16 +- example/lib/pages/many_markers.dart | 16 +- example/lib/pages/map_controller.dart | 23 +- example/lib/pages/map_inside_listview.dart | 15 +- example/lib/pages/markers.dart | 12 +- example/lib/pages/moving_markers.dart | 48 +-- example/lib/pages/offline_map.dart | 51 ---- example/lib/pages/overlay_image.dart | 110 +++---- example/lib/pages/plugin_scalebar.dart | 49 --- example/lib/pages/plugin_zoombuttons.dart | 47 --- example/lib/pages/polygon.dart | 178 +++++------ example/lib/pages/polyline.dart | 176 +++++------ example/lib/pages/reset_tile_layer.dart | 107 +++---- example/lib/pages/retina.dart | 12 +- .../lib/pages/scale_layer_plugin_option.dart | 35 ++- example/lib/pages/scalebar_utils.dart | 29 +- example/lib/pages/screen_point_to_latlng.dart | 16 +- example/lib/pages/secondary_tap.dart | 52 ++-- example/lib/pages/sliding_map.dart | 59 ++-- example/lib/pages/stateful_markers.dart | 48 +-- example/lib/pages/tile_builder.dart | 14 +- .../lib/pages/tile_loading_error_handle.dart | 104 ++++--- example/lib/pages/wms_tile_layer.dart | 78 ++--- example/lib/plugins/plugin_scalebar.dart | 38 +++ example/lib/plugins/plugin_zoombuttons.dart | 35 +++ .../zoombuttons_plugin_option.dart | 21 +- example/lib/widgets/attribution.dart | 15 - example/lib/widgets/drawer.dart | 284 ------------------ .../widgets/drawer/floating_menu_button.dart | 33 ++ example/lib/widgets/drawer/menu_drawer.dart | 235 +++++++++++++++ example/lib/widgets/drawer/menu_item.dart | 33 ++ example/lib/widgets/first_start_dialog.dart | 64 ++++ example/lib/widgets/notice_banner.dart | 69 +++++ example/pubspec.yaml | 2 +- .../gestures/positioned_tap_detector_2.dart | 10 +- .../layer/general/translucent_pointer.dart | 11 +- pubspec.yaml | 2 +- 68 files changed, 1389 insertions(+), 1547 deletions(-) rename example/android/app/src/main/kotlin/{me/jpryan => dev/fleaflet/flutter_map}/example/MainActivity.kt (70%) delete mode 100644 example/android/app/src/main/kotlin/me/jpryan/flutter_map_example/MainActivity.kt create mode 100644 example/lib/misc/tile_providers.dart create mode 100644 example/lib/pages/bundled_offline_map.dart delete mode 100644 example/lib/pages/fallback_url.dart delete mode 100644 example/lib/pages/fallback_url_network_page.dart create mode 100644 example/lib/pages/fallback_url_page.dart delete mode 100644 example/lib/pages/offline_map.dart delete mode 100644 example/lib/pages/plugin_scalebar.dart delete mode 100644 example/lib/pages/plugin_zoombuttons.dart create mode 100644 example/lib/plugins/plugin_scalebar.dart create mode 100644 example/lib/plugins/plugin_zoombuttons.dart rename example/lib/{pages => plugins}/zoombuttons_plugin_option.dart (78%) delete mode 100644 example/lib/widgets/attribution.dart delete mode 100644 example/lib/widgets/drawer.dart create mode 100644 example/lib/widgets/drawer/floating_menu_button.dart create mode 100644 example/lib/widgets/drawer/menu_drawer.dart create mode 100644 example/lib/widgets/drawer/menu_item.dart create mode 100644 example/lib/widgets/first_start_dialog.dart create mode 100644 example/lib/widgets/notice_banner.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index 544432675..285cf1fb5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -27,7 +27,6 @@ linter: type_annotate_public_apis: true unnecessary_statements: true use_named_constants: true - use_super_parameters: true cast_nullable_to_non_nullable: true only_throw_errors: true sort_unnamed_constructors_first: true diff --git a/example/.metadata b/example/.metadata index bead5eefe..7b8b9e04e 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,8 +4,8 @@ # This file should be version controlled and should not be manually edited. version: - revision: "2524052335ec76bb03e04ede244b071f1b86d190" - channel: "stable" + revision: "0b591f2c82e9f59276ed68c7d4cbd63196f7c865" + channel: "beta" project_type: app @@ -13,11 +13,11 @@ project_type: app migration: platforms: - platform: root - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - - platform: windows - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865 + base_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865 + - platform: android + create_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865 + base_revision: 0b591f2c82e9f59276ed68c7d4cbd63196f7c865 # User provided section diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 71b37b60c..c659fe36c 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -1,30 +1,8 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - language: - strict-casts: true - strict-inference: true - strict-raw-types: true - errors: - missing_required_param: error - missing_return: error +# match the lint rules from flutter_map +include: ./../analysis_options.yaml +# only specify things that should be different from the package linter: rules: - library_private_types_in_public_api: false # Not relevant to the example - - always_declare_return_types: true - always_use_package_imports: true - avoid_dynamic_calls: true - cancel_subscriptions: true - close_sinks: false - package_api_docs: true - prefer_constructors_over_static_methods: true - prefer_final_in_for_each: true - prefer_final_locals: true - prefer_int_literals: true - test_types_in_equals: true - throw_in_finally: true - type_annotate_public_apis: true - unnecessary_statements: true - use_named_constants: true \ No newline at end of file + # using the default parameter values are used as explanation and for showcase + avoid_redundant_argument_values: false diff --git a/example/android/.gitignore b/example/android/.gitignore index 0a741cb43..6f568019d 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index a654ab681..de1ae64a5 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '6' @@ -21,21 +22,27 @@ if (flutterVersionName == null) { flutterVersionName = '6.0.1' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 33 + namespace "dev.fleaflet.flutter_map.example" + compileSdk flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "me.jpryan.flutter_map_example" - minSdkVersion 16 + applicationId "dev.fleaflet.flutter_map.example" + minSdkVersion flutter.minSdkVersion targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -48,13 +55,10 @@ android { signingConfig signingConfigs.debug } } - namespace 'me.jpryan.flutter_map_example' } flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index f880684a6..399f6981d 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,6 @@ - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index d8b2374c9..5222e963c 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,22 +1,16 @@ - - - - - - - -