66 Commits
Author SHA1 Message Date
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
me 952c0449d5 android, successfully upgraded gradle and AGP to 9. 2026-09-13 18:18:43 -07:00
me 4b2f295fe7 Auto changes from Flutter and Android Studio. 2026-09-12 20:43:07 -07:00
me 0f979d3d31 Enable "core library deguaring" for android. 2026-09-12 20:42:41 -07:00
me 4ba8777ca9 Missed a flutter_. 2026-09-12 20:30:29 -07:00
me 1064a0b33f Successful settings to build on Android!! Finally! 2026-09-12 20:27:55 -07:00
me 718992eb42 Change flutter_sunset_alarm to just sunset_alarm. 2026-09-12 19:27:05 -07:00
me bb396abe20 Remove the flutter_ from app ID. 2026-09-12 18:42:57 -07:00
me 50cb05f3c9 Refactor library order. 2026-09-12 17:24:00 -07:00
me e47c85b3d9 Continue trying to fix Linux alarm. Android untested. 2026-09-12 17:22:35 -07:00
me 71e6f4e13d Alter message to show when the alarm is set for. Try fixing the alarm for Linux. 2026-09-12 17:17:40 -07:00
me 0e46307815 Automatic refactor after changing Code OSS settings. 2026-09-12 17:06:43 -07:00
me dc15af60dd Fix the minutes field to be persistent. (via Ask Brave) 2026-09-12 16:52:56 -07:00
63 changed files with 779 additions and 215 deletions

No files matched your search

