From 779b86737cceaf1f3cc935d8e369c2a07253a19c Mon Sep 17 00:00:00 2001 From: Blake Barrett Date: Thu, 4 Apr 2024 00:49:13 -0700 Subject: [PATCH 1/3] chore: update dependencies --- pubspec.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 17e3a9f..04175f7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+2 +version: 1.0.0+3 environment: sdk: ">=2.12.0 <3.0.0" @@ -28,13 +28,13 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. # cupertino_icons: ^1.0.2 - geolocator: ^7.0.3 - flutter_launcher_icons: ^0.9.0 + geolocator: ^11.0.0 + flutter_launcher_icons: ^0.13.1 shared_preferences: ^2.0.6 - flutter_svg: ^0.22.0 - image_picker: ^0.8.2 + flutter_svg: ^2.0.10+1 + image_picker: ^1.0.7 path_provider: ^2.0.2 - package_info: ^2.0.2 + package_info_plus: ^6.0.0 dev_dependencies: flutter_test: From c35384689ba0e15cecf37e70b3a72901d940e97a Mon Sep 17 00:00:00 2001 From: Blake Barrett Date: Thu, 4 Apr 2024 00:49:51 -0700 Subject: [PATCH 2/3] chore: upgrade Dart code to latest conventions `dart fix --apply` --- lib/gauges/analog.dart | 12 ++++++------ lib/gauges/digital.dart | 2 +- lib/main.dart | 17 ++++++++--------- lib/speedreader.dart | 7 +++++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/gauges/analog.dart b/lib/gauges/analog.dart index fc49911..d2c8f71 100644 --- a/lib/gauges/analog.dart +++ b/lib/gauges/analog.dart @@ -4,7 +4,7 @@ import 'dart:math' as math; @immutable class AnalogGauge extends StatelessWidget { AnalogGauge( - {required final this.speed, + {required this.speed, required this.maxSpeed, this.color = Colors.redAccent}) : super(); @@ -22,7 +22,7 @@ class AnalogGauge extends StatelessWidget { @immutable class AngledNeedle extends StatelessWidget { - AngledNeedle({required final this.angle, required this.color}) : super(); + AngledNeedle({required this.angle, required this.color}) : super(); final double angle; final Color color; @override @@ -47,10 +47,10 @@ class AngledNeedle extends StatelessWidget { class _LinePainter extends CustomPainter { _LinePainter( - {required final this.origin, - required final this.destination, - required final this.thickness, - required final this.color}) + {required this.origin, + required this.destination, + required this.thickness, + required this.color}) : super(); Offset origin, destination; diff --git a/lib/gauges/digital.dart b/lib/gauges/digital.dart index 7820394..60926ca 100644 --- a/lib/gauges/digital.dart +++ b/lib/gauges/digital.dart @@ -13,7 +13,7 @@ class DigitalGauge extends StatelessWidget { Widget build(BuildContext context) { return Text( '$_value', - style: Theme.of(context).textTheme.headline1, + style: Theme.of(context).textTheme.displayLarge, ); } } diff --git a/lib/main.dart b/lib/main.dart index bd059b0..d8307f0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,3 @@ -import 'package:flutter/animation.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; @@ -21,13 +20,13 @@ class GaugeSettings { final Widget? background; GaugeSettings({ - required final this.display, - required final this.speed, - required final this.topSpeed, - required final this.maxSpeed, - required final this.showTopSpeed, - required final this.showAnalog, - final this.background, + required this.display, + required this.speed, + required this.topSpeed, + required this.maxSpeed, + required this.showTopSpeed, + required this.showAnalog, + this.background, }); } @@ -187,7 +186,7 @@ class _SpeedListenerWidgetState extends State Center( child: Text( APP_NAME, - style: Theme.of(context).textTheme.headline1, + style: Theme.of(context).textTheme.displayLarge, ), ); } diff --git a/lib/speedreader.dart b/lib/speedreader.dart index e2b93bb..dbf9ad9 100644 --- a/lib/speedreader.dart +++ b/lib/speedreader.dart @@ -8,8 +8,11 @@ class SpeedReader { SpeedReader(void updateListener(Position value)) { _determinePosition().then((value) { _listener = Geolocator.getPositionStream( - desiredAccuracy: LocationAccuracy.bestForNavigation, - intervalDuration: Duration(microseconds: 0), + locationSettings: LocationSettings( + accuracy: LocationAccuracy.best, + distanceFilter: 1, + timeLimit: Duration(seconds: 1), + ), ).listen(updateListener); }); } From 3aa4b17705085f536e6681d7cd7de789bc6936ca Mon Sep 17 00:00:00 2001 From: Blake Barrett Date: Thu, 4 Apr 2024 00:50:35 -0700 Subject: [PATCH 3/3] fix: regenerate Android runner --- analysis_options.yaml | 28 ++++++++++ android/.gitignore | 2 + android/app/build.gradle | 55 ++++++++----------- android/app/src/debug/AndroidManifest.xml | 6 +- android/app/src/main/AndroidManifest.xml | 20 +++++-- .../kotlin/com/example/spdo/MainActivity.kt | 3 +- .../app/src/main/res/values-night/styles.xml | 4 +- android/app/src/main/res/values/styles.xml | 4 +- android/app/src/profile/AndroidManifest.xml | 6 +- android/build.gradle | 19 ++----- android/gradle.properties | 3 +- .../gradle/wrapper/gradle-wrapper.properties | 3 +- android/settings.gradle | 31 ++++++++--- 13 files changed, 110 insertions(+), 74 deletions(-) create mode 100644 analysis_options.yaml diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore index 0a741cb..6f56801 100644 --- a/android/.gitignore +++ b/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/android/app/build.gradle b/android/app/build.gradle index 967ec79..9fb9475 100644 --- a/android/app/build.gradle +++ b/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,17 +12,6 @@ if (localPropertiesFile.exists()) { } } -def keystoreProperties = new Properties() -def keystorePropertiesFile = rootProject.file('key.properties') -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - -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 = '1' @@ -27,40 +22,40 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 30 + namespace "com.blakebarrett.spdo" + 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 "com.blakebarrett.spdo" - minSdkVersion 16 - targetSdkVersion 30 + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } - signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null - storePassword keystoreProperties['storePassword'] - } - } - buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug -// signingConfig signingConfigs.release } } } @@ -69,6 +64,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 1a395c9..399f698 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6e539a0..1a07e76 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,12 +1,13 @@ - + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/spdo/MainActivity.kt b/android/app/src/main/kotlin/com/example/spdo/MainActivity.kt index 7d297aa..5bbd4d7 100644 --- a/android/app/src/main/kotlin/com/example/spdo/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/spdo/MainActivity.kt @@ -2,5 +2,4 @@ package com.blakebarrett.spdo import io.flutter.embedding.android.FlutterActivity -class MainActivity: FlutterActivity() { -} \ No newline at end of file +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml index 449a9f9..06952be 100644 --- a/android/app/src/main/res/values-night/styles.xml +++ b/android/app/src/main/res/values-night/styles.xml @@ -3,14 +3,14 @@