0.1.2 #1
No files matched your search
@@ -153,3 +153,6 @@ google-services.json
|
|||||||
# Android Profiling
|
# Android Profiling
|
||||||
*.hprof
|
*.hprof
|
||||||
|
|
||||||
|
# Staged build files for distribution.
|
||||||
|
*.linux-bundle.zip
|
||||||
|
release/*
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1 +1,10 @@
|
|||||||
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
- build/**
|
||||||
|
- android/**
|
||||||
|
- ios/**
|
||||||
|
- web/**
|
||||||
|
- windows/**
|
||||||
|
- macos/**
|
||||||
|
- linux/**
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
@@ -1,27 +1,36 @@
|
|||||||
|
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
|
||||||
@@ -39,6 +48,10 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
|
||||||
|
}
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
source = "../.."
|
source = "../.."
|
||||||
}
|
}
|
||||||
@@ -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"
|
||||||
|
>
|
||||||
|
|
||||||
|
<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"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<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,60 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<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
|
||||||
|
|||||||
|
After Width: | Height: | Size: 15 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
|
||||||
|
|
||||||
@@ -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>
|
||||||
|
Before Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 910 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 818 B |
|
After Width: | Height: | Size: 602 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
@@ -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
|
||||||
@@ -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
|
|
||||||
@@ -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")
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
#!/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
|
||||||
|
}
|
||||||
|
|
||||||
|
## 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'."
|
||||||
|
|
||||||
|
## Main ##
|
||||||
|
|
||||||
|
clean_flutter
|
||||||
|
|
||||||
|
log "Building Linux Bundle..."
|
||||||
|
flutter build linux
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
clean_flutter
|
||||||
|
|
||||||
|
log "Building APK..."
|
||||||
|
flutter build apk
|
||||||
|
|
||||||
|
log "Saving APK..."
|
||||||
|
filename=$RELEASE.apk
|
||||||
|
if [[ -e $filename ]]; then
|
||||||
|
rm -v $filename
|
||||||
|
fi
|
||||||
|
cp -v build/app/outputs/flutter-apk/app-release.apk $filename
|
||||||
|
ls -sh $filename
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -1,45 +1,491 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'dart:io';
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
void main() {
|
import 'package:flutter/material.dart';
|
||||||
runApp(const MainApp());
|
import 'package:geolocator/geolocator.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
|
import 'package:timezone/data/latest_all.dart' as tz;
|
||||||
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
//import 'package:alarm/alarm.dart';
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
tz.initializeTimeZones();
|
||||||
|
//await Alarm.init();
|
||||||
|
runApp(const SunsetAlarmApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainApp extends StatelessWidget {
|
class SunsetAlarmApp extends StatelessWidget {
|
||||||
const MainApp({super.key});
|
const SunsetAlarmApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
title: 'Sunset Alarm',
|
||||||
body: Column(
|
theme: ThemeData(
|
||||||
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
|
||||||
|
useMaterial3: true,
|
||||||
|
),
|
||||||
|
home: const HomeScreen(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HomeScreen extends StatefulWidget {
|
||||||
|
const HomeScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HomeScreen> createState() => _HomeScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomeScreenState extends State<HomeScreen> {
|
||||||
|
final _latController = TextEditingController();
|
||||||
|
final _lngController = TextEditingController();
|
||||||
|
final _sunsetController = TextEditingController();
|
||||||
|
final _minutesController = TextEditingController(text: '30');
|
||||||
|
|
||||||
|
final FlutterLocalNotificationsPlugin _notifications =
|
||||||
|
FlutterLocalNotificationsPlugin();
|
||||||
|
|
||||||
|
bool _alarmEnabled = false;
|
||||||
|
int _minutesBefore = 30;
|
||||||
|
bool _loading = false;
|
||||||
|
|
||||||
|
static const _alarmId = 1001;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_initNotifications();
|
||||||
|
_loadPrefs();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _initNotifications() async {
|
||||||
|
const androidInit = AndroidInitializationSettings('@mipmap/ic_launcher');
|
||||||
|
const iosInit = DarwinInitializationSettings();
|
||||||
|
const linuxInit = LinuxInitializationSettings(
|
||||||
|
defaultActionName: 'Sunset Alarm',
|
||||||
|
);
|
||||||
|
await _notifications.initialize(
|
||||||
|
settings: const InitializationSettings(
|
||||||
|
android: androidInit,
|
||||||
|
iOS: iosInit,
|
||||||
|
linux: linuxInit,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _loadPrefs() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
setState(() {
|
||||||
|
final lat = prefs.getDouble('lat');
|
||||||
|
final lng = prefs.getDouble('lng');
|
||||||
|
final sunset = prefs.getString('sunset_time');
|
||||||
|
_alarmEnabled = prefs.getBool('alarm_enabled') ?? false;
|
||||||
|
_minutesBefore = prefs.getInt('minutes_before') ?? 30;
|
||||||
|
if (lat != null) _latController.text = lat.toString();
|
||||||
|
if (lng != null) _lngController.text = lng.toString();
|
||||||
|
if (sunset != null) _sunsetController.text = sunset;
|
||||||
|
_minutesController.text = '$_minutesBefore';
|
||||||
|
});
|
||||||
|
if (_alarmEnabled && _sunsetController.text.isNotEmpty) {
|
||||||
|
_scheduleAlarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _savePrefs() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final lat = double.tryParse(_latController.text);
|
||||||
|
final lng = double.tryParse(_lngController.text);
|
||||||
|
if (lat != null) await prefs.setDouble('lat', lat);
|
||||||
|
if (lng != null) await prefs.setDouble('lng', lng);
|
||||||
|
if (_sunsetController.text.isNotEmpty) {
|
||||||
|
await prefs.setString('sunset_time', _sunsetController.text);
|
||||||
|
}
|
||||||
|
await prefs.setBool('alarm_enabled', _alarmEnabled);
|
||||||
|
await prefs.setInt('minutes_before', _minutesBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _getGpsLocation() async {
|
||||||
|
try {
|
||||||
|
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||||
|
if (!serviceEnabled) {
|
||||||
|
_showSnack('Location services are disabled.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LocationPermission permission = await Geolocator.checkPermission();
|
||||||
|
if (permission == LocationPermission.denied) {
|
||||||
|
permission = await Geolocator.requestPermission();
|
||||||
|
if (permission == LocationPermission.denied) {
|
||||||
|
_showSnack('Location permission denied.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final position = await Geolocator.getCurrentPosition(
|
||||||
|
desiredAccuracy: LocationAccuracy.high,
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
_latController.text = position.latitude.toString();
|
||||||
|
_lngController.text = position.longitude.toString();
|
||||||
|
});
|
||||||
|
await _savePrefs();
|
||||||
|
_showSnack('Location updated.');
|
||||||
|
} catch (e) {
|
||||||
|
_showSnack('GPS error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _fetchSunset() async {
|
||||||
|
final lat = double.tryParse(_latController.text);
|
||||||
|
final lng = double.tryParse(_lngController.text);
|
||||||
|
if (lat == null || lng == null) {
|
||||||
|
_showSnack('Enter valid latitude and longitude first.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() => _loading = true);
|
||||||
|
try {
|
||||||
|
final url = Uri.parse(
|
||||||
|
'https://api.open-meteo.com/v1/forecast'
|
||||||
|
'?latitude=$lat&longitude=$lng'
|
||||||
|
'&daily=sunset&timezone=auto&forecast_days=1',
|
||||||
|
);
|
||||||
|
final response = await http.get(url);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = jsonDecode(response.body);
|
||||||
|
final sunsetStr = data['daily']['sunset'][0] as String;
|
||||||
|
final timePart = sunsetStr.split('T')[1];
|
||||||
|
setState(() => _sunsetController.text = timePart);
|
||||||
|
await _savePrefs();
|
||||||
|
_showSnack('Sunset: $timePart');
|
||||||
|
} else {
|
||||||
|
_showSnack('API error: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
_showSnack('Network error: $e');
|
||||||
|
} finally {
|
||||||
|
setState(() => _loading = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer? _alarmTimer;
|
||||||
|
|
||||||
|
Future<void> _scheduleAlarm() async {
|
||||||
|
// 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 not yet granted, requesting...');
|
||||||
|
await android?.requestExactAlarmsPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
final sunsetText = _sunsetController.text.trim();
|
||||||
|
if (sunsetText.isEmpty) return;
|
||||||
|
|
||||||
|
final now = DateTime.now();
|
||||||
|
final parts = sunsetText.split(':');
|
||||||
|
if (parts.length < 2) return;
|
||||||
|
|
||||||
|
final h = int.parse(parts[0]);
|
||||||
|
final m = int.parse(parts[1]);
|
||||||
|
var alarmTime = DateTime(now.year, now.month, now.day, h, m);
|
||||||
|
|
||||||
|
if (alarmTime.isBefore(now)) {
|
||||||
|
alarmTime = alarmTime.add(const Duration(days: 1));
|
||||||
|
}
|
||||||
|
alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore));
|
||||||
|
|
||||||
|
if (alarmTime.isBefore(now)) {
|
||||||
|
_showSnack('Alarm time is in the past. Will fire tomorrow.');
|
||||||
|
alarmTime = alarmTime.add(const Duration(days: 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
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. Time to get ready!',
|
||||||
|
notificationDetails: const NotificationDetails(linux: linuxDetails),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
_showSnack(
|
||||||
|
'Alarm set for ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (app must stay open)',
|
||||||
|
);
|
||||||
|
} else if (Platform.isAndroid) {
|
||||||
|
/*** Notifcation Method - Works ***/
|
||||||
|
// 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 - WIP *** /
|
||||||
|
// Schedule:
|
||||||
|
final settings = AlarmSettings(
|
||||||
|
id: 42,
|
||||||
|
dateTime: alarmTime, // your computed sunset time
|
||||||
|
assetAudioPath: 'assets/alarm.mp3', // put an alarm sound in assets/
|
||||||
|
loopAudio: true, // keeps ringing until dismissed
|
||||||
|
vibrate: true,
|
||||||
|
androidFullScreenIntent: true, // wakes screen like clock app
|
||||||
|
volumeSettings: VolumeSettings.fade(
|
||||||
|
volume: 0.8,
|
||||||
|
fadeDuration: Duration(seconds: 5),
|
||||||
|
),
|
||||||
|
notificationSettings: const NotificationSettings(
|
||||||
|
title: 'Sunset Alarm',
|
||||||
|
body: 'The sun sets now. Time to get ready!',
|
||||||
|
stopButton: 'Dismiss',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await Alarm.set(alarmSettings: settings);
|
||||||
|
// End Alarm Method ***/
|
||||||
|
} else {
|
||||||
|
_showSnack('Platform not detected, unsure how to show alarm.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _toggleAlarm(bool value) async {
|
||||||
|
setState(() => _alarmEnabled = value);
|
||||||
|
await _savePrefs();
|
||||||
|
if (value) {
|
||||||
|
await _scheduleAlarm();
|
||||||
|
} else {
|
||||||
|
_alarmTimer?.cancel();
|
||||||
|
if (!Platform.isLinux) {
|
||||||
|
await _notifications.cancel(id: _alarmId);
|
||||||
|
}
|
||||||
|
_showSnack('Alarm cancelled.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showSnack(String msg) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_latController.dispose();
|
||||||
|
_lngController.dispose();
|
||||||
|
_sunsetController.dispose();
|
||||||
|
_minutesController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: const Text('Sunset Alarm')),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Sunset Coordinates"), // TODO: Text Field
|
// --- Location section ---
|
||||||
Text(
|
const Text(
|
||||||
"Hours before Sunset",
|
'Location',
|
||||||
), // TODO: Text Field. Add Spanish translation "Horas antes Noche"
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
TextButton(
|
|
||||||
child: Text("Set Alarm"),
|
|
||||||
onPressed: () {
|
|
||||||
null;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
// If enabled, this section controls "Pythagorian theorum" (spelling)
|
const SizedBox(height: 8),
|
||||||
// type math to check if the user has exited the distance from the
|
|
||||||
// sunset location.
|
|
||||||
Text("Enable Proximity Detector / Geofencing"), // TODO: Checkbox
|
|
||||||
Text(
|
|
||||||
"Current Coordinates",
|
|
||||||
), // TODO: Read Only View with current location
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Text("Distance"), // TODO: Text Field
|
Expanded(
|
||||||
Text("* Miles, * Kilometers"), // TODO: Radio Button Group
|
child: TextField(
|
||||||
|
controller: _latController,
|
||||||
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
|
signed: true,
|
||||||
|
decimal: true,
|
||||||
|
),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Latitude',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
onChanged: (_) => _savePrefs(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: _lngController,
|
||||||
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
|
signed: true,
|
||||||
|
decimal: true,
|
||||||
|
),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Longitude',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
onChanged: (_) => _savePrefs(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
IconButton.filledTonal(
|
||||||
|
icon: const Icon(Icons.my_location),
|
||||||
|
tooltip: 'Get GPS location',
|
||||||
|
onPressed: _getGpsLocation,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// --- Sunset time section ---
|
||||||
|
const Text(
|
||||||
|
'Sunset',
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: _sunsetController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Sunset time (HH:MM)',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
onChanged: (_) => _savePrefs(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
IconButton.filledTonal(
|
||||||
|
icon:
|
||||||
|
_loading
|
||||||
|
? const SizedBox(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
|
)
|
||||||
|
: const Icon(Icons.cloud_done_outlined),
|
||||||
|
tooltip: 'Fetch sunset from Open-Meteo',
|
||||||
|
onPressed: _loading ? null : _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;
|
||||||
|
} else {
|
||||||
|
_showSnack('Invalid Minute Value');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
onChanged: _toggleAlarm,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get _alarmDisplayTime {
|
||||||
|
final sunsetText = _sunsetController.text.trim();
|
||||||
|
if (sunsetText.isEmpty) return '—';
|
||||||
|
final parts = sunsetText.split(':');
|
||||||
|
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
|
||||||
|
>();
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Images, audio, and anything else used to support the app.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Images for use as app icons.
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1 @@
|
|||||||
|
Images for use in app stores.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
name: flutter_sunset_alarm
|
name: sunset_alarm
|
||||||
description: "A new Flutter project."
|
description: "Set an alarm to go off a specified time before sunset."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.1.0
|
version: 0.1.2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.7.2
|
sdk: ^3.7.2
|
||||||
@@ -9,11 +9,17 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
geolocator: ^14.1.1
|
||||||
|
shared_preferences: ^2.5.5
|
||||||
|
flutter_local_notifications: ^22.3.1
|
||||||
|
timezone: ^0.11.1
|
||||||
|
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
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||