diff --git a/app/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/app/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..8d04026
Binary files /dev/null and b/app/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png differ
diff --git a/app/android/app/src/main/res/drawable-hdpi/ic_launcher_monochrome.png b/app/android/app/src/main/res/drawable-hdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..12c09b1
Binary files /dev/null and b/app/android/app/src/main/res/drawable-hdpi/ic_launcher_monochrome.png differ
diff --git a/app/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/app/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..ea48eea
Binary files /dev/null and b/app/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png differ
diff --git a/app/android/app/src/main/res/drawable-mdpi/ic_launcher_monochrome.png b/app/android/app/src/main/res/drawable-mdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..8390b8b
Binary files /dev/null and b/app/android/app/src/main/res/drawable-mdpi/ic_launcher_monochrome.png differ
diff --git a/app/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/app/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..b0f89f5
Binary files /dev/null and b/app/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png differ
diff --git a/app/android/app/src/main/res/drawable-xhdpi/ic_launcher_monochrome.png b/app/android/app/src/main/res/drawable-xhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..acd5d0b
Binary files /dev/null and b/app/android/app/src/main/res/drawable-xhdpi/ic_launcher_monochrome.png differ
diff --git a/app/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/app/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..9bf73b9
Binary files /dev/null and b/app/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png differ
diff --git a/app/android/app/src/main/res/drawable-xxhdpi/ic_launcher_monochrome.png b/app/android/app/src/main/res/drawable-xxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..2fec2da
Binary files /dev/null and b/app/android/app/src/main/res/drawable-xxhdpi/ic_launcher_monochrome.png differ
diff --git a/app/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/app/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..a8b1bee
Binary files /dev/null and b/app/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/app/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_monochrome.png b/app/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..139e67a
Binary files /dev/null and b/app/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_monochrome.png differ
diff --git a/app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..d506366
--- /dev/null
+++ b/app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db77bb4..8e5cfc4 100644
Binary files a/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 17987b7..23fab87 100644
Binary files a/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 09d4391..ac1939a 100644
Binary files a/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index d5f1c8d..e4c166f 100644
Binary files a/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 4d6372e..6031053 100644
Binary files a/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/android/app/src/main/res/values/colors.xml b/app/android/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..89a0cc8
--- /dev/null
+++ b/app/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #1B1D21
+
diff --git a/app/assets/icon/icon.png b/app/assets/icon/icon.png
new file mode 100644
index 0000000..59b690c
Binary files /dev/null and b/app/assets/icon/icon.png differ
diff --git a/app/assets/icon/icon.svg b/app/assets/icon/icon.svg
new file mode 100644
index 0000000..c5c4a1a
--- /dev/null
+++ b/app/assets/icon/icon.svg
@@ -0,0 +1,10 @@
+
diff --git a/app/assets/icon/icon_foreground.png b/app/assets/icon/icon_foreground.png
new file mode 100644
index 0000000..177d268
Binary files /dev/null and b/app/assets/icon/icon_foreground.png differ
diff --git a/app/assets/icon/icon_foreground.svg b/app/assets/icon/icon_foreground.svg
new file mode 100644
index 0000000..1f68c44
--- /dev/null
+++ b/app/assets/icon/icon_foreground.svg
@@ -0,0 +1,9 @@
+
diff --git a/app/assets/icon/icon_monochrome.png b/app/assets/icon/icon_monochrome.png
new file mode 100644
index 0000000..f75264d
Binary files /dev/null and b/app/assets/icon/icon_monochrome.png differ
diff --git a/app/assets/icon/icon_monochrome.svg b/app/assets/icon/icon_monochrome.svg
new file mode 100644
index 0000000..3f585cf
--- /dev/null
+++ b/app/assets/icon/icon_monochrome.svg
@@ -0,0 +1,9 @@
+
diff --git a/app/linux/icons/128/diet-guard-app.png b/app/linux/icons/128/diet-guard-app.png
new file mode 100644
index 0000000..2fa7289
Binary files /dev/null and b/app/linux/icons/128/diet-guard-app.png differ
diff --git a/app/linux/icons/16/diet-guard-app.png b/app/linux/icons/16/diet-guard-app.png
new file mode 100644
index 0000000..5d1bcf4
Binary files /dev/null and b/app/linux/icons/16/diet-guard-app.png differ
diff --git a/app/linux/icons/24/diet-guard-app.png b/app/linux/icons/24/diet-guard-app.png
new file mode 100644
index 0000000..06d2d5a
Binary files /dev/null and b/app/linux/icons/24/diet-guard-app.png differ
diff --git a/app/linux/icons/256/diet-guard-app.png b/app/linux/icons/256/diet-guard-app.png
new file mode 100644
index 0000000..f0a6957
Binary files /dev/null and b/app/linux/icons/256/diet-guard-app.png differ
diff --git a/app/linux/icons/32/diet-guard-app.png b/app/linux/icons/32/diet-guard-app.png
new file mode 100644
index 0000000..93fea21
Binary files /dev/null and b/app/linux/icons/32/diet-guard-app.png differ
diff --git a/app/linux/icons/48/diet-guard-app.png b/app/linux/icons/48/diet-guard-app.png
new file mode 100644
index 0000000..10451f8
Binary files /dev/null and b/app/linux/icons/48/diet-guard-app.png differ
diff --git a/app/linux/icons/512/diet-guard-app.png b/app/linux/icons/512/diet-guard-app.png
new file mode 100644
index 0000000..d83c742
Binary files /dev/null and b/app/linux/icons/512/diet-guard-app.png differ
diff --git a/app/linux/icons/64/diet-guard-app.png b/app/linux/icons/64/diet-guard-app.png
new file mode 100644
index 0000000..efee8db
Binary files /dev/null and b/app/linux/icons/64/diet-guard-app.png differ
diff --git a/app/linux/install_desktop_entry.sh b/app/linux/install_desktop_entry.sh
new file mode 100755
index 0000000..3c568f3
--- /dev/null
+++ b/app/linux/install_desktop_entry.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+
+# ============================================================================
+# Install the diet_guard_app launcher icon and .desktop entry for the Linux desktop.
+#
+# Flutter's GTK runner has no icon of its own: my_application.cc calls
+# gtk_window_set_icon_name("diet-guard-app"), which resolves through the hicolor icon
+# theme. This script is what puts the icon into that theme, plus a .desktop
+# entry so the app appears in application menus.
+#
+# Icon PNGs are pre-rendered and committed under linux/icons/, so this script
+# needs no image tooling at run time. Regenerate them with:
+# PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons \
+# generate --app diet_guard_app --linux-out linux/icons
+# ============================================================================
+
+set -euo pipefail
+
+SCRIPT_NAME="$(basename "$0")"
+LINUX_DIR="$(cd "$(dirname "$0")" && pwd)"
+REPO_DIR="$(dirname "$LINUX_DIR")"
+readonly SCRIPT_NAME LINUX_DIR REPO_DIR
+readonly ICON_NAME="diet-guard-app"
+readonly BINARY_NAME="diet_guard_app"
+# GTK derives WM_CLASS from the GApplication id in linux/CMakeLists.txt,
+# not from the binary name; verified with xprop on the running window.
+readonly WM_CLASS="com.kuhy.diet_guard_app"
+readonly ICON_SRC_DIR="$LINUX_DIR/icons"
+readonly ICON_THEME_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor"
+readonly DESKTOP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
+readonly BUNDLE_BIN="$REPO_DIR/build/linux/x64/release/bundle/$BINARY_NAME"
+
+usage() {
+ echo "Usage: $SCRIPT_NAME"
+ echo "Installs the diet_guard_app icon into the hicolor theme and writes a .desktop entry."
+ exit 0
+}
+
+validate_requirements() {
+ if [[ ! -d "$ICON_SRC_DIR" ]]; then
+ echo "Error: $ICON_SRC_DIR is missing; regenerate the icons first" >&2
+ exit 1
+ fi
+}
+
+ensure_theme_index() {
+ # A user-local hicolor tree created from scratch has no index.theme, and
+ # without it gtk-update-icon-cache refuses to build a cache ("No theme
+ # index file"). Seed it from the system theme when one is available.
+ local system_index="/usr/share/icons/hicolor/index.theme"
+ if [[ ! -f "$ICON_THEME_DIR/index.theme" && -f "$system_index" ]]; then
+ install -Dm644 "$system_index" "$ICON_THEME_DIR/index.theme"
+ fi
+}
+
+install_icons() {
+ local size_dir size icon
+ for size_dir in "$ICON_SRC_DIR"/*/; do
+ size="$(basename "$size_dir")"
+ icon="$size_dir$ICON_NAME.png"
+ [[ -f "$icon" ]] || continue
+ install -Dm644 "$icon" \
+ "$ICON_THEME_DIR/${size}x${size}/apps/$ICON_NAME.png"
+ done
+ # Refresh the theme cache so GTK picks the icon up without a re-login.
+ # Harmless if the tool is absent: the icon still resolves, just slower.
+ if command -v gtk-update-icon-cache >/dev/null; then
+ gtk-update-icon-cache --quiet --force "$ICON_THEME_DIR" || true
+ fi
+}
+
+install_desktop_entry() {
+ mkdir -p "$DESKTOP_DIR"
+ # StartupWMClass must match the window's actual WM class, or the taskbar
+ # shows a generic icon for the running window even though the launcher
+ # entry itself looks right.
+ cat > "$DESKTOP_DIR/$ICON_NAME.desktop" </dev/null; then
+ update-desktop-database "$DESKTOP_DIR" || true
+ fi
+}
+
+main() {
+ validate_requirements
+ ensure_theme_index
+ install_icons
+ install_desktop_entry
+ echo "Installed $ICON_NAME icon into $ICON_THEME_DIR"
+ echo "Installed $DESKTOP_DIR/$ICON_NAME.desktop"
+ if [[ ! -x "$BUNDLE_BIN" ]]; then
+ echo "Note: $BUNDLE_BIN does not exist yet."
+ echo " Run 'flutter build linux --release' to make the entry launchable."
+ fi
+}
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -h|--help)
+ usage
+ ;;
+ *)
+ echo "Unknown option: $1" >&2
+ exit 1
+ ;;
+ esac
+done
+
+main "$@"
diff --git a/app/linux/runner/my_application.cc b/app/linux/runner/my_application.cc
index 464436e..6506bf6 100644
--- a/app/linux/runner/my_application.cc
+++ b/app/linux/runner/my_application.cc
@@ -54,6 +54,11 @@ static void my_application_activate(GApplication* application) {
gtk_window_set_default_size(window, 1280, 720);
+ // Resolved from the hicolor icon theme, which linux/install_desktop_entry.sh
+ // populates from linux/icons/. Without this the GTK runner shows a generic
+ // placeholder in the taskbar, since Flutter never sets a window icon itself.
+ gtk_window_set_icon_name(window, "diet-guard-app");
+
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(
project, self->dart_entrypoint_arguments);
diff --git a/app/pubspec.lock b/app/pubspec.lock
index e3e4a78..74c0e00 100644
--- a/app/pubspec.lock
+++ b/app/pubspec.lock
@@ -1,6 +1,14 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
+ archive:
+ dependency: transitive
+ description:
+ name: archive
+ sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.0.9"
args:
dependency: transitive
description:
@@ -33,6 +41,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.1"
+ checked_yaml:
+ dependency: transitive
+ description:
+ name: checked_yaml
+ sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.4"
+ cli_util:
+ dependency: transitive
+ description:
+ name: cli_util
+ sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.4.2"
clock:
dependency: transitive
description:
@@ -167,6 +191,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_launcher_icons:
+ dependency: "direct dev"
+ description:
+ name: flutter_launcher_icons
+ sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.14.4"
flutter_local_notifications:
dependency: "direct main"
description:
@@ -297,6 +329,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.2"
+ image:
+ dependency: transitive
+ description:
+ name: image
+ sha256: "6300175e00616bbc832e2fc91bfa4d776af5402c81c7151bee6905bb08473c52"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.9.1"
image_picker:
dependency: "direct main"
description:
@@ -377,6 +417,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.1"
+ json_annotation:
+ dependency: transitive
+ description:
+ name: json_annotation
+ sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.12.0"
leak_tracker:
dependency: transitive
description:
@@ -585,6 +633,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
+ posix:
+ dependency: transitive
+ description:
+ name: posix
+ sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.5.0"
pub_semver:
dependency: transitive
description:
diff --git a/app/pubspec.yaml b/app/pubspec.yaml
index 450a54f..c2eef19 100644
--- a/app/pubspec.yaml
+++ b/app/pubspec.yaml
@@ -29,6 +29,9 @@ dependencies:
workmanager: ^0.9.0+3
dev_dependencies:
+ # Generates the Android launcher icons from assets/icon/ (see
+ # python_pkg/app_icons in testsAndMisc for the shared style).
+ flutter_launcher_icons: ^0.14.4
flutter_test:
sdk: flutter
image_picker_platform_interface: ^2.10.0
@@ -37,3 +40,15 @@ dev_dependencies:
flutter:
uses-material-design: true
+
+# Launcher icon generation. Source art is produced by the shared generator:
+# PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons generate --app
+# then run: dart run flutter_launcher_icons
+flutter_launcher_icons:
+ android: true
+ ios: false
+ image_path: "assets/icon/icon.png"
+ adaptive_icon_background: "#1B1D21"
+ adaptive_icon_foreground: "assets/icon/icon_foreground.png"
+ adaptive_icon_monochrome: "assets/icon/icon_monochrome.png"
+ min_sdk_android: 21