commit 34e7cbc38264e66445779dd60a1c66a4a9703e81 Author: Daniel Esteban Date: Wed Mar 18 12:47:06 2026 +0100 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..41a1979 --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "8b872868494e429d94fa06dca855c306438b22c0" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + - platform: android + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + - platform: ios + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + - platform: linux + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + - platform: macos + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + - platform: web + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + - platform: windows + create_revision: 8b872868494e429d94fa06dca855c306438b22c0 + base_revision: 8b872868494e429d94fa06dca855c306438b22c0 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..4ed03f3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,64 @@ +# DeporOS — Guía para Claude + +## Qué es este proyecto +Port del panel de administración PHP (`sc-admin`) de un club deportivo a Flutter. +**Solo el panel de administración** (uso interno), NO la parte pública. + +## Rutas clave +| Recurso | Ruta | +|---|---| +| PHP original (referencia) | `/home/conejo/private_html/sportscenter/sc-admin/` | +| PHP sidebar (menú) | `/home/conejo/private_html/sportscenter/sc-admin/themes/modern/sidebar.php` | +| Flutter (este proyecto) | `/home/conejo/public_html/depor_os/` | +| Estado de tareas | `/home/conejo/public_html/depor_os/TAREAS.md` | + +## API backend +- Base URL: `https://reservas.madriguera.me/2.0` +- Auth: `POST /login` con `{"email": "...", "password": "..."}` → `{"access_token": "..."}` +- Token Bearer, guardado en SharedPreferences. Sin expiración, sin endpoint de logout. + +## Stack técnico +- Flutter con Material 3, seed color `#1565C0` (azul) +- `go_router ^14` para navegación (ShellRoute con sidebar) +- `http ^1.2` para llamadas a la API +- `shared_preferences ^2.3` para persistir el token +- Soporte light/dark mode + +## Estructura Flutter (`lib/`) +``` +core/ + constants.dart ← kApiBase + router.dart ← GoRouter + ShellRoute, todas las rutas +models/ + nav_item.dart ← modelo NavItem (label, icon, route, children) +navigation/ + app_navigation.dart ← árbol completo del sidebar (kAdminNavItems) +services/ + auth_service.dart ← login(), logout(), getToken(), isLoggedIn() +widgets/ + app_shell.dart ← layout responsive: sidebar fijo ≥800px / drawer <800px + sidebar/ + sidebar_widget.dart ← header + scroll nav + footer logout + nav_item_tile.dart ← tiles simples y grupos expandibles (ExpansionTile) +screens/ + login/login_screen.dart + dashboard/dashboard_screen.dart ← 4 accesos rápidos en grid + placeholder_screen.dart ← pantalla temporal para módulos pendientes +``` + +## Cómo retomar trabajo +1. Leer `TAREAS.md` para ver qué está hecho y qué sigue +2. Para cada módulo nuevo: revisar el PHP original en `/home/conejo/private_html/sportscenter/sc-admin/` +3. Preguntar al usuario el endpoint de la API antes de codificar +4. Al terminar una tarea: actualizar `TAREAS.md` + +## Plataformas y responsive +- **Objetivo principal:** web + tablet Android landscape +- **Breakpoint sidebar:** 800px (permanente) / <800px (drawer) +- **Grid dashboard:** ≥900px = 4 col / resto = 2 col +- Preparado para móvil aunque no es prioritario + +## Convenciones +- UI en español +- No usar Scaffold en pantallas hijas del ShellRoute (ya lo provee AppShell) +- Pantallas aún no implementadas usan `PlaceholderScreen` diff --git a/README.md b/README.md new file mode 100644 index 0000000..e141b30 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# depor_os + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/TAREAS.md b/TAREAS.md new file mode 100644 index 0000000..095747a --- /dev/null +++ b/TAREAS.md @@ -0,0 +1,138 @@ +# DeporOS — Flutter Port (sc-admin) + +> Proyecto: portar el panel de administración PHP (`sc-admin`) a Flutter (web + tablet Android, responsive). +> App en español. Backend: nueva API PHP separada (ya existe parcialmente). +> Sesiones de trabajo: incrementales, pantalla a pantalla. + +--- + +## Contexto técnico + +- **PHP origen:** `/home/conejo/private_html/sportscenter/sc-admin/` +- **Flutter destino:** `/home/conejo/public_html/depor_os/` +- **API backend:** proyecto separado (no en este repo), URL base `https://reservas.madriguera.me/2.0` +- **Plataformas:** Web + Tablet Android (responsive, preparado para móvil) +- **Auth:** Bearer token guardado en SharedPreferences. Sin logout en API, sin expiración. +- **UI:** Material 3, seed color `#1565C0` (azul), soporte light/dark +- **Dependencias:** `http ^1.2.0`, `shared_preferences ^2.3.0`, `go_router ^14.0.0` + +--- + +## Módulos identificados en sc-admin + +| Módulo | Fichero PHP principal | Estado Flutter | +|---|---|---| +| Login / Auth | `login.php`, `gui/login.php` | ✅ Hecho | +| Shell / Sidebar / Routing | — | ✅ Hecho | +| Dashboard | `main.php`, `index.php` | ✅ Hecho | +| Abonados | `members.php` | ⏳ Pendiente | +| Alumnos | `alumni.php` | ⏳ Pendiente | +| Búsqueda | `search.php` | ⏳ Pendiente | +| Reservas pistas | `booking.php` | ⏳ Pendiente | +| Reservas salas | `booking.php?rooms=true` | ⏳ Pendiente | +| Cursos | `courses.php` | ⏳ Pendiente | +| Recibos | `bills.php` | ⏳ Pendiente | +| Caja | `cash.php` | ⏳ Pendiente | +| Remesas SEPA | `remittance.php` | ⏳ Pendiente | +| Listados | `list.php` | ⏳ Pendiente | +| Utilidades | `extra.php` | ⏳ Pendiente | +| Tornos | `tools.php` | ⏳ Pendiente | +| Administradores / Permisos | `admins.php`, `tools.php` | ⏳ Pendiente | +| Emails | `emails.php` | ⏳ Pendiente | + +--- + +## Tareas + +### ✅ Completadas (sesión 4 — 2026-03-18) + +- [x] **BOOK-01** — Reservas de pistas (maquetación completa) + - Layout responsive con dos breakpoints independientes: + - **910px (contenido):** panel derecho al lado / debajo del grid + - **900px (ventana):** lista de actividades al lado del calendario / dropdown encima + - Lado izquierdo: calendario (`CalendarDatePicker`) + lista o dropdown de actividades + grid horario/pistas + - Lado derecho (≥910px) / debajo (<910px): 6 botones de acción + 3 botones de pago (Efectivo/Tarjeta/Bizum) + ticket preview + - Grid: celdas se expanden al 100% del ancho disponible; scroll horizontal solo si no caben + - Celdas coloreadas: verde=pagada, rojo=impagada, blanco=libre + - Banner de celebraciones del día + - Patrón mock/prod: `BookingRepository` abstracto, `BookingService` (HTTP), `MockBookingService` + - `lib/models/booking.dart`, `lib/services/booking_repository.dart`, `lib/services/booking_service.dart` + - `lib/services/mock/mock_booking_service.dart`, `lib/screens/booking/booking_screen.dart` + +### ✅ Completadas (sesión 3 — 2026-03-18) + +- [x] **MEMB-01** — Ficha de abonado (solo lectura) + - Barra de navegación: búsqueda autocomplete + botones primero/anterior/siguiente/último + - Tarjeta de información: número, fecha de alta, tipo, estado (activo/baja/retenido) + - Tarjeta de comentarios: nota heredada, nota interna, lista de comentarios + - Tabla de familiares asociados (read-only): avatar, nombre, DNI, móvil, email, fecha nac. + - Tarjeta de ficha: dirección + datos bancarios + - Responsive: 2 columnas ≥700px / 1 columna en el resto + - `lib/models/member.dart`, `lib/services/member_service.dart`, `lib/screens/members/members_screen.dart` + +### ✅ Completadas (sesión 2 — 2026-03-18) + +- [x] **DASH-02** — Accesos rápidos en dashboard + - 4 tarjetas: Abonados, Reservas, Recibos por abonado, Caja + - Grid responsive: 4 columnas ≥900px / 2 columnas en el resto + - Cada tarjeta usa un color tonal de Material 3 (primary/secondary/tertiary/error container) + - `lib/screens/dashboard/dashboard_screen.dart` + +### ✅ Completadas (sesión 1 — 2026-03-17) + +- [x] **AUTH-01** — Pantalla de Login + - `POST /login` con `email`+`password` → `access_token` guardado en SharedPreferences + - Validación, spinner, SnackBar de error, responsive, dark mode + - `lib/core/constants.dart`, `lib/services/auth_service.dart`, `lib/screens/login/login_screen.dart` + +- [x] **STRUCT-01** — Estructura base: GoRouter + ShellRoute + AppShell responsive + - Breakpoint sidebar permanente: **800px**. Por debajo → Drawer + AppBar + - `lib/core/router.dart`, `lib/widgets/app_shell.dart` + +- [x] **STRUCT-02** — Sidebar navegación multinivel (Material 3) + - Árbol completo extraído del PHP (`sidebar.php`), grupos expandibles con `ExpansionTile` + - Resaltado de ruta activa, auto-expansión del grupo activo, logout en pie + - `lib/models/nav_item.dart`, `lib/navigation/app_navigation.dart`, `lib/widgets/sidebar/` + +- [x] **DASH-01** — Dashboard (estructura base) + - Pantalla de inicio con placeholder para accesos rápidos + - Todas las rutas del sidebar apuntan a `PlaceholderScreen` hasta que se implementen + - `lib/screens/dashboard/dashboard_screen.dart`, `lib/screens/placeholder_screen.dart` + +### 🔄 En progreso +_(ninguna)_ + +### ⏳ Pendientes (próximas sesiones) + +- [ ] **AUTH-02** — Logo/imagen en pantalla de login (pendiente de asset) +- [ ] **MEMB-01** — Listado de abonados +- [ ] **MEMB-02** — Ficha de abonado (detalle + edición) +- [ ] **MEMB-03** — Pre-inscripciones +- [ ] **MEMB-04** — Alta de nuevo abonado +- [ ] **ALUM-01** — Listado de alumnos + altas/bajas +- [ ] **BOOK-01b** — Reservas de pistas (acciones reales: cobrar, devolver, imprimir ticket, QR) +- [ ] **BOOK-02** — Reservas de salas +- [ ] **CAJA-01** — Caja (cobros) +- [ ] **REC-01** — Recibos por abonado +- [ ] **REC-02** — Recibos por actividad +- [ ] **REM-01** — Remesas SEPA +- [ ] **LIST-01** — Listados (varios) +- [ ] **UTIL-01** — Utilidades / parámetros + +--- + +## Decisiones técnicas + +- API base: `https://reservas.madriguera.me/2.0` +- Auth: `POST /login` → `{"access_token": "..."}` Bearer, sin expiración, sin logout en API +- UI: Material 3, seed `#1565C0`, light + dark +- Sidebar breakpoint: 800px (permanente) / <800px (drawer) +- Breakpoints en pantallas: usar `LayoutBuilder` para medir el contenido disponible (ya excluye sidebar). Para breakpoints basados en ventana total, usar `MediaQuery.sizeOf(context).width`. Ejemplo: en BookingScreen, el layout de paneles usa LayoutBuilder (910px contenido), pero el selector actividad usa MediaQuery (900px ventana). +- Patrón mock/prod: `kUseMock` en `constants.dart`, repositorio abstracto en `*_repository.dart`, factory en `service_locator.dart`. Nunca importar mock desde el servicio real ni viceversa. +- Dependencias: `http ^1.2.0`, `shared_preferences ^2.3.0`, `go_router ^14.0.0` + +--- + +## Pendiente de confirmar + +- ¿Hay logo para la pantalla de login? diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..5950d0a --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.depor_os" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.depor_os" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c982f36 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/depor_os/MainActivity.kt b/android/app/src/main/kotlin/com/example/depor_os/MainActivity.kt new file mode 100644 index 0000000..45cb0c7 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/depor_os/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.depor_os + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..fbee1d8 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e4ef43f --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..ca7fe06 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false +} + +include(":app") diff --git a/claude/abonados.png b/claude/abonados.png new file mode 100644 index 0000000..bfa32c3 Binary files /dev/null and b/claude/abonados.png differ diff --git a/claude/reservas.png b/claude/reservas.png new file mode 100644 index 0000000..a05a60b Binary files /dev/null and b/claude/reservas.png differ diff --git a/docs/api-v2.md b/docs/api-v2.md new file mode 100644 index 0000000..6ddbeb6 --- /dev/null +++ b/docs/api-v2.md @@ -0,0 +1,1643 @@ +# API V2 — Documentación de endpoints + +**Base URL real:** `/2.0` +**Base URL mock:** `/2.0-mock` *(sin autenticación, datos de ejemplo)* + +> Las rutas protegidas requieren el header `Authorization: Bearer {token}` obtenido en `/login`. +> Todas las respuestas son `Content-Type: application/json`. + +--- + +## Índice + +1. [Auth](#1-auth) +2. [People (abonado)](#2-people-abonado) +3. [Activities (actividades)](#3-activities-actividades) +4. [Booking (reservas — app)](#4-booking-reservas--app) +5. [Payments](#5-payments) +6. [Wallet (monedero)](#6-wallet-monedero) +7. [Search (búsqueda)](#7-search-búsqueda) +8. [Members (socios — admin)](#8-members-socios--admin) +9. [Courses (cursos — admin)](#9-courses-cursos--admin) +10. [Bills (recibos — admin)](#10-bills-recibos--admin) +11. [Booking Admin (reservas — admin)](#11-booking-admin-reservas--admin) +12. [Cash (caja — admin)](#12-cash-caja--admin) +13. [Dayoff / Celebrations](#13-dayoff--celebrations) +14. [Remittance (remesas especiales)](#14-remittance-remesas-especiales) +15. [Inscriptions (preinscripciones)](#15-inscriptions-preinscripciones) +16. [Admin Misc](#16-admin-misc) +17. [Printer](#17-printer) +18. [Hash (público)](#18-hash-público) + +--- + +## 1. Auth + +### `POST /login` + +Autentica al usuario y devuelve un token Bearer. + +**Body (form/JSON)** + +| Campo | Tipo | Descripción | +|----------|--------|------------------| +| email | string | Email del abonado | +| password | string | Contraseña | + +**Respuesta 200** +```json +{ + "access_token": "4Km9xQzLp2VnRtYwEoJbFsUcXgHdAiMkNlOqPrSvTu" +} +``` + +**Respuesta 401** +```json +{ + "message": "Contraseña incorrecta." +} +``` + +--- + +### `POST /forgot` + +Envía un email de recuperación de contraseña. + +**Body** + +| Campo | Tipo | +|-------|--------| +| email | string | + +**Respuesta 200** +```json +{ + "error": "Se le ha enviado un email con instrucciones" +} +``` + +--- + +### `GET /logout` 🔒 + +Cierra la sesión del usuario autenticado. + +**Respuesta 200** +```json +{ + "logout": "ok" +} +``` + +--- + +## 2. People (abonado) + +### `GET /people/me` 🔒 + +Devuelve los datos del abonado autenticado. + +**Respuesta 200** +```json +{ + "member": "00042", + "family": 1, + "first_name": "María", + "last_name": "García López", + "email": "maria@example.com", + "phone": "612345678", + "dni": "12345678A", + "birth_date": "15/03/1985", + "address": "Calle Mayor 12", + "city": "Madrid", + "zip": "28001", + "type": "FAMILIAR", + "balance": "12.50 €", + "is_unreg": false, + "b_paid": 0 +} +``` + +--- + +### `POST /people/qr` 🔒 + +Genera un código QR temporal (válido 15 minutos) para el abonado. + +**Body** + +| Campo | Tipo | Descripción | +|--------|---------|--------------------------------------| +| family | integer | (opcional) Número de familiar de la unidad | + +**Respuesta 200** +```json +{ + "m": "00042", + "f": "01", + "code": "ABCDEF123456" +} +``` + +--- + +### `GET /people/card` 🔒 + +Devuelve el carnet digital del abonado en base64. + +**Respuesta 200** +```json +{ + "card": "iVBORw0KGgoAAAANSUhEUgAA...", + "me": 1 +} +``` + +> `card` es una imagen PNG codificada en base64. Si no existe, devuelve `""`. + +--- + +### `GET /people` 🔒 + +Devuelve todos los miembros de la unidad familiar del abonado autenticado. + +**Respuesta 200** +```json +{ + "people": [ + { + "member": "00042", + "family": 1, + "first_name": "María", + "last_name": "García López", + "email": "maria@example.com", + "phone": "612345678", + "is_unreg": false + }, + { + "member": "00042", + "family": 2, + "first_name": "Carlos", + "last_name": "García López", + "email": "carlos@example.com", + "phone": "623456789", + "is_unreg": false + } + ], + "me": 1 +} +``` + +> `me` indica el número de familiar del usuario autenticado dentro del array. + +--- + +## 3. Activities (actividades) + +### `GET /activities` 🔒 + +Devuelve el árbol completo de actividades/cursos disponibles. + +**Respuesta 200** +```json +[ + { + "id": "001", + "name": "PÁDEL", + "levels": [ + { + "id": "00101", + "name": "Iniciación", + "groups": [ + { + "id": "0010101", + "name": "Lunes 18h", + "monitor": "Carlos", + "place": "Pista 1", + "hour": "L 18:00-19:00", + "price": "25.00" + }, + { + "id": "0010102", + "name": "Miércoles 19h", + "monitor": "Carlos", + "place": "Pista 2", + "hour": "X 19:00-20:00", + "price": "25.00" + } + ] + }, + { + "id": "00102", + "name": "Avanzado", + "groups": [ + { + "id": "0010201", + "name": "Martes 20h", + "monitor": "Ana", + "place": "Pista 3", + "hour": "M 20:00-21:00", + "price": "30.00" + } + ] + } + ] + }, + { + "id": "002", + "name": "NATACIÓN", + "levels": [ + { + "id": "00201", + "name": "Adultos", + "groups": [ + { + "id": "0020101", + "name": "Lunes y Miércoles", + "monitor": "María", + "place": "Piscina", + "hour": "L-X 07:30-08:30", + "price": "35.00" + } + ] + } + ] + } +] +``` + +--- + +### `POST /activities` 🔒 + +Preinscribe a un miembro de la familia en una actividad. + +**Body** + +| Campo | Tipo | Descripción | +|----------------|---------|--------------------------------------------| +| activity | string | Código de actividad (7 dígitos, ej. `0010101`) | +| family | integer | Número de familiar | +| date_reg | string | Fecha de alta `dd/mm/yyyy` (opcional) | +| test_run | string | `permanent` o `test` | +| comment | string | Comentario / cuestionario de salud | +| privacy_policy | boolean | Aceptación política de privacidad | +| privacy_sports | boolean | Aceptación cláusula deportiva | + +**Respuesta 200 — éxito** +```json +{ + "msg": "Su preinscripción está siendo procesada, cuando sea aceptado/a en el grupo le llegará un mensaje de confirmación.", + "error": "0" +} +``` + +**Respuesta 200 — error** +```json +{ + "msg": "El abonado/a ya está inscrito en la actividad", + "error": "3" +} +``` + +> Códigos de error: `1` actividad no permitida · `2` ya en lista de espera · `3` ya inscrito · `4` error al guardar. + +--- + +### `GET /activities/unreg` 🔒 + +Devuelve las actividades e inscripciones de lista de espera de todos los miembros de la familia para solicitar bajas. + +**Respuesta 200** +```json +[ + { + "fk_i_member_id": "00042", + "i_family": 1, + "s_first_name": "María", + "s_last_name": "García", + "courses": [ + { "i_activity": "0010101", "s_name": "Pádel Iniciación - Lunes 18h", "d_reg_date": "01/09/2025" }, + { "i_activity": "0030101", "s_name": "Fitness Mañanas", "d_reg_date": "15/09/2025" } + ], + "waitlist": [ + { "i_activity": "0020101", "s_name": "Natación Adultos - L-X", "dt_date": "10/10/2025" } + ] + } +] +``` + +--- + +### `POST /activities/unreg` 🔒 + +Solicita la baja de actividades e inscripciones de lista de espera. + +**Body** + +| Campo | Tipo | Descripción | +|---------|--------|---------------------------------------------------------------| +| acs | object | Mapa `"{family}-{activity}": 1` de actividades a dar de baja | +| wls | object | Mapa `"{family}-{activity}": 1` de listas de espera | +| comment | string | Motivo / comentario | +| reason | string | Razón de baja | +| deftemp | string | `definitiva` o `temporal` | + +**Respuesta 200** +```json +{ + "msg": "Su solicitud de baja ha sido procesada. Muchas gracias.", + "error": "0" +} +``` + +--- + +## 4. Booking (reservas — app) + +### `GET /booking` 🔒 + +Devuelve la rejilla de disponibilidad de pistas para una actividad y fecha. + +**Query params** + +| Param | Tipo | Ejemplo | +|----------|--------|----------------| +| actividad | integer | `1` | +| fecha | string | `18/03/2026` | + +**Respuesta 200** +```json +{ + "columns": ["Horarios", "01", "02", "03", "04"], + "data": [ + [ + { "row": 0, "hour_id": 1, "text": "0900-1000", "type": "H" }, + { "id": "", "paid": "", "hourText": "0900-1000", "courtText": "01", "hour": 1, "court": 0, "type": "E", "text": "" }, + { "id": 4521, "paid": 0, "hourText": "0900-1000", "courtText": "02", "hour": 1, "court": 1, "type": "R", "text": "R" }, + { "id": "", "paid": "", "hourText": "0900-1000", "courtText": "03", "hour": 1, "court": 2, "type": "E", "text": "" }, + { "id": "", "paid": "", "hourText": "0900-1000", "courtText": "04", "hour": 1, "court": 3, "type": "E", "text": "" } + ] + ], + "ac": { "pk_i_activity_id": 1, "s_name": "PÁDEL MURO", "i_courts": 4 }, + "light": "1.00", + "extra": "1.50", + "amount": "6.00" +} +``` + +> Tipos de celda: `H` cabecera horario · `E` disponible · `R` ocupada (otro) · `I` tuya sin pagar · `P` tuya pagada. + +--- + +### `GET /booking/book/{id}` 🔒 + +Devuelve el detalle de una reserva concreta. + +**Respuesta 200** +```json +{ + "pk_i_id": 1234, + "fk_i_activity_id": 1, + "d_date": "2026-03-18", + "fk_i_court_id": 2, + "fk_i_hour": 3, + "s_hour": "1100-1200", + "fk_i_member_id": 42, + "fk_i_family": 1, + "b_paid": 0, + "s_source": "APP" +} +``` + +--- + +### `GET /booking/checkout/{id}` 🔒 + +Devuelve los datos de pago para una reserva. + +**Respuesta 200** +```json +{ + "booking_id": 1234, + "amount": "6.00", + "status": "pending", + "payment_url": "https://example.com/checkout/1234" +} +``` + +--- + +### `POST /booking` 🔒 + +Realiza una reserva de pista. + +**Body** + +| Campo | Tipo | Descripción | +|-------------------|---------|------------------------------| +| fk_i_activity_id | integer | ID de actividad | +| hour | integer | ID de hora | +| d_date | string | Fecha `dd/mm/yyyy` | +| court | integer | Número de pista (base 0) | +| light | boolean | Solicitar luz | + +**Respuesta 200** +```json +{ + "msg": "Reserva realizada correctamente", + "error": "0", + "id": 5678 +} +``` + +--- + +### `POST /booking/cancel` 🔒 + +Cancela una reserva existente. + +**Body** + +| Campo | Tipo | +|-------|---------| +| id | integer | + +**Respuesta 200** +```json +{ + "msg": "Reserva cancelada correctamente", + "error": "0" +} +``` + +--- + +### `POST /booking/edit` 🔒 + +Edita una reserva existente. + +**Body** + +| Campo | Tipo | Descripción | +|-------|---------|-------------| +| id | integer | ID de reserva | +| light | boolean | Activar/desactivar luz | + +**Respuesta 200** +```json +{ + "msg": "Reserva editada correctamente", + "error": "0" +} +``` + +--- + +### `POST /booking/refresh` 🔒 + +Refresca el estado de una reserva (actualiza pagos pendientes). + +**Respuesta 200** +```json +{ + "msg": "ok", + "error": "0" +} +``` + +--- + +## 5. Payments + +### `GET /payments` 🔒 + +Devuelve el historial de pagos del abonado. + +**Respuesta 200** +```json +{ + "payments": [ + { + "id": 1, + "description": "Cuota mensual", + "amount": "35.00", + "date": "01/03/2026", + "status": "Pagado", + "type": "REMESA" + }, + { + "id": 2, + "description": "Actividad pádel", + "amount": "25.00", + "date": "15/02/2026", + "status": "Pagado", + "type": "CAJA" + } + ], + "error": "0" +} +``` + +--- + +## 6. Wallet (monedero) + +### `GET /wallet` 🔒 + +Devuelve el saldo y el historial de transacciones del monedero. + +**Respuesta 200** +```json +{ + "transactions": [ + { + "id": 1, + "concept": "Recarga monedero", + "amount": "20.00", + "date": "10/03/2026 09:15", + "balance": "20.00" + }, + { + "id": 2, + "concept": "Pago reserva pádel", + "amount": "-6.00", + "date": "12/03/2026 18:32", + "balance": "14.00" + } + ], + "balance": "14.00 €", + "error": "0" +} +``` + +--- + +## 7. Search (búsqueda) + +### `GET /search` 🔒 + +Búsqueda rápida de socios por nombre, apellido, número o DNI. + +**Query params** + +| Param | Tipo | Descripción | +|-------|--------|-------------------| +| q | string | Término de búsqueda | + +**Respuesta 200** +```json +[ + { "id": "0004201", "member": "00042", "family": "01", "name": "García, María", "phone": "612345678" }, + { "id": "0012301", "member": "00123", "family": "01", "name": "García, Antonio", "phone": "623456789" } +] +``` + +--- + +### `GET /search/new` 🔒 + +Búsqueda avanzada con filtros de tipo y estado. + +**Query params** + +| Param | Tipo | Valores | +|--------|--------|-----------------------------| +| q | string | Término | +| type | string | `all` · `FAMILIAR` · `INDIVIDUAL` · `SABIC` | +| status | string | `all` · `active` · `inactive` | + +**Respuesta 200** +```json +{ + "results": [ + { + "id": "0004201", + "member": "00042", + "family": "01", + "name": "García, María", + "phone": "612345678", + "email": "maria@example.com", + "dni": "12345678A", + "type": "FAMILIAR", + "is_unreg": false, + "unreg_reason": "", + "b_paid": 0 + } + ], + "total": 1 +} +``` + +--- + +### `GET /search/doorlog` 🔒 + +Devuelve el log de accesos por torniquete de un abonado. + +**Query params** + +| Param | Tipo | Descripción | +|--------|---------|----------------------------| +| member | string | Número de socio (5 dígitos)| +| family | integer | Número de familiar (def. 1)| +| limit | integer | Máx. registros (def. 100) | + +**Respuesta 200** +```json +[ + { + "pk_i_id": 1, + "fk_i_member_id": "00042", + "fk_i_people_id": 1, + "dt_date": "2026-03-15 09:23:11", + "s_source": "TORNIQUETE" + }, + { + "pk_i_id": 2, + "fk_i_member_id": "00042", + "fk_i_people_id": 1, + "dt_date": "2026-03-14 18:45:02", + "s_source": "APP" + } +] +``` + +--- + +## 8. Members (socios — admin) + +> Todos los endpoints de esta sección requieren autenticación 🔒. + +El objeto **member** tiene la siguiente estructura completa: + +```json +{ + "pk_i_id": 42, + "d_reg_date": "2018-03-15", + "s_address": "Calle Mayor 12", + "s_city": "Madrid", + "s_zip": "28001", + "s_email": "socio@example.com", + "s_phone": "612345678", + "s_bank": "0049", + "s_bank_office": "1500", + "s_bank_sec_code": "42", + "s_bank_account": "0123456789", + "s_bank_name": "Santander", + "s_mandate": "MNDT-00042", + "s_type": "FAMILIAR", + "s_comment": "", + "s_comment2": "", + "b_paid": 0, + "b_rem_special": 0, + "b_retenido": 0, + "d_unreg_date": null, + "s_unreg_reason": "", + "people": [ + { + "fk_i_member_id": 42, + "i_family": 1, + "s_first_name": "María", + "s_last_name": "García", + "s_dni": "12345678A", + "d_birth_date": "1985-03-15", + "s_phone": "612345678", + "s_email": "maria@example.com", + "b_lopd": 1, + "b_newsletter": 1, + "b_authorized": 1, + "b_authorized2": 0, + "s_photo_path": null + } + ], + "cautions": [], + "comments": [] +} +``` + +--- + +### `GET /members/quick` — Búsqueda rápida por número + +**Query:** `fk_i_member_id=42` · `i_family=1` (opcional) +**Respuesta:** objeto `member` completo + +--- + +### `GET /members/first` — Primer socio +### `GET /members/last` — Último socio +### `GET /members/{id}` — Socio por ID +### `GET /members/{id}/prev` — Socio anterior +### `GET /members/{id}/next` — Socio siguiente + +Todas devuelven el objeto `member` completo. + +--- + +### `GET /members/search` — Autocompletar socios + +**Query:** `term=garcia` + +**Respuesta 200** +```json +{ + "0004201": "(00042-01) García, María", + "0004202": "(00042-02) García, Carlos" +} +``` + +--- + +### `POST /members/edit` + +**Body:** campos del objeto member a actualizar (`pk_i_id` requerido). + +**Respuesta 200** +```json +{ "msg": "Socio editado correctamente", "member": { "...": "objeto member completo" } } +``` + +--- + +### `POST /members/paid-caution` — Toggle flag recibos pendientes + +**Body:** `pk_i_id` +**Respuesta:** objeto `member` actualizado + +--- + +### `POST /members/recover` — Reactivar socio dado de baja + +**Body:** `pk_i_id` +**Respuesta:** objeto `member` actualizado + +--- + +### `POST /members/pre-delete` — Pre-verificación antes de dar de baja + +**Body:** `pk_i_id` + +**Respuesta 200** +```json +{ "pendientes": 0, "devueltos": 2, "revision": 0 } +``` + +--- + +### `POST /members/delete` — Dar de baja a un socio + +**Body:** `pk_i_id` · `d_unreg_date` · `s_unreg_reason` +**Respuesta:** objeto `member` actualizado + +--- + +### `POST /members/change-type` — Cambiar tipo de socio + +**Body:** `id` · `s_type` +**Respuesta 200:** `{ "error": 0, "msg": "ok" }` + +--- + +### `POST /members/rem-special` — Toggle remesa especial + +**Body:** `pk_i_id` · `b_rem_special` +**Respuesta:** objeto `member` con campo `error` + +--- + +### `POST /members/retener` / `POST /members/retener-cancel` + +Marca/desmarca al socio como retenido. +**Body:** `member` +**Respuesta:** `{ "msg": "...", "member": { ... } }` + +--- + +### `POST /members/promotion` — Registrar promoción + +**Body:** `pk_i_id` · `friend` +**Respuesta:** `{ "msg": "Promoción añadida correctamente", "member": { ... } }` + +--- + +### `POST /members/edit-comment` — Editar comentario interno + +**Body:** `pk_i_id` · `s_comment2` +**Respuesta:** `{ "msg": "...", "member": { ... } }` + +--- + +### `POST /members/comment/add` — Añadir comentario + +**Body:** `member` · `comment` +**Respuesta:** `{ "msg": "...", "member": { ... } }` + +--- + +### `GET /members/comment/edit` — Obtener comentario para editar + +**Query:** `id` +**Respuesta:** `{ "comment": { "id": 1, "comment": "texto", "created_at": "..." } }` + +--- + +### `POST /members/comment/edit-save` — Guardar edición de comentario + +**Body:** `id` · `comment` · `pk_i_id` +**Respuesta:** `{ "msg": "...", "member": { ... } }` + +--- + +### `POST /members/comment/delete` — Eliminar comentario + +**Body:** `id` (`"old"` para el comentario heredado) · `member_id` +**Respuesta:** `{ "msg": "Comentario borrado", "member": { ... } }` + +--- + +### Familiares (people) + +| Método | Ruta | Descripción | +|--------|------|-------------| +| `POST` | `/members/people/add` | Añadir familiar | +| `POST` | `/members/people/edit` | Editar familiar | +| `POST` | `/members/people/delete` | Eliminar familiar | +| `POST` | `/members/people/auth` | Toggle autorización acceso | +| `POST` | `/members/people/auth2` | Toggle autorización 2 | +| `POST` | `/members/people/picture/upload` | Subir foto (multipart `webcam`) | +| `POST` | `/members/people/picture/delete` | Eliminar foto | +| `GET` | `/members/people/card` | Tarjetas de acceso | +| `POST` | `/members/people/card/add` | Añadir tarjeta | +| `POST` | `/members/people/card/delete` | Eliminar tarjeta | +| `POST` | `/members/people/password` | Generar enlace de reset de contraseña | +| `GET` | `/members/people/card/preview` | Previsualizar carnet | +| `POST` | `/members/people/card/print` | Imprimir carnet | +| `POST` | `/members/people/minors-card` | Actualizar visibilidad carnets menores | + +Todas las respuestas de escritura devuelven `{ "msg": "...", "member": { ... } }` o `{ "error": 0, "msg": "..." }`. + +**`GET /members/people/card`** devuelve: +```json +{ + "cards": [ + { "pk_i_id": 1, "fk_i_member_id": 42, "i_family": 1, "s_card": "ABCD1234EFGH5678" } + ] +} +``` + +**`POST /members/people/password`** devuelve: +```json +{ "h": "https://app.example.com/password/reset/TOKEN?email=socio@example.com" } +``` + +--- + +## 9. Courses (cursos — admin) + +### `GET /courses/levels` 🔒 + +**Query:** `course` (código de actividad) + +**Respuesta 200** +```json +[ + { "i_code1": 1, "i_code2": 1, "i_code3": 0, "s_name": "Iniciación" }, + { "i_code1": 1, "i_code2": 2, "i_code3": 0, "s_name": "Avanzado" } +] +``` + +--- + +### `GET /courses/groups` 🔒 + +**Query:** `course` · `level` + +**Respuesta 200** +```json +[ + { + "i_code1": 1, "i_code2": 1, "i_code3": 1, + "s_name": "Lunes 18h-19h", + "f_price": "25.00", + "i_max_students": 15, + "s_hour": "L 18:00-19:00", + "s_monitor": "Carlos", + "s_place": "Pista 1", + "i_one_bill": 0, + "b_fitness": 0, + "b_pending_count": 0, + "s_comment": "" + } +] +``` + +--- + +### `GET /courses/group` 🔒 + +**Query:** `course` · `level` · `group` +**Respuesta:** objeto grupo (igual que el array anterior, un único elemento) + +--- + +### `GET /courses/data-alumni` 🔒 + +Actividades en las que está inscrito un abonado. + +**Query:** `code` (7 dígitos: `{member}{family}`) + +**Respuesta 200** +```json +[ + { "i_activity": "0010101", "s_name": "Pádel Iniciación L18h" }, + { "i_activity": "0030101", "s_name": "Fitness Mañanas" } +] +``` + +--- + +### `GET /courses/alumnis` 🔒 + +Lista de alumnos de un grupo. + +**Query:** `course` · `level` · `group` · `month` (opcional) · `year` (opcional) + +**Respuesta 200** +```json +[ + { + "pk_i_id": 1234, + "fk_i_member_id": "00042", + "fk_i_family": "01", + "i_activity": "0010101", + "s_last_name": "García", + "s_first_name": "María", + "d_reg_date": "01/09/2025", + "f_price": "25.00", + "mod_price": "25.00", + "ac_price": "25.00", + "s_type": "REMESA", + "s_comment": "", + "b_authorized": 1, + "b_authorized2": 0, + "i_door_log_count": 0 + } +] +``` + +--- + +### `GET /courses/waitlist` 🔒 + +**Query:** `course` · `level` · `group` +**Respuesta:** igual que `/courses/alumnis` con campo adicional `dt_date`. + +--- + +### `GET /courses/alumni/get-reg-comment` 🔒 + +**Query:** `m` · `f` · `a` + +**Respuesta 200** +```json +{ + "fk_i_member_id": "00042", + "fk_i_family": "01", + "i_activity": "0010101", + "s_comment": "Interesada en el grupo de tarde si hay plaza." +} +``` + +--- + +### `GET /courses/alumni/get-unreg-comment` 🔒 + +**Query:** `i` (ID del registro en unreg_requests) + +**Respuesta 200** +```json +{ "id": 5, "comment": "Se marcha al extranjero temporalmente." } +``` + +--- + +### Escritura de cursos + +| Método | Ruta | Body principal | Respuesta | +|--------|------|----------------|-----------| +| `POST` | `/courses/add` | `s_name` | Nuevo `i_code1` | +| `POST` | `/courses/edit` | `course` · `s_name` | `"ok"` | +| `POST` | `/courses/delete` | `course` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/level/add` | `course` · `s_name` | Nuevo `i_code2` | +| `POST` | `/courses/level/edit` | `course` · `level` · `s_name` | `"ok"` | +| `POST` | `/courses/level/delete` | `course` · `level` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/group/add` | `course` · `level` · `s_name` · `f_price` · `i_max_students` · `s_hour` · `s_monitor` · `s_place` | `"ok"` | +| `POST` | `/courses/group/edit` | `id` · `s_field` · `s_value` | `"ok"` | +| `POST` | `/courses/group/delete` | `course` · `group` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/group/comment` | `course` · `level` · `group` · `comment` | `{ "msg": "...", "error": 0 }` | +| `POST` | `/courses/alumni/add` | `course` · `level` · `group` · `fk_i_member_id` · `d_date` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/add-from-wait` | idem + `email` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/delete` | `course` · `level` · `group` · `fk_i_member_id` · `fk_i_family` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/delete-by-id` | `id` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/delete-by-ids` | `ids` (CSV) | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/delete-wait` | `course` · `level` · `group` · `fk_i_member_id` · `fk_i_family` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/empty` | `course` · `level` · `group` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/import` | `ocourse` · `olevel` · `ogroup` · `dcourse` · `dlevel` · `dgroup` · `date` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/auth` | `id` · `value` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/auth2` | `id` · `value` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/reg-comment` | `m` · `f` · `a` · `s_comment` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/courses/alumni/unreg-comment` | `id` · `s_comment` | `{ "error": 0, "msg": "..." }` | + +--- + +## 10. Bills (recibos — admin) + +### `GET /bills/member-search` 🔒 + +**Query:** `fk_i_member_id` + +**Respuesta 200** — array de recibos: +```json +[ + { + "alumni": 1234, + "member": "00042", + "family": "01", + "name": "García, María", + "ac_name": "Pádel Iniciación L18h", + "activity": "0010101", + "price": "25.00", + "user_price": "25.00", + "bill_price": "25.00", + "month": 3, + "year": 2026, + "month_name": "marzo", + "status": 0, + "type": "REMESA", + "bonus": 0, + "cash_date": "" + } +] +``` + +> Estado (`status`): `0` pendiente · `1` pagado · `2` eliminado · `4` devuelto. + +--- + +### `GET /bills/alumni` 🔒 + +**Query:** `id` (ID de alumno) + +**Respuesta 200** +```json +{ + "pk_i_id": 1234, + "fk_i_member_id": "00042", + "fk_i_family": "01", + "i_activity": "0010101", + "f_price": "25.00", + "s_type": "REMESA", + "s_comment": "", + "person": { "s_first_name": "María", "s_last_name": "García" }, + "next_bills": [ + { "i_month": 4, "i_year": 2026, "i_status": 0, "f_price": "25.00" }, + { "i_month": 5, "i_year": 2026, "i_status": 0, "f_price": "25.00" } + ] +} +``` + +--- + +### `GET /bills/from-alumni` 🔒 + +**Query:** `id` + +**Respuesta 200** +```json +{ + "pk_i_id": 1234, + "i_activity": "0010101", + "person": { "s_first_name": "María", "s_last_name": "García" }, + "bills": [ + { "i_month": 1, "i_year": 2026, "i_status": 1, "f_price": "25.00", "year": 0 }, + { "i_month": 2, "i_year": 2026, "i_status": 1, "f_price": "25.00", "year": 0 }, + { "i_month": 3, "i_year": 2026, "i_status": 0, "f_price": "25.00", "year": 0 } + ] +} +``` + +--- + +### `GET /bills/number` 🔒 + +**Query:** `course` · `level` · `group` · `month` · `year` · `type` (`BANK`/`ALL`) · `alumni[]` (opcional) + +**Respuesta 200** +```json +12 +``` + +--- + +### `GET /bills/pending` 🔒 + +**Query:** `id` (member) · `complete` (0/1) + +**Respuesta 200** — array de recibos pendientes (misma estructura que `/bills/member-search`) + +--- + +### `GET /bills/search` 🔒 + +**Query:** `fk_i_member_id` · `i_month` · `status` · `ext` + +**Respuesta 200** +```json +{ + "iTotalRecords": 5, + "iTotalDisplayRecords": 5, + "aaData": [ { "...": "objeto recibo" } ] +} +``` + +--- + +### `GET /bills/remittance-return/member` 🔒 + +**Query:** `member` + +**Respuesta 200** — mapa de miembros con recibos devueltos: +```json +{ + "42": { + "pk_i_id": 42, + "people": [ { "...": "..." } ], + "months": { "3": 1 }, + "bills": [ { "...": "..." } ], + "i_total": "25.00" + } +} +``` + +--- + +### Escritura de recibos + +| Método | Ruta | Body | Respuesta | +|--------|------|------|-----------| +| `POST` | `/bills/alumni/edit` | `id` · `price` · `type` · `comment` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/bills/generate` | `id` · `month` · `year` | `{ "error": 0, "msg": "Recibo creado" }` | +| `POST` | `/bills/generate-next` | `course` · `level` · `group` · `month` · `year` | `{ "msg": "Recibos generados", "error": 0 }` | +| `POST` | `/bills/generate-multi` | `activity` · `id` · `months[]` | `{ "iTotalRecords": N, "aaData": [...] }` | +| `POST` | `/bills/generate-remittance` | `course` · `level` · `group` · `month` · `year` | `{ "error": 0, "msg": "...", "paid_bills": 12 }` | +| `POST` | `/bills/ticket` | `bills[]` | `{ "error": 0, "msg": "...", "ticket_number": "2025/000123", "lines": [] }` | +| `POST` | `/bills/cancel` | `acs[]` | `{ "error": 0, "msg": "OK", "lines": [] }` | +| `POST` | `/bills/delete` | `acs[]` | `{ "error": 0, "msg": "OK" }` | +| `POST` | `/bills/delete-alumni` | `ids` (CSV) · `month` · `year` | `{ "error": 0, "msg": "OK" }` | +| `POST` | `/bills/recover` | `acs[]` | `{ "error": 0, "msg": "OK" }` | +| `POST` | `/bills/remittance-return/add` | `member` · `month` · `year` | `{ "error": 0, "msg": "OK" }` | +| `POST` | `/bills/remittance-return/delete` | `alumni` · `month` · `year` · `id` · `special` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/bills/remittance-return/print` | `id` | `{ "msg": "...", "data": { "id": 1 }, "lines": [] }` | + +--- + +## 11. Booking Admin (reservas — admin) + +### `GET /booking-admin/grid` 🔒 + +**Query:** `fk_i_activity_id` · `d_date` (`dd/mm/yyyy`) + +**Respuesta 200** +```json +{ + "aaData": [ + ["
0900-1000
", "00042.1+", "", "00123.2", ""], + ["
1000-1100
", "", "", "", "00456.1"] + ], + "aoColumns": [ + { "sTitle": "Horarios", "sClass": "celda_horario", "sWidth": "65px" }, + { "sTitle": "01", "sClass": "celda_normal", "sWidth": "95px" }, + { "sTitle": "02", "sClass": "celda_normal", "sWidth": "95px" } + ], + "ac": { "pk_i_activity_id": 1, "s_name": "PÁDEL MURO", "i_courts": 4 }, + "light": 100, + "extra": 150, + "extra2": 150 +} +``` + +> En `aaData`, la celda contiene `{member}.{family}[+]` si está ocupada, `""` si libre. El `+` indica pagado. + +--- + +### `GET /booking-admin/shared` 🔒 + +**Query:** `fk_i_activity_id` · `d_date` · `hour` · `court` + +**Respuesta 200** — array de reservas en la misma hora/pista (compartidas) + +--- + +### `GET /booking-admin/single` 🔒 + +**Query:** `fk_i_activity_id` · `d_date` · `hour` · `aPos[1]` + +**Respuesta 200** +```json +{ "fk_i_member_id": 42, "fk_i_family": 1, "d_date": "2026-03-18", "b_paid": 0 } +``` + +--- + +### `GET /booking-admin/single-by-id` 🔒 + +**Query:** `id` + +**Respuesta 200** +```json +{ "pk_i_id": 1234, "fk_i_member_id": 42, "fk_i_family": 1, "d_date": "2026-03-18", "b_paid": 0 } +``` + +--- + +### `POST /booking-admin/do` 🔒 + +**Body:** `fk_i_activity_id` · `hour` · `d_date` · `court` · `member` · `aPos[]` + +**Respuesta 200** +```json +{ + "msg": "Pista reservada correctamente", + "error": 1, + "cell": "2x1", + "book": { "fk_i_member_id": 42 } +} +``` + +> `error`: `0` fallo · `1` OK · `2` ya pagada · `3` ocupada por otro · `4` recibos pendientes · `5` dado de baja. + +--- + +### `POST /booking-admin/confirm` 🔒 + +**Body:** `id` (ID de reserva pendiente de confirmar) + +**Respuesta 200** — misma estructura que `/booking-admin/do` + +--- + +### `POST /booking-admin/empty` 🔒 + +**Body:** `fk_i_activity_id` · `hour` · `s_hour` · `d_date` · `aPos[]` + +**Respuesta 200** +```json +{ "error": 2, "book": { "pk_i_id": 1234, "b_paid": 0, "text": "" } } +``` + +> `error`: `0` nada que vaciar · `1` estaba pagada (devolver ticket) · `2` eliminada (no pagada) · `3` eliminada (pagada sin ticket). + +--- + +### `POST /booking-admin/empty-by-id` 🔒 + +**Body:** `id` +**Respuesta:** igual que `/booking-admin/empty` + +--- + +## 12. Cash (caja — admin) + +### `GET /cash/last-ticket` 🔒 + +**Query:** `iPage` (paginación, base 0) + +**Respuesta 200** +```json +{ + "ticket": [ + { "dt_date": "2026-03-18 10:23:45", "i_line": 1, "s_line": "--------------------------------" }, + { "dt_date": "2026-03-18 10:23:45", "i_line": 2, "s_line": "CLUB DEPORTIVO SANTA ANA" }, + { "dt_date": "2026-03-18 10:23:45", "i_line": 3, "s_line": "Reserva pádel 6,00 €" } + ] +} +``` + +--- + +### `GET /cash/search` 🔒 + +**Query:** `searchQuery` · `paymentType` · `iPage` + +**Respuesta 200** +```json +{ + "items": [ + { + "pk_i_id": 12345, + "pk_s_id": "2026/000042", + "d_year": 2026, + "dt_date": "2026-03-18 10:23:45", + "fk_s_activity_group_id":"AC", + "fk_i_activity_id": "01", + "fk_i_member_id": "00042", + "s_name": "García, María", + "s_concept": "Reserva pádel", + "f_price": 6000000, + "f_tax": 0, + "f_amount": "6.00", + "s_type": "CAJA" + } + ] +} +``` + +--- + +### `GET /cash/ticket-from-booking` 🔒 + +**Query:** `ac` · `hour` · `court` · `date` + +**Respuesta 200** +```json +{ "error": 0, "ticket": [ { "...": "objeto cash" } ] } +``` + +--- + +### Escritura de caja + +| Método | Ruta | Body | Respuesta | +|--------|------|------|-----------| +| `POST` | `/cash/post` | `fk_i_member_id` · `items[]` · `prices[]` · `concepts[]` · `taxes[]` · `amounts[]` · `payment_type` · `dt_date` | `{ "msg": "...", "total": 6000000, "pk_s_id": "2026/000042", "data": "" }` | +| `POST` | `/cash/post-ticket` | datos del ticket | `{ "msg": "...", "data": "", "lines": [] }` | +| `POST` | `/cash/print-ticket` | `date` | `{ "lines": ["linea1", "linea2"] }` | +| `POST` | `/cash/delete` | `id` | `{ "error": 0, "msg": "..." }` | +| `POST` | `/cash/delete-mov` | `sdate` · `edate` | `{ "error": 0, "msg": "OK" }` | +| `POST` | `/cash/book-ticket` | datos reserva + pago | `{ "msg": "...", "data": "", "lines": [] }` | +| `POST` | `/cash/book-return` | datos devolución | `{ "error": 0, "book": {}, "lines": [] }` | +| `POST` | `/cash/bonus-ticket` | datos bono | `{ "error": 0, "lines": [] }` | +| `POST` | `/cash/bonus-ticket-nopaid` | datos bono | `{ "error": 0, "lines": [] }` | +| `POST` | `/cash/qr` | `member` · `familiar` | `{ "msg": "ok", "error": 0, "qr": "00042-01-ABCDEF123456" }` | + +--- + +## 13. Dayoff / Celebrations + +| Método | Ruta | Body | Respuesta | +|--------|------|------|-----------| +| `POST` | `/dayoff/add` | `d_date` (`dd/mm/yyyy`) · `s_name` · `type` | `1` | +| `POST` | `/dayoff/delete` | `d_date` · `s_name` | `1` | +| `POST` | `/celebration/add` | `date` (`dd/mm/yyyy`) · `name` · `member` · `comment` | `1` | +| `POST` | `/celebration/delete` | `id` | `1` | + +--- + +## 14. Remittance (remesas especiales) + +### `POST /remittance/member/add` 🔒 + +**Body:** `id` (remittance ID) · `member` · `amount` · `concept` + +**Respuesta 200** +```json +{ "error": 0, "msg": "Socio añadido correctamente" } +``` + +--- + +### `POST /remittance/member/delete` 🔒 + +**Body:** `id` + +**Respuesta 200** +```json +{ "error": 0, "msg": "Socio eliminado correctamente" } +``` + +--- + +### `POST /remittance/edit` 🔒 + +**Body:** `id` · `field` · `value` + +**Respuesta 200** +```json +{ "error": 0, "msg": "Editado correctamente" } +``` + +--- + +### `POST /remittance/sepa` 🔒 + +**Body:** `id` (remittance ID) + +**Respuesta 200** +```json +{ + "error": 0, + "msg": "Remesa generada correctamente", + "file": "/storage/remesas/2026_sepa.xml", + "count": 42 +} +``` + +--- + +## 15. Inscriptions (preinscripciones) + +El objeto **inscription** tiene esta estructura: + +```json +{ + "id": 1, + "address": "Calle Mayor 12", + "city": "Madrid", + "zip_code": "28001", + "emergency_phone": "612345678", + "bank": "0049", + "bank_office": "1500", + "bank_sec_code": "42", + "bank_account": "0123456789", + "comment": "", + "know_us": "amigo", + "know_us_comment": "", + "know_us_by_who": "", + "created_at": "2026-03-01T10:00:00.000Z", + "people": [ + { + "first_name": "Luis", + "last_name": "Pérez", + "email": "luis@example.com", + "phone": "634567890", + "birth_date": "15/04/1990", + "dni": "87654321B" + } + ] +} +``` + +| Método | Ruta | Descripción | Respuesta | +|----------|------|-------------|-----------| +| `GET` | `/inscriptions/first` | Primera preinscripción | objeto inscription | +| `GET` | `/inscriptions/last` | Última preinscripción | objeto inscription | +| `GET` | `/inscriptions/{id}` | Preinscripción por ID | objeto inscription | +| `GET` | `/inscriptions/{id}/prev` | Anterior | objeto inscription | +| `GET` | `/inscriptions/{id}/next` | Siguiente | objeto inscription | +| `POST` | `/inscriptions` | Convertir en socio | `{ "error": 0, "msg": "Usuario creado correctamente", "id": 1234 }` | +| `DELETE` | `/inscriptions/{id}` | Eliminar preinscripción | objeto inscription siguiente | + +**`POST /inscriptions` — Body** + +| Campo | Tipo | +|----------------|---------| +| inscription_id | integer | +| s_type | string (`INDIVIDUAL` / `FAMILIAR` / `SABIC` / ...) | +| id | integer | (opcional, número de socio a asignar) | +| d_reg_date | string | + +--- + +## 16. Admin Misc + +### `POST /admin/quota` 🔒 + +Actualiza el precio/cupo de una actividad. + +**Body:** `pk_s_group_id` · `pk_i_activity_id` · `s_field` · `s_value` + +**Respuesta 200** +```json +1 +``` + +--- + +### `POST /admin/reboot` 🔒 + +Reinicia la impresora. + +**Respuesta 200** +```json +{ "error": 0, "msg": "Reiniciando impresora..." } +``` + +--- + +### `GET /admin/check-reboot` 🔒 + +**Respuesta 200** +```json +{ "status": "ok" } +``` + +--- + +### `GET /admin/bank-sec-code` 🔒 + +Calcula el dígito de control bancario. + +**Query:** `bank` · `office` · `account` + +**Respuesta 200** +```json +"42" +``` + +--- + +### `GET /admin/bank-name` 🔒 + +**Query:** `bank` (código 4 dígitos) + +**Respuesta 200** +```json +{ "name": "Banco Santander" } +``` + +--- + +### `POST /admin/print-card` 🔒 + +**Body:** `member` · `family` + +**Respuesta 200** +```json +{ "error": 0, "msg": "Carnet enviado a imprimir" } +``` + +--- + +### `POST /admin/set-printer` 🔒 + +**Body:** `printer` (nombre/IP) + +**Respuesta 200** +```json +{ "error": 0, "msg": "Impresora configurada correctamente" } +``` + +--- + +### `POST /admin/sorteo` 🔒 + +Registra participaciones en sorteo. + +**Body:** `data[]` (array de `{ member, name, email, phone, tickets }`) + +**Respuesta 200** +```json +{ "error": 0, "msg": "Participación registrada" } +``` + +--- + +## 17. Printer + +### `GET /printer/lines` 🔒 + +Devuelve líneas pendientes de imprimir. + +**Respuesta 200** +```json +{ "error": 0, "lines": [] } +``` + +--- + +## 18. Hash (público) + +### `GET /hash/{hash}` + +Devuelve el hash BCrypt de un valor, en base64. Útil para generar contraseñas desde scripts. + +**Ejemplo:** `GET /2.0/hash/mipassword` + +**Respuesta 200** +```json +{ "h": "JDJ5JDEwJGFCQ0Rm..." } +``` + +--- + +## Códigos de error comunes + +| Campo `error` | Significado | +|---------------|-------------| +| `"0"` / `0` | Operación correcta | +| `"1"` / `1` | Error genérico o entidad no encontrada | +| `"2"` | Ya existe / ya está pagado | +| `"3"` | Ocupado por otro usuario | +| `"4"` | Recibos pendientes — acceso restringido | +| `"5"` | Dado de baja — acceso restringido | + +--- + +## Convenciones + +- **Montos** se almacenan internamente en **millonésimas de euro** (`6000000` = `6.00 €`). La API devuelve el valor formateado como string (`"6.00"`) en los recursos de la app. +- **Fechas** en pantalla usan formato `dd/mm/yyyy`; en base de datos `yyyy-mm-dd`. +- **Códigos de actividad** son cadenas de 7 dígitos: `{course:3}{level:2}{group:2}` → `0010102`. +- **Identificador de abonado** combina miembro y familiar: `{member:5}{family:2}` → `0004201`. \ No newline at end of file diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..1dc6cf7 --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 13.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..3954d6a --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..e3773d4 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..6266644 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +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. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..2feab7c --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Depor Os + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + depor_os + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/lib/core/constants.dart b/lib/core/constants.dart new file mode 100644 index 0000000..c562a7c --- /dev/null +++ b/lib/core/constants.dart @@ -0,0 +1,4 @@ +const String kApiBase = 'https://reservas.madriguera.me/2.0'; + +/// Cambiar a false para usar la API real (necesita token). +const bool kUseMock = true; diff --git a/lib/core/router.dart b/lib/core/router.dart new file mode 100644 index 0000000..2b49ce0 --- /dev/null +++ b/lib/core/router.dart @@ -0,0 +1,102 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import '../screens/booking/booking_screen.dart'; +import '../screens/login/login_screen.dart'; +import '../screens/dashboard/dashboard_screen.dart'; +import '../screens/members/members_screen.dart'; +import '../screens/placeholder_screen.dart'; +import '../widgets/app_shell.dart'; + +final appRouter = GoRouter( + initialLocation: '/dashboard', // TODO: restaurar '/login' antes de producción + routes: [ + GoRoute( + path: '/login', + builder: (context, state) => const LoginScreen(), + ), + ShellRoute( + builder: (context, state, child) => AppShell(child: child), + routes: [ + GoRoute(path: '/dashboard', builder: (context, state) => const DashboardScreen()), + + // Abonados + GoRoute(path: '/abonados', builder: (_, __) => const MembersScreen()), + GoRoute(path: '/abonados/pre', builder: (_, s) => PlaceholderScreen(title: 'Pre-inscripciones', route: s.matchedLocation)), + GoRoute(path: '/abonados/nuevo', builder: (_, s) => PlaceholderScreen(title: 'Añadir abonado', route: s.matchedLocation)), + + // Cursos + GoRoute(path: '/cursos', builder: (_, s) => PlaceholderScreen(title: 'Cursos', route: s.matchedLocation)), + + // Alumnos + GoRoute(path: '/alumnos', builder: (_, s) => PlaceholderScreen(title: 'Alumnos', route: s.matchedLocation)), + GoRoute(path: '/alumnos/altas', builder: (_, s) => PlaceholderScreen(title: 'Altas', route: s.matchedLocation)), + GoRoute(path: '/alumnos/bajas', builder: (_, s) => PlaceholderScreen(title: 'Bajas', route: s.matchedLocation)), + + // Reservas + GoRoute(path: '/reservas', builder: (_, __) => const BookingScreen()), + GoRoute(path: '/reservas-salas', builder: (_, s) => PlaceholderScreen(title: 'Reservas Salas', route: s.matchedLocation)), + + // Consultas + GoRoute(path: '/consultas', builder: (_, s) => PlaceholderScreen(title: 'Consultas', route: s.matchedLocation)), + + // Caja + GoRoute(path: '/caja', builder: (_, s) => PlaceholderScreen(title: 'Caja', route: s.matchedLocation)), + + // Recibos + GoRoute(path: '/recibos/abonado', builder: (_, s) => PlaceholderScreen(title: 'Recibos por abonado', route: s.matchedLocation)), + GoRoute(path: '/recibos/actividad', builder: (_, s) => PlaceholderScreen(title: 'Recibos por actividad', route: s.matchedLocation)), + + // Remesas + GoRoute(path: '/remesas', builder: (_, s) => PlaceholderScreen(title: 'Administrar remesas', route: s.matchedLocation)), + GoRoute(path: '/remesas/especial', builder: (_, s) => PlaceholderScreen(title: 'Remesa especial', route: s.matchedLocation)), + + // Listados + GoRoute(path: '/listados/mensual', builder: (_, s) => PlaceholderScreen(title: 'Listado mensual', route: s.matchedLocation)), + GoRoute(path: '/listados/cobros-cursos', builder: (_, s) => PlaceholderScreen(title: 'Cobros por cursos', route: s.matchedLocation)), + GoRoute(path: '/listados/totales-curso', builder: (_, s) => PlaceholderScreen(title: 'Totales por curso', route: s.matchedLocation)), + GoRoute(path: '/listados/cobros-empleado', builder: (_, s) => PlaceholderScreen(title: 'Cobros por empleado', route: s.matchedLocation)), + GoRoute(path: '/listados/cobros', builder: (_, s) => PlaceholderScreen(title: 'Cobros', route: s.matchedLocation)), + GoRoute(path: '/listados/devueltos', builder: (_, s) => PlaceholderScreen(title: 'Recibos devueltos', route: s.matchedLocation)), + GoRoute(path: '/listados/bajas', builder: (_, s) => PlaceholderScreen(title: 'Listado de bajas', route: s.matchedLocation)), + GoRoute(path: '/listados/altas', builder: (_, s) => PlaceholderScreen(title: 'Listado de altas', route: s.matchedLocation)), + GoRoute(path: '/listados/altas-bajas', builder: (_, s) => PlaceholderScreen(title: 'Altas-bajas por mes', route: s.matchedLocation)), + GoRoute(path: '/listados/csv', builder: (_, s) => PlaceholderScreen(title: 'Ficheros CSV', route: s.matchedLocation)), + GoRoute(path: '/listados/impagadas', builder: (_, s) => PlaceholderScreen(title: 'Impagadas', route: s.matchedLocation)), + GoRoute(path: '/listados/impagadas-total', builder: (_, s) => PlaceholderScreen(title: 'Impagadas totales', route: s.matchedLocation)), + GoRoute(path: '/listados/retenidos', builder: (_, s) => PlaceholderScreen(title: 'Retenidos', route: s.matchedLocation)), + GoRoute(path: '/listados/sin-cuenta', builder: (_, s) => PlaceholderScreen(title: 'Sin cuenta', route: s.matchedLocation)), + GoRoute(path: '/listados/cursos-completos', builder: (_, s) => PlaceholderScreen(title: 'Cursos completos', route: s.matchedLocation)), + GoRoute(path: '/listados/registros-empleado', builder: (_, s) => PlaceholderScreen(title: 'Registros por empleado', route: s.matchedLocation)), + + // Utilidades + GoRoute(path: '/utilidades/movimientos', builder: (_, s) => PlaceholderScreen(title: 'Movimientos de Caja', route: s.matchedLocation)), + GoRoute(path: '/utilidades/cerrar-caja', builder: (_, s) => PlaceholderScreen(title: 'Cerrar caja', route: s.matchedLocation)), + GoRoute(path: '/utilidades/tickets', builder: (_, s) => PlaceholderScreen(title: 'Últimos tickets', route: s.matchedLocation)), + GoRoute(path: '/utilidades/parametros', builder: (_, s) => PlaceholderScreen(title: 'Parámetros', route: s.matchedLocation)), + GoRoute(path: '/utilidades/cuotas', builder: (_, s) => PlaceholderScreen(title: 'Modificar Cuotas', route: s.matchedLocation)), + GoRoute(path: '/utilidades/elim-caja', builder: (_, s) => PlaceholderScreen(title: 'Eliminación R. de Caja', route: s.matchedLocation)), + GoRoute(path: '/utilidades/festivos', builder: (_, s) => PlaceholderScreen(title: 'Festivos', route: s.matchedLocation)), + GoRoute(path: '/utilidades/celebraciones', builder: (_, s) => PlaceholderScreen(title: 'Celebraciones', route: s.matchedLocation)), + GoRoute(path: '/utilidades/horarios', builder: (_, s) => PlaceholderScreen(title: 'Horarios pistas', route: s.matchedLocation)), + GoRoute(path: '/utilidades/contadores', builder: (_, s) => PlaceholderScreen(title: 'Contadores', route: s.matchedLocation)), + GoRoute(path: '/utilidades/actividades', builder: (_, s) => PlaceholderScreen(title: 'Actividades', route: s.matchedLocation)), + GoRoute(path: '/utilidades/tablas', builder: (_, s) => PlaceholderScreen(title: 'Tablas', route: s.matchedLocation)), + GoRoute(path: '/utilidades/impresoras', builder: (_, s) => PlaceholderScreen(title: 'Impresoras', route: s.matchedLocation)), + GoRoute(path: '/utilidades/carnet-printer', builder: (_, s) => PlaceholderScreen(title: 'Impresora CARNETS', route: s.matchedLocation)), + GoRoute(path: '/utilidades/sorteo', builder: (_, s) => PlaceholderScreen(title: 'Sorteo abonados', route: s.matchedLocation)), + + // Admin / sistema + GoRoute(path: '/usuarios', builder: (_, s) => PlaceholderScreen(title: 'Usuarios', route: s.matchedLocation)), + GoRoute(path: '/tornos', builder: (_, s) => PlaceholderScreen(title: 'Tornos', route: s.matchedLocation)), + GoRoute(path: '/tornos/top', builder: (_, s) => PlaceholderScreen(title: 'Top usuarios', route: s.matchedLocation)), + GoRoute(path: '/tornos/gym', builder: (_, s) => PlaceholderScreen(title: 'Tornos (gym)', route: s.matchedLocation)), + GoRoute(path: '/tornos/activos', builder: (_, s) => PlaceholderScreen(title: 'Usuarios en sala', route: s.matchedLocation)), + GoRoute(path: '/registro', builder: (_, s) => PlaceholderScreen(title: 'Registro', route: s.matchedLocation)), + GoRoute(path: '/permisos', builder: (_, s) => PlaceholderScreen(title: 'Permisos', route: s.matchedLocation)), + ], + ), + ], + errorBuilder: (_, state) => Scaffold( + body: Center(child: Text('Ruta no encontrada: ${state.uri}')), + ), +); diff --git a/lib/core/service_locator.dart b/lib/core/service_locator.dart new file mode 100644 index 0000000..762f0e4 --- /dev/null +++ b/lib/core/service_locator.dart @@ -0,0 +1,15 @@ +import '../services/booking_repository.dart'; +import '../services/booking_service.dart'; +import '../services/member_repository.dart'; +import '../services/member_service.dart'; +import '../services/mock/mock_booking_service.dart'; +import '../services/mock/mock_member_service.dart'; +import 'constants.dart'; + +/// Devuelve la implementación correcta de cada repositorio según [kUseMock]. +/// Cambiar kUseMock en constants.dart para alternar entre mock y producción. +MemberRepository memberRepository() => + kUseMock ? MockMemberService() : MemberService(); + +BookingRepository bookingRepository() => + kUseMock ? MockBookingService() : BookingService(); diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..fe33b48 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'core/router.dart'; + +void main() { + runApp(const DeporOsApp()); +} + +class DeporOsApp extends StatelessWidget { + const DeporOsApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp.router( + title: 'DeporOS', + debugShowCheckedModeBanner: false, + routerConfig: appRouter, + theme: ThemeData( + useMaterial3: true, + colorScheme: ColorScheme.fromSeed( + seedColor: const Color(0xFF1565C0), + brightness: Brightness.light, + ), + inputDecorationTheme: const InputDecorationTheme(filled: true), + ), + darkTheme: ThemeData( + useMaterial3: true, + colorScheme: ColorScheme.fromSeed( + seedColor: const Color(0xFF1565C0), + brightness: Brightness.dark, + ), + inputDecorationTheme: const InputDecorationTheme(filled: true), + ), + ); + } +} diff --git a/lib/models/booking.dart b/lib/models/booking.dart new file mode 100644 index 0000000..9af4f8a --- /dev/null +++ b/lib/models/booking.dart @@ -0,0 +1,173 @@ +// ── Activity ────────────────────────────────────────────────────────────────── + +class BookingActivity { + final int id; + final String name; + + const BookingActivity({required this.id, required this.name}); + + factory BookingActivity.fromJson(Map json) => + BookingActivity( + id: json['pk_i_id'] ?? 0, + name: json['s_name'] ?? '', + ); +} + +// ── Grid ────────────────────────────────────────────────────────────────────── + +class BookingCell { + final String raw; + const BookingCell(this.raw); + + bool get isEmpty => raw.isEmpty; + bool get isPaid => raw.isNotEmpty && raw.endsWith('+'); + bool get isBooked => raw.isNotEmpty; + + int? get memberId { + final m = RegExp(r'^(\d+)\.').firstMatch(raw); + return m != null ? int.tryParse(m.group(1)!) : null; + } + + int? get familyId { + final m = RegExp(r'\.(\d+)[+\-]?$').firstMatch(raw); + return m != null ? int.tryParse(m.group(1)!) : null; + } +} + +class BookingRow { + final int slotIndex; + final String timeLabel; + final List cells; // one per court + + const BookingRow({ + required this.slotIndex, + required this.timeLabel, + required this.cells, + }); +} + +class BookingGrid { + final List rows; + final List courtTitles; // ["01", "02", ...] + final String activityName; + final int light; + final int extra; + final String? celebrations; + + const BookingGrid({ + required this.rows, + required this.courtTitles, + required this.activityName, + required this.light, + required this.extra, + this.celebrations, + }); + + factory BookingGrid.fromJson(Map json) { + final aoColumns = json['aoColumns'] as List? ?? []; + final aaData = json['aaData'] as List? ?? []; + + final courtTitles = aoColumns + .skip(1) + .map((c) => (c as Map)['sTitle'] as String? ?? '') + .toList(); + + final rows = aaData.map((rowData) { + final row = rowData as List; + final firstCell = row[0] as String? ?? ''; + final idMatch = RegExp(r'id="(\d+)"').firstMatch(firstCell); + final slotIndex = idMatch != null ? int.parse(idMatch.group(1)!) : 0; + final timeMatch = RegExp(r'>([^<]+)<').firstMatch(firstCell); + final timeLabel = timeMatch?.group(1) ?? firstCell; + + final cells = row + .skip(1) + .map((c) => BookingCell(c as String? ?? '')) + .toList(); + + return BookingRow(slotIndex: slotIndex, timeLabel: timeLabel, cells: cells); + }).toList(); + + final ac = json['ac'] as Map? ?? {}; + + return BookingGrid( + rows: rows, + courtTitles: courtTitles, + activityName: ac['s_name'] as String? ?? '', + light: (json['light'] as num?)?.toInt() ?? 0, + extra: (json['extra'] as num?)?.toInt() ?? 0, + celebrations: json['celebrations'] as String?, + ); + } +} + +// ── Booking detail (single cell) ────────────────────────────────────────────── + +class TicketLine { + final String concepto; + final double precio; + + const TicketLine({required this.concepto, required this.precio}); + + factory TicketLine.fromJson(Map json) => TicketLine( + concepto: json['concepto'] ?? '', + precio: (json['precio'] as num?)?.toDouble() ?? 0, + ); +} + +class TicketPreview { + final String concepto; + final double base; + final double iva; + final double total; + final List lines; + + const TicketPreview({ + required this.concepto, + required this.base, + required this.iva, + required this.total, + required this.lines, + }); + + factory TicketPreview.fromJson(Map json) => TicketPreview( + concepto: json['concepto'] ?? '', + base: (json['base'] as num?)?.toDouble() ?? 0, + iva: (json['iva'] as num?)?.toDouble() ?? 0, + total: (json['total'] as num?)?.toDouble() ?? 0, + lines: (json['lines'] as List? ?? []) + .map((l) => TicketLine.fromJson(l as Map)) + .toList(), + ); +} + +class BookingDetail { + final int id; + final int memberId; + final int familyId; + final String date; + final bool paid; + final TicketPreview? ticket; + + const BookingDetail({ + required this.id, + required this.memberId, + required this.familyId, + required this.date, + required this.paid, + this.ticket, + }); + + factory BookingDetail.fromJson(Map json) { + final book = json['book'] as Map? ?? {}; + final ticketJson = json['ticket'] as Map?; + return BookingDetail( + id: book['pk_i_id'] ?? 0, + memberId: book['fk_i_member_id'] ?? 0, + familyId: book['fk_i_family'] ?? 1, + date: book['d_date'] ?? '', + paid: (book['b_paid'] ?? 0) == 1, + ticket: ticketJson != null ? TicketPreview.fromJson(ticketJson) : null, + ); + } +} diff --git a/lib/models/member.dart b/lib/models/member.dart new file mode 100644 index 0000000..f918ff6 --- /dev/null +++ b/lib/models/member.dart @@ -0,0 +1,164 @@ +class MemberComment { + final int id; + final String comment; + final String createdAt; + + const MemberComment({ + required this.id, + required this.comment, + required this.createdAt, + }); + + factory MemberComment.fromJson(Map json) => MemberComment( + id: json['id'] ?? 0, + comment: json['comment'] ?? '', + createdAt: json['created_at'] ?? '', + ); +} + +class Person { + final int memberId; + final int family; + final String firstName; + final String lastName; + final String dni; + final String birthDate; + final String phone; + final String email; + final bool lopd; + final bool newsletter; + final bool? bHealth; + final bool authorized; + final bool authorized2; + final String? photoPath; + + const Person({ + required this.memberId, + required this.family, + required this.firstName, + required this.lastName, + required this.dni, + required this.birthDate, + required this.phone, + required this.email, + required this.lopd, + required this.newsletter, + this.bHealth, + required this.authorized, + required this.authorized2, + this.photoPath, + }); + + factory Person.fromJson(Map json) => Person( + memberId: json['fk_i_member_id'] ?? 0, + family: json['i_family'] ?? 0, + firstName: json['s_first_name'] ?? '', + lastName: json['s_last_name'] ?? '', + dni: json['s_dni'] ?? '', + birthDate: json['d_birth_date'] ?? '', + phone: json['s_phone'] ?? '', + email: json['s_email'] ?? '', + lopd: (json['b_lopd'] ?? 0) == 1, + newsletter: (json['b_newsletter'] ?? 0) == 1, + bHealth: json['b_health'] != null ? (json['b_health'] as int) == 1 : null, + authorized: (json['b_authorized'] ?? 0) == 1, + authorized2: (json['b_authorized2'] ?? 0) == 1, + photoPath: json['s_photo_path'], + ); + + String get fullName => '$firstName $lastName'.trim(); + String get initials { + final parts = fullName.split(' '); + if (parts.length >= 2) return '${parts[0][0]}${parts[1][0]}'.toUpperCase(); + if (parts.isNotEmpty && parts[0].isNotEmpty) return parts[0][0].toUpperCase(); + return '?'; + } +} + +class Member { + final int id; + final String regDate; + final String address; + final String city; + final String zip; + final String email; + final String phone; + final String bank; + final String bankOffice; + final String bankSecCode; + final String bankAccount; + final String bankName; + final String mandate; + final String type; + final String comment; + final String comment2; + final bool paid; + final bool remSpecial; + final bool retenido; + final String? unregDate; + final String unregReason; + final double? fee; + final List people; + final List comments; + + const Member({ + required this.id, + required this.regDate, + required this.address, + required this.city, + required this.zip, + required this.email, + required this.phone, + required this.bank, + required this.bankOffice, + required this.bankSecCode, + required this.bankAccount, + required this.bankName, + required this.mandate, + required this.type, + required this.comment, + required this.comment2, + required this.paid, + required this.remSpecial, + required this.retenido, + required this.unregDate, + required this.unregReason, + this.fee, + required this.people, + required this.comments, + }); + + factory Member.fromJson(Map json) => Member( + id: json['pk_i_id'] ?? 0, + regDate: json['d_reg_date'] ?? '', + address: json['s_address'] ?? '', + city: json['s_city'] ?? '', + zip: json['s_zip'] ?? '', + email: json['s_email'] ?? '', + phone: json['s_phone'] ?? '', + bank: json['s_bank'] ?? '', + bankOffice: json['s_bank_office'] ?? '', + bankSecCode: json['s_bank_sec_code'] ?? '', + bankAccount: json['s_bank_account'] ?? '', + bankName: json['s_bank_name'] ?? '', + mandate: json['s_mandate'] ?? '', + type: json['s_type'] ?? '', + comment: json['s_comment'] ?? '', + comment2: json['s_comment2'] ?? '', + paid: (json['b_paid'] ?? 0) == 1, + remSpecial: (json['b_rem_special'] ?? 0) == 1, + retenido: (json['b_retenido'] ?? 0) == 1, + unregDate: json['d_unreg_date'], + unregReason: json['s_unreg_reason'] ?? '', + fee: (json['f_fee'] as num?)?.toDouble(), + people: (json['people'] as List? ?? []) + .map((p) => Person.fromJson(p as Map)) + .toList(), + comments: (json['comments'] as List? ?? []) + .map((c) => MemberComment.fromJson(c as Map)) + .toList(), + ); + + String get formattedId => id.toString().padLeft(5, '0'); + bool get isActive => unregDate == null; +} diff --git a/lib/models/nav_item.dart b/lib/models/nav_item.dart new file mode 100644 index 0000000..45dda5e --- /dev/null +++ b/lib/models/nav_item.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +class NavItem { + final String label; + final IconData icon; + final String? route; + final List children; + + const NavItem({ + required this.label, + required this.icon, + this.route, + this.children = const [], + }); + + bool get hasChildren => children.isNotEmpty; + + /// Devuelve true si la ruta actual coincide con este item o algún hijo. + bool isActiveOrAncestor(String currentRoute) { + if (route != null && currentRoute.startsWith(route!)) return true; + return children.any((c) => c.isActiveOrAncestor(currentRoute)); + } +} diff --git a/lib/navigation/app_navigation.dart b/lib/navigation/app_navigation.dart new file mode 100644 index 0000000..cfe3055 --- /dev/null +++ b/lib/navigation/app_navigation.dart @@ -0,0 +1,114 @@ +import 'package:flutter/material.dart'; +import '../models/nav_item.dart'; + +/// Estructura de navegación completa del panel de administración. +/// Refleja el sidebar de sc-admin/themes/modern/sidebar.php (perfil admin completo). +const List kAdminNavItems = [ + NavItem(label: 'Inicio', icon: Icons.home_outlined, route: '/dashboard'), + + NavItem( + label: 'Abonados', + icon: Icons.people_outlined, + children: [ + NavItem(label: 'Gestionar abonados', icon: Icons.manage_accounts_outlined, route: '/abonados'), + NavItem(label: 'Pre-inscripciones', icon: Icons.pending_actions_outlined, route: '/abonados/pre'), + NavItem(label: 'Añadir abonado', icon: Icons.person_add_outlined, route: '/abonados/nuevo'), + ], + ), + + NavItem(label: 'Cursos', icon: Icons.school_outlined, route: '/cursos'), + + NavItem( + label: 'Alumnos', + icon: Icons.group_outlined, + children: [ + NavItem(label: 'Alumnos', icon: Icons.group_outlined, route: '/alumnos'), + NavItem(label: 'Altas', icon: Icons.add_circle_outline, route: '/alumnos/altas'), + NavItem(label: 'Bajas', icon: Icons.remove_circle_outline, route: '/alumnos/bajas'), + ], + ), + + NavItem(label: 'Reservas', icon: Icons.sports_tennis_outlined, route: '/reservas'), + NavItem(label: 'Reservas Salas', icon: Icons.meeting_room_outlined, route: '/reservas-salas'), + NavItem(label: 'Consultas', icon: Icons.search_outlined, route: '/consultas'), + NavItem(label: 'Caja', icon: Icons.point_of_sale_outlined, route: '/caja'), + + NavItem( + label: 'Recibos', + icon: Icons.receipt_long_outlined, + children: [ + NavItem(label: 'Recibos por abonado', icon: Icons.receipt_outlined, route: '/recibos/abonado'), + NavItem(label: 'Recibos por actividad', icon: Icons.receipt_long_outlined, route: '/recibos/actividad'), + ], + ), + + NavItem( + label: 'Remesas', + icon: Icons.account_balance_outlined, + children: [ + NavItem(label: 'Remesa especial', icon: Icons.star_border_outlined, route: '/remesas/especial'), + NavItem(label: 'Administrar remesas', icon: Icons.manage_history_outlined, route: '/remesas'), + ], + ), + + NavItem( + label: 'Listados', + icon: Icons.list_alt_outlined, + children: [ + NavItem(label: 'Listado mensual', icon: Icons.calendar_month_outlined, route: '/listados/mensual'), + NavItem(label: 'Cobros por cursos', icon: Icons.payments_outlined, route: '/listados/cobros-cursos'), + NavItem(label: 'Totales por curso', icon: Icons.summarize_outlined, route: '/listados/totales-curso'), + NavItem(label: 'Cobros por empleado', icon: Icons.badge_outlined, route: '/listados/cobros-empleado'), + NavItem(label: 'Cobros', icon: Icons.euro_outlined, route: '/listados/cobros'), + NavItem(label: 'Recibos devueltos', icon: Icons.undo_outlined, route: '/listados/devueltos'), + NavItem(label: 'Bajas', icon: Icons.person_remove_outlined, route: '/listados/bajas'), + NavItem(label: 'Altas', icon: Icons.person_add_outlined, route: '/listados/altas'), + NavItem(label: 'Altas-bajas por mes', icon: Icons.swap_vert_outlined, route: '/listados/altas-bajas'), + NavItem(label: 'Ficheros CSV', icon: Icons.file_download_outlined, route: '/listados/csv'), + NavItem(label: 'Impagadas', icon: Icons.money_off_outlined, route: '/listados/impagadas'), + NavItem(label: 'Impagadas totales', icon: Icons.money_off_csred_outlined, route: '/listados/impagadas-total'), + NavItem(label: 'Retenidos', icon: Icons.pause_circle_outline, route: '/listados/retenidos'), + NavItem(label: 'Sin cuenta', icon: Icons.no_accounts_outlined, route: '/listados/sin-cuenta'), + NavItem(label: 'Cursos completos', icon: Icons.check_circle_outline, route: '/listados/cursos-completos'), + NavItem(label: 'Registros por empleado', icon: Icons.assignment_ind_outlined, route: '/listados/registros-empleado'), + ], + ), + + NavItem( + label: 'Utilidades', + icon: Icons.build_outlined, + children: [ + NavItem(label: 'Movimientos de Caja', icon: Icons.swap_horiz_outlined, route: '/utilidades/movimientos'), + NavItem(label: 'Cerrar caja', icon: Icons.lock_clock_outlined, route: '/utilidades/cerrar-caja'), + NavItem(label: 'Últimos tickets', icon: Icons.confirmation_number_outlined, route: '/utilidades/tickets'), + NavItem(label: 'Parámetros', icon: Icons.tune_outlined, route: '/utilidades/parametros'), + NavItem(label: 'Modificar Cuotas', icon: Icons.price_change_outlined, route: '/utilidades/cuotas'), + NavItem(label: 'Eliminación R. de Caja', icon: Icons.delete_outline, route: '/utilidades/elim-caja'), + NavItem(label: 'Festivos', icon: Icons.beach_access_outlined, route: '/utilidades/festivos'), + NavItem(label: 'Celebraciones', icon: Icons.celebration_outlined, route: '/utilidades/celebraciones'), + NavItem(label: 'Horarios pistas', icon: Icons.schedule_outlined, route: '/utilidades/horarios'), + NavItem(label: 'Contadores', icon: Icons.numbers_outlined, route: '/utilidades/contadores'), + NavItem(label: 'Actividades', icon: Icons.sports_outlined, route: '/utilidades/actividades'), + NavItem(label: 'Tablas', icon: Icons.table_chart_outlined, route: '/utilidades/tablas'), + NavItem(label: 'Impresoras', icon: Icons.print_outlined, route: '/utilidades/impresoras'), + NavItem(label: 'Impresora CARNETS', icon: Icons.credit_card_outlined, route: '/utilidades/carnet-printer'), + NavItem(label: 'Sorteo abonados', icon: Icons.casino_outlined, route: '/utilidades/sorteo'), + ], + ), + + NavItem(label: 'Usuarios', icon: Icons.admin_panel_settings_outlined, route: '/usuarios'), + + NavItem( + label: 'Tornos', + icon: Icons.sensor_door_outlined, + children: [ + NavItem(label: 'Tornos', icon: Icons.sensor_door_outlined, route: '/tornos'), + NavItem(label: 'Top usuarios', icon: Icons.leaderboard_outlined, route: '/tornos/top'), + NavItem(label: 'Tornos (gym)', icon: Icons.fitness_center_outlined, route: '/tornos/gym'), + NavItem(label: 'Usuarios en sala', icon: Icons.people_alt_outlined, route: '/tornos/activos'), + ], + ), + + NavItem(label: 'Registro', icon: Icons.history_outlined, route: '/registro'), + NavItem(label: 'Permisos', icon: Icons.security_outlined, route: '/permisos'), +]; diff --git a/lib/screens/booking/booking_screen.dart b/lib/screens/booking/booking_screen.dart new file mode 100644 index 0000000..fd03298 --- /dev/null +++ b/lib/screens/booking/booking_screen.dart @@ -0,0 +1,1009 @@ +import 'package:flutter/material.dart'; +import '../../core/service_locator.dart'; +import '../../models/booking.dart'; + +// Grid cell dimensions +const double _kSlotW = 82; +const double _kCourtW = 94; +const double _kRowH = 40; +const double _kHeaderH = 34; + +class BookingScreen extends StatefulWidget { + const BookingScreen({super.key}); + + @override + State createState() => _BookingScreenState(); +} + +class _BookingScreenState extends State { + final _repo = bookingRepository(); + + List _activities = []; + BookingActivity? _selectedActivity; + DateTime _selectedDate = DateTime.now(); + + BookingGrid? _grid; + bool _gridLoading = false; + String? _gridError; + + ({int row, int court})? _selectedCell; + BookingDetail? _bookingDetail; + bool _detailLoading = false; + + @override + void initState() { + super.initState(); + _loadActivities(); + } + + Future _loadActivities() async { + try { + final list = await _repo.activities(); + setState(() { + _activities = list; + if (list.isNotEmpty) { + _selectedActivity = list.first; + _loadGrid(); + } + }); + } catch (_) {} + } + + Future _loadGrid() async { + final activity = _selectedActivity; + if (activity == null) return; + setState(() { + _gridLoading = true; + _gridError = null; + _selectedCell = null; + _bookingDetail = null; + }); + try { + final grid = await _repo.grid( + activityId: activity.id, + date: _fmtDate(_selectedDate), + ); + setState(() { + _grid = grid; + _gridLoading = false; + }); + } catch (e) { + setState(() { + _gridError = e.toString(); + _gridLoading = false; + }); + } + } + + Future _onCellTap(int row, int court, BookingCell cell) async { + setState(() { + _selectedCell = (row: row, court: court); + _bookingDetail = null; + _detailLoading = cell.isBooked; + }); + + if (!cell.isBooked) return; + + try { + final detail = await _repo.singleBooking( + activityId: _selectedActivity!.id, + date: _fmtDate(_selectedDate), + slotIndex: row, + courtIndex: court, + ); + setState(() { + _bookingDetail = detail; + _detailLoading = false; + }); + } catch (_) { + setState(() => _detailLoading = false); + } + } + + void _handleAction(String action) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('$action — pendiente de implementar'), + duration: const Duration(seconds: 2), + ), + ); + } + + Widget _gridCard(BuildContext context) { + final child = _gridLoading + ? const Center(child: CircularProgressIndicator()) + : _gridError != null + ? Center(child: Text(_gridError!)) + : _grid == null + ? Center( + child: Text('Selecciona una fecha y actividad', + style: TextStyle( + color: Theme.of(context).colorScheme.outline)), + ) + : LayoutBuilder(builder: (_, cst) => _GridView( + grid: _grid!, + availableWidth: cst.maxWidth, + selectedCell: _selectedCell, + onCellTap: _onCellTap, + )); + return Card.outlined(child: child); + } + + Widget _selectorSideBySide() => Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _CalendarCard( + selectedDate: _selectedDate, + onDateChanged: (d) { setState(() => _selectedDate = d); _loadGrid(); }, + ), + const SizedBox(width: 12), + Expanded( + child: _ActivityCard( + activities: _activities, + selected: _selectedActivity, + onSelected: (a) { setState(() => _selectedActivity = a); _loadGrid(); }, + ), + ), + ], + ), + ); + + Widget _selectorStacked() => Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _ActivityDropdown( + activities: _activities, + selected: _selectedActivity, + onSelected: (a) { setState(() => _selectedActivity = a); _loadGrid(); }, + ), + const SizedBox(height: 12), + _CalendarCard( + selectedDate: _selectedDate, + onDateChanged: (d) { setState(() => _selectedDate = d); _loadGrid(); }, + ), + ], + ), + ); + + List _leftContents(BuildContext context, {required bool sideBySide}) => [ + if (_grid?.celebrations != null) + _CelebrationBanner(text: _grid!.celebrations!), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 8), + child: Text('Reservas', style: Theme.of(context).textTheme.headlineSmall), + ), + sideBySide ? _selectorSideBySide() : _selectorStacked(), + const SizedBox(height: 12), + ]; + + Widget _rightPanel() => _RightPanel( + detail: _bookingDetail, + detailLoading: _detailLoading, + onAction: _handleAction, + ); + + @override + Widget build(BuildContext context) { + return LayoutBuilder(builder: (_, constraints) { + final w = constraints.maxWidth; + + // ── Narrow < 910px: right panel debajo del grid ─────────────────────── + final windowW = MediaQuery.sizeOf(context).width; + if (w < 910) { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ..._leftContents(context, sideBySide: windowW >= 900), + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 0), + child: _gridCard(context), + ), + const Divider(height: 24), + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: _rightPanel(), + ), + ], + ), + ); + } + + // ── Medium/wide ≥ 910px: right panel fijo a la derecha ──────────────── + return Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ..._leftContents(context, sideBySide: true), + Expanded( + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: _gridCard(context), + ), + ), + ], + ), + ), + VerticalDivider( + width: 1, + color: Theme.of(context).colorScheme.outlineVariant, + ), + SizedBox(width: 300, child: _rightPanel()), + ], + ); + }); + } +} + +// ── Celebration banner ──────────────────────────────────────────────────────── + +class _CelebrationBanner extends StatelessWidget { + final String text; + const _CelebrationBanner({required this.text}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Container( + margin: const EdgeInsets.fromLTRB(16, 12, 16, 0), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + decoration: BoxDecoration( + color: cs.primaryContainer, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + Icon(Icons.info_outline, size: 18, color: cs.primary), + const SizedBox(width: 8), + Expanded( + child: Text( + 'Celebraciones de hoy: $text', + style: TextStyle(color: cs.onPrimaryContainer, fontSize: 13), + ), + ), + ], + ), + ); + } +} + +// ── Calendar card ───────────────────────────────────────────────────────────── + +class _CalendarCard extends StatelessWidget { + final DateTime selectedDate; + final void Function(DateTime) onDateChanged; + + const _CalendarCard({ + required this.selectedDate, + required this.onDateChanged, + }); + + @override + Widget build(BuildContext context) { + return Card.outlined( + child: Padding( + padding: const EdgeInsets.all(8), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: Text('Fecha', + style: Theme.of(context).textTheme.labelMedium?.copyWith( + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold)), + ), + SizedBox( + width: 280, + child: CalendarDatePicker( + initialDate: selectedDate, + firstDate: DateTime(2020), + lastDate: DateTime(2030), + onDateChanged: onDateChanged, + ), + ), + ], + ), + ), + ); + } +} + +// ── Activity card ───────────────────────────────────────────────────────────── + +class _ActivityCard extends StatelessWidget { + final List activities; + final BookingActivity? selected; + final void Function(BookingActivity) onSelected; + + const _ActivityCard({ + required this.activities, + required this.selected, + required this.onSelected, + }); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + + return Card.outlined( + child: Padding( + padding: const EdgeInsets.all(8), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2), + child: Text('Actividad', + style: Theme.of(context).textTheme.labelMedium?.copyWith( + color: cs.primary, fontWeight: FontWeight.bold)), + ), + const SizedBox(height: 4), + ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: activities.length, + itemBuilder: (context, i) { + final a = activities[i]; + final isSelected = a.id == selected?.id; + return InkWell( + onTap: () => onSelected(a), + borderRadius: BorderRadius.circular(4), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 7), + decoration: BoxDecoration( + color: isSelected ? cs.primaryContainer : null, + borderRadius: BorderRadius.circular(4), + ), + child: Text( + a.name, + style: TextStyle( + fontSize: 13, + fontWeight: isSelected ? FontWeight.bold : null, + color: isSelected ? cs.onPrimaryContainer : null, + ), + ), + ), + ); + }, + ), + ], + ), + ), + ); + } +} + +// ── Activity dropdown (compact, for narrow screens) ─────────────────────────── + +class _ActivityDropdown extends StatelessWidget { + final List activities; + final BookingActivity? selected; + final void Function(BookingActivity) onSelected; + + const _ActivityDropdown({ + required this.activities, + required this.selected, + required this.onSelected, + }); + + @override + Widget build(BuildContext context) { + if (activities.isEmpty) return const SizedBox.shrink(); + final cs = Theme.of(context).colorScheme; + + return DropdownButtonFormField( + initialValue: selected, + decoration: InputDecoration( + labelText: 'Actividad', + labelStyle: TextStyle(color: cs.primary, fontWeight: FontWeight.bold), + isDense: true, + border: const OutlineInputBorder(), + contentPadding: + const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + ), + items: activities + .map((a) => DropdownMenuItem(value: a, child: Text(a.name))) + .toList(), + onChanged: (a) { if (a != null) onSelected(a); }, + ); + } +} + +// ── Grid view ───────────────────────────────────────────────────────────────── + +class _GridView extends StatelessWidget { + final BookingGrid grid; + final double availableWidth; + final ({int row, int court})? selectedCell; + final void Function(int row, int court, BookingCell cell) onCellTap; + + const _GridView({ + required this.grid, + required this.availableWidth, + required this.selectedCell, + required this.onCellTap, + }); + + /// Compute court cell width so all courts fill [availableWidth]. + /// Falls back to [_kCourtW] if available space is too narrow. + double _courtWidth() { + final numCourts = grid.courtTitles.length; + if (numCourts == 0) return _kCourtW; + final remaining = availableWidth - _kSlotW; + final expanded = remaining / numCourts; + return expanded >= _kCourtW ? expanded : _kCourtW; + } + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final courtW = _courtWidth(); + final totalW = _kSlotW + courtW * grid.courtTitles.length; + final needsHScroll = totalW > availableWidth; + + Widget content = Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Header row + Row( + children: [ + _headerCell('Horarios', _kSlotW, cs), + ...grid.courtTitles.map( + (t) => _headerCell(t, courtW, cs), + ), + ], + ), + // Data rows + ...grid.rows.asMap().entries.map((e) { + final rowIdx = e.key; + final row = e.value; + final isOdd = rowIdx.isOdd; + + return Row( + children: [ + // Time slot cell + Container( + width: _kSlotW, + height: _kRowH, + color: isOdd + ? cs.surfaceContainerLow + : cs.surfaceContainerLowest, + alignment: Alignment.centerLeft, + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Text(row.timeLabel, + style: const TextStyle( + fontSize: 12, fontWeight: FontWeight.w500)), + ), + // Court cells + ...row.cells.asMap().entries.map((ce) { + final courtIdx = ce.key + 1; // 1-based + final cell = ce.value; + final isSelected = selectedCell?.row == rowIdx && + selectedCell?.court == courtIdx; + + return _GridCell( + cell: cell, + width: courtW, + isSelected: isSelected, + isOdd: isOdd, + onTap: () => onCellTap(rowIdx, courtIdx, cell), + ); + }), + ], + ); + }), + ], + ); + + if (needsHScroll) { + content = SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: content, + ); + } + + return SingleChildScrollView( + scrollDirection: Axis.vertical, + child: content, + ); + } + + Widget _headerCell(String title, double width, ColorScheme cs) { + return Container( + width: width, + height: _kHeaderH, + color: cs.surfaceContainerHigh, + alignment: Alignment.center, + child: Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: cs.onSurface, + ), + ), + ); + } +} + +class _GridCell extends StatelessWidget { + final BookingCell cell; + final double width; + final bool isSelected; + final bool isOdd; + final VoidCallback onTap; + + const _GridCell({ + required this.cell, + required this.width, + required this.isSelected, + required this.isOdd, + required this.onTap, + }); + + Color _bgColor(BuildContext context) { + final cs = Theme.of(context).colorScheme; + if (cell.isPaid) return Colors.green.shade400; + if (cell.isBooked) return Colors.red.shade400; + return isOdd ? cs.surfaceContainerLow : cs.surfaceContainerLowest; + } + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + + return GestureDetector( + onTap: onTap, + child: Container( + width: width, + height: _kRowH, + decoration: BoxDecoration( + color: _bgColor(context), + border: isSelected + ? Border.all(color: cs.primary, width: 2) + : Border.all(color: cs.outlineVariant.withValues(alpha: 0.3)), + ), + alignment: Alignment.center, + child: cell.isBooked + ? Text( + cell.raw, + style: const TextStyle( + fontSize: 11, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + overflow: TextOverflow.ellipsis, + ) + : null, + ), + ); + } +} + +// ── Right panel ─────────────────────────────────────────────────────────────── + +class _RightPanel extends StatelessWidget { + final BookingDetail? detail; + final bool detailLoading; + final void Function(String) onAction; + + const _RightPanel({ + required this.detail, + required this.detailLoading, + required this.onAction, + }); + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _ActionButtons(onAction: onAction), + const SizedBox(height: 12), + const Divider(height: 1), + const SizedBox(height: 12), + if (detailLoading) + const Center( + child: Padding( + padding: EdgeInsets.all(24), + child: CircularProgressIndicator(), + )) + else if (detail == null) + _EmptyDetailPanel() + else + _TicketPanel(detail: detail!), + ], + ), + ); + } +} + +// ── Action buttons ──────────────────────────────────────────────────────────── + +class _ActionButtons extends StatelessWidget { + final void Function(String) onAction; + const _ActionButtons({required this.onAction}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + + return Column( + children: [ + // Row 1: booking actions + print actions + Row( + children: [ + // Left group: booking ops + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + _ActionIcon( + icon: Icons.person_add_outlined, + tooltip: 'Añadir suplemento', + onTap: () => onAction('supplement'), + ), + _ActionIcon( + icon: Icons.lightbulb_outline, + tooltip: 'Añadir luz', + onTap: () => onAction('light'), + ), + _ActionIcon( + icon: Icons.point_of_sale_outlined, + tooltip: 'Cobrar', + onTap: () => onAction('charge'), + ), + ], + ), + ), + Container( + width: 1, height: 36, color: cs.outlineVariant), + // Right group: print/cancel + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + _ActionIcon( + icon: Icons.print_outlined, + tooltip: 'Imprimir ticket', + onTap: () => onAction('print'), + ), + _ActionIcon( + icon: Icons.undo, + tooltip: 'Devolver', + onTap: () => onAction('return'), + color: cs.error, + ), + _ActionIcon( + icon: Icons.qr_code_2, + tooltip: 'Imprimir QR', + onTap: () => onAction('qr_print'), + ), + ], + ), + ), + ], + ), + + const SizedBox(height: 8), + + // Row 2: QR + payment methods + Row( + children: [ + // QR button + Padding( + padding: const EdgeInsets.only(left: 8), + child: _ActionIcon( + icon: Icons.qr_code, + tooltip: 'QR', + onTap: () => onAction('qr'), + size: 40, + ), + ), + const Spacer(), + // Payment buttons + _PayButton( + label: 'Efectivo', + color: Colors.green.shade600, + icon: Icons.payments_outlined, + onTap: () => onAction('cash'), + ), + const SizedBox(width: 6), + _PayButton( + label: 'Tarjeta', + color: Colors.amber.shade700, + icon: Icons.credit_card, + onTap: () => onAction('card'), + ), + const SizedBox(width: 6), + _PayButton( + label: 'Bizum', + color: Colors.teal.shade600, + icon: Icons.phone_android, + onTap: () => onAction('bizum'), + ), + const SizedBox(width: 8), + ], + ), + ], + ); + } +} + +class _ActionIcon extends StatelessWidget { + final IconData icon; + final String tooltip; + final VoidCallback onTap; + final Color? color; + final double size; + + const _ActionIcon({ + required this.icon, + required this.tooltip, + required this.onTap, + this.color, + this.size = 36, + }); + + @override + Widget build(BuildContext context) { + return Tooltip( + message: tooltip, + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(6), + child: Container( + width: size, + height: size, + decoration: BoxDecoration( + border: Border.all( + color: Theme.of(context).colorScheme.outlineVariant), + borderRadius: BorderRadius.circular(6), + ), + child: Icon(icon, + size: 20, color: color ?? Theme.of(context).colorScheme.onSurface), + ), + ), + ); + } +} + +class _PayButton extends StatelessWidget { + final String label; + final Color color; + final IconData icon; + final VoidCallback onTap; + + const _PayButton({ + required this.label, + required this.color, + required this.icon, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return Tooltip( + message: label, + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(6), + child: Container( + width: 52, + height: 36, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(6), + ), + child: Icon(icon, size: 20, color: Colors.white), + ), + ), + ); + } +} + +// ── Ticket panel ────────────────────────────────────────────────────────────── + +class _EmptyDetailPanel extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _FieldBox(label: 'Concepto', value: ''), + const SizedBox(height: 10), + Row( + children: [ + Expanded(child: _FieldBox(label: 'Base imponible', value: '0,00')), + const SizedBox(width: 8), + Expanded(child: _FieldBox(label: 'I.V.A.', value: '0,00')), + ], + ), + const SizedBox(height: 10), + _FieldBox(label: 'Total', value: '0,00'), + const SizedBox(height: 12), + Text('Fecha reserva: —', + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.outline)), + const SizedBox(height: 8), + _LineItemsHeader(), + ], + ); + } +} + +class _TicketPanel extends StatelessWidget { + final BookingDetail detail; + const _TicketPanel({required this.detail}); + + @override + Widget build(BuildContext context) { + final t = detail.ticket; + final cs = Theme.of(context).colorScheme; + + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _FieldBox(label: 'Concepto', value: t?.concepto ?? '—'), + const SizedBox(height: 10), + Row( + children: [ + Expanded( + child: _FieldBox( + label: 'Base imponible', + value: t != null ? _fmtMoney(t.base) : '—')), + const SizedBox(width: 8), + Expanded( + child: _FieldBox( + label: 'I.V.A.', + value: t != null ? _fmtMoney(t.iva) : '—')), + ], + ), + const SizedBox(height: 10), + _FieldBox( + label: 'Total', + value: t != null ? _fmtMoney(t.total) : '—', + highlight: true), + const SizedBox(height: 12), + Row( + children: [ + Text('Fecha reserva: ', + style: TextStyle(fontSize: 12, color: cs.outline)), + Text(detail.date, + style: const TextStyle( + fontSize: 12, fontWeight: FontWeight.w500)), + const Spacer(), + if (detail.paid) + Chip( + label: const Text('Pagada', + style: TextStyle(fontSize: 11, color: Colors.white)), + backgroundColor: Colors.green.shade600, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ) + else + Chip( + label: Text('Pendiente', + style: TextStyle( + fontSize: 11, color: cs.onErrorContainer)), + backgroundColor: cs.errorContainer, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + ], + ), + const SizedBox(height: 8), + _LineItemsHeader(), + if (t != null) + ...t.lines.map((line) => Padding( + padding: const EdgeInsets.symmetric(vertical: 3), + child: Row( + children: [ + Expanded( + child: Text(line.concepto, + style: const TextStyle(fontSize: 12))), + Text(_fmtMoney(line.precio), + style: const TextStyle( + fontSize: 12, fontWeight: FontWeight.w500)), + ], + ), + )), + ], + ); + } +} + +class _LineItemsHeader extends StatelessWidget { + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Container( + padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 0), + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: cs.outlineVariant)), + ), + child: Row( + children: [ + Expanded( + child: Text('Concepto', + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.bold, + color: cs.outline))), + Text('Precio', + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.bold, + color: cs.outline)), + ], + ), + ); + } +} + +class _FieldBox extends StatelessWidget { + final String label; + final String value; + final bool highlight; + + const _FieldBox({ + required this.label, + required this.value, + this.highlight = false, + }); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(label, + style: TextStyle( + fontSize: 11, + color: cs.outline, + fontWeight: FontWeight.w500)), + const SizedBox(height: 3), + Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), + decoration: BoxDecoration( + color: highlight ? cs.primaryContainer : cs.surfaceContainerLow, + borderRadius: BorderRadius.circular(6), + border: Border.all(color: cs.outlineVariant), + ), + child: Text( + value, + style: TextStyle( + fontSize: 13, + fontWeight: highlight ? FontWeight.bold : null, + color: highlight ? cs.onPrimaryContainer : null, + ), + ), + ), + ], + ); + } +} + +// ── Helpers ─────────────────────────────────────────────────────────────────── + +String _fmtDate(DateTime d) => + '${d.day.toString().padLeft(2, '0')}/${d.month.toString().padLeft(2, '0')}/${d.year}'; + +String _fmtMoney(double v) => + '${v.toStringAsFixed(2).replaceAll('.', ',')} €'; diff --git a/lib/screens/dashboard/dashboard_screen.dart b/lib/screens/dashboard/dashboard_screen.dart new file mode 100644 index 0000000..c6205e7 --- /dev/null +++ b/lib/screens/dashboard/dashboard_screen.dart @@ -0,0 +1,186 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +class DashboardScreen extends StatelessWidget { + const DashboardScreen({super.key}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final tt = Theme.of(context).textTheme; + + return SingleChildScrollView( + padding: const EdgeInsets.all(32), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Inicio', + style: tt.headlineMedium?.copyWith(fontWeight: FontWeight.bold), + ), + const SizedBox(height: 4), + Text( + 'Accesos rápidos', + style: tt.bodyLarge?.copyWith(color: cs.onSurfaceVariant), + ), + const SizedBox(height: 32), + _QuickAccessGrid(), + ], + ), + ); + } +} + +// ── Grid de accesos rápidos ─────────────────────────────────────────────── + +class _QuickAccessGrid extends StatelessWidget { + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, constraints) { + final columns = constraints.maxWidth >= 900 ? 4 : 2; + final spacing = 16.0; + final cardWidth = + (constraints.maxWidth - spacing * (columns - 1)) / columns; + + return Wrap( + spacing: spacing, + runSpacing: spacing, + children: _kShortcuts + .map((s) => SizedBox( + width: cardWidth, + child: _ShortcutCard(shortcut: s), + )) + .toList(), + ); + }, + ); + } +} + +// ── Tarjeta individual ──────────────────────────────────────────────────── + +class _ShortcutCard extends StatelessWidget { + final _Shortcut shortcut; + + const _ShortcutCard({required this.shortcut}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final tt = Theme.of(context).textTheme; + + final bgColor = shortcut.color.resolve(cs); + final fgColor = shortcut.foreground.resolve(cs); + + return Card( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + side: BorderSide(color: cs.outlineVariant), + ), + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: () => context.go(shortcut.route), + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 52, + height: 52, + decoration: BoxDecoration( + color: bgColor, + borderRadius: BorderRadius.circular(14), + ), + child: Icon(shortcut.icon, color: fgColor, size: 26), + ), + const SizedBox(height: 20), + Text( + shortcut.title, + style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600), + ), + const SizedBox(height: 4), + Text( + shortcut.subtitle, + style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant), + ), + ], + ), + ), + ), + ); + } +} + +// ── Datos ───────────────────────────────────────────────────────────────── + +class _Shortcut { + final String title; + final String subtitle; + final IconData icon; + final String route; + final _SchemeColor color; + final _SchemeColor foreground; + + const _Shortcut({ + required this.title, + required this.subtitle, + required this.icon, + required this.route, + required this.color, + required this.foreground, + }); +} + +/// Referencia indirecta a un color del ColorScheme para evitar context en const. +class _SchemeColor { + final Color Function(ColorScheme) resolve; + const _SchemeColor(this.resolve); +} + +const _kShortcuts = [ + _Shortcut( + title: 'Abonados', + subtitle: 'Gestionar abonados del club', + icon: Icons.people_outlined, + route: '/abonados', + color: _SchemeColor(_primary), + foreground: _SchemeColor(_onPrimary), + ), + _Shortcut( + title: 'Reservas', + subtitle: 'Reservas de pistas', + icon: Icons.sports_tennis_outlined, + route: '/reservas', + color: _SchemeColor(_secondary), + foreground: _SchemeColor(_onSecondary), + ), + _Shortcut( + title: 'Recibos', + subtitle: 'Recibos por abonado', + icon: Icons.receipt_long_outlined, + route: '/recibos/abonado', + color: _SchemeColor(_tertiary), + foreground: _SchemeColor(_onTertiary), + ), + _Shortcut( + title: 'Caja', + subtitle: 'Movimientos y cobros', + icon: Icons.point_of_sale_outlined, + route: '/caja', + color: _SchemeColor(_error), + foreground: _SchemeColor(_onError), + ), +]; + +// Funciones top-level para poder usarlas en const +Color _primary(ColorScheme cs) => cs.primaryContainer; +Color _onPrimary(ColorScheme cs) => cs.onPrimaryContainer; +Color _secondary(ColorScheme cs) => cs.secondaryContainer; +Color _onSecondary(ColorScheme cs) => cs.onSecondaryContainer; +Color _tertiary(ColorScheme cs) => cs.tertiaryContainer; +Color _onTertiary(ColorScheme cs) => cs.onTertiaryContainer; +Color _error(ColorScheme cs) => cs.errorContainer; +Color _onError(ColorScheme cs) => cs.onErrorContainer; diff --git a/lib/screens/login/login_screen.dart b/lib/screens/login/login_screen.dart new file mode 100644 index 0000000..0413795 --- /dev/null +++ b/lib/screens/login/login_screen.dart @@ -0,0 +1,197 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import '../../services/auth_service.dart'; + +class LoginScreen extends StatefulWidget { + const LoginScreen({super.key}); + + @override + State createState() => _LoginScreenState(); +} + +class _LoginScreenState extends State { + final _formKey = GlobalKey(); + final _emailCtrl = TextEditingController(); + final _passCtrl = TextEditingController(); + final _authService = AuthService(); + + bool _loading = false; + bool _obscurePass = true; + + @override + void dispose() { + _emailCtrl.dispose(); + _passCtrl.dispose(); + super.dispose(); + } + + Future _submit() async { + if (!_formKey.currentState!.validate()) return; + + setState(() => _loading = true); + + final error = await _authService.login( + _emailCtrl.text.trim(), + _passCtrl.text, + ); + + if (!mounted) return; + setState(() => _loading = false); + + if (error != null) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(error), + behavior: SnackBarBehavior.floating, + backgroundColor: Theme.of(context).colorScheme.error, + ), + ); + } else { + context.go('/dashboard'); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Theme.of(context).colorScheme.surfaceContainerLowest, + body: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.all(24), + child: ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 420), + child: Card( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(24), + side: BorderSide( + color: Theme.of(context).colorScheme.outlineVariant, + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 36, + vertical: 48, + ), + child: Form( + key: _formKey, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + // Logo / título + Icon( + Icons.sports, + size: 56, + color: Theme.of(context).colorScheme.primary, + ), + const SizedBox(height: 16), + Text( + 'DeporOS', + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .headlineMedium + ?.copyWith( + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.primary, + ), + ), + const SizedBox(height: 8), + Text( + 'Panel de administración', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context) + .colorScheme + .onSurfaceVariant, + ), + ), + const SizedBox(height: 40), + + // Email + TextFormField( + controller: _emailCtrl, + keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email_outlined), + border: OutlineInputBorder(), + ), + validator: (v) { + if (v == null || v.trim().isEmpty) { + return 'Introduce tu email'; + } + if (!v.contains('@')) return 'Email no válido'; + return null; + }, + ), + const SizedBox(height: 16), + + // Contraseña + TextFormField( + controller: _passCtrl, + obscureText: _obscurePass, + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) => _submit(), + decoration: InputDecoration( + labelText: 'Contraseña', + prefixIcon: const Icon(Icons.lock_outlined), + border: const OutlineInputBorder(), + suffixIcon: IconButton( + icon: Icon( + _obscurePass + ? Icons.visibility_outlined + : Icons.visibility_off_outlined, + ), + onPressed: () => + setState(() => _obscurePass = !_obscurePass), + ), + ), + validator: (v) { + if (v == null || v.isEmpty) { + return 'Introduce tu contraseña'; + } + return null; + }, + ), + const SizedBox(height: 32), + + // Botón entrar + FilledButton( + onPressed: _loading ? null : _submit, + style: FilledButton.styleFrom( + minimumSize: const Size.fromHeight(52), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ), + child: _loading + ? const SizedBox( + height: 22, + width: 22, + child: CircularProgressIndicator( + strokeWidth: 2.5, + color: Colors.white, + ), + ) + : const Text( + 'Entrar', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/members/members_screen.dart b/lib/screens/members/members_screen.dart new file mode 100644 index 0000000..0f66193 --- /dev/null +++ b/lib/screens/members/members_screen.dart @@ -0,0 +1,970 @@ +import 'package:flutter/material.dart'; +import '../../core/service_locator.dart'; +import '../../models/member.dart'; +import '../../services/member_repository.dart'; + +class MembersScreen extends StatefulWidget { + const MembersScreen({super.key}); + + @override + State createState() => _MembersScreenState(); +} + +class _MembersScreenState extends State { + final _service = memberRepository(); + Member? _member; + bool _loading = true; + String? _error; + + @override + void initState() { + super.initState(); + _load(_service.first()); + } + + void _handleAction(String action) { + final labels = { + 'receipts': 'Recibos anteriores — pendiente de implementar', + 'edit': 'Editar abonado — pendiente de implementar', + 'add_family': 'Añadir familiar — pendiente de implementar', + 'retain': 'Retener abonado — pendiente de implementar', + 'unregister': 'Dar de baja — pendiente de implementar', + }; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(labels[action] ?? action), duration: const Duration(seconds: 2)), + ); + } + + Future _load(Future future) async { + setState(() { + _loading = true; + _error = null; + }); + try { + final m = await future; + setState(() { + _member = m; + _loading = false; + }); + } catch (e) { + setState(() { + _error = e.toString(); + _loading = false; + }); + } + } + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _NavBar( + member: _member, + loading: _loading, + service: _service, + onFirst: () => _load(_service.first()), + onPrev: () { + if (_member != null) _load(_service.prev(_member!.id)); + }, + onNext: () { + if (_member != null) _load(_service.next(_member!.id)); + }, + onLast: () => _load(_service.last()), + onSearch: (id) => _load(_service.show(id)), + onAction: _handleAction, + ), + const Divider(height: 1), + Expanded( + child: _loading + ? const Center(child: CircularProgressIndicator()) + : _error != null + ? _ErrorView(error: _error!) + : _member == null + ? const Center(child: Text('Sin datos')) + : _MemberBody(member: _member!), + ), + ], + ); + } +} + +// ── Nav bar ────────────────────────────────────────────────────────────────── + +class _NavBar extends StatelessWidget { + final Member? member; + final bool loading; + final MemberRepository service; + final VoidCallback onFirst, onPrev, onNext, onLast; + final void Function(int id) onSearch; + final void Function(String action) onAction; + + const _NavBar({ + required this.member, + required this.loading, + required this.service, + required this.onFirst, + required this.onPrev, + required this.onNext, + required this.onLast, + required this.onSearch, + required this.onAction, + }); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final disabled = loading || member == null; + + return Container( + color: cs.surfaceContainerLow, + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: Row( + children: [ + Expanded( + child: _MemberSearch(service: service, onSelected: onSearch), + ), + const SizedBox(width: 4), + IconButton( + icon: const Icon(Icons.first_page), + onPressed: loading ? null : onFirst, + tooltip: 'Primero', + ), + IconButton( + icon: const Icon(Icons.chevron_left), + onPressed: loading ? null : onPrev, + tooltip: 'Anterior', + ), + IconButton( + icon: const Icon(Icons.chevron_right), + onPressed: loading ? null : onNext, + tooltip: 'Siguiente', + ), + IconButton( + icon: const Icon(Icons.last_page), + onPressed: loading ? null : onLast, + tooltip: 'Último', + ), + const VerticalDivider(width: 16, indent: 8, endIndent: 8), + PopupMenuButton( + icon: const Icon(Icons.more_vert), + tooltip: 'Acciones', + enabled: !disabled, + onSelected: onAction, + itemBuilder: (context) => [ + const PopupMenuItem( + value: 'receipts', + child: ListTile( + leading: Icon(Icons.receipt_long_outlined), + title: Text('Recibos anteriores'), + dense: true, + ), + ), + const PopupMenuItem( + value: 'edit', + child: ListTile( + leading: Icon(Icons.edit_outlined), + title: Text('Editar abonado'), + dense: true, + ), + ), + const PopupMenuItem( + value: 'add_family', + child: ListTile( + leading: Icon(Icons.person_add_outlined), + title: Text('Añadir familiar'), + dense: true, + ), + ), + const PopupMenuItem( + value: 'retain', + child: ListTile( + leading: Icon(Icons.pause_circle_outline), + title: Text('Retener abonado'), + dense: true, + ), + ), + const PopupMenuDivider(), + PopupMenuItem( + value: 'unregister', + child: ListTile( + leading: Icon(Icons.person_remove_outlined, + color: cs.error), + title: Text('Dar de baja', + style: TextStyle(color: cs.error)), + dense: true, + ), + ), + ], + ), + ], + ), + ); + } +} + +class _MemberSearch extends StatefulWidget { + final MemberRepository service; + final void Function(int id) onSelected; + + const _MemberSearch({required this.service, required this.onSelected}); + + @override + State<_MemberSearch> createState() => _MemberSearchState(); +} + +class _MemberSearchState extends State<_MemberSearch> { + @override + Widget build(BuildContext context) { + return Autocomplete>( + displayStringForOption: (entry) => entry.value, + optionsBuilder: (textValue) async { + if (textValue.text.length < 2) return const []; + final results = await widget.service.search(textValue.text); + return results.entries.toList(); + }, + onSelected: (entry) { + // key format: 5-digit member_id + 2-digit family index + final memberId = int.parse(entry.key.substring(0, entry.key.length - 2)); + widget.onSelected(memberId); + }, + fieldViewBuilder: (context, controller, focusNode, onSubmit) { + return TextField( + controller: controller, + focusNode: focusNode, + decoration: const InputDecoration( + hintText: 'Buscar abonado...', + prefixIcon: Icon(Icons.search), + isDense: true, + border: OutlineInputBorder(), + contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 10), + ), + ); + }, + optionsViewBuilder: (context, onSelected, options) { + return Align( + alignment: Alignment.topLeft, + child: Material( + elevation: 4, + borderRadius: BorderRadius.circular(8), + child: ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 400, maxHeight: 280), + child: ListView.builder( + shrinkWrap: true, + itemCount: options.length, + itemBuilder: (context, i) { + final entry = options.elementAt(i); + return ListTile( + dense: true, + title: Text(entry.value), + onTap: () => onSelected(entry), + ); + }, + ), + ), + ), + ); + }, + ); + } +} + +// ── Error ───────────────────────────────────────────────────────────────────── + +class _ErrorView extends StatelessWidget { + final String error; + const _ErrorView({required this.error}); + + @override + Widget build(BuildContext context) { + return Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.error_outline, + size: 48, color: Theme.of(context).colorScheme.error), + const SizedBox(height: 8), + Text(error, + style: TextStyle(color: Theme.of(context).colorScheme.error)), + ], + ), + ); + } +} + +// ── Member body ─────────────────────────────────────────────────────────────── + +class _MemberBody extends StatelessWidget { + final Member member; + const _MemberBody({required this.member}); + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + LayoutBuilder(builder: (context, constraints) { + if (constraints.maxWidth >= 700) { + return IntrinsicHeight( + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded(flex: 2, child: _InfoCard(member: member)), + const SizedBox(width: 12), + Expanded(flex: 3, child: _CommentsCard(member: member)), + ], + ), + ); + } + return Column( + children: [ + _InfoCard(member: member), + const SizedBox(height: 12), + _CommentsCard(member: member), + ], + ); + }), + const SizedBox(height: 12), + _FamiliarsCard(people: member.people), + const SizedBox(height: 12), + _FichaCard(member: member), + ], + ), + ); + } +} + +// ── Info card ───────────────────────────────────────────────────────────────── + +class _InfoCard extends StatelessWidget { + final Member member; + const _InfoCard({required this.member}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + + return Card.outlined( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Información', style: Theme.of(context).textTheme.titleMedium), + const Divider(height: 20), + + // Fila principal: Número | Fecha alta | Tipo+Estado | Cuota + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Número + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Número', + style: Theme.of(context) + .textTheme + .labelSmall + ?.copyWith(color: cs.outline)), + Text(member.formattedId, + style: Theme.of(context).textTheme.headlineSmall), + ], + ), + const SizedBox(width: 20), + + // Fecha de alta + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Fecha de alta', + style: Theme.of(context) + .textTheme + .labelSmall + ?.copyWith(color: cs.outline)), + Text(_fmtDate(member.regDate), + style: Theme.of(context).textTheme.bodyLarge), + ], + ), + const SizedBox(width: 20), + + // Tipo + Estado + Expanded( + child: Wrap( + spacing: 6, + runSpacing: 6, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + if (member.type.isNotEmpty) _TypeChip(label: member.type), + member.isActive + ? _StatusChip( + label: 'Activo', + color: Colors.green, + icon: Icons.check_circle_outline) + : _StatusChip( + label: 'Baja', + color: cs.error, + icon: Icons.cancel_outlined), + if (member.retenido) + _StatusChip( + label: 'Retenido', + color: Colors.orange, + icon: Icons.pause_circle_outline), + if (member.remSpecial) + _StatusChip( + label: 'Remesa especial', + color: cs.primary, + icon: Icons.star_outline), + ], + ), + ), + + // Cuota + if (member.fee != null) ...[ + const SizedBox(width: 20), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text('Cuota', + style: Theme.of(context) + .textTheme + .labelSmall + ?.copyWith(color: cs.outline)), + Text( + '${member.fee!.toStringAsFixed(2)} €', + style: Theme.of(context) + .textTheme + .titleMedium + ?.copyWith(color: cs.primary), + ), + ], + ), + ], + ], + ), + + const SizedBox(height: 14), + + // Franjas de años + _YearStrips(), + + // Info de baja si está dado de baja + if (!member.isActive && member.unregDate != null) ...[ + const SizedBox(height: 12), + _InfoRow(label: 'Fecha de baja', value: _fmtDate(member.unregDate)), + if (member.unregReason.isNotEmpty) + _InfoRow(label: 'Motivo', value: member.unregReason), + ], + ], + ), + ), + ); + } +} + +// ── Year strips ─────────────────────────────────────────────────────────────── + +enum _MonthStatus { unknown, paid, unpaid } + +class _YearStrips extends StatelessWidget { + /// year → month(1–12) → status. Si está vacío todos los meses son amarillo. + final Map> data; + + const _YearStrips({this.data = const {}}); + + static const _months = [ + 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', + 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic', + ]; + + @override + Widget build(BuildContext context) { + final now = DateTime.now(); + final years = [now.year - 1, now.year, now.year + 1, now.year + 2]; + + return Column( + children: years.map((year) { + final yearData = data[year] ?? {}; + return Padding( + padding: const EdgeInsets.only(bottom: 3), + child: Row( + children: [ + SizedBox( + width: 34, + child: Text('$year', + style: TextStyle( + fontSize: 10, + color: Theme.of(context).colorScheme.outline)), + ), + ...List.generate(12, (i) { + final status = yearData[i + 1] ?? _MonthStatus.unknown; + return Expanded(child: _MonthCell(month: _months[i], status: status)); + }), + ], + ), + ); + }).toList(), + ); + } +} + +class _MonthCell extends StatelessWidget { + final String month; + final _MonthStatus status; + const _MonthCell({required this.month, required this.status}); + + Color _bg(BuildContext context) => switch (status) { + _MonthStatus.paid => Colors.green.shade400, + _MonthStatus.unpaid => Theme.of(context).colorScheme.error, + _MonthStatus.unknown => Colors.amber.shade400, + }; + + @override + Widget build(BuildContext context) { + return Container( + height: 20, + margin: const EdgeInsets.only(right: 2), + decoration: BoxDecoration( + color: _bg(context), + borderRadius: BorderRadius.circular(3), + ), + alignment: Alignment.center, + child: Text( + month, + style: const TextStyle( + fontSize: 8, + color: Colors.white, + fontWeight: FontWeight.w700, + height: 1), + ), + ); + } +} + +class _TypeChip extends StatelessWidget { + final String label; + const _TypeChip({required this.label}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Chip( + label: Text(label, + style: TextStyle( + color: cs.onPrimaryContainer, + fontWeight: FontWeight.bold, + fontSize: 12)), + backgroundColor: cs.primaryContainer, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ); + } +} + +class _StatusChip extends StatelessWidget { + final String label; + final Color color; + final IconData icon; + const _StatusChip( + {required this.label, required this.color, required this.icon}); + + @override + Widget build(BuildContext context) { + return Chip( + avatar: Icon(icon, size: 16, color: color), + label: Text(label, + style: TextStyle(fontSize: 12, color: color)), + side: BorderSide(color: color.withValues(alpha: 0.4)), + backgroundColor: color.withValues(alpha: 0.08), + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ); + } +} + +// ── Comments card ───────────────────────────────────────────────────────────── + +class _CommentsCard extends StatelessWidget { + final Member member; + const _CommentsCard({required this.member}); + + bool get _hasContent => + member.comment.isNotEmpty || + member.comment2.isNotEmpty || + member.comments.isNotEmpty; + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + + return Card.outlined( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Comentarios', + style: Theme.of(context).textTheme.titleMedium), + const Divider(height: 20), + if (!_hasContent) + Text('Sin comentarios', + style: TextStyle(color: cs.outline, fontSize: 13)) + else ...[ + if (member.comment.isNotEmpty) + _CommentBubble( + text: member.comment, label: 'Nota heredada', legacy: true), + if (member.comment2.isNotEmpty) + _CommentBubble(text: member.comment2, label: 'Nota interna'), + ...member.comments.map((c) => _CommentBubble( + text: c.comment, + label: _fmtDate(c.createdAt), + )), + ], + ], + ), + ), + ); + } +} + +class _CommentBubble extends StatelessWidget { + final String text; + final String label; + final bool legacy; + + const _CommentBubble( + {required this.text, required this.label, this.legacy = false}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Container( + margin: const EdgeInsets.only(bottom: 8), + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: legacy + ? cs.errorContainer.withValues(alpha: 0.4) + : cs.surfaceContainerHigh, + borderRadius: BorderRadius.circular(8), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(label, + style: TextStyle( + fontSize: 11, + color: cs.outline, + fontWeight: FontWeight.w500)), + const SizedBox(height: 4), + Text(text, style: const TextStyle(fontSize: 13)), + ], + ), + ); + } +} + +// ── Familiars card ──────────────────────────────────────────────────────────── + +class _FamiliarsCard extends StatelessWidget { + final List people; + const _FamiliarsCard({required this.people}); + + @override + Widget build(BuildContext context) { + return Card.outlined( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Familiares asociados', + style: Theme.of(context).textTheme.titleMedium), + const Divider(height: 20), + if (people.isEmpty) + Text('Sin familiares', + style: TextStyle( + color: Theme.of(context).colorScheme.outline, + fontSize: 13)) + else + LayoutBuilder(builder: (context, constraints) { + return SizedBox( + width: constraints.maxWidth, + child: DataTable( + headingRowHeight: 36, + dataRowMinHeight: 52, + dataRowMaxHeight: 60, + columnSpacing: 12, + columns: const [ + DataColumn(label: Text('Foto')), + DataColumn(label: Text('FF')), + DataColumn(label: Text('Nombre')), + DataColumn(label: Text('DNI')), + DataColumn(label: Text('Móvil')), + DataColumn(label: Text('Email')), + DataColumn(label: Text('Fecha nac.')), + DataColumn(label: Tooltip(message: 'Acepta LOPD', child: Icon(Icons.privacy_tip_outlined, size: 16))), + DataColumn(label: Tooltip(message: 'Recibir noticias', child: Icon(Icons.mail_outline, size: 16))), + DataColumn(label: Tooltip(message: 'Cuestionario de salud', child: Icon(Icons.health_and_safety_outlined, size: 16))), + DataColumn(label: Tooltip(message: 'Autorización 1', child: Icon(Icons.verified_user_outlined, size: 16))), + DataColumn(label: Tooltip(message: 'Autorización 2', child: Icon(Icons.how_to_reg_outlined, size: 16))), + DataColumn(label: Text('')), + ], + rows: people.map((p) => _personRow(context, p)).toList(), + ), + ); + }), + ], + ), + ), + ); + } + + DataRow _personRow(BuildContext context, Person p) { + final cs = Theme.of(context).colorScheme; + final isPrincipal = p.family == 1; + + return DataRow(cells: [ + // Foto + DataCell( + p.photoPath != null + ? CircleAvatar( + radius: 18, + backgroundImage: NetworkImage(p.photoPath!), + ) + : CircleAvatar( + radius: 18, + backgroundColor: + isPrincipal ? cs.primary : cs.surfaceContainerHigh, + child: Text(p.initials, + style: TextStyle( + fontSize: 12, + color: isPrincipal ? cs.onPrimary : cs.onSurface)), + ), + ), + // FF — número de familiar + DataCell( + Tooltip( + message: isPrincipal ? 'Familiar principal' : 'Familiar ${p.family}', + child: Text( + p.family.toString(), + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.bold, + color: isPrincipal ? cs.primary : null, + ), + ), + ), + ), + DataCell(Text(p.fullName, style: const TextStyle(fontSize: 13))), + DataCell(Text(p.dni.isEmpty ? '—' : p.dni, style: const TextStyle(fontSize: 13))), + DataCell(Text(p.phone.isEmpty ? '—' : p.phone, style: const TextStyle(fontSize: 13))), + DataCell(Text(p.email.isEmpty ? '—' : p.email, style: const TextStyle(fontSize: 13))), + DataCell(Text(_fmtDate(p.birthDate.isEmpty ? null : p.birthDate), style: const TextStyle(fontSize: 13))), + DataCell(_BoolIcon(p.lopd, 'Acepta LOPD')), + DataCell(_BoolIcon(p.newsletter, 'Recibir noticias')), + DataCell(_BoolIcon(p.bHealth, 'Cuestionario de salud')), + DataCell(_BoolIcon(p.authorized, 'Autorización 1')), + DataCell(_BoolIcon(p.authorized2, 'Autorización 2')), + // Acciones + DataCell( + PopupMenuButton( + icon: const Icon(Icons.more_vert, size: 18), + tooltip: 'Acciones', + padding: EdgeInsets.zero, + onSelected: (value) { + // TODO: implementar acciones de familiar + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('$value — pendiente de implementar'), + duration: const Duration(seconds: 2), + ), + ); + }, + itemBuilder: (context) => [ + const PopupMenuItem( + value: 'edit', + child: ListTile(leading: Icon(Icons.edit_outlined), title: Text('Editar familiar'), dense: true), + ), + const PopupMenuItem( + value: 'photo', + child: ListTile(leading: Icon(Icons.camera_alt_outlined), title: Text('Tomar foto'), dense: true), + ), + const PopupMenuItem( + value: 'card', + child: ListTile(leading: Icon(Icons.badge_outlined), title: Text('Ver carnet'), dense: true), + ), + const PopupMenuItem( + value: 'password', + child: ListTile(leading: Icon(Icons.lock_reset_outlined), title: Text('Resetear contraseña'), dense: true), + ), + const PopupMenuDivider(), + PopupMenuItem( + value: 'delete', + child: ListTile( + leading: Icon(Icons.delete_outline, color: cs.error), + title: Text('Borrar familiar', style: TextStyle(color: cs.error)), + dense: true, + ), + ), + ], + ), + ), + ]); + } +} + +class _BoolIcon extends StatelessWidget { + final bool? value; + final String tooltip; + const _BoolIcon(this.value, this.tooltip); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + if (value == null) { + return Tooltip( + message: '$tooltip: desconocido', + child: Icon(Icons.help_outline, size: 18, color: cs.outlineVariant), + ); + } + return Tooltip( + message: '$tooltip: ${value! ? 'Sí' : 'No'}', + child: Icon( + value! ? Icons.check_circle : Icons.cancel, + size: 18, + color: value! ? Colors.green.shade600 : cs.error, + ), + ); + } +} + +// ── Ficha card ──────────────────────────────────────────────────────────────── + +class _FichaCard extends StatelessWidget { + final Member member; + const _FichaCard({required this.member}); + + @override + Widget build(BuildContext context) { + final hasBank = member.bank.isNotEmpty || member.bankAccount.isNotEmpty; + + return Card.outlined( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Ficha', style: Theme.of(context).textTheme.titleMedium), + const Divider(height: 20), + _SectionLabel('Contacto'), + const SizedBox(height: 8), + Wrap( + spacing: 32, + runSpacing: 8, + children: [ + _InfoRow( + label: 'Dirección', + value: member.address.isEmpty ? '—' : member.address), + _InfoRow( + label: 'Población', + value: member.city.isEmpty ? '—' : member.city), + _InfoRow( + label: 'C.P.', + value: member.zip.isEmpty ? '—' : member.zip), + _InfoRow( + label: 'Teléfono', + value: member.phone.isEmpty ? '—' : member.phone), + _InfoRow( + label: 'Email', + value: member.email.isEmpty ? '—' : member.email), + ], + ), + if (hasBank) ...[ + const SizedBox(height: 16), + _SectionLabel('Datos bancarios'), + const SizedBox(height: 8), + Wrap( + spacing: 32, + runSpacing: 8, + children: [ + _InfoRow( + label: 'Entidad', + value: member.bank.isEmpty ? '—' : member.bank), + _InfoRow( + label: 'Sucursal', + value: member.bankOffice.isEmpty + ? '—' + : member.bankOffice), + _InfoRow( + label: 'D.C.', + value: member.bankSecCode.isEmpty + ? '—' + : member.bankSecCode), + _InfoRow( + label: 'Cuenta', + value: member.bankAccount.isEmpty + ? '—' + : member.bankAccount), + if (member.bankName.isNotEmpty) + _InfoRow(label: 'Nombre', value: member.bankName), + if (member.mandate.isNotEmpty) + _InfoRow(label: 'Mandato SEPA', value: member.mandate), + ], + ), + ], + ], + ), + ), + ); + } +} + +class _SectionLabel extends StatelessWidget { + final String text; + const _SectionLabel(this.text); + + @override + Widget build(BuildContext context) { + return Text(text, + style: Theme.of(context).textTheme.labelMedium?.copyWith( + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + )); + } +} + +// ── Shared helpers ──────────────────────────────────────────────────────────── + +class _InfoRow extends StatelessWidget { + final String label; + final String value; + + const _InfoRow({required this.label, required this.value}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(label, + style: TextStyle( + fontSize: 11, + color: cs.outline, + fontWeight: FontWeight.w500)), + const SizedBox(height: 2), + Text(value, style: const TextStyle(fontSize: 14)), + ], + ); + } +} + +String _fmtDate(String? date) { + if (date == null || date.isEmpty) return '—'; + try { + final parts = date.split('-'); + if (parts.length == 3) return '${parts[2]}/${parts[1]}/${parts[0]}'; + } catch (_) {} + return date; +} \ No newline at end of file diff --git a/lib/screens/placeholder_screen.dart b/lib/screens/placeholder_screen.dart new file mode 100644 index 0000000..c6b2b2b --- /dev/null +++ b/lib/screens/placeholder_screen.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +/// Pantalla temporal para rutas pendientes de implementar. +class PlaceholderScreen extends StatelessWidget { + final String title; + final String route; + + const PlaceholderScreen({ + super.key, + required this.title, + required this.route, + }); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final tt = Theme.of(context).textTheme; + + return Padding( + padding: const EdgeInsets.all(32), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, style: tt.headlineMedium?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 32), + Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.construction_outlined, size: 64, color: cs.outline), + const SizedBox(height: 16), + Text( + 'Pendiente de implementar', + style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart new file mode 100644 index 0000000..8e5260b --- /dev/null +++ b/lib/services/auth_service.dart @@ -0,0 +1,52 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:shared_preferences/shared_preferences.dart'; +import '../core/constants.dart'; + +class AuthService { + static const _tokenKey = 'access_token'; + + /// Intenta hacer login. Devuelve null si ok, o un mensaje de error. + Future login(String email, String password) async { + try { + final response = await http.post( + Uri.parse('$kApiBase/login'), + headers: {'Content-Type': 'application/json'}, + body: jsonEncode({'email': email, 'password': password}), + ); + + if (response.statusCode == 200) { + final data = jsonDecode(response.body) as Map; + final token = data['access_token'] as String?; + if (token != null) { + await _saveToken(token); + return null; // éxito + } + return 'Respuesta inesperada del servidor'; + } else if (response.statusCode == 401) { + return 'Email o contraseña incorrectos'; + } else { + return 'Error del servidor (${response.statusCode})'; + } + } catch (_) { + return 'No se pudo conectar con el servidor'; + } + } + + Future logout() async { + final prefs = await SharedPreferences.getInstance(); + await prefs.remove(_tokenKey); + } + + Future getToken() async { + final prefs = await SharedPreferences.getInstance(); + return prefs.getString(_tokenKey); + } + + Future isLoggedIn() async => (await getToken()) != null; + + Future _saveToken(String token) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setString(_tokenKey, token); + } +} diff --git a/lib/services/booking_repository.dart b/lib/services/booking_repository.dart new file mode 100644 index 0000000..ffb829b --- /dev/null +++ b/lib/services/booking_repository.dart @@ -0,0 +1,18 @@ +import '../models/booking.dart'; + +abstract class BookingRepository { + Future> activities(); + + Future grid({ + required int activityId, + required String date, // dd/mm/yyyy + }); + + /// Devuelve null si la celda está vacía. + Future singleBooking({ + required int activityId, + required String date, + required int slotIndex, + required int courtIndex, // 1-based + }); +} diff --git a/lib/services/booking_service.dart b/lib/services/booking_service.dart new file mode 100644 index 0000000..c60e64e --- /dev/null +++ b/lib/services/booking_service.dart @@ -0,0 +1,73 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import '../core/constants.dart'; +import '../models/booking.dart'; +import 'auth_service.dart'; +import 'booking_repository.dart'; + +export 'booking_repository.dart'; + +class BookingService implements BookingRepository { + final _auth = AuthService(); + + Future> _headers() async { + final token = await _auth.getToken(); + return { + if (token != null) 'Authorization': 'Bearer $token', + 'Accept': 'application/json', + }; + } + + @override + Future> activities() async { + final res = await http.get( + Uri.parse('$kApiBase/activities/book'), + headers: await _headers(), + ); + if (res.statusCode == 200) { + final list = jsonDecode(res.body) as List; + return list + .map((e) => BookingActivity.fromJson(e as Map)) + .toList(); + } + throw Exception('Error ${res.statusCode}'); + } + + @override + Future grid({required int activityId, required String date}) async { + final uri = Uri.parse('$kApiBase/booking-admin/grid').replace( + queryParameters: { + 'fk_i_activity_id': activityId.toString(), + 'd_date': date, + }, + ); + final res = await http.get(uri, headers: await _headers()); + if (res.statusCode == 200) { + return BookingGrid.fromJson(jsonDecode(res.body) as Map); + } + throw Exception('Error ${res.statusCode}'); + } + + @override + Future singleBooking({ + required int activityId, + required String date, + required int slotIndex, + required int courtIndex, + }) async { + final uri = + Uri.parse('$kApiBase/booking-admin/single').replace(queryParameters: { + 'fk_i_activity_id': activityId.toString(), + 'd_date': date, + 'hour': slotIndex.toString(), + 'aPos[1]': courtIndex.toString(), + }); + final res = await http.get(uri, headers: await _headers()); + if (res.statusCode == 200) { + final data = jsonDecode(res.body) as Map; + if (data.isEmpty) return null; + return BookingDetail.fromJson(data); + } + return null; + } +} diff --git a/lib/services/member_repository.dart b/lib/services/member_repository.dart new file mode 100644 index 0000000..4326df2 --- /dev/null +++ b/lib/services/member_repository.dart @@ -0,0 +1,10 @@ +import '../models/member.dart'; + +abstract class MemberRepository { + Future first(); + Future last(); + Future show(int id); + Future prev(int id); + Future next(int id); + Future> search(String term); +} diff --git a/lib/services/member_service.dart b/lib/services/member_service.dart new file mode 100644 index 0000000..6d58e78 --- /dev/null +++ b/lib/services/member_service.dart @@ -0,0 +1,46 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import '../core/constants.dart'; +import '../models/member.dart'; +import 'auth_service.dart'; +import 'member_repository.dart'; + +export 'member_repository.dart'; + +class MemberService implements MemberRepository { + final _auth = AuthService(); + + Future> _headers() async { + final token = await _auth.getToken(); + return { + if (token != null) 'Authorization': 'Bearer $token', + 'Accept': 'application/json', + }; + } + + Future _fetch(String url) async { + final res = await http.get(Uri.parse(url), headers: await _headers()); + if (res.statusCode == 200) { + return Member.fromJson(jsonDecode(res.body) as Map); + } + throw Exception('Error ${res.statusCode}'); + } + + @override Future first() => _fetch('$kApiBase/members/first'); + @override Future last() => _fetch('$kApiBase/members/last'); + @override Future show(int id) => _fetch('$kApiBase/members/$id'); + @override Future prev(int id) => _fetch('$kApiBase/members/$id/prev'); + @override Future next(int id) => _fetch('$kApiBase/members/$id/next'); + + @override + Future> search(String term) async { + final uri = Uri.parse('$kApiBase/members/search') + .replace(queryParameters: {'term': term}); + final res = await http.get(uri, headers: await _headers()); + if (res.statusCode == 200) { + final data = jsonDecode(res.body) as Map; + return data.map((k, v) => MapEntry(k, v.toString())); + } + return {}; + } +} diff --git a/lib/services/mock/mock_booking_service.dart b/lib/services/mock/mock_booking_service.dart new file mode 100644 index 0000000..0291839 --- /dev/null +++ b/lib/services/mock/mock_booking_service.dart @@ -0,0 +1,139 @@ +import '../../models/booking.dart'; +import '../booking_repository.dart'; + +class MockBookingService implements BookingRepository { + static final _activities = [ + const BookingActivity(id: 1, name: 'TENIS'), + const BookingActivity(id: 2, name: 'PÁDEL'), + const BookingActivity(id: 3, name: 'BALONCESTO'), + ]; + + // Grid mock por actividad: activityId → aaData + static const _grids = { + 1: _tenisMock, + 2: _padelMock, + 3: _baloncestoMock, + }; + + static const _courtsByActivity = {1: 4, 2: 3, 3: 2}; + + @override + Future> activities() async => _activities; + + @override + Future grid({ + required int activityId, + required String date, + }) async { + final activity = + _activities.firstWhere((a) => a.id == activityId, orElse: () => _activities.first); + final courts = _courtsByActivity[activityId] ?? 4; + final courtTitles = + List.generate(courts, (i) => (i + 1).toString().padLeft(2, '0')); + final rawRows = _grids[activityId] ?? _tenisMock; + + final rows = rawRows.asMap().entries.map((e) { + final i = e.key; + final r = e.value; + return BookingRow( + slotIndex: i, + timeLabel: r[0], + cells: r.skip(1).map((c) => BookingCell(c)).toList(), + ); + }).toList(); + + return BookingGrid( + rows: rows, + courtTitles: courtTitles, + activityName: activity.name, + light: 100, + extra: 150, + celebrations: date.startsWith('18') ? 'Miguel Ángel' : null, + ); + } + + @override + Future singleBooking({ + required int activityId, + required String date, + required int slotIndex, + required int courtIndex, + }) async { + final rawRows = _grids[activityId] ?? _tenisMock; + if (slotIndex >= rawRows.length) return null; + + final row = rawRows[slotIndex]; + // courtIndex is 1-based, row[0] is the time label + final cellIndex = courtIndex; // row[0]=time, row[1]=court1, ... + if (cellIndex >= row.length) return null; + + final cellRaw = row[cellIndex]; + if (cellRaw.isEmpty) return null; + + final cell = BookingCell(cellRaw); + final courtStr = courtIndex.toString().padLeft(2, '0'); + final timeLabel = row[0]; + final actName = + _activities.firstWhere((a) => a.id == activityId).name; + + return BookingDetail( + id: 1000 + slotIndex * 10 + courtIndex, + memberId: cell.memberId ?? 7, + familyId: cell.familyId ?? 1, + date: date, + paid: cell.isPaid, + ticket: TicketPreview( + concepto: '$actName — Pista $courtStr — $timeLabel', + base: 8.26, + iva: 1.74, + total: 10.00, + lines: [ + TicketLine(concepto: '1h $actName Pista $courtStr', precio: 10.00), + if (!cell.isPaid) + const TicketLine(concepto: 'Pendiente de cobro', precio: 0), + ], + ), + ); + } +} + +// ── Mock data ───────────────────────────────────────────────────────────────── +// Formato: [timeLabel, court1, court2, ...] +// Celda: "" libre | "MMMMM.F+" pagada (verde) | "MMMMM.F-" impagada (roja) + +const _tenisMock = [ + ['0800-0900', '', '', '', ''], + ['0900-1000', '00007.1+', '', '00042.1+', ''], + ['1000-1100', '00085.1-', '', '00007.1+', '00042.1+'], + ['1100-1200', '', '00042.1+', '', ''], + ['1200-1300', '', '', '', ''], + ['1300-1400', '00007.2+', '', '', '00085.1-'], + ['1400-1500', '', '', '', ''], + ['1500-1600', '', '', '', ''], + ['1600-1700', '00007.1+', '00007.1+', '', ''], + ['1700-1800', '00007.1+', '00007.1+', '00042.1-', ''], + ['1800-1900', '00007.1+', '00007.1+', '00042.1-', '00085.1-'], + ['1900-2000', '00042.1+', '', '', ''], + ['2000-2100', '00042.1+', '', '', ''], + ['2100-2200', '', '', '', ''], +]; + +const _padelMock = [ + ['0900-1000', '', '00007.1+', ''], + ['1000-1100', '00042.1+', '', '00085.1-'], + ['1100-1200', '', '', ''], + ['1200-1300', '00007.1+', '', ''], + ['1300-1400', '', '', ''], + ['1600-1700', '00042.1-', '', ''], + ['1700-1800', '00042.1-', '00007.1+', ''], + ['1800-1900', '', '00007.1+', '00042.1+'], + ['1900-2000', '', '', '00042.1+'], + ['2000-2100', '', '', ''], +]; + +const _baloncestoMock = [ + ['1000-1200', '00007.1+', ''], + ['1600-1800', '', '00042.1-'], + ['1800-2000', '00085.1+', '00085.1+'], + ['2000-2200', '', ''], +]; diff --git a/lib/services/mock/mock_member_service.dart b/lib/services/mock/mock_member_service.dart new file mode 100644 index 0000000..162c073 --- /dev/null +++ b/lib/services/mock/mock_member_service.dart @@ -0,0 +1,204 @@ +import '../../models/member.dart'; +import '../member_repository.dart'; + +class MockMemberService implements MemberRepository { + static final _members = [_member7, _member42, _member85]; + + int _indexOf(int id) { + final i = _members.indexWhere((m) => m.id == id); + return i == -1 ? 0 : i; + } + + @override Future first() async => _members.first; + @override Future last() async => _members.last; + @override Future show(int id) async => + _members.firstWhere((m) => m.id == id, orElse: () => _members.first); + + @override + Future prev(int id) async { + final i = _indexOf(id); + return _members[i == 0 ? _members.length - 1 : i - 1]; + } + + @override + Future next(int id) async { + final i = _indexOf(id); + return _members[(i + 1) % _members.length]; + } + + @override + Future> search(String term) async { + final t = term.toLowerCase(); + final results = {}; + for (final m in _members) { + for (final p in m.people) { + if (p.fullName.toLowerCase().contains(t) || m.formattedId.contains(t)) { + final key = '${m.formattedId}${p.family.toString().padLeft(2, '0')}'; + results[key] = + '(${m.formattedId}-${p.family.toString().padLeft(2, '0')}) ${p.lastName}, ${p.firstName}'; + } + } + } + return results; + } +} + +// ── Datos mock ──────────────────────────────────────────────────────────────── + +final _member7 = Member( + id: 7, + regDate: '1993-01-01', + address: 'CALLE SALVADOR ESCUDERO, Nº3-2ºA', + city: 'CARTAGENA', + zip: '30205', + email: 'RICARDO.LEGAZ@GMAIL.COM', + phone: '648101900', + bank: '0182', + bankOffice: '6855', + bankSecCode: '87', + bankAccount: '0201674767', + bankName: 'CAIXABANK', + mandate: 'MNDT-00007', + type: 'FAMILIAR', + fee: 33.80, + comment: '', + comment2: '', + paid: false, + remSpecial: false, + retenido: false, + unregDate: null, + unregReason: '', + people: [ + Person( + memberId: 7, family: 1, + firstName: 'ANTONIO', lastName: 'PUENTE CARBALLES', + dni: '', birthDate: '1953-01-02', + phone: '633313501', email: 'apcarballes@gmail.com', + lopd: true, newsletter: true, bHealth: true, authorized: true, authorized2: false, + ), + Person( + memberId: 7, family: 2, + firstName: 'POLONIA', lastName: 'COLMENAR SÁNCHEZ', + dni: '', birthDate: '1952-08-09', + phone: '670243473', email: '', + lopd: true, newsletter: true, authorized: true, authorized2: false, + ), + Person( + memberId: 7, family: 3, + firstName: 'RICARDO', lastName: 'LEGAZ RÍOS', + dni: '23032266C', birthDate: '1961-04-21', + phone: '648101900', email: 'RICARDO.LEGAZ@GMAIL.COM', + lopd: true, newsletter: true, authorized: true, authorized2: true, + ), + Person( + memberId: 7, family: 4, + firstName: 'CRISTINA', lastName: 'PUENTE COLMENAR', + dni: '23019853TX', birthDate: '1978-10-15', + phone: '690728311', email: 'CPUENTE.SPANIA@GMAIL.COM', + lopd: true, newsletter: true, authorized: true, authorized2: true, + ), + Person( + memberId: 7, family: 5, + firstName: 'MATILDA', lastName: 'LEGAZ PUENTE', + dni: '', birthDate: '2013-04-28', + phone: '', email: '', + lopd: false, newsletter: false, authorized: false, authorized2: false, + ), + ], + comments: [ + MemberComment( + id: 1, + comment: + '11.03.23 chema: viene a darse de baja pero va a intentar traspasar el abono a su hija. 12.03.23. Cristina: Su hija está interesada, en el caso de traspaso, toma nota. 13.03.25: LOS TITULARES 3 Y 4 HARÁN USO ACTIVO DE CLUB.', + createdAt: '2023-03-11', + ), + ], +); + +final _member42 = Member( + id: 42, + regDate: '2018-03-15', + address: 'Calle Mayor 12', + city: 'Madrid', + zip: '28001', + email: 'socio@example.com', + phone: '612345678', + bank: '0049', + bankOffice: '1500', + bankSecCode: '42', + bankAccount: '0123456789', + bankName: 'Santander', + mandate: 'MNDT-00042', + type: 'INDIVIDUAL', + fee: 25.50, + comment: 'Nota antigua importada del sistema anterior.', + comment2: 'Revisado en auditoría 2024.', + paid: false, + remSpecial: false, + retenido: false, + unregDate: null, + unregReason: '', + people: [ + Person( + memberId: 42, family: 1, + firstName: 'María', lastName: 'García López', + dni: '12345678A', birthDate: '1985-03-15', + phone: '612345678', email: 'maria@example.com', + lopd: true, newsletter: true, authorized: true, authorized2: false, + ), + Person( + memberId: 42, family: 2, + firstName: 'Carlos', lastName: 'García López', + dni: '87654321B', birthDate: '1988-07-22', + phone: '699887766', email: 'carlos@example.com', + lopd: true, newsletter: false, authorized: true, authorized2: true, + ), + ], + comments: [ + MemberComment( + id: 10, + comment: 'Solicitó cambio de domiciliación bancaria el 05/01/2024.', + createdAt: '2024-01-05', + ), + MemberComment( + id: 11, + comment: 'Renovó cuota anual sin incidencias.', + createdAt: '2024-09-01', + ), + ], +); + +final _member85 = Member( + id: 85, + regDate: '2010-06-20', + address: 'Av. de la Constitución 45, 3B', + city: 'Murcia', + zip: '30008', + email: 'jlopez@correo.es', + phone: '968112233', + bank: '2100', + bankOffice: '0001', + bankSecCode: '12', + bankAccount: '9876543210', + bankName: 'CaixaBank', + mandate: 'MNDT-00085', + type: 'JUVENIL', + fee: 18.00, + comment: '', + comment2: '', + paid: false, + remSpecial: true, + retenido: true, + unregDate: null, + unregReason: '', + people: [ + Person( + memberId: 85, family: 1, + firstName: 'Jorge', lastName: 'López Martínez', + dni: '22334455C', birthDate: '2005-11-30', + phone: '968112233', email: 'jlopez@correo.es', + lopd: true, newsletter: true, authorized: true, authorized2: false, + ), + ], + comments: [], +); diff --git a/lib/widgets/app_shell.dart b/lib/widgets/app_shell.dart new file mode 100644 index 0000000..0251941 --- /dev/null +++ b/lib/widgets/app_shell.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'sidebar/sidebar_widget.dart'; + +/// Breakpoint a partir del cual el sidebar se muestra permanente. +const double kSidebarBreakpoint = 800; + +class AppShell extends StatelessWidget { + final Widget child; + + const AppShell({super.key, required this.child}); + + @override + Widget build(BuildContext context) { + final width = MediaQuery.sizeOf(context).width; + + if (width >= kSidebarBreakpoint) { + return _WideLayout(child: child); + } + return _NarrowLayout(child: child); + } +} + +// ── Wide: sidebar permanente ─────────────────────────────────────────────── + +class _WideLayout extends StatelessWidget { + final Widget child; + const _WideLayout({required this.child}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Row( + children: [ + const SidebarWidget(), + VerticalDivider( + width: 1, + color: Theme.of(context).colorScheme.outlineVariant, + ), + Expanded(child: child), + ], + ), + ); + } +} + +// ── Narrow: drawer + AppBar ──────────────────────────────────────────────── + +class _NarrowLayout extends StatelessWidget { + final Widget child; + const _NarrowLayout({required this.child}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('DeporOS'), + centerTitle: false, + ), + drawer: const Drawer(child: SidebarWidget()), + body: child, + ); + } +} diff --git a/lib/widgets/sidebar/nav_item_tile.dart b/lib/widgets/sidebar/nav_item_tile.dart new file mode 100644 index 0000000..f70c333 --- /dev/null +++ b/lib/widgets/sidebar/nav_item_tile.dart @@ -0,0 +1,149 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import '../../models/nav_item.dart'; + +class NavItemTile extends StatelessWidget { + final NavItem item; + final String currentRoute; + + const NavItemTile({ + super.key, + required this.item, + required this.currentRoute, + }); + + @override + Widget build(BuildContext context) { + if (item.hasChildren) { + return _GroupTile(item: item, currentRoute: currentRoute); + } + return _LeafTile(item: item, currentRoute: currentRoute); + } +} + +// ── Leaf (item sin hijos) ────────────────────────────────────────────────── + +class _LeafTile extends StatelessWidget { + final NavItem item; + final String currentRoute; + + const _LeafTile({required this.item, required this.currentRoute}); + + bool get _isActive => + item.route != null && currentRoute == item.route; + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final tt = Theme.of(context).textTheme; + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + child: Material( + color: _isActive ? cs.secondaryContainer : Colors.transparent, + borderRadius: BorderRadius.circular(12), + child: InkWell( + borderRadius: BorderRadius.circular(12), + onTap: () => context.go(item.route!), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Row( + children: [ + Icon( + item.icon, + size: 20, + color: _isActive ? cs.onSecondaryContainer : cs.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Text( + item.label, + style: tt.bodyMedium?.copyWith( + color: _isActive ? cs.onSecondaryContainer : cs.onSurface, + fontWeight: _isActive ? FontWeight.w600 : FontWeight.normal, + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} + +// ── Group (item con hijos, expansible) ──────────────────────────────────── + +class _GroupTile extends StatefulWidget { + final NavItem item; + final String currentRoute; + + const _GroupTile({required this.item, required this.currentRoute}); + + @override + State<_GroupTile> createState() => _GroupTileState(); +} + +class _GroupTileState extends State<_GroupTile> { + late bool _expanded; + + @override + void initState() { + super.initState(); + _expanded = widget.item.isActiveOrAncestor(widget.currentRoute); + } + + @override + void didUpdateWidget(_GroupTile old) { + super.didUpdateWidget(old); + if (old.currentRoute != widget.currentRoute) { + if (widget.item.isActiveOrAncestor(widget.currentRoute)) { + _expanded = true; + } + } + } + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final tt = Theme.of(context).textTheme; + final isAncestor = widget.item.isActiveOrAncestor(widget.currentRoute); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + child: Theme( + // Quita el separador por defecto del ExpansionTile + data: Theme.of(context).copyWith(dividerColor: Colors.transparent), + child: ExpansionTile( + initiallyExpanded: _expanded, + onExpansionChanged: (v) => setState(() => _expanded = v), + tilePadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 0), + childrenPadding: const EdgeInsets.only(left: 16), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + collapsedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + backgroundColor: isAncestor ? cs.surfaceContainerHigh : Colors.transparent, + collapsedBackgroundColor: Colors.transparent, + leading: Icon( + widget.item.icon, + size: 20, + color: isAncestor ? cs.primary : cs.onSurfaceVariant, + ), + title: Text( + widget.item.label, + style: tt.bodyMedium?.copyWith( + color: isAncestor ? cs.primary : cs.onSurface, + fontWeight: isAncestor ? FontWeight.w600 : FontWeight.normal, + ), + ), + children: widget.item.children + .map((child) => NavItemTile( + item: child, + currentRoute: widget.currentRoute, + )) + .toList(), + ), + ), + ); + } +} diff --git a/lib/widgets/sidebar/sidebar_widget.dart b/lib/widgets/sidebar/sidebar_widget.dart new file mode 100644 index 0000000..8caf9b1 --- /dev/null +++ b/lib/widgets/sidebar/sidebar_widget.dart @@ -0,0 +1,125 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import '../../navigation/app_navigation.dart'; +import '../../services/auth_service.dart'; +import 'nav_item_tile.dart'; + +class SidebarWidget extends StatelessWidget { + const SidebarWidget({super.key}); + + static const double _width = 260; + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final currentRoute = GoRouterState.of(context).matchedLocation; + + return SizedBox( + width: _width, + child: Material( + color: cs.surfaceContainerLow, + child: Column( + children: [ + _SidebarHeader(), + const Divider(height: 1), + Expanded( + child: ListView( + padding: const EdgeInsets.symmetric(vertical: 8), + children: kAdminNavItems + .map((item) => NavItemTile( + item: item, + currentRoute: currentRoute, + )) + .toList(), + ), + ), + const Divider(height: 1), + _SidebarFooter(), + ], + ), + ), + ); + } +} + +class _SidebarHeader extends StatelessWidget { + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20), + child: Row( + children: [ + CircleAvatar( + radius: 20, + backgroundColor: cs.primaryContainer, + child: Icon(Icons.sports, color: cs.onPrimaryContainer, size: 22), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'DeporOS', + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.bold, + color: cs.onSurface, + ), + ), + Text( + 'Panel de administración', + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: cs.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ); + } +} + +class _SidebarFooter extends StatelessWidget { + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.all(8), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + child: Material( + color: Colors.transparent, + borderRadius: BorderRadius.circular(12), + child: InkWell( + borderRadius: BorderRadius.circular(12), + onTap: () => _logout(context), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon(Icons.logout, size: 20, color: cs.error), + const SizedBox(width: 12), + Text( + 'Salir', + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: cs.error, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + Future _logout(BuildContext context) async { + await AuthService().logout(); + if (context.mounted) context.go('/login'); + } +} diff --git a/linux/.gitignore b/linux/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 0000000..f57fe71 --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,128 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "depor_os") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.depor_os") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/linux/flutter/CMakeLists.txt b/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000..d5bd016 --- /dev/null +++ b/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt new file mode 100644 index 0000000..e97dabc --- /dev/null +++ b/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/linux/runner/main.cc b/linux/runner/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/runner/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc new file mode 100644 index 0000000..ac3289c --- /dev/null +++ b/linux/runner/my_application.cc @@ -0,0 +1,148 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Called when first Flutter frame received. +static void first_frame_cb(MyApplication* self, FlView* view) { + gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); +} + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "depor_os"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "depor_os"); + } + + gtk_window_set_default_size(window, 1280, 720); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments( + project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + GdkRGBA background_color; + // Background defaults to black, override it here if necessary, e.g. #00000000 + // for transparent. + gdk_rgba_parse(&background_color, "#000000"); + fl_view_set_background_color(view, &background_color); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + // Show the window when Flutter renders. + // Requires the view to be realized so we can start rendering. + g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), + self); + gtk_widget_realize(GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, + gchar*** arguments, + int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + // MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + // MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = + my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); + + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, "flags", + G_APPLICATION_NON_UNIQUE, nullptr)); +} diff --git a/linux/runner/my_application.h b/linux/runner/my_application.h new file mode 100644 index 0000000..db16367 --- /dev/null +++ b/linux/runner/my_application.h @@ -0,0 +1,21 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, + my_application, + MY, + APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/macos/.gitignore b/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..724bb2a --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import shared_preferences_foundation + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..442a313 --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,705 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* depor_os.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "depor_os.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* depor_os.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* depor_os.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/depor_os.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/depor_os"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/depor_os.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/depor_os"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/depor_os.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/depor_os"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..86a1418 --- /dev/null +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..b3c1761 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..82b6f9d Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..13b35eb Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..0a3f5fa Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bdb5722 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..f083318 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..326c0e7 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..2f1632c Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..901d90c --- /dev/null +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = depor_os + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.deporOs + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2026 com.example. All rights reserved. diff --git a/macos/Runner/Configs/Debug.xcconfig b/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Release.xcconfig b/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Warnings.xcconfig b/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/macos/Runner/DebugProfile.entitlements b/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..3cc05eb --- /dev/null +++ b/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/macos/RunnerTests/RunnerTests.swift b/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..61f3bd1 --- /dev/null +++ b/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..1e6ed2b --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,386 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + go_router: + dependency: "direct main" + description: + name: go_router + sha256: f02fd7d2a4dc512fec615529824fdd217fecb3a3d3de68360293a551f21634b3 + url: "https://pub.dev" + source: hosted + version: "14.8.1" + http: + dependency: "direct main" + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "8374d6200ab33ac99031a852eba4c8eb2170c4bf20778b3e2c9eccb45384fb41" + url: "https://pub.dev" + source: hosted + version: "2.4.21" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" + source: hosted + version: "0.7.7" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" +sdks: + dart: ">=3.10.7 <4.0.0" + flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..f4f75e6 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,90 @@ +name: depor_os +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.10.7 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + cupertino_icons: ^1.0.8 + http: ^1.2.0 + shared_preferences: ^2.3.0 + go_router: ^14.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..6e5a861 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,9 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:depor_os/main.dart'; + +void main() { + testWidgets('App smoke test', (WidgetTester tester) async { + await tester.pumpWidget(const DeporOsApp()); + expect(find.byType(DeporOsApp), findsOneWidget); + }); +} diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..d4e7673 --- /dev/null +++ b/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + depor_os + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..ebc2252 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "depor_os", + "short_name": "depor_os", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt new file mode 100644 index 0000000..718d07d --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(depor_os LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "depor_os") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..903f489 --- /dev/null +++ b/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..b93c4c3 --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc new file mode 100644 index 0000000..5c3538a --- /dev/null +++ b/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "depor_os" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "depor_os" "\0" + VALUE "LegalCopyright", "Copyright (C) 2026 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "depor_os.exe" "\0" + VALUE "ProductName", "depor_os" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/windows/runner/flutter_window.cpp b/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..955ee30 --- /dev/null +++ b/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/windows/runner/flutter_window.h b/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp new file mode 100644 index 0000000..360c6f0 --- /dev/null +++ b/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"depor_os", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/windows/runner/resource.h b/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/windows/runner/resources/app_icon.ico differ diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..153653e --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,14 @@ + + + + + PerMonitorV2 + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 0000000..3a0b465 --- /dev/null +++ b/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + unsigned int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length == 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/windows/runner/utils.h b/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/windows/runner/win32_window.cpp b/windows/runner/win32_window.cpp new file mode 100644 index 0000000..60608d0 --- /dev/null +++ b/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h new file mode 100644 index 0000000..e901dde --- /dev/null +++ b/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_