diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index c07788517..dd18bb154 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -72,5 +72,6 @@ flutter {
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
implementation("androidx.work:work-runtime-ktx:2.9.0")
-
+ implementation("androidx.glance:glance-appwidget:1.0.0-alpha05")
+ implementation("com.google.android.material:material:1.12.0")
}
\ No newline at end of file
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 615611a23..03ec09431 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -40,6 +40,34 @@
android:name="flutterEmbedding"
android:value="2" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values-night-v31/colors.xml b/android/app/src/main/res/values-night-v31/colors.xml
new file mode 100644
index 000000000..070744bb6
--- /dev/null
+++ b/android/app/src/main/res/values-night-v31/colors.xml
@@ -0,0 +1,35 @@
+
+
+
+ @android:color/system_accent1_100
+ @android:color/system_accent1_900
+ @android:color/system_accent1_700
+ @android:color/system_accent1_100
+
+
+ @android:color/system_accent2_300
+ @android:color/system_accent2_900
+ @android:color/system_accent2_700
+ @android:color/system_accent2_100
+
+
+ @android:color/system_accent3_300
+ @android:color/system_accent3_900
+ @android:color/system_accent3_700
+ @android:color/system_accent3_100
+
+
+ @android:color/system_neutral1_900
+ @android:color/system_neutral1_100
+ @android:color/system_neutral1_700
+ @android:color/system_neutral1_100
+
+
+ @android:color/system_accent2_800
+ @color/black
+ @color/material_dynamic_neutral40
+
+
+ @android:color/system_neutral2_700
+ @android:color/system_neutral2_100
+
diff --git a/android/app/src/main/res/values-night/colors.xml b/android/app/src/main/res/values-night/colors.xml
new file mode 100644
index 000000000..3bd7ed6fa
--- /dev/null
+++ b/android/app/src/main/res/values-night/colors.xml
@@ -0,0 +1,29 @@
+
+ #aac7ff
+ #0a305f
+ #284777
+ #d6e3ff
+
+ #bec6dc
+ #283141
+ #3e4759
+ #dae2f9
+
+ #ddbce0
+ #3f2844
+ #573e5c
+ #fad8fd
+
+ #111318
+ #e2e2e9
+ #111318
+ #e2e2e9
+
+ #1d2024
+
+ #111318
+ #c4c6d0
+
+ #ffb4ab
+ #690005
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values-v31/colors.xml b/android/app/src/main/res/values-v31/colors.xml
new file mode 100644
index 000000000..6f9937f79
--- /dev/null
+++ b/android/app/src/main/res/values-v31/colors.xml
@@ -0,0 +1,37 @@
+
+
+
+ @android:color/system_accent1_600
+ @android:color/system_accent1_0
+ @android:color/system_accent1_100
+ @android:color/system_accent1_900
+
+
+ @android:color/system_accent2_600
+ @android:color/system_accent2_0
+ @android:color/system_accent2_100
+ @android:color/system_accent2_900
+
+
+ @android:color/system_accent3_600
+ @android:color/system_accent3_0
+ @android:color/system_accent3_100
+ @android:color/system_accent3_900
+
+
+ @android:color/system_neutral1_100
+ @android:color/system_neutral1_900
+ @android:color/system_neutral1_500
+ @android:color/system_neutral1_100
+
+
+ @android:color/system_accent2_50
+ @color/white
+ @color/material_dynamic_neutral90
+
+
+ @android:color/system_neutral2_500
+ @android:color/system_neutral1_500
+
+
+
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..6e696a57a
--- /dev/null
+++ b/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,35 @@
+
+
+ #FF000000
+ #FFFFFFFF
+
+
+
+ #415f91
+ #ffffff
+ #d6e3ff
+ #001b3e
+
+ #565f71
+ #ffffff
+ #dae2f9
+ #131c2b
+
+ #705575
+ #ffffff
+ #fad8fd
+ #28132e
+
+ #f9f9ff
+ #191c20
+ #f9f9ff
+ #191c20
+
+ #ededf4
+
+ #d9d9e0
+ #44474e
+
+ #ba1a1a
+ #ffffff
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index cb1ef8805..a3991de8e 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -11,8 +11,38 @@
Flutter UI initializes, as well as behind your Flutter UI while its
running.
+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
+
+
+
+
+
diff --git a/android/app/src/main/res/xml/weather_widget_info.xml b/android/app/src/main/res/xml/weather_widget_info.xml
new file mode 100644
index 000000000..af1491495
--- /dev/null
+++ b/android/app/src/main/res/xml/weather_widget_info.xml
@@ -0,0 +1,8 @@
+
+
diff --git a/lib/main.dart b/lib/main.dart
index 71371ccf8..b379ed411 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -22,6 +22,8 @@ import '../services/data_backup_service.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'dart:ui' as ui;
import 'package:workmanager/workmanager.dart';
+import 'widget_background.dart';
+import 'package:home_widget/home_widget.dart';
final CorePalette paletteStartScreen = CorePalette.of(const Color.fromARGB(255, 255, 196, 0).toARGB32());
@@ -69,6 +71,7 @@ final flutterSupportedLocales = easySupportedLocales
.toList();
+
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
@@ -88,6 +91,26 @@ void main() async {
final dir = await getApplicationDocumentsDirectory();
Hive.init(dir.path);
+ // widget------
+
+ Workmanager().initialize(
+ callbackDispatcherBG,
+ );
+
+ Workmanager().registerPeriodicTask(
+ "weatherAutoUpdateTask",
+ "weatherUpdate",
+ frequency: Duration(minutes: 15),
+ constraints: Constraints(
+ networkType: NetworkType.connected,
+ ),
+ );
+
+
+
+ // widget ------
+
+
final themeController = ThemeController();
await themeController.initialize();
await themeController.checkDynamicColorSupport();
diff --git a/lib/screens/home.dart b/lib/screens/home.dart
index 2b38438fa..627a5d68c 100644
--- a/lib/screens/home.dart
+++ b/lib/screens/home.dart
@@ -60,7 +60,11 @@ import '../widgets/pollen_card.dart';
import '../widgets/rain_block.dart';
import '../widgets/top_summary_block.dart';
import '../widgets/top_weather_card.dart';
-import '../widgets/alert_block.dart';
+
+
+// home widget
+import '../widget_background.dart';
+import 'package:workmanager/workmanager.dart';
class WeatherHome extends StatefulWidget {
@@ -270,7 +274,7 @@ Future saveLayoutConfig() async {
} else if (isHomeLocation && lastUpdated != null) {
final lastUpdateTime = DateTime.tryParse(lastUpdated);
final now = DateTime.now();
- if (lastUpdateTime != null && now.difference(lastUpdateTime).inMinutes < 450) {
+ if (lastUpdateTime != null && now.difference(lastUpdateTime).inMinutes < 4500) {
_isAppFullyLoaded = true;
} else{
checkAndUpdateHomeLocation();
@@ -811,6 +815,9 @@ Widget _buildWeatherContent() {
}
+
+
+
final raw = snapshot.data!;
final weather = raw['data'];
final current = weather['current'];
@@ -881,7 +888,7 @@ void maybeUpdateWeatherAnimation(Map current) {
final useFullMaterialScheme = PreferencesHelper.getBool("OnlyMaterialScheme") ?? false;
-
+// updateHomeWidget();
String formattedTime = lastUpdated != null
@@ -969,6 +976,10 @@ for (int i = 0; i < allTimeStrings.length; i++) {
}
}
+// updateHomeWidget();
+
+
+
final List next2hPrecip = [];
for (int i = 0; i < timeNext12h.length; i++) {
@@ -1009,10 +1020,6 @@ if (rainStart != null) {
final bool shouldShowRainBlock = bestStart != null && bestEnd != null;
-final List alerts = (weather['alerts']?['alert'] as List?) ?? []; // Get alerts list or empty list if null
-final bool showAlerts = alerts.isNotEmpty; // True if there are any alerts
-
-
Widget buildLayoutBlock(LayoutBlockType type) {
switch (type) {
@@ -1145,6 +1152,7 @@ else
GestureDetector(
onTap: () async {
+await Workmanager().cancelAll();
final result =
await Navigator.of(context).push