+3
View File
@@ -153,3 +153,6 @@ google-services.json
# Android Profiling # Android Profiling
*.hprof *.hprof
# Staged build files for distribution.
*.linux-bundle.zip
release/*
+1 -1
View File
@@ -1,4 +1,4 @@
# flutter_sunset_alarm # sunset_alarm
Android app to set off an alarm a set number of hours before sunset if enabled Android app to set off an alarm a set number of hours before sunset if enabled
manually or if the user has wandered a set distance away from the sunset manually or if the user has wandered a set distance away from the sunset
+9
View File
@@ -1 +1,10 @@
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
+43 -8
View File
@@ -1,27 +1,38 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
id("com.android.application") id("com.android.application")
id("kotlin-android")
// This supposedly needs removed in Gradle/AGP 9 but works fine.
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")
} }
android { android {
namespace = "com.example.flutter_sunset_alarm" namespace = "com.hyperling.sunset_alarm"
compileSdk = flutter.compileSdkVersion compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion ndkVersion = flutter.ndkVersion
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 isCoreLibraryDesugaringEnabled = true
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
} }
kotlinOptions { // This supposedly needs removed in Gradle/AGP 9, but then uses 21 and fails to build.
jvmTarget = JavaVersion.VERSION_11.toString() kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
} }
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.flutter_sunset_alarm" applicationId = "com.hyperling.sunset_alarm"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion minSdk = flutter.minSdkVersion
@@ -31,14 +42,38 @@ 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 {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
}
flutter { flutter {
source = "../.." source = "../.."
} }
View File
Whitespace-only changes.
+82 -7
View File
@@ -1,6 +1,34 @@
<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"/>
<application <application
android:label="flutter_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 +58,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 +122,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

@@ -1,4 +1,4 @@
package com.example.flutter_sunset_alarm package com.hyperling.sunset_alarm
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

@@ -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>
@@ -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="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
</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="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

+4
View File
@@ -1,3 +1,7 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false
+3 -1
View File
@@ -1,5 +1,7 @@
#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.7.1-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
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
+7 -2
View File
@@ -18,8 +18,13 @@ 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 "8.7.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false id("com.android.application") version "9.4.1" apply false
//id("com.android.application") version "9.0.1" apply false
// This will need removed in Gradle/AGP 9. JK - needs to exist otherwiese:
// "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.20" 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
+108
View File
@@ -0,0 +1,108 @@
#!/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="v${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 "Saving Linux Bundle..."
filename=$RELEASE.linux-bundle.zip
if [[ -e $filename ]]; then
rm -v $filename
fi
zip -r $filename build/linux/x64/release/bundle/*
ls -sh $filename
# 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"
ls -sh "$filename"
echo " "
done
# Finish
exit 0
+1 -1
View File
@@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>flutter_sunset_alarm</string> <string>sunset_alarm</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
+378 -161
View File
@@ -1,4 +1,6 @@
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';
@@ -6,25 +8,49 @@ 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';
/// TBD:
/// - Add other languages (Spanish, Croatian)
/// v1.1.0
/// - Change sunset grabber to checkbox and retrieve it each alarm or open.
/// v2.0.0
/// - Add sunrise section and change app name to Sunshine Alarm?
/// :TBD
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
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,13 +67,18 @@ class _HomeScreenState extends State<HomeScreen> {
final _latController = TextEditingController(); final _latController = TextEditingController();
final _lngController = TextEditingController(); final _lngController = TextEditingController();
final _sunsetController = TextEditingController(); final _sunsetController = TextEditingController();
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;
static const _alarmId = 1001; static const _alarmId = 1001;
@@ -59,13 +90,16 @@ class _HomeScreenState extends State<HomeScreen> {
} }
Future<void> _initNotifications() async { Future<void> _initNotifications() async {
const androidInit = const androidInit = AndroidInitializationSettings('@mipmap/ic_launcher');
AndroidInitializationSettings('@mipmap/ic_launcher'); const iosInit = DarwinInitializationSettings();
const linuxInit = DarwinInitializationSettings(); const linuxInit = LinuxInitializationSettings(
defaultActionName: 'Sunset Alarm',
);
await _notifications.initialize( await _notifications.initialize(
const InitializationSettings( settings: const InitializationSettings(
android: androidInit, android: androidInit,
iOS: linuxInit, iOS: iosInit,
linux: linuxInit,
), ),
); );
} }
@@ -81,6 +115,7 @@ class _HomeScreenState extends State<HomeScreen> {
if (lat != null) _latController.text = lat.toString(); if (lat != null) _latController.text = lat.toString();
if (lng != null) _lngController.text = lng.toString(); if (lng != null) _lngController.text = lng.toString();
if (sunset != null) _sunsetController.text = sunset; if (sunset != null) _sunsetController.text = sunset;
_minutesController.text = '$_minutesBefore';
}); });
if (_alarmEnabled && _sunsetController.text.isNotEmpty) { if (_alarmEnabled && _sunsetController.text.isNotEmpty) {
_scheduleAlarm(); _scheduleAlarm();
@@ -104,14 +139,14 @@ class _HomeScreenState extends State<HomeScreen> {
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;
} }
} }
@@ -123,9 +158,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');
} }
} }
@@ -133,7 +168,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;
} }
@@ -148,21 +183,26 @@ class _HomeScreenState extends State<HomeScreen> {
if (response.statusCode == 200) { if (response.statusCode == 200) {
final data = jsonDecode(response.body); final data = jsonDecode(response.body);
final sunsetStr = data['daily']['sunset'][0] as String; final sunsetStr = data['daily']['sunset'][0] as String;
// "2026-09-12T19:42" -> "19:42"
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);
} }
if (_alarmEnabled) {
_scheduleAlarm();
}
} }
Timer? _alarmTimer;
Future<void> _scheduleAlarm() async { Future<void> _scheduleAlarm() async {
final sunsetText = _sunsetController.text.trim(); final sunsetText = _sunsetController.text.trim();
if (sunsetText.isEmpty) return; if (sunsetText.isEmpty) return;
@@ -175,46 +215,110 @@ class _HomeScreenState extends State<HomeScreen> {
final m = int.parse(parts[1]); final m = int.parse(parts[1]);
var alarmTime = DateTime(now.year, now.month, now.day, h, m); var alarmTime = DateTime(now.year, now.month, now.day, h, m);
// If the alarm time has already passed today, schedule for tomorrow
if (alarmTime.isBefore(now)) { if (alarmTime.isBefore(now)) {
alarmTime = alarmTime.add(const Duration(days: 1)); alarmTime = alarmTime.add(const Duration(days: 1));
} }
// Subtract the "minutes before" offset
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));
} }
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local); if (Platform.isLinux) {
// Linux: use a Timer (app must stay open)
_alarmTimer?.cancel();
final delay = alarmTime.difference(now);
_alarmTimer = Timer(delay, () {
const linuxDetails = LinuxNotificationDetails(
urgency: LinuxNotificationUrgency.critical,
resident: true,
timeout: LinuxNotificationTimeout.expiresNever(),
);
_notifications.show(
id: _alarmId,
title: 'Sunset in ${_minutesBefore} min!',
body: 'The sun sets at $sunsetText.',
notificationDetails: const NotificationDetails(linux: linuxDetails),
);
});
_showSnack(
'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();
const androidDetails = AndroidNotificationDetails( // Ensure that Android has the correct alarm permissions.
'sunset_alarm', final canSchedule = await android?.canScheduleExactNotifications();
'Sunset Alarm', if (canSchedule != true) {
channelDescription: 'Alarm X minutes before sunset', _showSnack('Permissions Need Granted, Requesting...');
importance: Importance.max, await android?.requestExactAlarmsPermission();
priority: Priority.high, }
fullScreenIntent: true,
category: AndroidNotificationCategory.alarm,
);
const linuxDetails = DarwinNotificationDetails(
presentAlert: true,
presentBadge: true,
presentSound: true,
);
await _notifications.zonedSchedule( /*** Notification Method - Works ***/
_alarmId, if (ANDROID_USE_NOTIF) {
'Sunset in ${_minutesBefore} min', // Android: use zonedSchedule (works in background)
'The sun sets at $sunsetText. Time to get ready!', final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
tzAlarm, const androidDetails = AndroidNotificationDetails(
NotificationDetails(android: androidDetails, iOS: linuxDetails), 'sunset_alarm',
androidScheduleMode: AndroidScheduleMode.alarmClock, 'Sunset Alarm',
uiLocalNotificationDateInterpretation: channelDescription: 'Alarm X minutes before sunset',
UILocalNotificationDateInterpretation.absoluteTime, 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 {
_showSnack('Platform Not Detected - Contact Developer');
}
} }
Future<void> _toggleAlarm(bool value) async { Future<void> _toggleAlarm(bool value) async {
@@ -222,10 +326,16 @@ class _HomeScreenState extends State<HomeScreen> {
await _savePrefs(); await _savePrefs();
if (value) { if (value) {
await _scheduleAlarm(); await _scheduleAlarm();
_showSnack('Alarm scheduled.');
} else { } else {
await _notifications.cancel(_alarmId); _alarmTimer?.cancel();
_showSnack('Alarm cancelled.'); if (!Platform.isLinux) {
// Notification Method
if (ANDROID_USE_NOTIF) await _notifications.cancel(id: _alarmId);
// Alarm Method
if (ANDROID_USE_ALARM) await Alarm.stop(_alarmId);
}
_showSnack('Alarm Cancelled');
} }
} }
@@ -235,143 +345,250 @@ class _HomeScreenState extends State<HomeScreen> {
@override @override
void dispose() { void dispose() {
_savePrefs();
_latController.dispose(); _latController.dispose();
_lngController.dispose(); _lngController.dispose();
_sunsetController.dispose(); _sunsetController.dispose();
_minutesController.dispose();
super.dispose(); super.dispose();
} }
String? _validateTime(String? value) {
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';
return null; // valid
}
@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('Location', children: [
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), // --- Location section ---
const SizedBox(height: 8), const Text(
Row( 'Location',
children: [ style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
Expanded( ),
child: TextField( const SizedBox(height: 8),
controller: _latController, Row(
keyboardType: children: [
const TextInputType.numberWithOptions(signed: true, decimal: true), Expanded(
decoration: const InputDecoration( child: TextField(
labelText: 'Latitude', controller: _latController,
border: OutlineInputBorder(), keyboardType: const TextInputType.numberWithOptions(
signed: true,
decimal: true,
),
decoration: const InputDecoration(
labelText: 'Latitude',
border: OutlineInputBorder(),
),
onChanged: (_) => _savePrefs(),
), ),
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: signed: true,
const TextInputType.numberWithOptions(signed: true, decimal: true), decimal: true,
decoration: const InputDecoration( ),
labelText: 'Longitude', decoration: const InputDecoration(
border: OutlineInputBorder(), labelText: 'Longitude',
border: OutlineInputBorder(),
),
onChanged: (_) => _savePrefs(),
), ),
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('Sunset', const Text(
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), 'Sunset',
const SizedBox(height: 8), style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
Row( ),
children: [ const SizedBox(height: 8),
Expanded( Row(
child: TextField( children: [
controller: _sunsetController, Expanded(
decoration: const InputDecoration( child: TextField(
labelText: 'Sunset time (HH:MM)', controller: _sunsetController,
border: OutlineInputBorder(), decoration: InputDecoration(
labelText: 'Sunset Time (HH:MM)',
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) {
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 sunset from Open-Meteo', tooltip: 'Fetch Open-Meteo Sunset Data',
onPressed: _loading ? null : _fetchSunset, onPressed: () {
), 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: TextEditingController(text: '$_minutesBefore'),
keyboardType: TextInputType.number,
decoration:
const InputDecoration(border: OutlineInputBorder()),
onEditingComplete: () async {
final val = int.tryParse(
(findContextController() as TextEditingController?)?.text ?? '');
if (val != null && val > 0) {
setState(() => _minutesBefore = val);
await _savePrefs();
} }
}, },
), ),
), ],
],
),
const SizedBox(height: 24),
// --- Toggle ---
SwitchListTile(
title: const Text('Enable Sunset Alarm'),
subtitle: Text(
_alarmEnabled
? 'Will alert ${_minutesBefore} min before sunset'
: '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 ---
Row(
children: [
if (!_alarmEnabled)
Expanded(
child: 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';
}
_plural = (_minutesBefore == 1) ? '' : 's';
});
},
),
),
// --- Toggle ---
Expanded(
child: SwitchListTile(
//title: const Text('Enable Sunset Alarm'),
title: Text(_alarmEnabled ? 'Sunset Alarm Enabled' : ''),
subtitle: Text(
_alarmEnabled
? '${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime'
: '',
),
value: _alarmEnabled,
onChanged: _toggleAlarm,
),
),
],
),
],
),
), ),
), ),
); );
} }
// Helper to avoid recreating TextEditingController on each build String get _alarmDisplayTime {
TextEditingController? _minutesController; final sunsetText = _sunsetController.text.trim();
TextEditingController? findContextController() { if (sunsetText.isEmpty) return '—';
_minutesController ??= TextEditingController(text: '$_minutesBefore'); final parts = sunsetText.split(':');
return _minutesController; if (parts.length < 2) return '—';
final h = int.tryParse(parts[0]);
final m = int.tryParse(parts[1]);
if (h == null || m == null) return '—';
final alarmMinutes = h * 60 + m - _minutesBefore;
final displayMin = alarmMinutes % (24 * 60);
final dh = (displayMin ~/ 60) % 24;
final dm = displayMin % 60;
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
>();
+2 -2
View File
@@ -4,10 +4,10 @@ project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change # The name of the executable created for the application. Change this to change
# the on-disk name of your application. # the on-disk name of your application.
set(BINARY_NAME "flutter_sunset_alarm") set(BINARY_NAME "sunset_alarm")
# The unique GTK application identifier for this application. See: # The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID # https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.flutter_sunset_alarm") set(APPLICATION_ID "com.hyperling.sunset_alarm")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake. # versions of CMake.
+2 -2
View File
@@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) { if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar)); gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "flutter_sunset_alarm"); gtk_header_bar_set_title(header_bar, "sunset_alarm");
gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else { } else {
gtk_window_set_title(window, "flutter_sunset_alarm"); gtk_window_set_title(window, "sunset_alarm");
} }
gtk_window_set_default_size(window, 1280, 720); gtk_window_set_default_size(window, 1280, 720);
+6 -6
View File
@@ -64,7 +64,7 @@
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* flutter_sunset_alarm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "flutter_sunset_alarm.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10ED2044A3C60003C045 /* sunset_alarm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "sunset_alarm.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -131,7 +131,7 @@
33CC10EE2044A3C60003C045 /* Products */ = { 33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
33CC10ED2044A3C60003C045 /* flutter_sunset_alarm.app */, 33CC10ED2044A3C60003C045 /* sunset_alarm.app */,
331C80D5294CF71000263BE5 /* RunnerTests.xctest */, 331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
); );
name = Products; name = Products;
@@ -217,7 +217,7 @@
); );
name = Runner; name = Runner;
productName = Runner; productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* flutter_sunset_alarm.app */; productReference = 33CC10ED2044A3C60003C045 /* sunset_alarm.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@@ -388,7 +388,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm.RunnerTests; PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_sunset_alarm.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_sunset_alarm"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sunset_alarm.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/sunset_alarm";
}; };
name = Debug; name = Debug;
}; };
@@ -402,7 +402,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm.RunnerTests; PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_sunset_alarm.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_sunset_alarm"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sunset_alarm.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/sunset_alarm";
}; };
name = Release; name = Release;
}; };
@@ -416,7 +416,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm.RunnerTests; PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_sunset_alarm.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_sunset_alarm"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sunset_alarm.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/sunset_alarm";
}; };
name = Profile; name = Profile;
}; };
@@ -15,7 +15,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "flutter_sunset_alarm.app" BuildableName = "sunset_alarm.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
@@ -31,7 +31,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "flutter_sunset_alarm.app" BuildableName = "sunset_alarm.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
@@ -66,7 +66,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "flutter_sunset_alarm.app" BuildableName = "sunset_alarm.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
@@ -83,7 +83,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "flutter_sunset_alarm.app" BuildableName = "sunset_alarm.app"
BlueprintName = "Runner" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
+1 -1
View File
@@ -5,7 +5,7 @@
// 'flutter create' template. // 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window. // The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = flutter_sunset_alarm PRODUCT_NAME = sunset_alarm
// The application's bundle identifier // The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterSunsetAlarm
+1
View File
@@ -0,0 +1 @@
Images, audio, and anything else used to support the app.
+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.
+1
View File
@@ -0,0 +1 @@
Images for use in app stores.
+8 -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.0.0
environment: environment:
sdk: ^3.7.2 sdk: ^3.7.2
@@ -9,16 +9,17 @@ 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
+2 -2
View File
@@ -23,13 +23,13 @@
<!-- iOS meta tags & icons --> <!-- iOS meta tags & icons -->
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="flutter_sunset_alarm"> <meta name="apple-mobile-web-app-title" content="sunset_alarm">
<link rel="apple-touch-icon" href="icons/Icon-192.png"> <link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon --> <!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/> <link rel="icon" type="image/png" href="favicon.png"/>
<title>flutter_sunset_alarm</title> <title>sunset_alarm</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
</head> </head>
<body> <body>
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "flutter_sunset_alarm", "name": "sunset_alarm",
"short_name": "flutter_sunset_alarm", "short_name": "sunset_alarm",
"start_url": ".", "start_url": ".",
"display": "standalone", "display": "standalone",
"background_color": "#0175C2", "background_color": "#0175C2",
+2 -2
View File
@@ -1,10 +1,10 @@
# Project-level configuration. # Project-level configuration.
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(flutter_sunset_alarm LANGUAGES CXX) project(sunset_alarm LANGUAGES CXX)
# The name of the executable created for the application. Change this to change # The name of the executable created for the application. Change this to change
# the on-disk name of your application. # the on-disk name of your application.
set(BINARY_NAME "flutter_sunset_alarm") set(BINARY_NAME "sunset_alarm")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake. # versions of CMake.
+4 -4
View File
@@ -90,12 +90,12 @@ BEGIN
BLOCK "040904e4" BLOCK "040904e4"
BEGIN BEGIN
VALUE "CompanyName", "com.example" "\0" VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "flutter_sunset_alarm" "\0" VALUE "FileDescription", "sunset_alarm" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "flutter_sunset_alarm" "\0" VALUE "InternalName", "sunset_alarm" "\0"
VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "flutter_sunset_alarm.exe" "\0" VALUE "OriginalFilename", "sunset_alarm.exe" "\0"
VALUE "ProductName", "flutter_sunset_alarm" "\0" VALUE "ProductName", "sunset_alarm" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"
END END
END END
+1 -1
View File
@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project); FlutterWindow window(project);
Win32Window::Point origin(10, 10); Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720); Win32Window::Size size(1280, 720);
if (!window.Create(L"flutter_sunset_alarm", origin, size)) { if (!window.Create(L"sunset_alarm", origin, size)) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
window.SetQuitOnClose(true); window.SetQuitOnClose(true);