From e3328589047711195b11ebc517d235d21a5ddc1e Mon Sep 17 00:00:00 2001 From: Alex Gorichev Date: Sun, 10 Sep 2023 22:52:22 +0100 Subject: [PATCH 1/3] Revert "Recreate project and fix Kotlin error" This reverts commit a9fb10320eb7717c4b0370057974017c2efa1684. --- .metadata | 30 +++++++++---------- android/app/build.gradle | 5 +++- .../daily_diary/MainActivity.kt | 2 +- android/build.gradle | 2 +- android/settings.gradle | 25 +++++----------- 5 files changed, 29 insertions(+), 35 deletions(-) rename android/app/src/main/kotlin/com/{example => voklen}/daily_diary/MainActivity.kt (75%) diff --git a/.metadata b/.metadata index b15081a..bef11fe 100644 --- a/.metadata +++ b/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled and should not be manually edited. +# This file should be version controlled. version: - revision: "2524052335ec76bb03e04ede244b071f1b86d190" - channel: "stable" + revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + channel: stable project_type: app @@ -13,23 +13,23 @@ project_type: app migration: platforms: - platform: root - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - platform: android - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - platform: ios - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - platform: linux - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - platform: macos - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - platform: windows - create_revision: 2524052335ec76bb03e04ede244b071f1b86d190 - base_revision: 2524052335ec76bb03e04ede244b071f1b86d190 + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 # User provided section diff --git a/android/app/build.gradle b/android/app/build.gradle index 6d644da..920b44d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -71,10 +71,13 @@ android { signingConfig signingConfigs.release } } + } flutter { source '../..' } -dependencies {} +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/android/app/src/main/kotlin/com/example/daily_diary/MainActivity.kt b/android/app/src/main/kotlin/com/voklen/daily_diary/MainActivity.kt similarity index 75% rename from android/app/src/main/kotlin/com/example/daily_diary/MainActivity.kt rename to android/app/src/main/kotlin/com/voklen/daily_diary/MainActivity.kt index 65e6955..7e68a03 100644 --- a/android/app/src/main/kotlin/com/example/daily_diary/MainActivity.kt +++ b/android/app/src/main/kotlin/com/voklen/daily_diary/MainActivity.kt @@ -1,4 +1,4 @@ -package com.example.daily_diary +package com.voklen.daily_diary import io.flutter.embedding.android.FlutterActivity diff --git a/android/build.gradle b/android/build.gradle index 0aa80aa..5264885 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.8.10' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() diff --git a/android/settings.gradle b/android/settings.gradle index 55c4ca8..44e62bc 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,20 +1,11 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - } - settings.ext.flutterSdkPath = flutterSdkPath() +include ':app' - includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() - plugins { - id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false - } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -include ":app" - -apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" From 6ad69110cb62253c5d3be3f9d251ef163a6759da Mon Sep 17 00:00:00 2001 From: Alex Gorichev Date: Mon, 11 Sep 2023 08:54:13 +0100 Subject: [PATCH 2/3] Fix Kotlin error by reverting version --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 5264885..0aa80aa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.8.10' repositories { google() mavenCentral() From 4712ee161932acae05c175d683f6118a6efa073f Mon Sep 17 00:00:00 2001 From: Alex Gorichev Date: Mon, 11 Sep 2023 09:01:13 +0100 Subject: [PATCH 3/3] Fix crashing on empty color scheme --- lib/backend_classes/storage.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/backend_classes/storage.dart b/lib/backend_classes/storage.dart index 4b5e426..b1b5963 100644 --- a/lib/backend_classes/storage.dart +++ b/lib/backend_classes/storage.dart @@ -180,11 +180,15 @@ class SettingsStorage { extension HexColor on Color { /// String is in the format "aabbcc" or "ffaabbcc" with an optional leading "#". - static Color fromHex(String hexString) { + /// Returns null if bad string format + static Color? fromHex(String hexString) { final buffer = StringBuffer(); if (hexString.length == 6 || hexString.length == 7) buffer.write('ff'); buffer.write(hexString.replaceFirst('#', '')); - return Color(int.parse(buffer.toString(), radix: 16)); + + int? asInt = int.tryParse(buffer.toString(), radix: 16); + if (asInt == null) return null; + return Color(asInt); } /// Prefixes a hash sign if [leadingHashSign] is set to `true` (default is `true`).