103 Commits
Author SHA1 Message Date
me f432e0b406 changelog, update to match releases page. 2026-11-01 18:59:35 -07:00
me 220df450c3 gitignore, add more Android build and release locations. 2026-11-01 15:59:34 -07:00
me 4b877f3807 Merge pull request '1.1.0' (#4) from dev into main
Reviewed-on: #4
2026-11-01 14:27:23 -07:00
me 4591dc591d upcoming, reword the versions since not all came to fruition. 2026-11-01 14:22:34 -07:00
me 86069dce2f Update changelog. 2026-11-01 14:10:28 -07:00
me 6b7b91daac Update Gradle. 2026-11-01 14:08:18 -07:00
me c61521c4d7 gradle, update AGP and Kotlin. 2026-11-01 14:07:54 -07:00
me 9b5162216e Update version. 2026-11-01 14:07:28 -07:00
me 7078dcd560 gradle, remove commented version. 2026-10-22 18:06:22 -07:00
me 86ffb773df gradle, remove commented version. 2026-10-22 17:34:14 -07:00
me 2b1d382069 compile, linux-bundle was missing from tar files. 2026-10-01 20:35:19 -07:00
me 8455f14ed8 changelog, add unplanned modifications. 2026-10-01 20:25:49 -07:00
me 7d5667d253 icons, fix monochrome images, was not working on hardware when the source had colors.. 2026-10-01 20:24:03 -07:00
me 4c3c087e98 compile, final changes to script for output and utility. 2026-10-01 20:23:30 -07:00
me c8f314dcc7 compile, finalize the tar files. 2026-10-01 20:14:22 -07:00
me 2770c13a94 compile, start adding section for tar. 2026-10-01 19:16:37 -07:00
me b33218fa60 Add build instructions. 2026-10-01 19:15:40 -07:00
me c629162c44 TBD, rename to UPCOMING 2026-10-01 15:47:49 -07:00
me 41041e9105 Add a TBD file and move all upcoming features and notes into it. 2026-09-29 18:46:14 -07:00
me 1ac28bb8e5 changelog, add future features. 2026-09-29 18:37:38 -07:00
me b42ead1771 changelog, update verbiage tense. 2026-09-29 18:35:24 -07:00
me c0f9b58569 main, add TBD about minutes changing. 2026-09-29 18:33:18 -07:00
me 77e964a4c7 main, put switch back on its own row. Yay! 2026-09-29 18:31:56 -07:00
me 21f7236957 changelog, fix attempt at comments. 2026-09-29 18:17:35 -07:00
me ea5a64ccdd changelog, fix list items added from website, add upcoming version. 2026-09-29 18:16:57 -07:00
me e51239ab1c Add CHANGELOG. 2026-09-29 18:07:48 -07:00
me af32c1e313 Merge pull request '1.0.1' (#3) from dev into main
Reviewed-on: #3
2026-09-29 17:54:04 -07:00
me 4f15f94629 main, forget about the switch title fanciness for now, will make them different rows in a future version and handle minutes dynamically. 2026-09-29 17:51:49 -07:00
me b02a6ff80a main, more work on getting variables to flow properly and minutes to not take up space when the switch has text. 2026-09-29 17:28:41 -07:00
me b649c9c1e7 Random file, likely created by Flutter. 2026-09-29 17:27:54 -07:00
me 23ca37c671 main, handle variable state values a bit better. 2026-09-29 15:51:00 -07:00
me 11616841b3 gradle, upgrade to 9.8.0. 2026-09-29 15:50:34 -07:00
me 085031bc26 gradle, add task to print variables. 2026-09-29 15:49:49 -07:00
me 05f1b68d3f Add root certificate for Let's Encrypt in order to access Open Meteo on older devices. 2026-09-29 13:31:25 -07:00
me 0bc20a6e08 config, add cert path to assets. 2026-09-29 13:30:42 -07:00
me a661cfabbb main, put more variables in the cache, load them directly into their vars rather than having intermediates. 2026-09-29 13:30:13 -07:00
me 0e481f13cc main, swap the switch with text rather than disabling, allows giving a better error message. 2026-09-29 13:29:24 -07:00
me 436c96285c main, fix cert issues on older versions of Android (before Let's Encrypt existed). 2026-09-29 13:24:02 -07:00
me dd9d15172c main, handle the time being invalid better. 2026-09-29 13:23:28 -07:00
me 42d4992b6b icon, fix notification icon, may have chosen trim last time. 2026-09-29 12:30:28 -07:00
me f20bd99da4 icon, add another accidentally deleted XML. 2026-09-29 12:30:08 -07:00
me 79578de1f7 icon, untrim and ensure they are PNG. 2026-09-29 11:57:23 -07:00
me 183634dee5 main, disable the slide switch if the time is missing, stop the alarm if the time is completely backed out. 2026-09-29 11:57:09 -07:00
me 2606116c62 manifest, allow internet access. 2026-09-29 10:55:27 -07:00
me 424176a529 Add launch background XML's back in, 2026-09-29 10:50:59 -07:00
me 13a00917f9 icon, remove the old versions which were lingering and install version 03. 2026-09-29 08:25:00 -07:00
me 76ef8a7131 icon, modify to be circular and add an inversed monochrome version. 2026-09-29 08:24:36 -07:00
me 8b466229e1 compile, exclude the v from the version number. 2026-09-28 11:05:29 -07:00
me b62eff80c9 Increment version. 2026-09-28 11:05:17 -07:00
me 07447a2ffe Merge pull request '1.0.0' (#2) from dev into main
Reviewed-on: #2
2026-09-28 10:50:01 -07:00
me 6627ab46e8 fdroid, add to email that the user came from sunset. 2026-09-28 10:48:55 -07:00
me 79d9da8285 compile, further enhance the script as well as add space-saving options and platform specific APKs. 2026-09-28 10:34:52 -07:00
me 03f9e2fa56 android, add release build rules which slightly help to reduce filesizes. 2026-09-28 10:30:13 -07:00
me 7ab13dd4de main, fix older versions of Android not being able to see bottom widgets when keyboard is open. 2026-09-28 09:07:22 -07:00
me f5e368a902 main, more UI/UX fixes and enhancements. 2026-09-28 09:02:10 -07:00
me 251e03db5b Update version to 1.0.0, feeling feature complete until doing sunrise too. 2026-09-28 08:36:38 -07:00
me 3f0b69d6cf android, import icon version 2 and its monochrome notification counterpart. 2026-09-28 08:32:07 -07:00
me dc97081517 Add updated icon media. Sun is smaller and exactly centered. Version mc is monochrome. 2026-09-28 08:30:50 -07:00
me 8167c748ff main, continue ensuring actual alarm gets changed if sunset time is changed, add reference to notification icon. 2026-09-28 08:27:45 -07:00
me 4926c869b9 main, use global variables for now to decide between notifications and alarms on Android, may become a setting later. 2026-09-28 07:58:15 -07:00
me 7f908a7fab main, change toast phrasing to be consistent. 2026-09-28 07:52:56 -07:00
me 65ce0f8135 main, ensure the alarm time gets changed if modified when already enabled. 2026-09-28 07:44:18 -07:00
me 75b0a6b875 main, check for and use system theme properly. 2026-09-28 07:43:38 -07:00
me aed58f56dc main, add optional timepicker for sunset. 2026-09-28 07:06:43 -07:00
me db94f3bea1 main, add validation for sunset time field. 2026-09-28 06:59:22 -07:00
me 39792270f1 main, change layout so that minutes cannot be modified while the alarm is enabled, also handle validation better. 2026-09-28 06:48:40 -07:00
me 77320b05d6 main, change comments and UI text. 2026-09-28 06:47:53 -07:00
me 4788cdd220 main, attempt to cancel future alarms when untoggled. 2026-09-28 06:45:47 -07:00
me 0659262e61 main, add TBD's. 2026-09-28 06:44:22 -07:00
me 287c2f0cd0 main, use the default user volume. 2026-09-28 05:34:45 -07:00
me b4f8f37c79 android, change manifest label to be human friendly. 2026-09-28 05:30:58 -07:00
me b4acaa308d main, alarm is now successfully working on Android! 2026-09-28 05:14:34 -07:00
me 14372df628 android, re-enable manifest alarm code. 2026-09-28 05:00:02 -07:00
me c32373173b main, re-enable alarm code. 2026-09-28 04:59:46 -07:00
me 64a070fb4e Update version. 2026-09-28 04:56:47 -07:00
me bb1118d071 Add yml file for F-Droid repo. 2026-09-28 04:56:19 -07:00
me bf1c4614a1 Merge pull request '0.1.2' (#1) from dev into main
Reviewed-on: #1
2026-09-28 04:36:42 -07:00
me 9c681094c1 android, add additional needs to the manifest related to the alarm, but commented out for now. 2026-09-28 04:30:14 -07:00
me a44d4b1574 main, remove the alarm code for now, just do the notification based alert. 2026-09-28 04:27:23 -07:00
me ee9821f30f main, use the new version of flutter_local_notifications correctly. 2026-09-28 04:11:44 -07:00
me efde9624ff Changes from flutter pub upgrade --major-versions --tighten. 2026-09-28 04:05:25 -07:00
me b9bc2ca77d Changes from flutter pub uprade --major-versions. 2026-09-28 04:04:49 -07:00
me 105591910c packages, add alarm. 2026-09-28 04:00:04 -07:00
me 6030da178c main, add an actual alarm for Android. 2026-09-28 03:58:04 -07:00
me dad8fff6d2 main, fix minutes not working properly when set to 0. 2026-09-28 03:57:40 -07:00
me 3d89661b37 android, add receiver block to the manifest, seems to be the last piece of the puzzle for getting a notification to go off, but was not a true alarm. 2026-09-28 03:44:10 -07:00
me 6de5fbe991 main, ensure the notifications permission is requested. 2026-09-28 03:43:27 -07:00
me 9ac5fdd4f6 android, move permissions to beginning of manifest file based on studio suggestion. 2026-09-28 03:06:18 -07:00
me 5f14dbbc5b Add an additional permission in case that's why Android is not alarming. 2026-09-25 12:07:30 -07:00
me aade4fd7f2 Change alarm display code to ensure we're hitting the Android section. 2026-09-25 12:07:11 -07:00
me dfca094c95 gitignore, add anything in the release directory. 2026-09-25 11:58:32 -07:00
me e643e797c9 Begin changes to ask for Android permissions rather than silrently failing. 2026-09-25 11:56:14 -07:00
me 280e748bb7 android, AGP Upgrade Assistant. 2026-09-25 11:55:46 -07:00
me a19447b8a0 compile, overhaul the script to have the name and version in the filenames as well as reuse more code. 2026-09-25 11:55:27 -07:00
me 0ef88ba978 compile, fix permissions. 2026-09-24 09:44:53 -07:00
me 00566d9cc0 Add descriptions of the new folders. 2026-09-24 09:40:09 -07:00
me b0f59e2296 Add the basic icon via Android Studio. 2026-09-24 09:36:27 -07:00
me 7fe2af8058 Create a basic icon with GIMP. 2026-09-24 09:36:07 -07:00
me 09fdcea0f9 Fix the build vs compile scrips to be compile. 2026-09-13 18:54:36 -07:00
me 6586398db6 Add an initial build program, still needs work. 2026-09-13 18:53:06 -07:00
me 46eeaca422 Ignore linux bundles. 2026-09-13 18:46:54 -07:00
me 657b41d63c Increment version now that exports have been done. 2026-09-13 18:46:03 -07:00
me d6c0c79f8a android, upgraded all components to the latest versions and it builds successfully!! 2026-09-13 18:36:16 -07:00
62 changed files with 898 additions and 199 deletions

No files matched your search

+7
View File
@@ -57,6 +57,10 @@ unlinked_spec.ds
**/android/**/GeneratedPluginRegistrant.java **/android/**/GeneratedPluginRegistrant.java
**/android/key.properties **/android/key.properties
*.jks *.jks
android/build
android/app/build
android/release
android/app/release
# iOS/XCode related # iOS/XCode related
**/ios/**/*.mode1v3 **/ios/**/*.mode1v3
@@ -153,3 +157,6 @@ google-services.json
# Android Profiling # Android Profiling
*.hprof *.hprof
# Staged build files for distribution.
*.linux-bundle.zip
release/*
+5
View File
@@ -0,0 +1,5 @@
1. Install Flutter SDK
2. Install Android SDK
3. Clone Repo
4. Run `compile.sh`
5. Check `releases/` Folder
+65
View File
@@ -0,0 +1,65 @@
# Changelog
## 1.1.0 (In Development)
Usability improvements.
- move switchtile back to its own row
- allows showing text without crowding out or hiding minutes field
- fix monochrome icons, source was not white which may have been causing issues
- begin creating tar files for Linux rather than zips to use on release
- begin using a proper release signature rather that flutter's debug
- update internal plugin versions
This version may require uninstalling any previous versions before updating due to the signature change. It is a one-time event.
## 1.0.1 (2026-09-29)
Fixes for issues on hardware devices.
- fix internet access on some devices
- fix SSL certificate issues on older devices
- fix null minutes making a null alarm time
- fix enabling alarm with no time set yet
- enhance the icon for older devices
- upgrade SDKs and compilers
## 1.0.0 (2026-09-28)
Completed the app for Android which also brings many benefits to the Linux version.
**Android**
- upgraded from single notification to alarm
- platform specific APK to help reduce file size
**Both**
- automatic dark theme if system is set to dark
- input validation on sunset time and minutes
- alarm now properly resets if time is changed
- add optional time picker for sunset time field
- only do the permission request on Android
- more consistent verbiage and text styling
- enhanced icon and added monochrome
- added file necessary for F-Droid repo
- updated flutter package versions
This release has been tested tested tested, but only on emulators (x86_64). If you have any issues, please reach out.
From now on only the arm64-v8a APK will be provided.
## 0.1.2 (2026-09-28)
- add icon
- fix notification on Android
- allow minutes to be 0
- show toast if invalid minute value is provided
- enhance compile.sh to allow easier publications
- other small fixes and enhancements
## 0.1.1 (2026-09-13)
Linux version tested and now has alarm notification working.
Android still needs testing and fixes.
+16
View File
@@ -0,0 +1,16 @@
# To Be Done
Upcoming feature list. All notes subject to change.
## Patch
- Change time grabber to a checkbox so that it stays up to date.
## Minor
- Cancel and reschedule alarm when minutes are changed.
- Add languages (Spanish, Croatian).
## Major
- Add sunrise section and retitle app to Sunshine Alarm.
+50 -6
View File
@@ -1,15 +1,15 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
id("com.android.application") id("com.android.application")
// This will need removed in Gradle/AGP 9. // This supposedly needs removed in Gradle/AGP 9 but works fine.
id("org.jetbrains.kotlin.android") // id("kotlin-android") id("org.jetbrains.kotlin.android") // id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin") id("dev.flutter.flutter-gradle-plugin")
} }
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
android { android {
namespace = "com.hyperling.sunset_alarm" namespace = "com.hyperling.sunset_alarm"
compileSdk = flutter.compileSdkVersion compileSdk = flutter.compileSdkVersion
@@ -21,7 +21,7 @@ android {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_17
} }
// This will need removed in Gradle/AGP 9. // This supposedly needs removed in Gradle/AGP 9, but then uses 21 and fails to build.
kotlin { kotlin {
compilerOptions { compilerOptions {
jvmTarget.set(JvmTarget.JVM_17) jvmTarget.set(JvmTarget.JVM_17)
@@ -40,18 +40,62 @@ android {
} }
buildTypes { buildTypes {
release { getByName("release") {
// TODO: Add your own signing config for the release build. // TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works. // Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug") signingConfig = signingConfigs.getByName("debug")
/// 20260928 - Without minifying.
/// Built build/app/outputs/flutter-apk/app-release.apk (54.3MB)
/// Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (17.2MB)
/// Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (19.8MB)
/// Built build/app/outputs/flutter-apk/app-x86_64-release.apk (21.2MB)
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
/// 20260928 - With minifying, helped some, but also used
/// in combination with `--obfuscate --split-debug-info=./debug-info/`
/// Built build/app/outputs/flutter-apk/app-release.apk (54.3MB)
/// Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (16.1MB)
/// Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (18.8MB)
/// Built build/app/outputs/flutter-apk/app-x86_64-release.apk (20.3MB)
} }
} }
} }
dependencies { dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4") coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
} }
flutter { flutter {
source = "../.." source = "../.."
} }
/// To use this, first be in $PROJ/android/, then run: ./gradlew printFlutterVariables
tasks.register("printFlutterVariables") {
description = "Print Local Flutter Variables"
doLast {
// android //
// compileSdk = flutter.compileSdkVersion
println("compileSdk: ${android.compileSdk}")
println("compileSdkVersion: ${android.compileSdkVersion}")
// ndkVersion = flutter.ndkVersion
println("ndkVersion: ${android.ndkVersion}")
// android.defaultConfig //
// minSdk = flutter.minSdkVersion
println("minSdk: ${android.defaultConfig.minSdk}")
// targetSdk = flutter.targetSdkVersion
println("targetSdk: ${android.defaultConfig.targetSdk}")
println("targetSdkVersion: ${android.defaultConfig.targetSdkVersion}")
// versionCode = flutter.versionCode
println("versionCode: ${android.defaultConfig.versionCode}")
// versionName = flutter.versionName
println("versionName: ${android.defaultConfig.versionName}")
}
}
View File
Whitespace-only changes.
+85 -7
View File
@@ -1,6 +1,37 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<!-- Allow notifications to work. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
<!-- Allow alarms to work. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<!-- Allow internet to work. -->
<uses-permission android:name="android.permission.INTERNET"/>
<application <application
android:label="sunset_alarm" android:label="Sunset Alarm"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
@@ -30,6 +61,58 @@
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
<!-- Allow notifications to work. -->
<receiver
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
android:enabled="true" />
<receiver
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<!-- Allow alarms to work. -->
<service
android:name="com.gdelataillade.alarm.AlarmService"
android:foregroundServiceType="mediaPlayback"
android:exported="false" />
<receiver
android:name="com.gdelataillade.alarm.AlarmBroadcastReceiver"
android:exported="false" />
<receiver
android:name="com.gdelataillade.alarm.BootBroadcastReceiver"
android:enabled="false"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"
tools:ignore="MissingClass"/>
<receiver
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver"
android:exported="false"
tools:ignore="MissingClass"/>
<receiver
android:name="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver"
android:enabled="false"
android:exported="false"
tools:ignore="MissingClass">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application> </application>
<!-- Required to query activities that can process text, see: <!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and https://developer.android.com/training/package-visibility and
@@ -42,9 +125,4 @@
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain"/>
</intent> </intent>
</queries> </queries>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
</manifest> </manifest>
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

@@ -10,3 +10,4 @@
android:src="@mipmap/launch_image" /> android:src="@mipmap/launch_image" />
</item> --> </item> -->
</layer-list> </layer-list>
Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
@@ -10,3 +10,4 @@
android:src="@mipmap/launch_image" /> android:src="@mipmap/launch_image" />
</item> --> </item> -->
</layer-list> </layer-list>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
+1 -2
View File
@@ -1,7 +1,6 @@
#Sat Sep 12 19:36:23 MST 2026 #Sat Sep 12 19:36:23 MST 2026
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
+4 -4
View File
@@ -19,11 +19,11 @@ pluginManagement {
plugins { plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0" id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "9.4.0" apply false id("com.android.application") version "9.5.0" apply false
//id("com.android.application") version "9.0.1" apply false
// This will need removed in Gradle/AGP 9. // This will need removed in Gradle/AGP 9. JK - needs to exist otherwiese:
id("org.jetbrains.kotlin.android") version "2.4.20" apply false // "Error: Your project's Kotlin version (2.2.10) is lower than Flutter's minimum supported version of 2.2.20."
id("org.jetbrains.kotlin.android") version "2.4.21" apply false
} }
include(":app") include(":app")
+16
View File
@@ -0,0 +1,16 @@
AuthorName: 'Chad Michael "Hyperling" Greenwood'
AuthorEmail: 'me+sunset@hyperling.com'
AuthorWebSite: 'https://hyperling.com/about/'
Donate: 'https://hyperling.com/donate/'
Liberapay: 'HyperVegan'
Bitcoin: 'bc1qsfe8dkvry3d34kztz449gkq67wq8fu2nkgfkh0'
Litecoin: 'ltc1qavmpu5d6ljntxsd6jj548m4yys83zwscl0dzkx'
IssueTracker: 'https://hyperling.com/contact/'
Categories:
- fdroid
- hyperling
- utilities
Name: Sunset Timer
Summary: 'Play a notification at your chosen time before sunset.'
SourceCode: 'https://git.hyperling.com/me/flutter-sunset-alarm/'
WebSite: 'https://hyperling.com/apps/#sunset'
Executable
+122
View File
@@ -0,0 +1,122 @@
#!/usr/bin/env bash
# 20260913 - Hyperling
# Build the project and add the output to a releases folder.
## Setup ##
DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
## Functions ##
function log {
echo -e "\n $@ \n"
}
function clean_flutter {
log "Cleaning..."
flutter clean
echo "Done!"
}
## Variables ##
app_details="$DIR/pubspec.yaml"
name=""
for i in `grep name $app_details`; do
name="$i"
done
name="${name// /_}"
version=""
for i in `grep version $app_details`; do
version="$i"
done
version="${version// /_}"
if [[ -z $name || -z $version ]]; then
echo "ERROR: Could not retrieve name or version. name='$name' version='$version'"
exit 1
fi
RELEASE="release/$name-$version"
echo "Running for '$RELEASE'."
BUILD_OPTIONS=(
--release
--obfuscate
--split-debug-info=./debug-info/
--extra-gen-snapshot-options="--strip"
)
## Main ##
clean_flutter
# Linux
log "Building Linux Bundle..."
set -x
flutter build linux ${BUILD_OPTIONS[@]}
set +x
log "- zip"
filename=$RELEASE.linux-bundle.zip
contents="build/linux/x64/release/bundle/"
if [[ -e $filename ]]; then
rm -v $filename
fi
set -x
zip -qr "$filename" "$contents"/*
set +x
ls -sh $filename
log "- tar"
filename=$RELEASE.linux-bundle.tar
if [[ -e "$filename"* ]]; then
rm -v "$filename"*
fi
set -x
tar -c --zstd -f "${filename}.zst" -C "$contents" .
tar -cz -f "${filename}.gz" -C "$contents" .
tar -cJ -f "${filename}.xz" -C "$contents" .
set +x
ls -sh "$filename"* | sort -h
# Android
log "Building Universal APK..."
# Creates a generic (and large) app-release.apk
set -x
flutter build apk ${BUILD_OPTIONS[@]}
set +x
#log "Saving Universal APK..."
#apk="build/app/outputs/flutter-apk/app-release.apk"
#filename=`basename $apk`
#filename=${filename//app/${RELEASE}}
#if [[ -e $filename ]]; then
# rm -v $filename
#fi
#cp -v "$apk" "$filename"
#ls -sh "$filename"
log "Building Individual APKs..."
# Creates files such as build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
set -x
flutter build apk ${BUILD_OPTIONS[@]} --split-per-abi
set +x
log "Saving APKs..."
for apk in `ls build/app/outputs/flutter-apk/app*release.apk`; do
#if [[ "$apk" == *"x86"* ]]; then echo "Skipping $apk" continue; fi
#log "APK: $apk"
filename=`basename $apk`
filename=${filename//app/${RELEASE}}
cp -v "$apk" "$filename"
done
ls -sh release/*.apk | sort -h
# Finish
exit 0
+3
View File
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
+388 -173
View File
@@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@@ -7,25 +8,54 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:timezone/data/latest_all.dart' as tz; import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz; import 'package:timezone/timezone.dart' as tz;
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:alarm/alarm.dart';
import 'dart:convert'; import 'dart:convert';
// For trusting Let's Encrypt on older devices (SDK 24, Android 7)
//import 'dart:io';
//import 'package:http/http.dart' as http;
import 'package:flutter/services.dart' show rootBundle;
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final certData = await rootBundle.load(
'media/certs/open-meteo-com_isrg-root-x1.pem',
);
SecurityContext.defaultContext.setTrustedCertificatesBytes(
certData.buffer.asUint8List(),
);
tz.initializeTimeZones(); tz.initializeTimeZones();
await Alarm.init();
runApp(const SunsetAlarmApp()); runApp(const SunsetAlarmApp());
} }
const ANDROID_USE_NOTIF = false;
const ANDROID_USE_ALARM = !ANDROID_USE_NOTIF;
class SunsetAlarmApp extends StatelessWidget { class SunsetAlarmApp extends StatelessWidget {
const SunsetAlarmApp({super.key}); const SunsetAlarmApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
const seedColor = Colors.deepOrange;
return MaterialApp( return MaterialApp(
title: 'Sunset Alarm', title: 'Sunset Alarm',
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange), colorScheme: ColorScheme.fromSeed(
useMaterial3: true, seedColor: seedColor,
brightness: Brightness.light,
),
), ),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: seedColor,
brightness: Brightness.dark,
),
),
themeMode: ThemeMode.system,
home: const HomeScreen(), home: const HomeScreen(),
); );
} }
@@ -41,15 +71,20 @@ class HomeScreen extends StatefulWidget {
class _HomeScreenState extends State<HomeScreen> { class _HomeScreenState extends State<HomeScreen> {
final _latController = TextEditingController(); final _latController = TextEditingController();
final _lngController = TextEditingController(); final _lngController = TextEditingController();
final _sunsetController = TextEditingController(); final _sunsetController = TextEditingController(text: "18:00");
final _minutesController = TextEditingController(text: '30'); final _minutesController = TextEditingController(text: "30");
final FlutterLocalNotificationsPlugin _notifications = final FlutterLocalNotificationsPlugin _notifications =
FlutterLocalNotificationsPlugin(); FlutterLocalNotificationsPlugin();
bool _loading = false;
bool _alarmEnabled = false; bool _alarmEnabled = false;
int _minutesBefore = 30; int _minutesBefore = 30;
bool _loading = false; String _plural = 's';
String? _sunsetErrorText;
String? _minuteErrorText;
bool _validTime = false;
static const _alarmId = 1001; static const _alarmId = 1001;
@@ -67,7 +102,7 @@ class _HomeScreenState extends State<HomeScreen> {
defaultActionName: 'Sunset Alarm', defaultActionName: 'Sunset Alarm',
); );
await _notifications.initialize( await _notifications.initialize(
const InitializationSettings( settings: const InitializationSettings(
android: androidInit, android: androidInit,
iOS: iosInit, iOS: iosInit,
linux: linuxInit, linux: linuxInit,
@@ -78,15 +113,20 @@ class _HomeScreenState extends State<HomeScreen> {
Future<void> _loadPrefs() async { Future<void> _loadPrefs() async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
setState(() { setState(() {
final lat = prefs.getDouble('lat'); final lat = prefs.getDouble('lat').toString();
final lng = prefs.getDouble('lng'); final lng = prefs.getDouble('lng').toString();
final sunset = prefs.getString('sunset_time'); final sun = prefs.getString('sunset_time');
_alarmEnabled = prefs.getBool('alarm_enabled') ?? false; _latController.text = (lat == "null") ? "" : lat;
_lngController.text = (lng == "null") ? "" : lng;
_sunsetController.text = sun ?? "";
_minutesBefore = prefs.getInt('minutes_before') ?? 30; _minutesBefore = prefs.getInt('minutes_before') ?? 30;
if (lat != null) _latController.text = lat.toString(); _minutesController.text = _minutesBefore.toString();
if (lng != null) _lngController.text = lng.toString();
if (sunset != null) _sunsetController.text = sunset; _alarmEnabled = prefs.getBool('alarm_enabled') ?? false;
_minutesController.text = '$_minutesBefore'; _validTime = prefs.getBool('valid_time') ?? false;
_calcPlural();
}); });
if (_alarmEnabled && _sunsetController.text.isNotEmpty) { if (_alarmEnabled && _sunsetController.text.isNotEmpty) {
_scheduleAlarm(); _scheduleAlarm();
@@ -104,20 +144,21 @@ class _HomeScreenState extends State<HomeScreen> {
} }
await prefs.setBool('alarm_enabled', _alarmEnabled); await prefs.setBool('alarm_enabled', _alarmEnabled);
await prefs.setInt('minutes_before', _minutesBefore); await prefs.setInt('minutes_before', _minutesBefore);
await prefs.setBool('valid_time', _validTime);
} }
Future<void> _getGpsLocation() async { Future<void> _getGpsLocation() async {
try { try {
bool serviceEnabled = await Geolocator.isLocationServiceEnabled(); bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) { if (!serviceEnabled) {
_showSnack('Location services are disabled.'); _showSnack('Location Services Disabled');
return; return;
} }
LocationPermission permission = await Geolocator.checkPermission(); LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) { if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission(); permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) { if (permission == LocationPermission.denied) {
_showSnack('Location permission denied.'); _showSnack('Location Permission Denied');
return; return;
} }
} }
@@ -129,9 +170,9 @@ class _HomeScreenState extends State<HomeScreen> {
_lngController.text = position.longitude.toString(); _lngController.text = position.longitude.toString();
}); });
await _savePrefs(); await _savePrefs();
_showSnack('Location updated.'); _showSnack('Location Updated.');
} catch (e) { } catch (e) {
_showSnack('GPS error: $e'); _showSnack('GPS Error: $e');
} }
} }
@@ -139,7 +180,7 @@ class _HomeScreenState extends State<HomeScreen> {
final lat = double.tryParse(_latController.text); final lat = double.tryParse(_latController.text);
final lng = double.tryParse(_lngController.text); final lng = double.tryParse(_lngController.text);
if (lat == null || lng == null) { if (lat == null || lng == null) {
_showSnack('Enter valid latitude and longitude first.'); _showSnack('Enter Valid Latitude & Longitude');
return; return;
} }
@@ -157,14 +198,21 @@ class _HomeScreenState extends State<HomeScreen> {
final timePart = sunsetStr.split('T')[1]; final timePart = sunsetStr.split('T')[1];
setState(() => _sunsetController.text = timePart); setState(() => _sunsetController.text = timePart);
await _savePrefs(); await _savePrefs();
_showSnack('Sunset: $timePart'); _showSnack('Sunset Time Retrieved: $timePart');
} else { } else {
_showSnack('API error: ${response.statusCode}'); _showSnack('API Error: ${response.statusCode}');
} }
} catch (e) { } catch (e) {
_showSnack('Network error: $e'); _showSnack('Network Error: $e');
} finally { } finally {
setState(() => _loading = false); setState(() {
_loading = false;
_validTime = true;
});
}
if (_alarmEnabled) {
_scheduleAlarm();
} }
} }
@@ -188,7 +236,7 @@ class _HomeScreenState extends State<HomeScreen> {
alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore)); alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore));
if (alarmTime.isBefore(now)) { if (alarmTime.isBefore(now)) {
_showSnack('Alarm time is in the past. Will fire tomorrow.'); _showSnack('Alarm Time In Past - Will Start Tomorrow');
alarmTime = alarmTime.add(const Duration(days: 1)); alarmTime = alarmTime.add(const Duration(days: 1));
} }
@@ -203,38 +251,88 @@ class _HomeScreenState extends State<HomeScreen> {
timeout: LinuxNotificationTimeout.expiresNever(), timeout: LinuxNotificationTimeout.expiresNever(),
); );
_notifications.show( _notifications.show(
_alarmId, id: _alarmId,
'Sunset in ${_minutesBefore} min', title: 'Sunset in ${_minutesBefore} min!',
'The sun sets at $sunsetText. Time to get ready!', body: 'The sun sets at $sunsetText.',
const NotificationDetails(linux: linuxDetails), notificationDetails: const NotificationDetails(linux: linuxDetails),
); );
}); });
_showSnack( _showSnack(
'Alarm set for ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (app must stay open)', 'Alarm Enabled @ ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (App Must Stay Open!)',
); );
} else if (Platform.isAndroid) {
// Get the Notifications permission:
final android =
_notifications
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>();
await android?.requestNotificationsPermission();
// Ensure that Android has the correct alarm permissions.
final canSchedule = await android?.canScheduleExactNotifications();
if (canSchedule != true) {
_showSnack('Permissions Need Granted, Requesting...');
await android?.requestExactAlarmsPermission();
}
/*** Notification Method - Works ***/
if (ANDROID_USE_NOTIF) {
// Android: use zonedSchedule (works in background)
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
const androidDetails = AndroidNotificationDetails(
'sunset_alarm',
'Sunset Alarm',
channelDescription: 'Alarm X minutes before sunset',
importance: Importance.max,
priority: Priority.high,
fullScreenIntent: true,
category: AndroidNotificationCategory.alarm,
);
await _notifications.zonedSchedule(
id: _alarmId,
title: 'Sunset in ${_minutesBefore} min',
body: 'The sun sets at $sunsetText. Time to get ready!',
scheduledDate: tzAlarm,
notificationDetails: const NotificationDetails(
android: androidDetails,
),
androidScheduleMode: AndroidScheduleMode.alarmClock,
);
_showSnack('Alarm scheduled!');
debugPrint('DEBUG: Alarm time: ${tzAlarm.toString()}');
debugPrint('DEBUG: Current time: ${DateTime.now().toUtc().toString()}');
debugPrint('DEBUG: ${_notifications.toString()}');
}
// End Notification Method ***/
/*** Alarm Method - Works ***/
if (ANDROID_USE_ALARM) {
// Schedule:
final settings = AlarmSettings(
id: _alarmId,
dateTime: alarmTime,
//assetAudioPath: 'assets/alarm.mp3', // use default rather than custom
loopAudio: true, // keeps ringing until dismissed
vibrate: true,
androidFullScreenIntent: true, // wakes screen like clock app
volumeSettings: VolumeSettings.fade(
//volume: 0.8, // use default rather than custom
fadeDuration: Duration(seconds: 60),
),
notificationSettings: NotificationSettings(
title: 'Sunset Alarm',
body: 'Sun is setting in ${_minutesBefore} minute${_plural}!',
stopButton: 'Dismiss',
icon: 'ic_notification',
),
);
await Alarm.set(alarmSettings: settings);
}
// End Alarm Method ***/
_showSnack('Alarm Scheduled @ ${alarmTime}');
} else { } else {
// Android: use zonedSchedule (works in background) _showSnack('Platform Not Detected - Contact Developer');
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
const androidDetails = AndroidNotificationDetails(
'sunset_alarm',
'Sunset Alarm',
channelDescription: 'Alarm X minutes before sunset',
importance: Importance.max,
priority: Priority.high,
fullScreenIntent: true,
category: AndroidNotificationCategory.alarm,
);
await _notifications.zonedSchedule(
_alarmId,
'Sunset in ${_minutesBefore} min',
'The sun sets at $sunsetText. Time to get ready!',
tzAlarm,
const NotificationDetails(android: androidDetails),
androidScheduleMode: AndroidScheduleMode.alarmClock,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
);
_showSnack('Alarm scheduled.');
} }
} }
@@ -244,20 +342,33 @@ class _HomeScreenState extends State<HomeScreen> {
if (value) { if (value) {
await _scheduleAlarm(); await _scheduleAlarm();
} else { } else {
_alarmTimer?.cancel(); _stopAlarm();
if (!Platform.isLinux) {
await _notifications.cancel(_alarmId);
}
_showSnack('Alarm cancelled.');
} }
} }
Future<void> _stopAlarm() async {
if (Platform.isLinux) {
_alarmTimer?.cancel();
} else if (Platform.isAndroid) {
// Notification Method
if (ANDROID_USE_NOTIF) {
await _notifications.cancel(id: _alarmId);
}
// Alarm Method
if (ANDROID_USE_ALARM) {
await Alarm.stop(_alarmId);
}
}
_showSnack('Alarm Cancelled');
}
void _showSnack(String msg) { void _showSnack(String msg) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg))); ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
} }
@override @override
void dispose() { void dispose() {
_savePrefs();
_latController.dispose(); _latController.dispose();
_lngController.dispose(); _lngController.dispose();
_sunsetController.dispose(); _sunsetController.dispose();
@@ -265,138 +376,218 @@ class _HomeScreenState extends State<HomeScreen> {
super.dispose(); super.dispose();
} }
String? _validateTime(String? value) {
setState(() {
_validTime = false;
});
if (value == null || !RegExp(r'^\d{2}:\d{2}$').hasMatch(value)) {
return 'Use HH:MM Format';
}
final h = int.parse(value.substring(0, 2));
final m = int.parse(value.substring(3, 5));
if (h > 23) return 'Hour Must Be 0–23';
if (m > 59) return 'Minute Must Be 0–59';
setState(() {
_validTime = true;
});
return null; // valid
}
void _calcPlural() {
setState(() {
_plural = (_minutesBefore == 1) ? '' : 's';
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Sunset Alarm')), appBar: AppBar(title: const Text('Sunset Alarm')),
body: Padding( resizeToAvoidBottomInset: true, // default, but be explicit
padding: const EdgeInsets.all(16), body: SingleChildScrollView(
child: Column( child: Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: const EdgeInsets.all(16),
children: [ child: Column(
// --- Location section --- crossAxisAlignment: CrossAxisAlignment.start,
const Text( children: [
'Location', // --- Location section ---
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), const Text(
), 'Location',
const SizedBox(height: 8), style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
Row( ),
children: [ const SizedBox(height: 8),
Expanded( Row(
child: TextField( children: [
controller: _latController, Expanded(
keyboardType: const TextInputType.numberWithOptions( child: TextField(
signed: true, controller: _latController,
decimal: true, keyboardType: const TextInputType.numberWithOptions(
signed: true,
decimal: true,
),
decoration: const InputDecoration(
labelText: 'Latitude',
border: OutlineInputBorder(),
),
onChanged: (_) => _savePrefs(),
), ),
decoration: const InputDecoration(
labelText: 'Latitude',
border: OutlineInputBorder(),
),
onChanged: (_) => _savePrefs(),
), ),
), const SizedBox(width: 8),
const SizedBox(width: 8), Expanded(
Expanded( child: TextField(
child: TextField( controller: _lngController,
controller: _lngController, keyboardType: const TextInputType.numberWithOptions(
keyboardType: const TextInputType.numberWithOptions( signed: true,
signed: true, decimal: true,
decimal: true, ),
decoration: const InputDecoration(
labelText: 'Longitude',
border: OutlineInputBorder(),
),
onChanged: (_) => _savePrefs(),
), ),
decoration: const InputDecoration(
labelText: 'Longitude',
border: OutlineInputBorder(),
),
onChanged: (_) => _savePrefs(),
), ),
), const SizedBox(width: 8),
const SizedBox(width: 8), IconButton.filledTonal(
IconButton.filledTonal( icon: const Icon(Icons.my_location),
icon: const Icon(Icons.my_location), tooltip: 'Get GPS Location',
tooltip: 'Get GPS location', onPressed: _getGpsLocation,
onPressed: _getGpsLocation, ),
), ],
], ),
), const SizedBox(height: 16),
const SizedBox(height: 16),
// --- Sunset time section --- // --- Sunset time section ---
const Text( const Text(
'Sunset', 'Sunset',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Row( Row(
children: [ children: [
Expanded( Expanded(
child: TextField( child: TextField(
controller: _sunsetController, controller: _sunsetController,
decoration: const InputDecoration( decoration: InputDecoration(
labelText: 'Sunset time (HH:MM)', labelText: 'Sunset Time (HH:MM)',
border: OutlineInputBorder(), border: OutlineInputBorder(),
errorText: _sunsetErrorText,
suffixIcon: IconButton(
icon: Icon(Icons.access_time),
onPressed: () async {
final picked = await showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
);
if (picked != null) {
_sunsetController.text =
'${picked.hour.toString().padLeft(2, '0')}:'
'${picked.minute.toString().padLeft(2, '0')}';
setState(
() =>
_sunsetErrorText = _validateTime(
_sunsetController.text,
),
);
if (_alarmEnabled) {
_scheduleAlarm();
}
}
},
),
),
onChanged: (v) {
if (v == "") {
_stopAlarm();
}
final val = _validateTime(v);
if (val == null) {
_savePrefs();
if (_alarmEnabled) {
_scheduleAlarm();
}
}
setState(() {
_sunsetErrorText = val;
});
},
), ),
onChanged: (_) => _savePrefs(),
), ),
), const SizedBox(width: 8),
const SizedBox(width: 8), IconButton.filledTonal(
IconButton.filledTonal( icon:
icon: _loading
_loading ? const SizedBox(
? const SizedBox( width: 20,
width: 20, height: 20,
height: 20, child: CircularProgressIndicator(strokeWidth: 2),
child: CircularProgressIndicator(strokeWidth: 2), )
) : const Icon(Icons.cloud_done_outlined),
: const Icon(Icons.cloud_done_outlined), tooltip: 'Fetch Open-Meteo Sunset Data',
tooltip: 'Fetch sunset from Open-Meteo', onPressed: () {
onPressed: _loading ? null : _fetchSunset, if (!_loading) {
), _fetchSunset();
],
),
const SizedBox(height: 16),
// --- Minutes before ---
const Text(
'Alert Before Sunset',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
Row(
children: [
const Text('Minutes before: '),
SizedBox(
width: 80,
child: TextField(
controller: _minutesController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
border: OutlineInputBorder(),
),
onChanged: (v) {
final val = int.tryParse(v);
if (val != null && val > 0) {
_minutesBefore = val;
} }
}, },
), ),
), ],
],
),
const SizedBox(height: 24),
// --- Toggle ---
SwitchListTile(
title: const Text('Enable Sunset Alarm'),
subtitle: Text(
_alarmEnabled
? 'Will alert ${_minutesBefore} min before sunset. ($_alarmDisplayTime)'
: 'Alarm is off',
), ),
value: _alarmEnabled, const SizedBox(height: 16),
onChanged: _toggleAlarm,
), const Text(
], 'Alert',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
// --- Minutes before ---
TextField(
controller: _minutesController,
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Minutes Before Sunset',
errorText: _minuteErrorText,
),
onChanged: (v) {
final val = int.tryParse(v);
setState(() {
if (val != null) {
_minuteErrorText = null;
_minutesBefore = val;
} else {
_minuteErrorText = 'Invalid Minute Value';
}
_calcPlural();
});
},
),
// --- Toggle ---
SwitchListTile(
title: Center(
child: Text(
_validTime
? _alarmEnabled
? "Sunset Alarm Enabled"
: "Enable"
: "Disabled",
),
),
subtitle: Center(
child: Text(
_validTime
? _alarmEnabled
? "${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime"
: "Sunset Alarm"
: "Enter Valid Time",
),
),
value: _validTime ? _alarmEnabled : false,
onChanged: _validTime ? _toggleAlarm : null,
),
],
),
), ),
), ),
); );
@@ -417,3 +608,27 @@ class _HomeScreenState extends State<HomeScreen> {
return '${dh.toString().padLeft(2, '0')}:${dm.toString().padLeft(2, '0')}'; return '${dh.toString().padLeft(2, '0')}:${dm.toString().padLeft(2, '0')}';
} }
} }
final _plugin = FlutterLocalNotificationsPlugin();
Future<void> requestPermissions() async {
if (Platform.isAndroid) {
final android =
_plugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>();
// Android 13+ — standard notification permission (shows a dialog)
await android?.requestNotificationsPermission();
// Android 12+ — exact alarm special access (opens system settings page)
await android?.requestExactAlarmsPermission();
}
}
final android =
_plugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>();
+1
View File
@@ -0,0 +1 @@
Images, audio, and anything else used to support the app.
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
+1
View File
@@ -0,0 +1 @@
Images for use as app icons.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.
+1
View File
@@ -0,0 +1 @@
Images for use in app stores.
+10 -7
View File
@@ -1,7 +1,7 @@
name: sunset_alarm name: sunset_alarm
description: "Set an alarm to go off a specified time before sunset." description: "Set an alarm to go off a specified time before sunset."
publish_to: 'none' publish_to: 'none'
version: 0.1.1 version: 1.1.0
environment: environment:
sdk: ^3.7.2 sdk: ^3.7.2
@@ -9,16 +9,19 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
geolocator: ^13.0.0 geolocator: ^14.1.1
shared_preferences: ^2.3.0 shared_preferences: ^2.5.5
flutter_local_notifications: ^18.0.0 flutter_local_notifications: ^22.3.1
timezone: ^0.9.0 timezone: ^0.11.1
http: ^1.2.0 http: ^1.6.0
alarm: ^5.13.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^5.0.0 flutter_lints: ^6.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true
assets:
- media/certs/