├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h ├── my_application.cc └── CMakeLists.txt ├── .tool-versions ├── ios ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── .gitignore ├── Podfile.lock └── Podfile ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── assets ├── app_logo.png ├── favicon.png └── race_flag.png ├── lib ├── model │ ├── sel_page.dart │ ├── pref_keys.dart │ └── article.dart ├── provider │ ├── fetch_dummy.dart │ ├── fetch_stub.dart │ └── pocket_base_prov.dart ├── component │ ├── selected_page.dart │ ├── i18n_util.dart │ ├── theme_options.dart │ ├── article_selection_card.dart │ ├── article_card.dart │ ├── slapp_app_bar.dart │ ├── custom_themes.dart │ └── slapp_drawer.dart ├── view │ ├── splash_screen.dart │ ├── article_page.dart │ ├── article_edit_page.dart │ └── active_page.dart ├── application.dart ├── specific_localization_delegate.dart ├── i18n │ ├── app_de.arb │ └── app_en.arb └── main.dart ├── screenshots ├── login.png ├── logout.png ├── dark_theme.png ├── drawer_open.png ├── article_list.png ├── end_shopping.png ├── no_connection.png ├── search_article.png ├── shoppinglist-1.png ├── shoppinglist-2.png ├── shoppinglist-3.png ├── shoppinglist-4.png ├── connection_to_pb.png └── connection_to_pb_local.png ├── macos ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ ├── app_icon_64.png │ │ │ └── Contents.json │ ├── Release.entitlements │ ├── AppDelegate.swift │ ├── MainFlutterWindow.swift │ ├── DebugProfile.entitlements │ └── Info.plist ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── RunnerTests │ └── RunnerTests.swift ├── Podfile.lock └── Podfile ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ ├── win32_window.h │ └── win32_window.cpp ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── .gitignore └── CMakeLists.txt ├── android ├── app │ ├── src │ │ ├── main │ │ │ ├── ic_launcher-playstore.png │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── slapp_f │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle.kts ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle.kts └── settings.gradle.kts ├── l10n.yaml ├── flatpak ├── app.desktop ├── build-flutter-app.sh ├── build-flatpak.sh ├── Dockerfile ├── app.yml └── app.metainfo.xml ├── .metadata ├── LICENSE ├── .gitignore ├── pubspec.yaml ├── analysis_options.yaml ├── pb_schema.json └── README.md /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | flutter 3.35.6-stable 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/web/favicon.png -------------------------------------------------------------------------------- /assets/app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/assets/app_logo.png -------------------------------------------------------------------------------- /assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/assets/favicon.png -------------------------------------------------------------------------------- /assets/race_flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/assets/race_flag.png -------------------------------------------------------------------------------- /lib/model/sel_page.dart: -------------------------------------------------------------------------------- 1 | enum SelPage { 2 | login, 3 | activeList, 4 | articleList, 5 | } 6 | -------------------------------------------------------------------------------- /screenshots/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/login.png -------------------------------------------------------------------------------- /screenshots/logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/logout.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /screenshots/dark_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/dark_theme.png -------------------------------------------------------------------------------- /screenshots/drawer_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/drawer_open.png -------------------------------------------------------------------------------- /screenshots/article_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/article_list.png -------------------------------------------------------------------------------- /screenshots/end_shopping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/end_shopping.png -------------------------------------------------------------------------------- /screenshots/no_connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/no_connection.png -------------------------------------------------------------------------------- /screenshots/search_article.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/search_article.png -------------------------------------------------------------------------------- /screenshots/shoppinglist-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/shoppinglist-1.png -------------------------------------------------------------------------------- /screenshots/shoppinglist-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/shoppinglist-2.png -------------------------------------------------------------------------------- /screenshots/shoppinglist-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/shoppinglist-3.png -------------------------------------------------------------------------------- /screenshots/shoppinglist-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/shoppinglist-4.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /screenshots/connection_to_pb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/connection_to_pb.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /lib/provider/fetch_dummy.dart: -------------------------------------------------------------------------------- 1 | import 'package:http/http.dart'; 2 | 3 | Client getClient() { 4 | return Client(); 5 | } 6 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /screenshots/connection_to_pb_local.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/screenshots/connection_to_pb_local.png -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /lib/component/selected_page.dart: -------------------------------------------------------------------------------- 1 | library; 2 | 3 | import 'package:shoppinglist/model/sel_page.dart'; 4 | 5 | SelPage page = SelPage.login; 6 | -------------------------------------------------------------------------------- /android/app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/android/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aluedtke7/shoppinglist/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/slapp_f/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package de.luedtke.shoppinglist 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /l10n.yaml: -------------------------------------------------------------------------------- 1 | arb-dir: lib/i18n 2 | output-dir: lib/src/generated/i18n 3 | template-arb-file: app_en.arb 4 | output-localization-file: app_localizations.dart 5 | untranslated-messages-file: untranslated-messages.json 6 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/provider/fetch_stub.dart: -------------------------------------------------------------------------------- 1 | import 'package:fetch_client/fetch_client.dart'; 2 | 3 | // see also https://github.com/pocketbase/dart-sdk#limitations 4 | 5 | FetchClient getClient() { 6 | return FetchClient(mode: RequestMode.cors); 7 | } 8 | -------------------------------------------------------------------------------- /lib/component/i18n_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:shoppinglist/src/generated/i18n/app_localizations.dart'; 3 | 4 | AppLocalizations i18n(BuildContext context) { 5 | return AppLocalizations.of(context)!; 6 | } 7 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip 6 | -------------------------------------------------------------------------------- /flatpak/app.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | 5 | Name=Shoppinglist 6 | Comment=A shopping list made with Flutter 7 | Categories=Utility; 8 | 9 | Icon=de.luedtke.shoppinglist 10 | Exec=shoppinglist 11 | Terminal=false 12 | StartupWMClass=shoppinglist 13 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/view/splash_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SplashScreen extends StatelessWidget { 4 | const SplashScreen({super.key}); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return const Scaffold( 9 | body: Center( 10 | child: Text('Loading...'), 11 | ), 12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | /app/.cxx/ 15 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /lib/model/pref_keys.dart: -------------------------------------------------------------------------------- 1 | class PrefKeys { 2 | static const serverUrlPrefsKey = 'server_url'; 3 | static const lastUserPrefsKey = 'last_user'; 4 | static const accessTokenPrefsKey = 'access_token'; 5 | static const accessModelPrefsKey = 'access_model'; 6 | static const accessNamePrefsKey = 'access_name'; 7 | static const invoicesListDateRangePrefsKey = 'invoices_list_dr'; 8 | static const projectsListDateRangePrefsKey = 'projects_list_dr'; 9 | } 10 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | com.apple.security.network.client 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /flatpak/build-flutter-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set -x 4 | 5 | projectName=Shoppinglist 6 | archiveName=$projectName-Linux-Portable.tar.gz 7 | baseDir=$(pwd) 8 | 9 | pushd . 10 | 11 | cd .. 12 | 13 | # Build Flutter app 14 | flutter --disable-analytics 15 | flutter clean 16 | flutter gen-l10n 17 | flutter build linux --release 18 | 19 | cd build/linux/x64/release/bundle || exit 1 20 | tar -czaf $archiveName ./* 21 | mv $archiveName "$baseDir"/ 22 | popd 23 | 24 | flatpak-builder --force-clean build-dir app.yml --repo=repo 25 | flatpak build-bundle repo de.luedtke.shoppinglist.flatpak de.luedtke.shoppinglist 26 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import device_info_plus 9 | import package_info_plus 10 | import shared_preferences_foundation 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) 14 | FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) 15 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | val newBuildDir: Directory = 9 | rootProject.layout.buildDirectory 10 | .dir("../../build") 11 | .get() 12 | rootProject.layout.buildDirectory.value(newBuildDir) 13 | 14 | subprojects { 15 | val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) 16 | project.layout.buildDirectory.value(newSubprojectBuildDir) 17 | } 18 | subprojects { 19 | project.evaluationDependsOn(":app") 20 | } 21 | 22 | tasks.register("clean") { 23 | delete(rootProject.layout.buildDirectory) 24 | } 25 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /lib/model/article.dart: -------------------------------------------------------------------------------- 1 | class Article { 2 | String id = ''; 3 | String shop = ''; 4 | String article = ''; 5 | int amount = 0; 6 | bool active = false; 7 | bool inCart = false; 8 | 9 | Article({ 10 | this.id = '', 11 | this.shop = '', 12 | this.article = '', 13 | this.amount = 0, 14 | this.active = false, 15 | this.inCart = false, 16 | }); 17 | 18 | factory Article.fromJson(Map json) => Article( 19 | id: json['id'], 20 | shop: json['shop'], 21 | article: json['article'], 22 | amount: json['amount'], 23 | active: json['active'], 24 | inCart: json['inCart'], 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = shoppinglist 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = de.luedtke.shoppinglist 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 de.luedtke. All rights reserved. 15 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /lib/application.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | typedef LocaleChangeCallback = void Function(Locale locale); 6 | 7 | class APPLIC { 8 | // List of supported languages 9 | final List supportedLanguages = ['en', 'de']; 10 | 11 | // Returns the list of supported Locales 12 | Iterable supportedLocales() => supportedLanguages.map((lang) => Locale(lang, '')); 13 | 14 | // Function to be invoked when changing the working language 15 | late LocaleChangeCallback onLocaleChanged; 16 | 17 | /// 18 | /// Internals 19 | /// 20 | static final APPLIC _applic = APPLIC._internal(); 21 | 22 | factory APPLIC() { 23 | return _applic; 24 | } 25 | 26 | APPLIC._internal(); 27 | } 28 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val flutterSdkPath = 3 | run { 4 | val properties = java.util.Properties() 5 | file("local.properties").inputStream().use { properties.load(it) } 6 | val flutterSdkPath = properties.getProperty("flutter.sdk") 7 | require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } 8 | flutterSdkPath 9 | } 10 | 11 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | } 19 | 20 | plugins { 21 | id("dev.flutter.flutter-plugin-loader") version "1.0.0" 22 | id("com.android.application") version "8.9.1" apply false 23 | id("org.jetbrains.kotlin.android") version "2.1.0" apply false 24 | } 25 | 26 | include(":app") 27 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /flatpak/build-flatpak.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set -x 4 | 5 | projectName=Shoppinglist 6 | projectId=de.luedtke.shoppinglist 7 | executableName=shoppinglist 8 | 9 | # Build Flatpak 10 | echo "$(pwd)" 11 | 12 | mkdir -p $projectName 13 | tar -xf $projectName-Linux-Portable.tar.gz -C $projectName 14 | 15 | # Copy the portable app to the Flatpak-based location. 16 | cp -r $projectName /app/ 17 | chmod +x /app/$projectName/$executableName 18 | mkdir -p /app/bin 19 | ln -s /app/$projectName/$executableName /app/bin/$executableName 20 | 21 | # Install the icon. 22 | iconDir=/app/share/icons/hicolor/scalable/apps 23 | mkdir -p $iconDir 24 | cp -r $projectId.png $iconDir/ 25 | 26 | # Install the desktop file. 27 | desktopFileDir=/app/share/applications 28 | mkdir -p $desktopFileDir 29 | cp -r $projectId.desktop $desktopFileDir/ 30 | 31 | # Install the AppStream metadata file. 32 | metadataDir=/app/share/metainfo 33 | mkdir -p $metadataDir 34 | cp -r $projectId.metainfo.xml $metadataDir/ 35 | -------------------------------------------------------------------------------- /lib/component/theme_options.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | typedef ThemedBoxDecoration = BoxDecoration Function(BuildContext context); 5 | typedef ColorGetter = Color Function(BuildContext context); 6 | 7 | class ThemeOptions implements AppThemeOptions { 8 | final Color inCartBackgroundColor; 9 | final ColorGetter slideBtnBackgroundColor; 10 | final ColorGetter slideBtnForegroundColor; 11 | final double cardTextScaleFactor; 12 | final FontWeight cardTextFontWeight; 13 | final BoxDecoration pageDecoration; 14 | final ThemedBoxDecoration drawerDecoration; 15 | final ThemedBoxDecoration drawerHeaderDecoration; 16 | 17 | ThemeOptions( 18 | this.inCartBackgroundColor, 19 | this.slideBtnBackgroundColor, 20 | this.slideBtnForegroundColor, 21 | this.cardTextScaleFactor, 22 | this.cardTextFontWeight, 23 | this.pageDecoration, 24 | this.drawerDecoration, 25 | this.drawerHeaderDecoration, 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /flatpak/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Europe apt-get -y install tzdata 4 | 5 | # Install tree and Flutter dependencies 6 | RUN apt-get -y install tree curl file git unzip xz-utils zip clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev 7 | 8 | # Prepare environment for building Flatpak 9 | RUN apt-get install -y flatpak flatpak-builder 10 | RUN flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo 11 | RUN flatpak install -y org.freedesktop.Sdk/x86_64/22.08 12 | RUN flatpak install -y org.freedesktop.Platform/x86_64/22.08 13 | RUN flatpak install -y flathub org.freedesktop.appstream-glib 14 | 15 | RUN useradd -m -s /bin/bash builder 16 | 17 | # Install Flutter 18 | RUN git clone https://github.com/flutter/flutter.git -b stable /home/builder/flutter 19 | RUN git config --global --add safe.directory /home/builder/flutter 20 | ENV PATH="$PATH:/home/builder/flutter/bin" 21 | RUN flutter upgrade 22 | RUN chown -R builder:builder /home/builder/flutter 23 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 17 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 18 | - platform: macos 19 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 20 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Shoppinglist App", 3 | "short_name": "shoppinglist", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 aluedtke7 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flatpak/app.yml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/flatpak/flatpak-builder/main/data/flatpak-manifest.schema.json 2 | 3 | --- 4 | id: de.luedtke.shoppinglist 5 | runtime: org.freedesktop.Platform 6 | runtime-version: "22.08" 7 | sdk: org.freedesktop.Sdk 8 | command: shoppinglist 9 | separate-locales: false 10 | finish-args: 11 | - --device=dri 12 | - --share=network 13 | - --socket=wayland 14 | - --socket=fallback-x11 15 | modules: 16 | - name: shoppinglist 17 | buildsystem: simple 18 | only-arches: 19 | - x86_64 20 | build-commands: 21 | - "./build-flatpak.sh" 22 | sources: 23 | - type: file 24 | path: ./build-flatpak.sh 25 | - type: file 26 | path: ./Shoppinglist-Linux-Portable.tar.gz 27 | - type: file 28 | path: ../assets/app_logo.png 29 | dest-filename: de.luedtke.shoppinglist.png 30 | - type: file 31 | path: ./app.desktop 32 | dest-filename: de.luedtke.shoppinglist.desktop 33 | - type: file 34 | path: ./app.metainfo.xml 35 | dest-filename: de.luedtke.shoppinglist.metainfo.xml 36 | 37 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .build/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .swiftpm/ 13 | migrate_working_dir/ 14 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # The .vscode folder contains launch configuration and tasks you configure in 22 | # VS Code which you may wish to be included in version control, so this line 23 | # is commented out by default. 24 | #.vscode/ 25 | 26 | # Flutter/Dart/Pub related 27 | **/doc/api/ 28 | **/ios/Flutter/.last_build_id 29 | .dart_tool/ 30 | .flutter-plugins 31 | .flutter-plugins-dependencies 32 | .packages 33 | .pub-cache/ 34 | .pub/ 35 | /build/ 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | 48 | untranslated-messages.json 49 | .envrc 50 | .vscode 51 | deploy 52 | build-release.sh 53 | todo.md 54 | /macos.old/ 55 | /devtools_options.yaml 56 | 57 | # Flatpak 58 | flatpak/*.flatpak 59 | flatpak/*.tar.gz 60 | flatpak/.flatpak-builder 61 | flatpak/build-dir 62 | flatpak/repo 63 | /lib/src/generated/i18n/ 64 | -------------------------------------------------------------------------------- /lib/specific_localization_delegate.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:shoppinglist/src/generated/i18n/app_localizations.dart'; 4 | import 'package:shoppinglist/src/generated/i18n/app_localizations_de.dart'; 5 | import 'package:shoppinglist/src/generated/i18n/app_localizations_en.dart'; 6 | 7 | class SpecificLocalizationDelegate extends LocalizationsDelegate { 8 | final Locale overriddenLocale; 9 | 10 | const SpecificLocalizationDelegate(this.overriddenLocale); 11 | 12 | @override 13 | bool isSupported(Locale locale) => true; 14 | 15 | @override 16 | Future load(Locale locale) { 17 | // Lookup logic when only language code is specified. 18 | switch (overriddenLocale.languageCode) { 19 | case 'de': 20 | return SynchronousFuture(AppLocalizationsDe()); 21 | case 'en': 22 | return SynchronousFuture(AppLocalizationsEn()); 23 | } 24 | // if language can't be found, use English as default 25 | return SynchronousFuture(AppLocalizationsEn()); 26 | } 27 | 28 | @override 29 | bool shouldReload(LocalizationsDelegate old) => true; 30 | } 31 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: shoppinglist 2 | description: Shoppinglist made with Flutter 3 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 4 | version: 1.1.0+41 5 | 6 | environment: 7 | sdk: '^3.6.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | flutter_localizations: 13 | sdk: flutter 14 | 15 | cupertino_icons: ^1.0.2 16 | pocketbase: ^0.23.0 17 | provider: ^6.0.5 18 | email_validator: ^3.0.0 19 | package_info_plus: ^9.0.0 20 | shared_preferences: ^2.0.17 21 | flutter_slidable: ^4.0.0 22 | vibration: ^3.1.0 23 | vibration_web: ^1.6.5 24 | theme_provider: ^0.6.0 25 | intl: ^0.20.2 26 | fetch_client: ^1.0.2 27 | http: ^1.1.0 28 | form_validator: ^2.1.1 29 | 30 | dev_dependencies: 31 | flutter_test: 32 | sdk: flutter 33 | 34 | flutter_lints: ^6.0.0 35 | icons_launcher: ^3.0.0 36 | 37 | flutter: 38 | generate: true # needed for l10n generation 39 | uses-material-design: true 40 | assets: 41 | - assets/race_flag.png 42 | 43 | icons_launcher: 44 | image_path: 'assets/app_logo.png' 45 | platforms: 46 | android: 47 | enable: true 48 | ios: 49 | enable: true 50 | linux: 51 | enable: true 52 | web: 53 | enable: true 54 | favicon_path: 'assets/favicon.png' 55 | macos: 56 | enable: true 57 | windows: 58 | enable: true 59 | -------------------------------------------------------------------------------- /flatpak/app.metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | de.luedtke.shoppinglist 4 | Shoppinglist 5 | A shopping list made with Flutter 6 | Andreas Lüdtke 7 | https://github.com/aluedtke7/shoppinglist 8 | MIT 9 | MIT 10 | 11 | pointing 12 | keyboard 13 | touch 14 | 15 | 16 |

A shopping list made with Flutter

17 |

Features

18 |
    19 |
  • several themes with custom options including dark modes
  • 20 |
  • localization (English and German)
  • 21 |
  • Works with PocketBase v0.24
  • 22 |
23 |
24 | de.luedtke.shopping.desktop 25 | 26 | 27 | https://github.com/aluedtke7/shoppinglist/blob/0c524fbf85ad78794c89786d90350e71ddeac934/screenshots/shoppinglist-1.png 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | -------------------------------------------------------------------------------- /macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - device_info_plus (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - package_info_plus (0.0.1): 6 | - FlutterMacOS 7 | - shared_preferences_foundation (0.0.1): 8 | - Flutter 9 | - FlutterMacOS 10 | 11 | DEPENDENCIES: 12 | - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) 13 | - FlutterMacOS (from `Flutter/ephemeral`) 14 | - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) 15 | - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) 16 | 17 | EXTERNAL SOURCES: 18 | device_info_plus: 19 | :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos 20 | FlutterMacOS: 21 | :path: Flutter/ephemeral 22 | package_info_plus: 23 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos 24 | shared_preferences_foundation: 25 | :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin 26 | 27 | SPEC CHECKSUMS: 28 | device_info_plus: 1b14eed9bf95428983aed283a8d51cce3d8c4215 29 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 30 | package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b 31 | shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 32 | 33 | PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3 34 | 35 | COCOAPODS: 1.16.2 36 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Shoppinglist 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"shoppinglist", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /android/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | id("kotlin-android") 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id("dev.flutter.flutter-gradle-plugin") 6 | } 7 | 8 | android { 9 | namespace = "de.luedtke.shoppinglist" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = "27.0.12077973" 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_11 15 | targetCompatibility = JavaVersion.VERSION_11 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_11.toString() 20 | } 21 | 22 | defaultConfig { 23 | applicationId = "de.luedtke.shoppinglist" 24 | // You can update the following values to match your application needs. 25 | // For more information, see: https://flutter.dev/to/review-gradle-config. 26 | minSdk = flutter.minSdkVersion 27 | targetSdk = flutter.targetSdkVersion 28 | versionCode = flutter.versionCode 29 | versionName = flutter.versionName 30 | } 31 | 32 | buildTypes { 33 | release { 34 | // TODO: Add your own signing config for the release build. 35 | // Signing with the debug keys for now, so `flutter run --release` works. 36 | signingConfig = signingConfigs.getByName("debug") 37 | } 38 | } 39 | } 40 | 41 | flutter { 42 | source = "../.." 43 | } 44 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - device_info_plus (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - package_info_plus (0.4.5): 6 | - Flutter 7 | - shared_preferences_foundation (0.0.1): 8 | - Flutter 9 | - FlutterMacOS 10 | - vibration (1.7.5): 11 | - Flutter 12 | 13 | DEPENDENCIES: 14 | - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) 15 | - Flutter (from `Flutter`) 16 | - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) 17 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) 18 | - vibration (from `.symlinks/plugins/vibration/ios`) 19 | 20 | EXTERNAL SOURCES: 21 | device_info_plus: 22 | :path: ".symlinks/plugins/device_info_plus/ios" 23 | Flutter: 24 | :path: Flutter 25 | package_info_plus: 26 | :path: ".symlinks/plugins/package_info_plus/ios" 27 | shared_preferences_foundation: 28 | :path: ".symlinks/plugins/shared_preferences_foundation/darwin" 29 | vibration: 30 | :path: ".symlinks/plugins/vibration/ios" 31 | 32 | SPEC CHECKSUMS: 33 | device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342 34 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 35 | package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4 36 | shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 37 | vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241 38 | 39 | PODFILE CHECKSUM: e840dd57ba2b03bcb6fdba293a27c5f82151a80a 40 | 41 | COCOAPODS: 1.15.2 42 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.15' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | # target 'RunnerTests' do 36 | # inherit! :search_paths 37 | # end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "filename": "app_icon_16.png", 5 | "idiom": "mac", 6 | "scale": "1x", 7 | "size": "16x16" 8 | }, 9 | { 10 | "filename": "app_icon_32.png", 11 | "idiom": "mac", 12 | "scale": "2x", 13 | "size": "16x16" 14 | }, 15 | { 16 | "filename": "app_icon_32.png", 17 | "idiom": "mac", 18 | "scale": "1x", 19 | "size": "32x32" 20 | }, 21 | { 22 | "filename": "app_icon_64.png", 23 | "idiom": "mac", 24 | "scale": "2x", 25 | "size": "32x32" 26 | }, 27 | { 28 | "filename": "app_icon_128.png", 29 | "idiom": "mac", 30 | "scale": "1x", 31 | "size": "128x128" 32 | }, 33 | { 34 | "filename": "app_icon_256.png", 35 | "idiom": "mac", 36 | "scale": "2x", 37 | "size": "128x128" 38 | }, 39 | { 40 | "filename": "app_icon_256.png", 41 | "idiom": "mac", 42 | "scale": "1x", 43 | "size": "256x256" 44 | }, 45 | { 46 | "filename": "app_icon_512.png", 47 | "idiom": "mac", 48 | "scale": "2x", 49 | "size": "256x256" 50 | }, 51 | { 52 | "filename": "app_icon_512.png", 53 | "idiom": "mac", 54 | "scale": "1x", 55 | "size": "512x512" 56 | }, 57 | { 58 | "filename": "app_icon_1024.png", 59 | "idiom": "mac", 60 | "scale": "2x", 61 | "size": "512x512" 62 | } 63 | ], 64 | "info": { 65 | "author": "icons_launcher", 66 | "version": 1 67 | } 68 | } -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | always_use_package_imports: true 28 | 29 | # Additional information about this file can be found at 30 | # https://dart.dev/guides/language/analysis-options 31 | -------------------------------------------------------------------------------- /lib/component/article_selection_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | import 'package:shoppinglist/component/theme_options.dart'; 5 | import 'package:shoppinglist/model/article.dart'; 6 | 7 | class ArticleSelectionCard extends StatelessWidget { 8 | const ArticleSelectionCard({ 9 | super.key, 10 | required this.article, 11 | }); 12 | 13 | final Article article; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return GestureDetector( 18 | onTap: () { 19 | // debugPrint('ArticleSelectionCard tapped: ${article.article}'); 20 | Navigator.pop(context, article); 21 | }, 22 | child: Card( 23 | color: Theme.of(context).cardColor, 24 | elevation: 4, 25 | child: Container( 26 | width: double.maxFinite, 27 | margin: const EdgeInsets.all(8), 28 | child: Column( 29 | crossAxisAlignment: CrossAxisAlignment.start, 30 | children: [ 31 | if (article.shop.isNotEmpty) Text(article.shop), 32 | Text( 33 | article.article, 34 | textScaler: TextScaler.linear( 35 | ThemeProvider.optionsOf(context) 36 | .cardTextScaleFactor), 37 | style: TextStyle( 38 | fontWeight: ThemeProvider.optionsOf(context) 39 | .cardTextFontWeight, 40 | ), 41 | ), 42 | ], 43 | ), 44 | ), 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/component/article_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | import 'package:shoppinglist/component/theme_options.dart'; 5 | import 'package:shoppinglist/model/article.dart'; 6 | 7 | class ArticleCard extends StatelessWidget { 8 | const ArticleCard({ 9 | super.key, 10 | required this.article, 11 | required this.isArticleList, 12 | }); 13 | 14 | final Article article; 15 | final bool isArticleList; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Card( 20 | color: article.inCart 21 | ? ThemeProvider.optionsOf(context).inCartBackgroundColor 22 | : Theme.of(context).cardTheme.color, 23 | elevation: 4, 24 | child: Container( 25 | width: double.maxFinite, 26 | margin: const EdgeInsets.all(8), 27 | child: Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | if (article.shop.isNotEmpty) Text(article.shop), 31 | Text( 32 | '${!isArticleList ? "${article.amount} " : ""}${article.article}', 33 | textScaler: TextScaler.linear( 34 | ThemeProvider.optionsOf(context) 35 | .cardTextScaleFactor), 36 | style: TextStyle( 37 | fontWeight: ThemeProvider.optionsOf(context) 38 | .cardTextFontWeight, 39 | decoration: article.inCart 40 | ? TextDecoration.lineThrough 41 | : TextDecoration.none, 42 | ), 43 | ), 44 | ], 45 | ), 46 | ), 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Shoppinglist 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | shoppinglist 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | return true; 35 | } 36 | 37 | void FlutterWindow::OnDestroy() { 38 | if (flutter_controller_) { 39 | flutter_controller_ = nullptr; 40 | } 41 | 42 | Win32Window::OnDestroy(); 43 | } 44 | 45 | LRESULT 46 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 47 | WPARAM const wparam, 48 | LPARAM const lparam) noexcept { 49 | // Give Flutter, including plugins, an opportunity to handle window messages. 50 | if (flutter_controller_) { 51 | std::optional result = 52 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 53 | lparam); 54 | if (result) { 55 | return *result; 56 | } 57 | } 58 | 59 | switch (message) { 60 | case WM_FONTCHANGE: 61 | flutter_controller_->engine()->ReloadSystemFonts(); 62 | break; 63 | } 64 | 65 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 66 | } 67 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/i18n/app_de.arb: -------------------------------------------------------------------------------- 1 | { 2 | "com_app_name": "Shoppinglist", 3 | "com_ok": "Ok", 4 | "com_cancel": "Abbruch", 5 | "com_yes": "Ja", 6 | "com_no": "Nein", 7 | "com_back": "Zurück", 8 | "com_new": "Neu", 9 | "com_save": "Speichern", 10 | "com_article": "Artikel", 11 | "com_shop": "Geschäft", 12 | "com_change_theme": "Farbschema ändern", 13 | "com_change_language": "Sprache ändern", 14 | "com_change_server": "Server Verbindung ändern", 15 | "com_search_term": "Suchbegriff (3 oder mehr Zeichen eingeben)", 16 | "com_num_articles": "{count, plural, =0{keine Artikel} =1{ein Artikel} other{{count} Artikel}}", 17 | 18 | "drawer_title": "Shoppinglist App", 19 | "drawer_version": "Version {v}", 20 | "drawer_expires": "Läuft aus {dt}", 21 | "drawer_end_shopping": "Einkauf beenden", 22 | "drawer_end_shopping_q": "Sollen alle Artikel aus dem Warenkorb in die Artikelliste verschoben werden?", 23 | "drawer_logout": "Abmelden", 24 | "drawer_logout_q": "Möchten Sie sich wirklich abmelden?", 25 | 26 | "l_p_error": "Ein Fehler ist aufgetreten!", 27 | "l_p_okay": "Ok", 28 | "l_p_authfailed": "Authentifizierung fehlgeschlagen:\n{err}", 29 | "l_p_login": "Anmelden", 30 | "l_p_login_btn": "Anmelden...", 31 | "l_p_email": "E-Mail", 32 | "l_p_email_val": "Bitte geben Sie eine gültige E-Mail Adresse ein", 33 | "l_p_password": "Passwort", 34 | "l_p_password_val": "Bitte geben Sie ein Passwort ein", 35 | "l_p_forgot_password": "Passwort vergessen?", 36 | "l_p_forgot_password_info": "Wir schicken eine E-Mail an die eingegebene Adresse.", 37 | "l_p_reset_password": "Zurücksetzen", 38 | "l_p_email_sent": "E-Mail wurde verschickt.", 39 | "l_p_server_url_not_set": "Verbindung zum Server ist nicht gesetzt!", 40 | "l_p_server_url_configure": "Server Url konfigurieren", 41 | "l_p_server_url": "Verbindung zum PocketBase Server", 42 | "l_p_server_example": "z.B. https://Ihr_PocketBase_Server.de", 43 | "l_p_server_url_info": "Bitte geben Sie die URL Ihres PocketBase Server ein.\nInkl. http/https und evtl. nötiger Portnummer.", 44 | 45 | "p_active_title": "Einkaufsliste", 46 | "p_active_tooltip": "Artikel suchen", 47 | "p_active_empty": "Es wurde\nkein Artikel\nausgewählt.", 48 | 49 | "p_articles_title": "Artikelliste", 50 | "p_articles_tooltip": "Artikel hinzufügen", 51 | 52 | "p_edit_new": "Neuer Artikel", 53 | "p_edit_change": "Artikel ändern", 54 | "p_edit_delete": "Artikel löschen", 55 | "p_edit_unique_error": "Artikelname muss einmalig sein", 56 | "p_edit_delete_q": "Soll der Artikel '{name}' wirklich gelöscht werden?" 57 | } -------------------------------------------------------------------------------- /pb_schema.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "3mv593ieqawcouz", 4 | "listRule": "", 5 | "viewRule": "", 6 | "createRule": "", 7 | "updateRule": "", 8 | "deleteRule": "", 9 | "name": "shoppinglist", 10 | "type": "base", 11 | "fields": [ 12 | { 13 | "autogeneratePattern": "[a-z0-9]{15}", 14 | "hidden": false, 15 | "id": "text3208210256", 16 | "max": 15, 17 | "min": 15, 18 | "name": "id", 19 | "pattern": "^[a-z0-9]+$", 20 | "presentable": false, 21 | "primaryKey": true, 22 | "required": true, 23 | "system": true, 24 | "type": "text" 25 | }, 26 | { 27 | "hidden": false, 28 | "id": "u13k0nxy", 29 | "name": "active", 30 | "presentable": false, 31 | "required": false, 32 | "system": false, 33 | "type": "bool" 34 | }, 35 | { 36 | "hidden": false, 37 | "id": "pinqrobn", 38 | "max": 100, 39 | "min": 0, 40 | "name": "amount", 41 | "onlyInt": false, 42 | "presentable": false, 43 | "required": false, 44 | "system": false, 45 | "type": "number" 46 | }, 47 | { 48 | "hidden": false, 49 | "id": "l6vkoreu", 50 | "name": "inCart", 51 | "presentable": false, 52 | "required": false, 53 | "system": false, 54 | "type": "bool" 55 | }, 56 | { 57 | "autogeneratePattern": "", 58 | "hidden": false, 59 | "id": "u7ot6v3e", 60 | "max": 120, 61 | "min": 1, 62 | "name": "article", 63 | "pattern": "", 64 | "presentable": false, 65 | "primaryKey": false, 66 | "required": true, 67 | "system": false, 68 | "type": "text" 69 | }, 70 | { 71 | "autogeneratePattern": "", 72 | "hidden": false, 73 | "id": "mk1md3hr", 74 | "max": 80, 75 | "min": 0, 76 | "name": "shop", 77 | "pattern": "", 78 | "presentable": false, 79 | "primaryKey": false, 80 | "required": false, 81 | "system": false, 82 | "type": "text" 83 | }, 84 | { 85 | "hidden": false, 86 | "id": "autodate2990389176", 87 | "name": "created", 88 | "onCreate": true, 89 | "onUpdate": false, 90 | "presentable": false, 91 | "system": false, 92 | "type": "autodate" 93 | }, 94 | { 95 | "hidden": false, 96 | "id": "autodate3332085495", 97 | "name": "updated", 98 | "onCreate": true, 99 | "onUpdate": true, 100 | "presentable": false, 101 | "system": false, 102 | "type": "autodate" 103 | } 104 | ], 105 | "indexes": [], 106 | "system": false 107 | } 108 | ] -------------------------------------------------------------------------------- /lib/i18n/app_en.arb: -------------------------------------------------------------------------------- 1 | { 2 | "com_app_name": "Shoppinglist", 3 | "com_ok": "Ok", 4 | "com_cancel": "Cancel", 5 | "com_yes": "Yes", 6 | "com_no": "No", 7 | "com_back": "Back", 8 | "com_new": "New", 9 | "com_save": "Save", 10 | "com_article": "article", 11 | "com_shop": "shop", 12 | "com_change_theme": "change theme", 13 | "com_change_language": "change language", 14 | "com_change_server": "change server connection", 15 | "com_search_term": "search term (enter 3 or more character)", 16 | "com_num_articles": "{count, plural, =0{no articles} =1{one article} other{{count} articles}}", 17 | "@com_num_articles": { 18 | "placeholders": { 19 | "count": {} 20 | } 21 | }, 22 | 23 | "drawer_title": "Shoppinglist App", 24 | "drawer_version": "version {v}", 25 | "@drawer_version": { 26 | "placeholders": { 27 | "v": { 28 | "type": "String" 29 | } 30 | } 31 | }, 32 | "drawer_expires": "expires {dt}", 33 | "@drawer_expires": { 34 | "placeholders": { 35 | "dt": { 36 | "type": "String" 37 | } 38 | } 39 | }, 40 | "drawer_end_shopping": "end shopping", 41 | "drawer_end_shopping_q": "Shall all articles in the cart be moved to the article list?", 42 | "drawer_logout": "logout", 43 | "drawer_logout_q": "Do you really want to logout?", 44 | 45 | "l_p_error": "An Error Occurred!", 46 | "l_p_okay": "Okay", 47 | "l_p_authfailed": "Authentication failed:\n{err}", 48 | "@l_p_authfailed": { 49 | "placeholders": { 50 | "err": { 51 | "type": "String" 52 | } 53 | } 54 | }, 55 | "l_p_login": "Login", 56 | "l_p_login_btn": "Login...", 57 | "l_p_email": "E-mail", 58 | "l_p_email_val": "Please enter a valid e-mail", 59 | "l_p_password": "Password", 60 | "l_p_password_val": "Please enter a password", 61 | "l_p_forgot_password": "Forgot password?", 62 | "l_p_forgot_password_info": "We send an e-mail to the given address.", 63 | "l_p_reset_password": "Recover", 64 | "l_p_email_sent": "E-Mail has been sent.", 65 | "l_p_server_url_not_set": "Server connection is not set!", 66 | "l_p_server_url_configure": "Configure server url", 67 | "l_p_server_url": "Connection to PocketBase server", 68 | "l_p_server_example": "i.e. https://Your_PocketBase_Server.com", 69 | "l_p_server_url_info": "Please enter the URL of your PocketBase server.\nIncl. http/https and port number if needed.", 70 | 71 | "p_active_title": "shopping list", 72 | "p_active_tooltip": "search article", 73 | "p_active_empty": "No article\nhas been\nselected.", 74 | 75 | "p_articles_title": "article list", 76 | "p_articles_tooltip": "add article", 77 | 78 | "p_edit_new": "new article", 79 | "p_edit_change": "change article", 80 | "p_edit_delete": "delete article", 81 | "p_edit_unique_error": "article name must be unique", 82 | "p_edit_delete_q": "Do you really want to delete article '{name}'?", 83 | "@p_edit_delete_q": { 84 | "placeholders": { 85 | "name": { 86 | "type": "String" 87 | } 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "filename": "Icon-App-20x20@2x.png", 5 | "idiom": "iphone", 6 | "scale": "2x", 7 | "size": "20x20" 8 | }, 9 | { 10 | "filename": "Icon-App-20x20@3x.png", 11 | "idiom": "iphone", 12 | "scale": "3x", 13 | "size": "20x20" 14 | }, 15 | { 16 | "filename": "Icon-App-29x29@1x.png", 17 | "idiom": "iphone", 18 | "scale": "1x", 19 | "size": "29x29" 20 | }, 21 | { 22 | "filename": "Icon-App-29x29@2x.png", 23 | "idiom": "iphone", 24 | "scale": "2x", 25 | "size": "29x29" 26 | }, 27 | { 28 | "filename": "Icon-App-29x29@3x.png", 29 | "idiom": "iphone", 30 | "scale": "3x", 31 | "size": "29x29" 32 | }, 33 | { 34 | "filename": "Icon-App-40x40@2x.png", 35 | "idiom": "iphone", 36 | "scale": "2x", 37 | "size": "40x40" 38 | }, 39 | { 40 | "filename": "Icon-App-40x40@3x.png", 41 | "idiom": "iphone", 42 | "scale": "3x", 43 | "size": "40x40" 44 | }, 45 | { 46 | "filename": "Icon-App-60x60@2x.png", 47 | "idiom": "iphone", 48 | "scale": "2x", 49 | "size": "60x60" 50 | }, 51 | { 52 | "filename": "Icon-App-60x60@3x.png", 53 | "idiom": "iphone", 54 | "scale": "3x", 55 | "size": "60x60" 56 | }, 57 | { 58 | "filename": "Icon-App-20x20@1x.png", 59 | "idiom": "ipad", 60 | "scale": "1x", 61 | "size": "20x20" 62 | }, 63 | { 64 | "filename": "Icon-App-20x20@2x.png", 65 | "idiom": "ipad", 66 | "scale": "2x", 67 | "size": "20x20" 68 | }, 69 | { 70 | "filename": "Icon-App-29x29@1x.png", 71 | "idiom": "ipad", 72 | "scale": "1x", 73 | "size": "29x29" 74 | }, 75 | { 76 | "filename": "Icon-App-29x29@2x.png", 77 | "idiom": "ipad", 78 | "scale": "2x", 79 | "size": "29x29" 80 | }, 81 | { 82 | "filename": "Icon-App-40x40@1x.png", 83 | "idiom": "ipad", 84 | "scale": "1x", 85 | "size": "40x40" 86 | }, 87 | { 88 | "filename": "Icon-App-40x40@2x.png", 89 | "idiom": "ipad", 90 | "scale": "2x", 91 | "size": "40x40" 92 | }, 93 | { 94 | "filename": "Icon-App-76x76@1x.png", 95 | "idiom": "ipad", 96 | "scale": "1x", 97 | "size": "76x76" 98 | }, 99 | { 100 | "filename": "Icon-App-76x76@2x.png", 101 | "idiom": "ipad", 102 | "scale": "2x", 103 | "size": "76x76" 104 | }, 105 | { 106 | "filename": "Icon-App-83.5x83.5@2x.png", 107 | "idiom": "ipad", 108 | "scale": "2x", 109 | "size": "83.5x83.5" 110 | }, 111 | { 112 | "filename": "Icon-App-1024x1024@1x.png", 113 | "idiom": "ios-marketing", 114 | "scale": "1x", 115 | "size": "1024x1024" 116 | } 117 | ], 118 | "info": { 119 | "author": "icons_launcher", 120 | "version": 1 121 | } 122 | } -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "de.luedtke" "\0" 93 | VALUE "FileDescription", "shoppinglist" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "shoppinglist" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 de.luedtke. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "shoppinglist.exe" "\0" 98 | VALUE "ProductName", "shoppinglist" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /lib/component/slapp_app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:provider/provider.dart'; 4 | import 'package:shared_preferences/shared_preferences.dart'; 5 | import 'package:shoppinglist/application.dart'; 6 | import 'package:shoppinglist/component/i18n_util.dart'; 7 | import 'package:shoppinglist/component/statics.dart'; 8 | import 'package:shoppinglist/model/pref_keys.dart'; 9 | import 'package:shoppinglist/provider/pocket_base_prov.dart'; 10 | import 'package:theme_provider/theme_provider.dart'; 11 | 12 | class SlappAppBar extends StatefulWidget implements PreferredSizeWidget { 13 | const SlappAppBar({ 14 | super.key, 15 | required this.title, 16 | }); 17 | 18 | final String title; 19 | 20 | @override 21 | State createState() => _SlappAppBarState(); 22 | 23 | @override 24 | Size get preferredSize => const Size.fromHeight(kToolbarHeight); 25 | } 26 | 27 | class _SlappAppBarState extends State { 28 | var _serverUrl = ''; 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | _loadPrefs(); 34 | } 35 | 36 | Future _loadPrefs() async { 37 | final url = await Statics.getServerUrl(); 38 | setState(() { 39 | _serverUrl = url; 40 | }); 41 | } 42 | 43 | Future _savePrefs() async { 44 | final prefs = await SharedPreferences.getInstance(); 45 | prefs.setString(PrefKeys.serverUrlPrefsKey, _serverUrl); 46 | } 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | final pbp = Provider.of(context, listen: true); 51 | 52 | return AppBar( 53 | iconTheme: IconThemeData(color: Theme.of(context).colorScheme.onPrimary), 54 | backgroundColor: Theme.of(context).colorScheme.primary, 55 | title: Text( 56 | widget.title, 57 | style: TextStyle(color: Theme.of(context).colorScheme.onPrimary), 58 | ), 59 | actions: [ 60 | if (!pbp.isHealthy) 61 | const Padding( 62 | padding: EdgeInsets.only(right: 32), 63 | child: Icon(Icons.cloud_off), 64 | ), 65 | IconButton( 66 | onPressed: () { 67 | ThemeProvider.controllerOf(context).nextTheme(); 68 | }, 69 | icon: const Icon(Icons.color_lens), 70 | tooltip: i18n(context).com_change_theme, 71 | ), 72 | IconButton( 73 | onPressed: () { 74 | if ((Intl.defaultLocale ?? '').contains('de')) { 75 | Intl.defaultLocale = 'en'; 76 | APPLIC().onLocaleChanged(const Locale('en', '')); 77 | } else { 78 | Intl.defaultLocale = 'de'; 79 | APPLIC().onLocaleChanged(const Locale('de', '')); 80 | } 81 | }, 82 | icon: const Icon(Icons.language), 83 | tooltip: i18n(context).com_change_language, 84 | ), 85 | IconButton( 86 | onPressed: () { 87 | Statics.showSettingsDialog( 88 | context, 89 | i18n(context).l_p_server_url, 90 | i18n(context).l_p_server_url_info, 91 | _serverUrl, 92 | ).then((value) { 93 | if (value != null && value.isNotEmpty) { 94 | setState(() { 95 | _serverUrl = value; 96 | }); 97 | _savePrefs(); 98 | pbp.setPocketBaseUrl(_serverUrl); 99 | } 100 | }); 101 | }, 102 | icon: const Icon(Icons.settings), 103 | tooltip: i18n(context).com_change_server, 104 | ) 105 | ], 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responsponds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_localizations/flutter_localizations.dart'; 7 | 8 | import 'package:intl/intl.dart'; 9 | import 'package:provider/provider.dart'; 10 | import 'package:theme_provider/theme_provider.dart'; 11 | 12 | import 'package:shoppinglist/application.dart'; 13 | import 'package:shoppinglist/component/custom_themes.dart'; 14 | import 'package:shoppinglist/provider/pocket_base_prov.dart'; 15 | import 'package:shoppinglist/specific_localization_delegate.dart'; 16 | import 'package:shoppinglist/view/active_page.dart'; 17 | import 'package:shoppinglist/view/article_edit_page.dart'; 18 | import 'package:shoppinglist/view/article_page.dart'; 19 | import 'package:shoppinglist/view/login_page.dart'; 20 | import 'package:shoppinglist/view/splash_screen.dart'; 21 | 22 | void main() { 23 | runApp( 24 | ChangeNotifierProvider( 25 | create: (context) => PocketBaseProvider(), 26 | child: const MyApp(), 27 | ), 28 | ); 29 | } 30 | 31 | class MyApp extends StatefulWidget { 32 | const MyApp({super.key}); 33 | 34 | @override 35 | State createState() => _MyAppState(); 36 | } 37 | 38 | class _MyAppState extends State { 39 | late SpecificLocalizationDelegate _localeOverrideDelegate; 40 | 41 | @override 42 | void initState() { 43 | super.initState(); 44 | final String initialLanguage; 45 | if (kIsWeb) { 46 | initialLanguage = PlatformDispatcher.instance.locale.languageCode; 47 | } else { 48 | initialLanguage = Platform.localeName.substring(0, 2); 49 | } 50 | _localeOverrideDelegate = SpecificLocalizationDelegate(Locale(initialLanguage)); 51 | Intl.defaultLocale = initialLanguage; 52 | APPLIC().onLocaleChanged = onLocaleChange; 53 | } 54 | 55 | void onLocaleChange(Locale locale) { 56 | setState(() { 57 | debugPrint('onLocaleChange: ${locale.languageCode}'); 58 | _localeOverrideDelegate = SpecificLocalizationDelegate(locale); 59 | }); 60 | } 61 | 62 | @override 63 | Widget build(BuildContext context) { 64 | return ThemeProvider( 65 | onThemeChanged: (oldTheme, newTheme) { 66 | debugPrint('Theme: ${newTheme.id}'); 67 | }, 68 | loadThemeOnInit: true, 69 | saveThemesOnChange: true, 70 | themes: customThemes, 71 | child: ThemeConsumer( 72 | child: MultiProvider( 73 | providers: [ 74 | ChangeNotifierProvider.value( 75 | value: PocketBaseProvider(), 76 | ), 77 | ], 78 | child: Consumer( 79 | builder: (context, pbp, _) => MaterialApp( 80 | title: 'Shoppinglist', 81 | theme: ThemeProvider.themeOf(context).data, 82 | localizationsDelegates: [ 83 | _localeOverrideDelegate, 84 | GlobalMaterialLocalizations.delegate, 85 | GlobalWidgetsLocalizations.delegate, 86 | GlobalCupertinoLocalizations.delegate, 87 | ], 88 | supportedLocales: APPLIC().supportedLocales(), 89 | home: pbp.isAuth 90 | ? const ActivePage() 91 | : FutureBuilder( 92 | future: pbp.tryAutoLogin(), 93 | builder: (context, snapshot) => snapshot.connectionState == ConnectionState.waiting 94 | ? const SplashScreen() 95 | : const LoginPage(), 96 | ), 97 | routes: { 98 | // LoginPage.routeName: (context) => const LoginPage(), 99 | // --- Views/Pages --- 100 | ActivePage.routeName: (context) => const ActivePage(), 101 | ArticlePage.routeName: (context) => const ArticlePage(), 102 | // --- Edits --- 103 | ArticleEditPage.routeName: (context) => const ArticleEditPage(), 104 | }, 105 | ), 106 | ), 107 | ), 108 | ), 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "Shoppinglist"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "Shoppinglist"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(shoppinglist LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "shoppinglist") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /lib/component/custom_themes.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | import 'package:shoppinglist/component/statics.dart'; 5 | import 'package:shoppinglist/component/theme_options.dart'; 6 | 7 | var customThemes = [ 8 | AppTheme( 9 | id: 'light-blue', 10 | description: 'Light blue', 11 | data: ThemeData( 12 | useMaterial3: true, 13 | colorScheme: ColorScheme.fromSeed( 14 | brightness: Brightness.light, 15 | seedColor: Colors.lightBlue, 16 | ), 17 | dialogTheme: DialogThemeData(backgroundColor: const Color.fromARGB(255, 240, 240, 240)), 18 | ), 19 | options: ThemeOptions( 20 | Colors.grey.shade400, 21 | Statics.getSlideBtnBackgroundLight, 22 | Statics.getSlideBtnForegroundLight, 23 | 1.4, 24 | FontWeight.bold, 25 | Statics.getGradientPageDecoration(), 26 | Statics.getGradientDrawerDecoration, 27 | Statics.getGradientDrawerHeaderDecoration, 28 | ), 29 | ), 30 | AppTheme( 31 | id: 'light-green', 32 | description: 'Light green', 33 | data: ThemeData( 34 | useMaterial3: true, 35 | colorScheme: ColorScheme.fromSeed( 36 | brightness: Brightness.light, 37 | seedColor: Colors.lightGreen, 38 | ), 39 | dialogTheme: DialogThemeData(backgroundColor: const Color.fromARGB(255, 240, 240, 240)), 40 | ), 41 | options: ThemeOptions( 42 | Colors.grey.shade400, 43 | Statics.getSlideBtnBackgroundLight, 44 | Statics.getSlideBtnForegroundLight, 45 | 1.4, 46 | FontWeight.bold, 47 | Statics.getGradientPageDecoration(), 48 | Statics.getGradientDrawerDecoration, 49 | Statics.getGradientDrawerHeaderDecoration, 50 | ), 51 | ), 52 | AppTheme( 53 | id: 'orange', 54 | description: 'Orange', 55 | data: ThemeData( 56 | useMaterial3: true, 57 | colorScheme: ColorScheme.fromSeed( 58 | brightness: Brightness.light, 59 | primary: Colors.orange, 60 | seedColor: Colors.orange, 61 | ), 62 | dialogTheme: DialogThemeData(backgroundColor: const Color.fromARGB(255, 240, 240, 240)), 63 | ), 64 | options: ThemeOptions( 65 | Colors.grey.shade400, 66 | Statics.getSlideBtnBackgroundLight, 67 | Statics.getSlideBtnForegroundLight, 68 | 1.4, 69 | FontWeight.bold, 70 | Statics.getGradientPageDecoration(), 71 | Statics.getGradientDrawerDecoration, 72 | Statics.getGradientDrawerHeaderDecoration, 73 | ), 74 | ), 75 | AppTheme( 76 | id: 'light-orange', 77 | description: 'Light orange', 78 | data: ThemeData( 79 | useMaterial3: false, 80 | colorScheme: ColorScheme.fromSeed( 81 | seedColor: Colors.orange, 82 | primary: Colors.orange, 83 | brightness: Brightness.light, 84 | ), 85 | dialogTheme: DialogThemeData(backgroundColor: const Color.fromARGB(255, 240, 240, 240)), 86 | ), 87 | options: ThemeOptions( 88 | Colors.grey.shade400, 89 | Statics.getSlideBtnBackgroundLight, 90 | Statics.getSlideBtnForegroundLight, 91 | 1.1, 92 | FontWeight.normal, 93 | Statics.getSimplePageDecoration(), 94 | Statics.getSimpleDrawerDecoration, 95 | Statics.getSimpleDrawerHeaderDecoration, 96 | ), 97 | ), 98 | AppTheme( 99 | id: 'dark-cyan', 100 | description: 'Dark cyan', 101 | data: ThemeData( 102 | useMaterial3: true, 103 | colorScheme: ColorScheme.fromSeed( 104 | brightness: Brightness.dark, 105 | seedColor: Colors.cyan, 106 | ), 107 | dialogTheme: DialogThemeData(backgroundColor: const Color.fromARGB(255, 50, 50, 50)), 108 | ), 109 | options: ThemeOptions( 110 | Colors.grey.shade600, 111 | Statics.getSlideBtnBackgroundDark, 112 | Statics.getSlideBtnForegroundDark, 113 | 1.4, 114 | FontWeight.bold, 115 | Statics.getGradientPageDecoration(), 116 | Statics.getGradientDrawerDecoration, 117 | Statics.getGradientDrawerHeaderDecoration, 118 | ), 119 | ), 120 | AppTheme( 121 | id: 'dark-orange', 122 | description: 'Dark orange', 123 | data: ThemeData( 124 | useMaterial3: true, 125 | colorScheme: ColorScheme.fromSeed( 126 | brightness: Brightness.dark, 127 | seedColor: Colors.orange, 128 | ), 129 | ), 130 | options: ThemeOptions( 131 | Colors.grey.shade600, 132 | Statics.getSlideBtnBackgroundDark, 133 | Statics.getSlideBtnForegroundDark, 134 | 1.4, 135 | FontWeight.bold, 136 | Statics.getGradientPageDecoration(), 137 | Statics.getGradientDrawerDecoration, 138 | Statics.getGradientDrawerHeaderDecoration, 139 | ), 140 | ), 141 | ]; 142 | -------------------------------------------------------------------------------- /lib/component/slapp_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:package_info_plus/package_info_plus.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:theme_provider/theme_provider.dart'; 6 | 7 | import 'package:shoppinglist/component/i18n_util.dart'; 8 | import 'package:shoppinglist/component/statics.dart'; 9 | import 'package:shoppinglist/component/theme_options.dart'; 10 | import 'package:shoppinglist/provider/pocket_base_prov.dart'; 11 | import 'package:shoppinglist/view/active_page.dart'; 12 | import 'package:shoppinglist/view/article_page.dart'; 13 | import 'package:shoppinglist/view/login_page.dart'; 14 | 15 | class SlappDrawer extends StatelessWidget { 16 | const SlappDrawer({super.key}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | final pbp = context.read(); 21 | 22 | return Drawer( 23 | child: Container( 24 | decoration: ThemeProvider.optionsOf(context).drawerDecoration(context), 25 | child: ListView( 26 | padding: EdgeInsets.zero, 27 | children: [ 28 | DrawerHeader( 29 | decoration: ThemeProvider.optionsOf(context).drawerHeaderDecoration(context), 30 | child: Column( 31 | crossAxisAlignment: CrossAxisAlignment.start, 32 | children: [ 33 | Text( 34 | i18n(context).drawer_title, 35 | textScaler: const TextScaler.linear(1.6), 36 | style: TextStyle( 37 | fontWeight: FontWeight.bold, 38 | color: Theme.of(context).colorScheme.onPrimary, 39 | ), 40 | ), 41 | Padding( 42 | padding: const EdgeInsets.all(8.0), 43 | child: Text( 44 | pbp.userName, 45 | textScaler: const TextScaler.linear(1.2), 46 | style: TextStyle( 47 | color: Theme.of(context).colorScheme.onPrimary, 48 | ), 49 | ), 50 | ), 51 | Padding( 52 | padding: const EdgeInsets.all(8.0), 53 | child: FutureBuilder( 54 | future: PackageInfo.fromPlatform(), 55 | builder: (ctx, snapshot) { 56 | var defText = '---'; 57 | if (snapshot.hasData) { 58 | defText = '${snapshot.data!.version}+${snapshot.data!.buildNumber}'; 59 | } 60 | return Text( 61 | i18n(context).drawer_version(defText), 62 | style: TextStyle( 63 | color: Theme.of(context).colorScheme.onPrimary, 64 | ), 65 | ); 66 | }), 67 | ), 68 | ], 69 | ), 70 | ), 71 | ListTile( 72 | title: Text(i18n(context).p_active_title), 73 | selected: ModalRoute.of(context)?.settings.name == ActivePage.routeName, 74 | onTap: () { 75 | Navigator.pushNamed(context, ActivePage.routeName); 76 | }, 77 | leading: const Icon( 78 | Icons.list, 79 | ), 80 | ), 81 | ListTile( 82 | title: Text(i18n(context).p_articles_title), 83 | selected: ModalRoute.of(context)?.settings.name == ArticlePage.routeName, 84 | onTap: () { 85 | Navigator.pushNamed(context, ArticlePage.routeName); 86 | }, 87 | leading: const Icon( 88 | Icons.list, 89 | ), 90 | ), 91 | const Divider(), 92 | ListTile( 93 | title: Text(i18n(context).drawer_end_shopping), 94 | onTap: () { 95 | Statics.showEndShoppingDialog(context, pbp).then((b) { 96 | if (context.mounted) Navigator.pop(context); 97 | }); 98 | }, 99 | leading: ImageIcon( 100 | size: 24, 101 | AssetImage('assets/race_flag.png'), 102 | ), 103 | ), 104 | const Divider(), 105 | ListTile( 106 | title: Text(i18n(context).drawer_logout), 107 | onTap: () { 108 | Statics.showConfirmDialog(context, i18n(context).drawer_logout, i18n(context).drawer_logout_q) 109 | .then((value) { 110 | if (value != null && value) { 111 | pbp.logout(); 112 | if (context.mounted) { 113 | Navigator.pushNamedAndRemoveUntil(context, LoginPage.routeName, (route) => false); 114 | } 115 | } 116 | }); 117 | }, 118 | leading: const Icon( 119 | Icons.logout, 120 | ), 121 | ), 122 | ], 123 | ), 124 | ), 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "shoppinglist") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "de.luedtke.shoppinglist") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /lib/view/article_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:pocketbase/pocketbase.dart'; 5 | import 'package:provider/provider.dart'; 6 | import 'package:theme_provider/theme_provider.dart'; 7 | 8 | import 'package:shoppinglist/component/article_card.dart'; 9 | import 'package:shoppinglist/component/i18n_util.dart'; 10 | import 'package:shoppinglist/component/selected_page.dart'; 11 | import 'package:shoppinglist/component/slapp_app_bar.dart'; 12 | import 'package:shoppinglist/component/slapp_drawer.dart'; 13 | import 'package:shoppinglist/component/statics.dart'; 14 | import 'package:shoppinglist/component/theme_options.dart'; 15 | import 'package:shoppinglist/model/article.dart'; 16 | import 'package:shoppinglist/model/sel_page.dart'; 17 | import 'package:shoppinglist/provider/pocket_base_prov.dart'; 18 | import 'package:shoppinglist/view/article_edit_page.dart'; 19 | 20 | class ArticlePage extends StatefulWidget { 21 | const ArticlePage({super.key}); 22 | static const routeName = '/articles'; 23 | 24 | @override 25 | State createState() => _ArticlePageState(); 26 | } 27 | 28 | class _ArticlePageState extends State { 29 | var _isLoading = false; 30 | var _searchFor = ''; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | 36 | _fetchAll(); 37 | } 38 | 39 | Future _fetchAllArticles(PocketBaseProvider pbp) async { 40 | return pbp.fetchAllArticles(); 41 | } 42 | 43 | Future _fetchAll() async { 44 | final pbp = Provider.of(context, listen: false); 45 | setState(() { 46 | _isLoading = true; 47 | }); 48 | try { 49 | await Future.wait([_fetchAllArticles(pbp)]); 50 | } on ClientException catch (e) { 51 | if (mounted) { 52 | Statics.showErrorSnackbar(context, e); 53 | } 54 | } finally { 55 | setState(() { 56 | _isLoading = false; 57 | }); 58 | } 59 | } 60 | 61 | @override 62 | Widget build(BuildContext context) { 63 | final pbp = Provider.of(context, listen: true); 64 | Timer? delayedSearch; 65 | final filteredArticles = pbp.allArticles 66 | .where((art) => 67 | art.shop.toUpperCase().contains(_searchFor.toUpperCase()) || 68 | art.article.toUpperCase().contains(_searchFor.toUpperCase())) 69 | .toList(); 70 | page = SelPage.articleList; 71 | 72 | return Scaffold( 73 | appBar: SlappAppBar(title: i18n(context).p_articles_title), 74 | drawer: const SlappDrawer(), 75 | body: RefreshIndicator( 76 | onRefresh: _fetchAll, 77 | child: Container( 78 | decoration: ThemeProvider.optionsOf(context).pageDecoration, 79 | child: Padding( 80 | padding: const EdgeInsets.all(8.0), 81 | child: Center( 82 | child: Column( 83 | mainAxisAlignment: MainAxisAlignment.center, 84 | children: [ 85 | Padding( 86 | padding: const EdgeInsets.all(8.0), 87 | child: Row( 88 | crossAxisAlignment: CrossAxisAlignment.baseline, 89 | textBaseline: TextBaseline.alphabetic, 90 | children: [ 91 | Flexible( 92 | flex: 3, 93 | child: TextField( 94 | decoration: InputDecoration(labelText: i18n(context).com_search_term), 95 | autofocus: true, 96 | onChanged: (text) { 97 | // debugPrint('Search text: $text'); 98 | delayedSearch?.cancel(); 99 | delayedSearch = Timer(const Duration(milliseconds: 750), () { 100 | setState(() { 101 | _searchFor = text; 102 | }); 103 | }); 104 | }, 105 | ), 106 | ), 107 | const SizedBox(width: 8), 108 | Flexible( 109 | flex: 2, 110 | child: Text(i18n(context).com_num_articles(filteredArticles.length)), 111 | ), 112 | ], 113 | ), 114 | ), 115 | _isLoading 116 | ? const SizedBox(height: 50, width: 50, child: CircularProgressIndicator()) 117 | : Expanded( 118 | child: ListView.builder( 119 | itemBuilder: (ctx, idx) { 120 | return GestureDetector( 121 | onTap: () { 122 | Navigator.pushNamed(context, ArticleEditPage.routeName, 123 | arguments: filteredArticles[idx]); 124 | }, 125 | child: ArticleCard( 126 | article: filteredArticles[idx], 127 | isArticleList: true, 128 | ), 129 | ); 130 | }, 131 | itemCount: filteredArticles.length, 132 | ), 133 | ), 134 | ], 135 | ), 136 | ), 137 | ), 138 | ), 139 | ), 140 | floatingActionButton: FloatingActionButton( 141 | onPressed: () { 142 | Navigator.pushNamed(context, ArticleEditPage.routeName, arguments: Article()); 143 | }, 144 | backgroundColor: Theme.of(context).floatingActionButtonTheme.backgroundColor, 145 | tooltip: i18n(context).p_articles_tooltip, 146 | child: const Icon(Icons.add), 147 | ), 148 | ); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /lib/view/article_edit_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:pocketbase/pocketbase.dart'; 3 | import 'package:provider/provider.dart'; 4 | import 'package:theme_provider/theme_provider.dart'; 5 | 6 | import 'package:shoppinglist/component/i18n_util.dart'; 7 | import 'package:shoppinglist/component/statics.dart'; 8 | import 'package:shoppinglist/component/theme_options.dart'; 9 | import 'package:shoppinglist/model/article.dart'; 10 | import 'package:shoppinglist/provider/pocket_base_prov.dart'; 11 | 12 | class ArticleEditPage extends StatefulWidget { 13 | const ArticleEditPage({super.key}); 14 | 15 | static const routeName = '/articleEdit'; 16 | 17 | @override 18 | State createState() => _ArticleEditPageState(); 19 | } 20 | 21 | class _ArticleEditPageState extends State { 22 | var _isLoading = false; 23 | bool? _isValid; 24 | final _formKey = GlobalKey(); 25 | 26 | void copyArticle(PocketBaseProvider pbp, Article article, BuildContext context) async { 27 | setState(() { 28 | _isLoading = true; 29 | }); 30 | try { 31 | await pbp.updateArticle(article); 32 | pbp.fetchAllArticles(); 33 | if (context.mounted) { 34 | Navigator.of(context).pop(); 35 | } 36 | } catch (err) { 37 | if (err is ClientException && err.response['data']?['article']?['code'] == 'validation_not_unique') { 38 | if (context.mounted) { 39 | Statics.showErrorSnackbar(context, i18n(context).p_edit_unique_error); 40 | } 41 | } else { 42 | if (context.mounted) { 43 | Statics.showErrorSnackbar(context, err); 44 | } 45 | } 46 | } finally { 47 | setState(() { 48 | _isLoading = false; 49 | }); 50 | } 51 | } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | final pbp = Provider.of(context, listen: false); 56 | final article = ModalRoute.of(context)!.settings.arguments as Article; 57 | _isValid ??= article.article.length > 1; 58 | 59 | var appBar = AppBar( 60 | title: Text(article.id.isEmpty ? i18n(context).p_edit_new : i18n(context).p_edit_change), 61 | actions: [ 62 | IconButton( 63 | icon: const Icon(Icons.delete_rounded), 64 | onPressed: (article.id.isEmpty) 65 | ? null 66 | : () { 67 | Statics.showConfirmDialog( 68 | context, 69 | i18n(context).p_edit_delete, 70 | i18n(context).p_edit_delete_q(article.article), 71 | ).then((value) { 72 | if (value != null && value) { 73 | pbp.deleteArticle(article.id).then((_) { 74 | if (context.mounted) { 75 | Navigator.of(context).pop(); 76 | } 77 | }); 78 | pbp.fetchAllArticles(); 79 | } 80 | }); 81 | }, 82 | ), 83 | IconButton( 84 | icon: const Icon(Icons.save_rounded), 85 | onPressed: (!(_isValid ?? false)) 86 | ? null 87 | : () { 88 | if (_formKey.currentState!.validate()) { 89 | _formKey.currentState!.save(); 90 | copyArticle(pbp, article, context); 91 | } 92 | }, 93 | ), 94 | ], 95 | ); 96 | 97 | return Scaffold( 98 | appBar: appBar, 99 | body: Container( 100 | decoration: ThemeProvider.optionsOf(context).pageDecoration, 101 | child: Column( 102 | mainAxisAlignment: MainAxisAlignment.start, 103 | children: [ 104 | Padding( 105 | padding: const EdgeInsets.all(8), 106 | child: Container( 107 | height: null, 108 | decoration: BoxDecoration( 109 | color: Theme.of(context).cardColor, 110 | borderRadius: const BorderRadius.all(Radius.circular(15)), 111 | ), 112 | child: Form( 113 | autovalidateMode: AutovalidateMode.always, 114 | key: _formKey, 115 | child: SingleChildScrollView( 116 | child: Column( 117 | crossAxisAlignment: CrossAxisAlignment.start, 118 | mainAxisAlignment: MainAxisAlignment.start, 119 | children: [ 120 | Padding( 121 | padding: const EdgeInsets.all(8), 122 | child: TextFormField( 123 | autofocus: true, 124 | initialValue: article.shop, 125 | textInputAction: TextInputAction.next, 126 | keyboardType: TextInputType.text, 127 | decoration: InputDecoration(labelText: i18n(context).com_shop), 128 | onSaved: (newValue) => article.shop = newValue ?? '', 129 | ), 130 | ), 131 | Padding( 132 | padding: const EdgeInsets.all(8), 133 | child: TextFormField( 134 | autofocus: false, 135 | initialValue: article.article, 136 | textInputAction: TextInputAction.next, 137 | keyboardType: TextInputType.text, 138 | decoration: InputDecoration(labelText: i18n(context).com_article), 139 | onChanged: (value) { 140 | setState(() { 141 | _isValid = value.length > 1; 142 | }); 143 | }, 144 | onSaved: (newValue) => article.article = newValue ?? '', 145 | ), 146 | ), 147 | if (_isLoading) const CircularProgressIndicator(), 148 | ], 149 | ), 150 | )), 151 | )), 152 | ], 153 | ), 154 | ), 155 | ); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /lib/provider/pocket_base_prov.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:pocketbase/pocketbase.dart'; 5 | import 'package:shared_preferences/shared_preferences.dart'; 6 | import 'package:shoppinglist/component/statics.dart'; 7 | import 'package:shoppinglist/model/article.dart'; 8 | import 'package:shoppinglist/model/pref_keys.dart'; 9 | import 'package:shoppinglist/provider/fetch_dummy.dart' 10 | if (dart.library.html) 'package:shoppinglist/provider/fetch_stub.dart'; 11 | import 'package:vibration/vibration.dart' as vib; 12 | 13 | class PocketBaseProvider extends ChangeNotifier { 14 | PocketBase? _pb; 15 | final collectionName = 'shoppinglist'; 16 | List
_active = []; 17 | List
_allArticles = []; 18 | List
_searchArticles = []; 19 | Timer? _healthCheckTimer; 20 | bool _lastHealthy = true; 21 | bool _healthy = true; 22 | String _userName = ''; 23 | 24 | bool get isAuth { 25 | return (_pb?.authStore.isValid ?? false) && (_pb?.authStore.token.isNotEmpty ?? false); 26 | } 27 | 28 | bool get isHealthy => _healthy; 29 | 30 | String get userName => _userName; 31 | 32 | List
get activeArticles => _active; 33 | 34 | List
get allArticles => _allArticles; 35 | 36 | List
get searchArticles => _searchArticles; 37 | 38 | Future login(String email, String password) async { 39 | await ensurePocketBaseIsLoaded(); 40 | ensureKeepAlive(); 41 | if (_pb == null) { 42 | return; 43 | } 44 | final authData = await _pb!.collection('users').authWithPassword(email, password); 45 | _healthy = true; 46 | _userName = authData.record.data['name'].toString(); 47 | final prefs = await SharedPreferences.getInstance(); 48 | prefs.setString(PrefKeys.accessTokenPrefsKey, _pb!.authStore.token); 49 | prefs.setString(PrefKeys.accessNamePrefsKey, _userName); 50 | notifyListeners(); 51 | } 52 | 53 | Future doHealthCheck() async { 54 | await ensurePocketBaseIsLoaded(); 55 | _pb?.health.check().then((value) { 56 | _healthy = true; 57 | }).onError((error, stackTrace) { 58 | _healthy = false; 59 | }).whenComplete(() { 60 | if (_healthy != _lastHealthy) { 61 | notifyListeners(); 62 | } 63 | _lastHealthy = _healthy; 64 | }); 65 | } 66 | 67 | Future ensureKeepAlive() async { 68 | _healthCheckTimer?.cancel(); 69 | _healthCheckTimer = Timer.periodic(const Duration(seconds: 10), (timer) { 70 | doHealthCheck(); 71 | }); 72 | } 73 | 74 | Future logout() async { 75 | _healthCheckTimer?.cancel(); 76 | _healthCheckTimer = null; 77 | _pb?.authStore.clear(); 78 | final prefs = await SharedPreferences.getInstance(); 79 | prefs.remove(PrefKeys.accessTokenPrefsKey); 80 | prefs.remove(PrefKeys.accessModelPrefsKey); 81 | prefs.remove(PrefKeys.accessNamePrefsKey); 82 | } 83 | 84 | Future tryAutoLogin() async { 85 | await ensurePocketBaseIsLoaded(); 86 | final prefs = await SharedPreferences.getInstance(); 87 | _userName = prefs.getString(PrefKeys.accessNamePrefsKey) ?? ''; 88 | if (_pb == null) { 89 | return false; 90 | } 91 | _pb!.authStore.save( 92 | prefs.getString(PrefKeys.accessTokenPrefsKey) ?? '', 93 | RecordModel({ 94 | 'email': prefs.getString(PrefKeys.lastUserPrefsKey) ?? '', 95 | })); 96 | if (!_pb!.authStore.isValid) { 97 | return false; 98 | } 99 | ensureKeepAlive(); 100 | notifyListeners(); 101 | return _pb!.authStore.isValid; 102 | } 103 | 104 | Future fetchActive([bool doReload = false]) async { 105 | await ensurePocketBaseIsLoaded(); 106 | final result = await _pb?.collection(collectionName).getList( 107 | filter: 'active = true', 108 | ); 109 | if (result != null) { 110 | List
al = []; 111 | for (var element in result.items) { 112 | Article art = Article.fromJson(element.toJson()); 113 | al.add(art); 114 | } 115 | _active = al.toList(); 116 | _sortActive(_active); 117 | notifyListeners(); 118 | } 119 | } 120 | 121 | Future fetchAllArticles([bool doReload = false]) async { 122 | await ensurePocketBaseIsLoaded(); 123 | final result = await _pb?.collection(collectionName).getFullList(); 124 | if (result != null) { 125 | List
al = []; 126 | for (var element in result) { 127 | Article art = Article.fromJson(element.toJson()); 128 | al.add(art); 129 | } 130 | _allArticles = al.toList(); 131 | _sortActive(_allArticles); 132 | notifyListeners(); 133 | } 134 | } 135 | 136 | Future searchForArticles(String what) async { 137 | await ensurePocketBaseIsLoaded(); 138 | final searchString = 'active = false && (article ~ "$what" || shop ~ "$what")'; 139 | final result = await _pb?.collection(collectionName).getList(filter: searchString, sort: '+article'); 140 | if (result != null) { 141 | List
al = []; 142 | for (var element in result.items) { 143 | Article art = Article.fromJson(element.toJson()); 144 | al.add(art); 145 | } 146 | _searchArticles = al.toList(); 147 | _sortActive(_searchArticles); 148 | notifyListeners(); 149 | } 150 | } 151 | 152 | void clearSearchList() { 153 | _searchArticles = []; 154 | notifyListeners(); 155 | } 156 | 157 | void _sortActive(List
list) { 158 | list.sort((a, b) { 159 | if (a.inCart != b.inCart) { 160 | if (a.inCart) { 161 | return 1; 162 | } else { 163 | return -1; 164 | } 165 | } 166 | int ret = a.shop.compareTo(b.shop); 167 | if (ret != 0) { 168 | return ret; 169 | } 170 | return a.article.compareTo(b.article); 171 | }); 172 | } 173 | 174 | Map _articleToMap(Article article) { 175 | return { 176 | 'shop': article.shop, 177 | 'article': article.article, 178 | 'amount': article.amount, 179 | 'inCart': article.inCart, 180 | 'active': article.active 181 | }; 182 | } 183 | 184 | Future updateArticle(Article article) async { 185 | await ensurePocketBaseIsLoaded(); 186 | if (article.id.isEmpty) { 187 | return _pb!.collection(collectionName).create(body: _articleToMap(article)); 188 | } 189 | return _pb!.collection(collectionName).update(article.id, body: _articleToMap(article)); 190 | } 191 | 192 | Future toggleinCart(Article article) async { 193 | if (article.id.isEmpty) { 194 | return RecordModel(); 195 | } 196 | await ensurePocketBaseIsLoaded(); 197 | if (![TargetPlatform.linux, TargetPlatform.macOS, TargetPlatform.windows].contains(defaultTargetPlatform)) { 198 | try { 199 | if (await vib.Vibration.hasVibrator()) { 200 | await vib.Vibration.vibrate(duration: 50); 201 | } 202 | } catch (e) { 203 | debugPrint('Vibration impossible: $e'); 204 | } 205 | } 206 | article.inCart = !article.inCart; 207 | return _pb!.collection(collectionName).update(article.id, body: _articleToMap(article)); 208 | } 209 | 210 | Future endShopping() async { 211 | await ensurePocketBaseIsLoaded(); 212 | final inCartItems = _active.where((element) => element.inCart).toList(); 213 | for (var itm in inCartItems) { 214 | itm.inCart = false; 215 | itm.active = false; 216 | updateArticle(itm); 217 | } 218 | } 219 | 220 | Future subscribeActive() async { 221 | await ensurePocketBaseIsLoaded(); 222 | _pb?.collection(collectionName).subscribe('*', (e) { 223 | debugPrint(e.action); // create, update, delete 224 | debugPrint(e.record?.toString()); // the changed record 225 | Article art = Article.fromJson(e.record?.toJson() ?? {}); 226 | if (e.action == 'create') { 227 | _active.insert(0, art); 228 | } else if (e.action == 'delete') { 229 | _active.removeWhere((element) => element.id == art.id); 230 | } else { 231 | if (!art.active) { 232 | _active.removeWhere((element) => element.id == art.id); 233 | } else { 234 | int idx = _active.indexWhere((element) => element.id == art.id); 235 | if (idx < 0) { 236 | _active.insert(0, art); 237 | } else { 238 | _active[idx] = art; 239 | } 240 | } 241 | } 242 | _sortActive(_active); 243 | notifyListeners(); 244 | }); 245 | } 246 | 247 | Future unsubscribeActive() async { 248 | await ensurePocketBaseIsLoaded(); 249 | return _pb?.collection(collectionName).unsubscribe(); 250 | } 251 | 252 | Future deleteArticle(String id) async { 253 | await ensurePocketBaseIsLoaded(); 254 | return _pb?.collection(collectionName).delete(id); 255 | } 256 | 257 | Future sendPasswordResetEmail(String email) { 258 | return _pb!.collection('users').requestPasswordReset(email); 259 | } 260 | 261 | void setPocketBaseUrl(String url) { 262 | // for a local PocketBase installation, the default url is 'http://localhost:8090' 263 | _pb = PocketBase( 264 | url, 265 | httpClientFactory: kIsWeb ? () => getClient() : null, 266 | ); 267 | } 268 | 269 | Future ensurePocketBaseIsLoaded() async { 270 | if (_pb == null) { 271 | final url = await Statics.getServerUrl(); 272 | if (url.isNotEmpty) { 273 | setPocketBaseUrl(url); 274 | } 275 | } 276 | return _pb != null; 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Shopping list made with Flutter and PocketBase 2 | 3 | ## Overview 4 | 5 | The purpose of this app is to maintain a shopping list that can be used by more than one person. 6 | In our family, we all use this app to inform the others about the goods that are wanted. If someone goes shopping, 7 | he/she can buy the goods for all family members. 8 | 9 | The backend software PocketBase informs all running instances of the app about changes in the 10 | list. So, if you're inside a shop, you will see also articles that are newly put in the list by other members. 11 | 12 | This app needs a PocketBase backend, running somewhere. PocketBase is a Firebase clone in one single binary. 13 | More infos on [the PocketBase homepage](https://pocketbase.io). On that page is a good description, how to run PocketBase 14 | on [fly.io](https://github.com/pocketbase/pocketbase/discussions/537) (discussion area). There are some chapters about fly.io further down below. 15 | 16 | ### Features 17 | 18 | - Dart 3 and Flutter 3.35 compatible 19 | - Works with PocketBase v0.31 20 | - several themes with custom options including dark modes 21 | - localization (English and German) 22 | - it works on Android, iOS, Linux, macOS, Windows and Web (also WebAssembly) 23 | 24 | ### Screenshots 25 | 26 |

27 | The login page 28 | Connection to PocketBase 29 | Connection to a local PocketBase 30 |

31 |

32 | The shopping list 33 | A dark theme 34 | Swipe right for amount 35 |

36 |

37 | Swipe left for edit or duplicate 38 | 2 articles in cart 39 | Search article 40 |

41 |

42 | Open drawer 43 | Article list 44 | End shopping 45 |

46 |

47 | Logout 48 |

49 | 50 | ### Here are some tips for the shopping list: 51 | 52 | - you can mark an article as _inCart_ by double-clicking the article itself 53 | - when you swipe the article to the right, a click on the plus or minus sign will change the quantity of that article 54 | - when you swipe the article to the left, the article can be edited (pen symbol) and duplicated (copy symbol) 55 | - a long press on the article will also open the edit dialog 56 | - articles are grouped by shop and sorted alphabetically 57 | - articles marked _inCart_ are placed at the end of the list to have a clearer view about what is left 58 | - in the search dialog, a new article can be added by pressing the plus sign 59 | 60 | When the server can't be reached, an icon is displayed in the app bar. 61 |

62 | No connection 63 |

64 | 65 | 66 | ## Technical description 67 | 68 | There is only one database table 'shoppinglist' that is used in this app. This table (or collection) 69 | has the following fields that must be created beforehand: 70 | 71 | - `active` : Bool 72 | - `amount` : Number, Min=0, Max=100 73 | - `inCart` : Bool 74 | - `article` : Plain text, Min length=1, Max length=120, Nonempty, Unique 75 | - `shop` : Plain text, Max length=80 76 | 77 | > **Info** 78 | > 79 | > There is also a schema file in JSON format (`pb_schema.json`) that can be imported in PocketBase to 80 | > create this collection. 81 | 82 | When an article is marked _`active`_, it will be visible on the **shopping list**. Otherwise, the article will 83 | show up in the **article list**. 84 | 85 | ## Get it working 86 | 87 | ### Install / deploy PocketBase 88 | 89 | Proceed as follows: 90 | 91 | 1. deploy or install PocketBase (local is fine) 92 | 2. open the admin page of PocketBase (create PocketBase admin user on the fly) 93 | 3. import `pb_schema.json` to create the `shoppinglist` collection (via "Sync - Import Collection") 94 | 4. create users with email and password. Mark them as verified and give them a **NAME**. This name is visible in the app. 95 | 5. enter some data in the `shoppinglist` collection or do it later in the app 96 | 97 | ### Compile / run Shoppinglist 98 | 99 | I assume that Flutter is installed on your machine and that `flutter doctor` doesn't show errors 100 | for the platform you're using. 101 | 102 | 1. run `flutter gen-l10n` to compile the localization files 103 | 2. run **`flutter run`** to start the application 104 | 3. click on the settings icon to open the PocketBase connection dialog and enter the url of the PocketBase server (typically http://localhost:8090) 105 | 4. to create i.e., an Android app, run **`flutter build apk`**. Please use a *real* ip-address and **not** localhost! (see also note below) 106 | 5. inside the app, login with the email and password of a user that you created on the PocketBase admin page 107 | 108 | That's it. Have fun and go shopping! 109 | 110 | > **Important** 111 | > 112 | > If you run PocketBase locally and want to access it, i.e. from the Android Emulator, you need to start 113 | > PocketBase like this: 114 | > 115 | > `> pocketbase serve --http 0.0.0.0:8090` 116 | > 117 | > This ensures that PocketBase will listen on all addresses. Furthermore, you need to set the 118 | > connection url with the correct ip-address of your host machine like `http://192.168.0.52:8090`. 119 | > The address depends on your network, and you should look it up with tools like `ip a`, 120 | > `ipconfig` or `ifconfig`. 121 | 122 | ### Command line parameter 123 | There is one parameter that can be set via 124 | 125 | --dart-define="SHOPPINGLIST_HOST=http://localhost:8090" 126 | 127 | When this parameter is set, it overrides the URL that is set via the UI. This makes it easy 128 | to switch between different PocketBase instances while developing. 129 | 130 | ## Run a debug Web version with an external host 131 | 132 | If you want to run the app as a Web app, you have to use a commandline like this: 133 | 134 | > flutter run -d chrome 135 | 136 | ## Create release builds 137 | 138 | To create a release build, run a command like this: 139 | 140 | > flutter build apk 141 | > flutter build ios 142 | > flutter build macos 143 | > flutter build web --wasm 144 | 145 | ## Using Visual Studio Code 146 | 147 | To have the right environment variable when running or debugging the app in VSCode, you 148 | have to create a launch configuration `.vscode/launch.json` and have a configuration like this: 149 | 150 | { 151 | "version": "0.2.0", 152 | "configurations": [ 153 | { 154 | "name": "shoppinglist", 155 | "request": "launch", 156 | "type": "dart", 157 | }, 158 | { 159 | "name": "shoppinglist local", 160 | "request": "launch", 161 | "type": "dart", 162 | "args": [ 163 | "--dart-define", 164 | "SHOPPINGLIST_HOST=http://192.168.0.52:8090" 165 | ] 166 | }, 167 | { 168 | "name": "shoppinglist LIVE", 169 | "request": "launch", 170 | "type": "dart", 171 | "args": [ 172 | "--dart-define", 173 | "SHOPPINGLIST_HOST=https://YOUR-POCKETBASE-DOMAIN.com" 174 | ] 175 | }, 176 | ] 177 | } 178 | 179 | ## Localization 180 | 181 | The app uses the `Intl` package to maintain different localizations. Run the following command, if you change 182 | the content of the `./lib/l10n/*.arb` files or if you are compiling the source for the first time: 183 | 184 | > flutter gen-l10n 185 | 186 | This will update or create the files in `.dart_tool/flutter_gen/gen_l10n`. 187 | 188 | ## PocketBase running on fly.io 189 | 190 | In the following chapters I show some useful commands to help you manage PocketBase on fly.io. 191 | I assume that you're in the folder where the `Dockerfile` and the file `fly.toml` reside. 192 | 193 | ### Inspect container 194 | 195 | If you want to look at the file system inside the container: 196 | 197 | > flyctl ssh console 198 | # ls -l /pb/pb_data 199 | 200 | ### Backup 201 | 202 | Make a local backup of the database file: 203 | 204 | > flyctl ssh sftp get /pb/pb_data/data.db ./data.db 205 | 206 | ### Restore 207 | 208 | Restore a database backup on fly.io: 209 | 210 | > flyctl ssh sftp shell 211 | >> put ./LOCAL-PATH-WITH-DB/data.db /pb/pb_data/data.db 212 | 213 | After that, you should restart PocketBase to use the restored database: 214 | 215 | > flyctl apps restart YOUR_APPLICATION_NAME 216 | 217 | ### Deploy a new PocketBase version 218 | 219 | You have to update the `fly.toml` in respect of the PocketBase version (`PB_VERSION`). After doing that, run 220 | 221 | > flyctl deploy 222 | 223 | Your database will not be affected and remain as it is. Check the fly dashboard for errors and messages. 224 | 225 | ## Build Linux Flatpak 226 | ### General 227 | We need a special Docker image for building the app and the flatpak version of it. It's best to use the oldest 228 | supported Linux OS for this task, to get the widest OS support for our flatpak app. I'm using the LTS version 229 | Ubuntu 20.04. The [Dockerfile](./flatpak/Dockerfile) takes this as the base image and installs then all the necessary dependencies 230 | to be able to compile the source code for Linux. In addition, the flatpak utilities are also installed. It's also 231 | important to install all the dependencies that the Linux version of the used Flutter packages needs. You find 232 | this information typically on pub.dev at the Linux version of the used package. 233 | 234 | The build time for this image is approx. 10 minutes on my machine and the resulting image size is around 8.2GB. 235 | 236 | ### Image for Flutter and Flatpak 237 | Build the image: 238 | 239 | cd flatpak 240 | docker build --platform linux/amd64 -t flutterpack:1.0.0 . 241 | 242 | ### Build and pack 243 | Execute the following command in the project root folder to compile the Flutter source code and to generate 244 | a flatpak version of it (`de.luedtke.shoppinglist.flatpak`): 245 | 246 | docker run --rm --privileged --platform linux/amd64 -u builder -v "$PWD":/home/builder/app \ 247 | -w /home/builder/app/flatpak flutterpack:1.0.0 "./build-flutter-app.sh" 248 | 249 | ### Local install 250 | In order to run the flatpak app, you need to have the following two runtimes installed on your local machine: 251 | 252 | flatpak install org.freedesktop.Sdk/x86_64/22.08 253 | flatpak install org.freedesktop.Platform/x86_64/22.08 254 | 255 | Now install the app locally: 256 | 257 | flatpak install --user de.luedtke.shoppinglist.flatpak 258 | 259 | If you want to remove it: 260 | 261 | flatpak remove de.luedtke.shoppinglist 262 | 263 | -------------------------------------------------------------------------------- /lib/view/active_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_slidable/flutter_slidable.dart'; 5 | import 'package:pocketbase/pocketbase.dart'; 6 | import 'package:provider/provider.dart'; 7 | import 'package:shoppinglist/component/article_card.dart'; 8 | import 'package:shoppinglist/component/i18n_util.dart'; 9 | import 'package:shoppinglist/component/selected_page.dart'; 10 | import 'package:shoppinglist/component/slapp_app_bar.dart'; 11 | import 'package:shoppinglist/component/slapp_drawer.dart'; 12 | import 'package:shoppinglist/component/statics.dart'; 13 | import 'package:shoppinglist/component/theme_options.dart'; 14 | import 'package:shoppinglist/model/article.dart'; 15 | import 'package:shoppinglist/model/sel_page.dart'; 16 | import 'package:shoppinglist/provider/pocket_base_prov.dart'; 17 | import 'package:shoppinglist/view/article_edit_page.dart'; 18 | import 'package:theme_provider/theme_provider.dart'; 19 | 20 | class ActivePage extends StatefulWidget { 21 | const ActivePage({super.key}); 22 | 23 | static const routeName = '/active'; 24 | 25 | @override 26 | State createState() => _ActivePageState(); 27 | } 28 | 29 | class _ActivePageState extends State with WidgetsBindingObserver { 30 | var _isLoading = false; 31 | PocketBaseProvider? pbp; 32 | 33 | @override 34 | void initState() { 35 | super.initState(); 36 | pbp = Provider.of(context, listen: false); 37 | WidgetsBinding.instance.addObserver(this); 38 | _fetchAll(); 39 | } 40 | 41 | @override 42 | void dispose() { 43 | WidgetsBinding.instance.removeObserver(this); 44 | pbp?.unsubscribeActive(); 45 | super.dispose(); 46 | } 47 | 48 | @override 49 | void didChangeAppLifecycleState(AppLifecycleState state) { 50 | super.didChangeAppLifecycleState(state); 51 | debugPrint('Lifecycle changed: $state'); 52 | if (state == AppLifecycleState.resumed) { 53 | pbp?.doHealthCheck(); 54 | _fetchActive(); 55 | } 56 | } 57 | 58 | Future _fetchActive() async { 59 | return pbp?.fetchActive(); 60 | } 61 | 62 | Future _fetchAll() async { 63 | setState(() { 64 | _isLoading = true; 65 | }); 66 | try { 67 | pbp?.subscribeActive(); 68 | await Future.wait([_fetchActive()]); 69 | } on ClientException catch (e) { 70 | if (mounted) { 71 | Statics.showErrorSnackbar(context, e); 72 | } 73 | } finally { 74 | setState(() { 75 | _isLoading = false; 76 | }); 77 | } 78 | } 79 | 80 | @override 81 | Widget build(BuildContext context) { 82 | final pbp = Provider.of(context, listen: true); 83 | page = SelPage.activeList; 84 | 85 | return Scaffold( 86 | appBar: SlappAppBar(title: i18n(context).p_active_title), 87 | drawer: const SlappDrawer(), 88 | body: RefreshIndicator( 89 | onRefresh: _fetchAll, 90 | child: Container( 91 | decoration: ThemeProvider.optionsOf(context).pageDecoration, 92 | child: Center( 93 | child: Column( 94 | mainAxisAlignment: MainAxisAlignment.center, 95 | children: [ 96 | _isLoading 97 | ? const SizedBox(height: 50, width: 50, child: CircularProgressIndicator()) 98 | : Expanded( 99 | child: Padding( 100 | padding: const EdgeInsets.all(8.0), 101 | child: SlidableAutoCloseBehavior( 102 | child: pbp.activeArticles.isEmpty 103 | ? Center( 104 | child: Text( 105 | textAlign: TextAlign.center, 106 | i18n(context).p_active_empty, 107 | style: const TextStyle( 108 | fontSize: 30, 109 | height: 1.5, 110 | ), 111 | ), 112 | ) 113 | : ListView.builder( 114 | itemBuilder: (ctx, idx) { 115 | final itm = pbp.activeArticles[idx]; 116 | return Slidable( 117 | groupTag: '0', 118 | startActionPane: ActionPane( 119 | motion: const StretchMotion(), 120 | children: [ 121 | SlidableAction( 122 | autoClose: false, 123 | borderRadius: const BorderRadius.all(Radius.circular(12)), 124 | padding: const EdgeInsets.all(8), 125 | backgroundColor: ThemeProvider.optionsOf(context) 126 | .slideBtnBackgroundColor(context), 127 | foregroundColor: ThemeProvider.optionsOf(context) 128 | .slideBtnForegroundColor(context), 129 | onPressed: (context) async { 130 | itm.amount = min(12, itm.amount + 1); 131 | try { 132 | await pbp.updateArticle(itm); 133 | } catch (e) { 134 | if (context.mounted) { 135 | Statics.showErrorSnackbar(context, e); 136 | } 137 | } 138 | }, 139 | icon: Icons.add, 140 | ), 141 | SlidableAction( 142 | autoClose: false, 143 | borderRadius: const BorderRadius.all(Radius.circular(12)), 144 | padding: const EdgeInsets.all(8), 145 | backgroundColor: ThemeProvider.optionsOf(context) 146 | .slideBtnBackgroundColor(context), 147 | foregroundColor: ThemeProvider.optionsOf(context) 148 | .slideBtnForegroundColor(context), 149 | onPressed: (context) async { 150 | itm.amount = max(1, itm.amount - 1); 151 | try { 152 | await pbp.updateArticle(itm); 153 | } catch (e) { 154 | if (context.mounted) { 155 | Statics.showErrorSnackbar(context, e); 156 | } 157 | } 158 | }, 159 | icon: Icons.remove, 160 | ), 161 | ], 162 | ), 163 | endActionPane: ActionPane(motion: const StretchMotion(), children: [ 164 | SlidableAction( 165 | borderRadius: const BorderRadius.all(Radius.circular(12)), 166 | padding: const EdgeInsets.all(8), 167 | backgroundColor: ThemeProvider.optionsOf(context) 168 | .slideBtnBackgroundColor(context), 169 | foregroundColor: ThemeProvider.optionsOf(context) 170 | .slideBtnForegroundColor(context), 171 | onPressed: (context) { 172 | Navigator.pushNamed(context, ArticleEditPage.routeName, arguments: itm); 173 | }, 174 | icon: Icons.edit, 175 | ), 176 | SlidableAction( 177 | borderRadius: const BorderRadius.all(Radius.circular(12)), 178 | padding: const EdgeInsets.all(8), 179 | backgroundColor: ThemeProvider.optionsOf(context) 180 | .slideBtnBackgroundColor(context), 181 | foregroundColor: ThemeProvider.optionsOf(context) 182 | .slideBtnForegroundColor(context), 183 | onPressed: (context) { 184 | final newItm = Article( 185 | active: true, 186 | amount: 1, 187 | shop: itm.shop, 188 | article: itm.article, 189 | ); 190 | Navigator.pushNamed( 191 | context, 192 | ArticleEditPage.routeName, 193 | arguments: newItm, 194 | ); 195 | }, 196 | icon: Icons.copy, 197 | ), 198 | ]), 199 | child: Builder(builder: (c) { 200 | return GestureDetector( 201 | onDoubleTap: () { 202 | pbp.toggleinCart(itm); 203 | }, 204 | onLongPress: () { 205 | Navigator.pushNamed(context, ArticleEditPage.routeName, arguments: itm); 206 | }, 207 | child: ArticleCard( 208 | article: itm, 209 | isArticleList: false, 210 | ), 211 | ); 212 | }), 213 | ); 214 | }, 215 | itemCount: pbp.activeArticles.length, 216 | ), 217 | ), 218 | ), 219 | ), 220 | ], 221 | ), 222 | ), 223 | ), 224 | ), 225 | floatingActionButton: Column( 226 | spacing: 16, 227 | mainAxisAlignment: MainAxisAlignment.end, 228 | children: [ 229 | FloatingActionButton( 230 | heroTag: 'end_shopping', 231 | onPressed: () { 232 | Statics.showEndShoppingDialog(context, pbp); 233 | }, 234 | tooltip: i18n(context).drawer_end_shopping, 235 | backgroundColor: Theme.of(context).floatingActionButtonTheme.backgroundColor, 236 | child: ImageIcon( 237 | size: 24, 238 | AssetImage('assets/race_flag.png'), 239 | ), 240 | ), 241 | FloatingActionButton( 242 | heroTag: 'add_item', 243 | onPressed: () { 244 | pbp.clearSearchList(); 245 | Statics.searchForArticle(context, pbp).then((value) { 246 | if (value != null) { 247 | value.active = true; 248 | value.amount = max(1, value.amount); 249 | pbp.updateArticle(value); 250 | } 251 | }); 252 | }, 253 | tooltip: i18n(context).p_active_tooltip, 254 | backgroundColor: Theme.of(context).floatingActionButtonTheme.backgroundColor, 255 | child: const Icon(Icons.add), 256 | ), 257 | ], 258 | ), 259 | ); 260 | } 261 | } 262 | --------------------------------------------------------------------------------