diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79c113f --- /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 +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# 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..c9704a8 --- /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: "be698c48a6750c8cb8e61c740ca9991bb947aba2" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + - platform: android + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + - platform: ios + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + - platform: linux + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + - platform: macos + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + - platform: web + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + - platform: windows + create_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + base_revision: be698c48a6750c8cb8e61c740ca9991bb947aba2 + + # 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/README.md b/README.md index 742dc06..bc7edcc 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,123 @@ -# Desafio para Flutter Developer na DoroTech +# Projeto + +Este projeto Flutter foi desenvolvido como parte de um teste para uma vaga na empresa DoroTech. Ele foi executado utilizando o SDK do Flutter, seguindo as melhores práticas de desenvolvimento para aplicações multiplataforma e aplicando conceitos como SOLID para organização do código, MVVM (Model-View-ViewModel) para separação de responsabilidades e Atomic Design para estruturação da interface de usuário. + +# Conceitos de Programação e Arquitetura + +Este projeto foi desenvolvido aplicando diversos conceitos e padrões de programação e arquitetura, visando a criação de um código limpo, testável, escalável e de fácil manutenção: + +* **Programação Orientada a Objetos (POO)**: Utilização de classes, objetos, herança, polimorfismo e encapsulamento, pilares do desenvolvimento em Dart e Flutter. +* **Injeção de Dependências**: Implementada através da biblioteca `get_it`, facilitando a inversão de controle e a testabilidade das classes. +* **Tratamento de Erros Funcional**: Adoção da biblioteca `result_dart` para um tratamento explícito e robusto de resultados de operações (sucesso/falha), promovendo um fluxo de controle mais claro. +* **Arquitetura em Camadas / Clean Architecture (ou similar)**: A estrutura de diretórios (`config`, `data`, `design_system`, `domain`, `routing`, `shared`, `ui`) reflete uma clara separação de responsabilidades, isolando a lógica de negócio da interface do usuário e da infraestrutura. +* **SOLID Principles**: Os princípios SOLID (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) foram aplicados para garantir um design de software flexível e manutenível. +* **MVVM (Model-View-ViewModel)**: Padrão de arquitetura utilizado para separar a lógica de negócio da interface do usuário, promovendo a testabilidade e a reutilização de código. +* **Atomic Design**: A organização dos componentes de UI na pasta `design_system` segue os princípios do Atomic Design, permitindo a construção de interfaces a partir de elementos menores e reutilizáveis (átomos, moléculas, organismos, templates e páginas). +* **Testes Unitários**: Com o uso de `flutter_test` e `mocktail`, o projeto incorpora testes automatizados para garantir a qualidade e o comportamento esperado das funcionalidades. +* **Navegação Declarativa**: Gerenciamento de rotas e navegação na aplicação de forma declarativa, utilizando a biblioteca `go_router`. +* **Consumo de API / Requisições HTTP**: A biblioteca `dio` é utilizada para realizar requisições de rede, facilitando a comunicação com serviços externos. +* **Logging**: Implementação de um sistema de logging com a biblioteca `logger` para auxiliar na depuração e monitoramento da aplicação. +* **Persistência de Dados Local**: Utilização de `shared_preferences` para o armazenamento simples e persistente de dados no dispositivo. + +# Tecnologias + +As seguintes tecnologias e bibliotecas foram utilizadas neste projeto: + +* **Flutter SDK**: `3.8.0` + * [Documentação Oficial do Flutter](https://docs.flutter.dev/) + * **Motivo**: Framework principal para o desenvolvimento da aplicação multiplataforma. +* **Dart SDK**: Versão compatível com Flutter `3.8.0` + * [Documentação Oficial do Dart](https://dart.dev/guides) + * **Motivo**: Linguagem de programação utilizada pelo Flutter. + +## Dependências + +* **`get_it`**: `^8.0.3` + * [Pacote get_it](https://pub.dev/packages/get_it) + * **Motivo**: Utilizado para injeção de dependências, facilitando a organização e testabilidade do código. +* **`go_router`**: `^14.8.1` + * [Pacote go_router](https://pub.dev/packages/go_router) + * **Motivo**: Gerenciamento de rotas e navegação declarativa na aplicação. +* **`result_dart`**: `^2.0.0` + * [Pacote result_dart](https://pub.dev/packages/result_dart) + * **Motivo**: Implementa o padrão `Result` para tratamento de sucesso e falha em operações, promovendo um código mais robusto e legível. +* **`shared_preferences`**: `^2.5.3` + * [Pacote shared_preferences](https://pub.dev/packages/shared_preferences) + * **Motivo**: Permite o armazenamento simples de dados persistentes no dispositivo. +* **`dio`**: `^5.6.0` + * [Pacote dio](https://pub.dev/packages/dio) + * **Motivo**: Cliente HTTP poderoso para fazer requisições de rede. +* **`logger`**: `^2.6.0` + * [Pacote logger](https://pub.dev/packages/logger) + * **Motivo**: Biblioteca para logging de mensagens no console, útil para depuração. + +## Dependências de Desenvolvimento + +* **`flutter_lints`**: `^5.0.0` + * [Pacote flutter_lints](https://pub.dev/packages/flutter_lints) + * **Motivo**: Conjunto de regras de lint recomendadas para encorajar boas práticas de codificação. +* **`mocktail`**: `^1.0.3` + * [Pacote mocktail](https://pub.dev/packages/mocktail) + * **Motivo**: Biblioteca para criação de mocks em testes unitários e de integração. + +# Emulador Utilizado para Testes + +Para os testes e desenvolvimento desta aplicação, foi utilizado o seguinte emulador Android: + +* **Modelo do Dispositivo**: Pixel 6 Pro +* **Resolução da Tela**: 1440 x 3120 pixels +* **Densidade da Tela (DPI)**: 560 dpi (xxxhdpi) +* **Versão do Android**: Android 14 (API Level 34) +* **Tamanho da Tela**: 6.7 polegadas + +# Como Compilar e Rodar + +Para compilar e rodar esta aplicação, siga os passos abaixo: + +## Pré-requisitos + +Certifique-se de ter o Flutter SDK instalado e configurado em sua máquina. Você pode verificar sua instalação executando: -Somos uma empresa com clientes que atuam em vários segmentos do mercado, com diferentes tecnologias, culturas e desafios. - -Gostamos de compor nossos times com profissionais multidisciplinares, que tenham alta capacidade de aprendizado, sejam detalhistas, resilientes, questionadores e curiosos. -Você, como **Flutter Developer**, será o responsável por implementar, dar manutenção, aplicar correções e propor soluções em projetos de software. - -## Orientações -Para executar o desafio de **Flutter Developer**, você **deverá utilizar framework Flutter e seguir suas boas práticas**, seguindo o [passo a passo](https://github.com/dorotech/flutter-test#etapas) para a execução, atendendo aos [critérios de aceitação](https://github.com/dorotech/flutter-test#critérios-de-aceitação). - -## Desafio -Nossa equipe é apaixonada por **Rick and Morty**, o seu desafio será criar uma aplicação utilizando a API pública da série [https://rickandmortyapi.com/](https://rickandmortyapi.com/), para exibir a lista de personagens. -Veja a documentação [https://rickandmortyapi.com/documentation/#rest](https://rickandmortyapi.com/documentation/#rest). - -Os requisitos da aplicação: - -- Como usuário, desejo visualizar na página inicial, uma lista de 20 personagens incialmente, contendo **foto**, **nome** e **status**, com o tamanho da paginação sendo dinamica, podendo ser selecionando, 5, 10 ou 20 itens por vez. -- Como usuário, desejo clicar em um personagem da lista, para visualizar informações detalhadas. (seja criativo a api contem diversas informaçoes) -- Como usuário, desejo filtrar os personagens por **nome**, **gênero**, **espécie** e **status**, alguns filtros são enums, seja criativo. -- Como usuário, desejo combinar varios filtros. - -## Etapas - -#### 1 - Fazer um fork desse repositório - -#### 2 - Criar um branch com o seu primeiro e último nome ```bash -git checkout -b joao-silva +flutter doctor ``` -#### 3 - Escreva a documentação da sua aplicação -Você deve, substituir o conteúdo do arquivo **README.md** e escrever a documentação da sua aplicação, com os seguintes tópicos: -- **Projeto**: Descreva o projeto e como você o executou. Seja objetivo. -- **Tecnologias**: Descreva quais tecnologias foram utilizadas, enumerando versões (se necessário) e os links para suas documentações, quais bibliotecas instalou e porque. -- **Como compilar e rodar**: Descreva como compilar e rodar sua aplicação no Android e Web - -#### 4 - Faça uma Pull Request -Após implementada a solução, crie uma [pull request](https://github.com/dorotech/flutter-test/pulls) com o seu projeto para esse repositório, avise o recrutador. - -## Critérios de Aceitação -Para que seu teste tenha o mínimo necessário que atenda aos requisitos esperados, ele deve: -- Atender ao que foi proposto no [Desafio](https://github.com/dorotech/flutter-test#Desafio). -- Interfaces responsivas compatíveis com dispositivos Mobile e Web. -- Especificar qual dispositivo foi utilizado para testar a aplicação. -- Compatibilidade entre browsers. -- Uso de alguma arquitetura para o código. Ex: MVVM, BLoC. -- Utilizar padrões semânticos em mensagens de commit. (Gostamos do padrão de commits do repositório [AngularJS](http://karma-runner.github.io/3.0/dev/git-commit-msg.html)) -- Caso você nao consiga completar tudo e tenha algum receio, não se preocupe, iremos avaliar o que foi entregue, mesmo com pendências. -- O diferencial para este desafio: layout, ux e ui, bem como implementação de boas práticas de segurança, performance e/ou estrutura. - - -## Dicas e Informações Valiosas - -#### O que gostaríamos de ver em seu teste: -- Convenção de nome em classes, objetos, variáveis, métodos e etc. -- layout encantador -- Faça commits regulares. Eles são melhores do que um commit gigantesco. Gostaríamos de ver commits organizados e padronizados, então capriche neles! -- Animações, Sombras, Menus, componentes de Libs de UX implementados. -- **Bônus 1** Dark Mode, implementação sendo um botão que mude o padrão de cores da pagina para escuro e claro com 1 click ou que siga a configuração do dispositivo do cliente. -- **Bônus 2** Listagem de favoritos, com algum mecanismo de cache. -- **Bônus 3** Outros filtros além dos sugeridos na descrição inicial -- **Bônus 4** Testes automatizados - -**Observação:** Nenhum dos itens acima é obrigatório. - -#### O que o seu Teste não deve ter: -- Saber que não foi você quem implementou o projeto. -- Varias bibliotecas instaladas sem uso. -- Falta de organização de código. -- Falta de documentação. -- Nome de variáveis sem sentido ou sem padrão de nomes. -- Histórico de commits desorganizado e despadronizado. - -## Boa Sorte!! +## Configuração Inicial + +1. **Clone o repositório:** + ```bash + git clone https://github.com/AlisonMeneses/flutter-test.git + cd flutter-test + ``` +2. **Instale as dependências:** + ```bash + flutter pub get + ``` + +## Rodar no Android + +1. **Conecte um dispositivo Android** (físico ou emulador) e certifique-se de que ele seja reconhecido pelo Flutter. + ```bash + flutter devices + ``` +2. **Execute a aplicação:** + ```bash + flutter run + ``` + Isso compilará e instalará a aplicação no dispositivo Android conectado. + +## Rodar na Web + +1. **Habilite o suporte web** (se ainda não o fez): + ```bash + flutter config --enable-web + ``` +2. **Execute a aplicação para web:** + ```bash + flutter run -d chrome + ``` + Ou para um navegador específico: + ```bash + flutter run -d web-server + ``` + Isso iniciará um servidor web local e abrirá a aplicação no seu navegador padrão. \ No newline at end of file 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..83a6ff1 --- /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.doro_tech" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.doro_tech" + // 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..74a7821 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/doro_tech/MainActivity.kt b/android/app/src/main/kotlin/com/example/doro_tech/MainActivity.kt new file mode 100644 index 0000000..e979f93 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/doro_tech/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.doro_tech + +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..89176ef --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,21 @@ +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..f018a61 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ac3b479 --- /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.12-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..ab39a10 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,25 @@ +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.7.3" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/coverage/html/amber.png b/coverage/html/amber.png new file mode 100644 index 0000000..2cab170 Binary files /dev/null and b/coverage/html/amber.png differ diff --git a/coverage/html/cmd_line b/coverage/html/cmd_line new file mode 100644 index 0000000..d441f57 --- /dev/null +++ b/coverage/html/cmd_line @@ -0,0 +1 @@ +genhtml coverage/lcov.info -o coverage/html diff --git a/coverage/html/data/repository/characters/characters_repository_impl.dart.gcov.html b/coverage/html/data/repository/characters/characters_repository_impl.dart.gcov.html new file mode 100644 index 0000000..66add4a --- /dev/null +++ b/coverage/html/data/repository/characters/characters_repository_impl.dart.gcov.html @@ -0,0 +1,117 @@ + + + + + + + LCOV - lcov.info - data/repository/characters/characters_repository_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/characters - characters_repository_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %55
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:doro_tech/src/data/service/characters/characters_service.dart';
+       2              : import 'package:doro_tech/src/domain/models/character_model.dart';
+       3              : import 'package:doro_tech/src/shared/pagination/paginated_response.dart';
+       4              : import 'package:doro_tech/src/shared/pagination/pagination.dart';
+       5              : import 'package:doro_tech/src/shared/utils/app_error.dart';
+       6              : import 'package:result_dart/src/result_dart_base.dart';
+       7              : 
+       8              : import '../../../domain/enums/gender_enum.dart';
+       9              : import '../../../domain/enums/status_enum.dart';
+      10              : import 'characters_repository.dart';
+      11              : 
+      12              : class CharactersRepositoryImpl implements ICharactersRepository {
+      13              :   final ICharactersService charactersService;
+      14              : 
+      15            1 :   CharactersRepositoryImpl({required this.charactersService});
+      16              : 
+      17            1 :   @override
+      18              :   Future<ResultDart<PaginatedResponse<CharacterModel>, AppError>>
+      19              :   getCharacters({
+      20              :     required Pagination pagination,
+      21              :     String? name,
+      22              :     GenderEnum? gender,
+      23              :     StatusEnum? status,
+      24              :   }) {
+      25            2 :     return charactersService.getCharacters(
+      26              :       pagination: pagination,
+      27              :       name: name,
+      28              :       gender: gender,
+      29              :       status: status,
+      30              :     );
+      31              :   }
+      32              : 
+      33            1 :   @override
+      34              :   Future<ResultDart<List<CharacterModel>, AppError>> getFavoriteCharacters({
+      35              :     required List<int> charactersIds,
+      36              :   }) {
+      37            2 :     return charactersService.getFavoriteCharacters(
+      38              :       charactersIds: charactersIds,
+      39              :     );
+      40              :   }
+      41              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/characters/index.html b/coverage/html/data/repository/characters/index.html new file mode 100644 index 0000000..2ae9b27 --- /dev/null +++ b/coverage/html/data/repository/characters/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/repository/characters + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/charactersCoverageTotalHit
Test:lcov.infoLines:100.0 %55
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
characters_repository_impl.dart +
100.0%
+
100.0 %55
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/episodes/episodes_repository_impl.dart.gcov.html b/coverage/html/data/repository/episodes/episodes_repository_impl.dart.gcov.html new file mode 100644 index 0000000..4f24488 --- /dev/null +++ b/coverage/html/data/repository/episodes/episodes_repository_impl.dart.gcov.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - lcov.info - data/repository/episodes/episodes_repository_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/episodes - episodes_repository_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %33
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:doro_tech/src/domain/models/episode_model.dart';
+       2              : 
+       3              : import 'package:doro_tech/src/shared/utils/app_error.dart';
+       4              : import 'package:result_dart/src/result_dart_base.dart';
+       5              : 
+       6              : import '../../service/episodes/episodes_service.dart';
+       7              : import 'episodes_repository.dart';
+       8              : 
+       9              : class EpisodesRepositoryImpl implements IEpisodesRepository {
+      10              :   final IEpisodesService episodesService;
+      11              : 
+      12            1 :   EpisodesRepositoryImpl({required this.episodesService});
+      13              : 
+      14            1 :   @override
+      15              :   Future<ResultDart<List<EpisodeModel>, AppError>> getEpisodesByIds({
+      16              :     required List<int> episodesIds,
+      17              :   }) {
+      18            2 :     return episodesService.getEpisodesByIds(episodesIds: episodesIds);
+      19              :   }
+      20              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/episodes/index.html b/coverage/html/data/repository/episodes/index.html new file mode 100644 index 0000000..1cc38ac --- /dev/null +++ b/coverage/html/data/repository/episodes/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/repository/episodes + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/episodesCoverageTotalHit
Test:lcov.infoLines:100.0 %33
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
episodes_repository_impl.dart +
100.0%
+
100.0 %33
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/favorites/favorites_repository_impl.dart.gcov.html b/coverage/html/data/repository/favorites/favorites_repository_impl.dart.gcov.html new file mode 100644 index 0000000..3a3a478 --- /dev/null +++ b/coverage/html/data/repository/favorites/favorites_repository_impl.dart.gcov.html @@ -0,0 +1,106 @@ + + + + + + + LCOV - lcov.info - data/repository/favorites/favorites_repository_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/favorites - favorites_repository_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %99
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import '../../../shared/utils/app_error.dart';
+       2              : import '../../service/favorites/favorites_service.dart';
+       3              : import 'favorites_repository.dart';
+       4              : import 'package:result_dart/result_dart.dart';
+       5              : 
+       6              : class FavoritesRepositoryImpl implements IFavoritesRepository {
+       7              :   final IFavoritesService favoritesService;
+       8              : 
+       9            1 :   FavoritesRepositoryImpl({required this.favoritesService});
+      10              : 
+      11            1 :   @override
+      12              :   Future<ResultDart<bool, AppError>> saveFavoriteId({required int characterId}) {
+      13            2 :     return favoritesService.saveFavoriteId(characterId: characterId);
+      14              :   }
+      15              : 
+      16            1 :   @override
+      17              :   Future<ResultDart<bool, AppError>> deleteFavoriteId({required int characterId}) {
+      18            2 :     return favoritesService.deleteFavoriteId(characterId: characterId);
+      19              :   }
+      20              : 
+      21            1 :   @override
+      22              :   Future<ResultDart<List<int>, AppError>> getFavoriteIds() {
+      23            2 :     return favoritesService.getFavoriteIds();
+      24              :   }
+      25              : 
+      26            1 :   @override
+      27              :   Future<ResultDart<bool, AppError>> deleteAllFavoriteIds() {
+      28            2 :     return favoritesService.deleteAllFavoriteIds();
+      29              :   }
+      30              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/favorites/index.html b/coverage/html/data/repository/favorites/index.html new file mode 100644 index 0000000..8da76d7 --- /dev/null +++ b/coverage/html/data/repository/favorites/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/repository/favorites + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/favoritesCoverageTotalHit
Test:lcov.infoLines:100.0 %99
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
favorites_repository_impl.dart +
100.0%
+
100.0 %99
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/theme/index.html b/coverage/html/data/repository/theme/index.html new file mode 100644 index 0000000..d9a2359 --- /dev/null +++ b/coverage/html/data/repository/theme/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/repository/theme + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/themeCoverageTotalHit
Test:lcov.infoLines:100.0 %55
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
theme_repository_impl.dart +
100.0%
+
100.0 %55
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/repository/theme/theme_repository_impl.dart.gcov.html b/coverage/html/data/repository/theme/theme_repository_impl.dart.gcov.html new file mode 100644 index 0000000..7c7059a --- /dev/null +++ b/coverage/html/data/repository/theme/theme_repository_impl.dart.gcov.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/repository/theme/theme_repository_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/repository/theme - theme_repository_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %55
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:flutter/material.dart';
+       2              : import 'package:result_dart/result_dart.dart';
+       3              : 
+       4              : import '../../../shared/utils/app_error.dart';
+       5              : import 'theme_repository.dart';
+       6              : import '../../service/theme/theme_service.dart';
+       7              : 
+       8              : class ThemeRepositoryImpl implements IThemeRepository {
+       9              :   final IThemeService themeService;
+      10              : 
+      11            1 :   ThemeRepositoryImpl({required this.themeService});
+      12              : 
+      13            1 :   @override
+      14              :   Future<ResultDart<ThemeMode, AppError>> getThemeMode() {
+      15            2 :     return themeService.getThemeMode();
+      16              :   }
+      17              : 
+      18            1 :   @override
+      19              :   Future<ResultDart<bool, AppError>> saveThemeMode(ThemeMode mode) {
+      20            2 :     return themeService.saveThemeMode(mode);
+      21              :   }
+      22              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/characters/characters_service_impl.dart.gcov.html b/coverage/html/data/service/characters/characters_service_impl.dart.gcov.html new file mode 100644 index 0000000..011e21a --- /dev/null +++ b/coverage/html/data/service/characters/characters_service_impl.dart.gcov.html @@ -0,0 +1,211 @@ + + + + + + + LCOV - lcov.info - data/service/characters/characters_service_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/characters - characters_service_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %5555
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:dio/dio.dart';
+       2              : import 'package:doro_tech/src/domain/models/character_model.dart';
+       3              : import 'package:doro_tech/src/shared/pagination/paginated_response.dart';
+       4              : import 'package:doro_tech/src/shared/pagination/pagination.dart';
+       5              : import 'package:doro_tech/src/shared/utils/app_error.dart';
+       6              : import 'package:result_dart/src/result_dart_base.dart';
+       7              : 
+       8              : import '../../../domain/enums/gender_enum.dart';
+       9              : import '../../../domain/enums/status_enum.dart';
+      10              : import '../../../shared/utils/logger.dart';
+      11              : import 'characters_service.dart';
+      12              : 
+      13              : class CharactersServiceImpl implements ICharactersService {
+      14              :   final Dio _dio;
+      15              : 
+      16            1 :   CharactersServiceImpl(this._dio);
+      17              : 
+      18            1 :   @override
+      19              :   Future<ResultDart<PaginatedResponse<CharacterModel>, AppError>>
+      20              :   getCharacters({
+      21              :     required Pagination pagination,
+      22              :     String? name,
+      23              :     GenderEnum? gender,
+      24              :     StatusEnum? status,
+      25              :   }) async {
+      26              :     try {
+      27            2 :       final Response response = await _dio.get(
+      28              :         'https://rickandmortyapi.com/api/character',
+      29            1 :         queryParameters: {
+      30            2 :           'page': pagination.page,
+      31            2 :           if (name != null && name.isNotEmpty) ...{'name': name},
+      32            3 :           if (gender != null && gender != GenderEnum.all) ...{'gender': gender.genderLabel},
+      33            3 :           if (status != null && status != StatusEnum.all) ...{'status': status.statusLabel},
+      34              :         },
+      35              :       );
+      36              : 
+      37            2 :       if (response.statusCode == 200) {
+      38              :         final List<CharacterModel> characters =
+      39            4 :             (response.data['results'] as List).map((character) {
+      40            1 :               return CharacterModel.fromJson(character);
+      41            1 :             }).toList();
+      42              : 
+      43            1 :         return Success(
+      44            1 :           PaginatedResponse(
+      45            1 :             pagination: pagination.copyWith(
+      46            3 :               total: response.data['info']['count'],
+      47              :             ),
+      48              :             data: characters,
+      49              :           ),
+      50              :         );
+      51              :       }
+      52              : 
+      53            1 :       Log.error(
+      54            2 :         "Erro ao listar personagens. Server error: ${response.statusMessage}",
+      55              :       );
+      56              : 
+      57            1 :       return Failure(
+      58            1 :         AppError(
+      59              :           message:
+      60            2 :               "Erro ao listar personagens. Server error: ${response.statusMessage}",
+      61              :           type: AppErrorType.server,
+      62              :         ),
+      63              :       );
+      64            1 :     } on DioException catch (e) {
+      65            7 :       if (e.response?.statusCode == 404 && e.response?.data['error'] == 'There is nothing here') {
+      66            3 :         Log.error("API retorna 404 quando nenhum item é encontrado pelo filtro: ${e.message}");
+      67            1 :         return Success(
+      68            1 :           PaginatedResponse(
+      69              :             pagination: pagination,
+      70            1 :             data: [],
+      71              :           ),
+      72              :         );
+      73              :       }
+      74              : 
+      75            3 :       Log.error("Erro de rede Dio: ${e.message}");
+      76            1 :       return Failure(
+      77            1 :         AppError(
+      78            2 :           message: "Erro de rede Dio: ${e.message}",
+      79              :           type: AppErrorType.network,
+      80              :         ),
+      81              :       );
+      82              :     } catch (e) {
+      83            2 :       Log.error("Erro inesperado: $e");
+      84            1 :       return Failure(
+      85            2 :         AppError(message: "Erro inesperado: $e", type: AppErrorType.local),
+      86              :       );
+      87              :     }
+      88              :   }
+      89              : 
+      90            1 :   @override
+      91              :   Future<ResultDart<List<CharacterModel>, AppError>> getFavoriteCharacters({
+      92              :     required List<int> charactersIds,
+      93              :   }) async {
+      94              :     try {
+      95            2 :       final Response response = await _dio.get(
+      96            1 :         'https://rickandmortyapi.com/api/character/$charactersIds',
+      97              :       );
+      98              : 
+      99            2 :       if (response.statusCode == 200) {
+     100            3 :         final List<CharacterModel> characters = (response.data as List).map((
+     101              :           character,
+     102              :         ) {
+     103            1 :           return CharacterModel.fromJson(character);
+     104            1 :         }).toList();
+     105              : 
+     106            1 :         return Success(characters);
+     107              :       }
+     108              : 
+     109            1 :       Log.error(
+     110            2 :         "Erro ao listar personagens favoritos. Server error: ${response.statusMessage}",
+     111              :       );
+     112              : 
+     113            1 :       return Failure(
+     114            1 :         AppError(
+     115              :           message:
+     116            2 :               "Erro ao listar personagens favoritos. Server error: ${response.statusMessage}",
+     117              :           type: AppErrorType.server,
+     118              :         ),
+     119              :       );
+     120            1 :     } on DioException catch (e) {
+     121            3 :       Log.error("Erro de rede Dio: ${e.message}");
+     122            1 :       return Failure(
+     123            1 :         AppError(
+     124            2 :           message: "Erro de rede Dio: ${e.message}",
+     125              :           type: AppErrorType.network,
+     126              :         ),
+     127              :       );
+     128              :     } catch (e) {
+     129            2 :       Log.error("Erro inesperado: $e");
+     130            1 :       return Failure(
+     131            2 :         AppError(message: "Erro inesperado: $e", type: AppErrorType.local),
+     132              :       );
+     133              :     }
+     134              :   }
+     135              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/characters/index.html b/coverage/html/data/service/characters/index.html new file mode 100644 index 0000000..73a3a87 --- /dev/null +++ b/coverage/html/data/service/characters/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/service/characters + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/charactersCoverageTotalHit
Test:lcov.infoLines:100.0 %5555
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
characters_service_impl.dart +
100.0%
+
100.0 %5555
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/episodes/episodes_service_impl.dart.gcov.html b/coverage/html/data/service/episodes/episodes_service_impl.dart.gcov.html new file mode 100644 index 0000000..dbfed05 --- /dev/null +++ b/coverage/html/data/service/episodes/episodes_service_impl.dart.gcov.html @@ -0,0 +1,135 @@ + + + + + + + LCOV - lcov.info - data/service/episodes/episodes_service_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/episodes - episodes_service_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %2222
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:dio/dio.dart';
+       2              : import 'package:doro_tech/src/domain/models/episode_model.dart';
+       3              : import 'package:doro_tech/src/shared/utils/app_error.dart';
+       4              : import 'package:result_dart/src/result_dart_base.dart';
+       5              : 
+       6              : import '../../../shared/utils/logger.dart';
+       7              : import 'episodes_service.dart';
+       8              : 
+       9              : class EpisodesServiceImpl implements IEpisodesService {
+      10              :   final Dio _dio;
+      11              : 
+      12            1 :   EpisodesServiceImpl(this._dio);
+      13              : 
+      14            1 :   @override
+      15              :   Future<ResultDart<List<EpisodeModel>, AppError>> getEpisodesByIds({
+      16              :     required List<int> episodesIds,
+      17              :   }) async {
+      18              :     try {
+      19            2 :       final Response response = await _dio.get(
+      20            1 :         'https://rickandmortyapi.com/api/episode/$episodesIds',
+      21              :       );
+      22              : 
+      23            2 :       if (response.statusCode == 200) {
+      24            3 :         final List<EpisodeModel> episodes = (response.data as List).map((
+      25              :           episode,
+      26              :         ) {
+      27            1 :           return EpisodeModel.fromJson(episode);
+      28            1 :         }).toList();
+      29              : 
+      30            1 :         return Success(episodes);
+      31              :       }
+      32              : 
+      33            1 :       Log.error(
+      34            2 :         "Erro ao consultar episódios. Server error: ${response.statusMessage}",
+      35              :       );
+      36              : 
+      37            1 :       return Failure(
+      38            1 :         AppError(
+      39              :           message:
+      40            2 :               "Erro ao consultar episódios. Server error: ${response.statusMessage}",
+      41              :           type: AppErrorType.server,
+      42              :         ),
+      43              :       );
+      44            1 :     } on DioException catch (e) {
+      45            3 :       Log.error("Erro de rede Dio: ${e.message}");
+      46            1 :       return Failure(
+      47            1 :         AppError(
+      48            2 :           message: "Erro de rede Dio: ${e.message}",
+      49              :           type: AppErrorType.network,
+      50              :         ),
+      51              :       );
+      52              :     } catch (e) {
+      53            2 :       Log.error("Erro inesperado: $e");
+      54            1 :       return Failure(
+      55            2 :         AppError(message: "Erro inesperado: $e", type: AppErrorType.local),
+      56              :       );
+      57              :     }
+      58              :   }
+      59              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/episodes/index.html b/coverage/html/data/service/episodes/index.html new file mode 100644 index 0000000..82275ab --- /dev/null +++ b/coverage/html/data/service/episodes/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/service/episodes + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/episodesCoverageTotalHit
Test:lcov.infoLines:100.0 %2222
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
episodes_service_impl.dart +
100.0%
+
100.0 %2222
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/favorites/favorites_service_impl.dart.gcov.html b/coverage/html/data/service/favorites/favorites_service_impl.dart.gcov.html new file mode 100644 index 0000000..eb8dece --- /dev/null +++ b/coverage/html/data/service/favorites/favorites_service_impl.dart.gcov.html @@ -0,0 +1,167 @@ + + + + + + + LCOV - lcov.info - data/service/favorites/favorites_service_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/favorites - favorites_service_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %3030
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:shared_preferences/shared_preferences.dart';
+       2              : import 'package:result_dart/result_dart.dart';
+       3              : 
+       4              : import '../../../shared/utils/app_error.dart';
+       5              : import '../../../shared/utils/logger.dart';
+       6              : import 'favorites_service.dart';
+       7              : 
+       8              : class FavoritesServiceImpl implements IFavoritesService {
+       9              :   static const String _favoritesKey = 'favorites';
+      10              :   final SharedPreferences _prefs;
+      11              : 
+      12            1 :   FavoritesServiceImpl(this._prefs);
+      13              : 
+      14            1 :   @override
+      15              :   Future<ResultDart<bool, AppError>> saveFavoriteId({required int characterId}) async {
+      16              :     try {
+      17            2 :       final List<String> favorites = _prefs.getStringList(_favoritesKey) ?? <String>[];
+      18              : 
+      19            1 :       final String characterIdStr = characterId.toString();
+      20              : 
+      21            1 :       if (!favorites.contains(characterIdStr)) {
+      22            1 :         favorites.add(characterIdStr);
+      23            2 :         await _prefs.setStringList(_favoritesKey, favorites);
+      24              :       }
+      25              : 
+      26              :       return const Success(true);
+      27              :     } catch (e) {
+      28            1 :       Log.error('Erro ao salvar favoritos');
+      29            1 :       return Failure(
+      30            1 :         AppError(
+      31              :           message: 'Erro ao salvar favoritos',
+      32              :           type: AppErrorType.local,
+      33              :         ),
+      34              :       );
+      35              :     }
+      36              :   }
+      37              : 
+      38            1 :   @override
+      39              :   Future<ResultDart<bool, AppError>> deleteFavoriteId({required int characterId}) async {
+      40              :     try {
+      41            2 :       final List<String> favoriteIds = _prefs.getStringList(_favoritesKey) ?? <String>[];
+      42              : 
+      43            2 :       favoriteIds.remove(characterId.toString());
+      44            2 :       await _prefs.setStringList(_favoritesKey, favoriteIds);
+      45              : 
+      46              :       return const Success(true);
+      47              :     } catch (e) {
+      48            1 :       Log.error('Erro ao deletar favoritos');
+      49            1 :       return Failure(
+      50            1 :         AppError(
+      51              :           message: 'Erro ao deletar favoritos',
+      52              :           type: AppErrorType.local,
+      53              :         ),
+      54              :       );
+      55              :     }
+      56              :   }
+      57              : 
+      58            1 :   @override
+      59              :   Future<ResultDart<List<int>, AppError>> getFavoriteIds() async {
+      60              :     try {
+      61            2 :       final List<String> favoriteIds = _prefs.getStringList(_favoritesKey) ?? <String>[];
+      62            4 :       final List<int> favoritesInt = favoriteIds.map((e) => int.parse(e)).toList();
+      63            1 :       return Success(favoritesInt);
+      64              :     } catch (e) {
+      65            1 :       Log.error('Erro ao buscar favoritos');
+      66            1 :       return Failure(
+      67            1 :         AppError(
+      68              :           message: 'Erro ao buscar favoritos',
+      69              :           type: AppErrorType.local,
+      70              :         ),
+      71              :       );
+      72              :     }
+      73              :   }
+      74              : 
+      75            1 :   @override
+      76              :   Future<ResultDart<bool, AppError>> deleteAllFavoriteIds() async {
+      77              :     try {
+      78            2 :       final isRemoved = await _prefs.remove(_favoritesKey);
+      79              : 
+      80            1 :       return Success(isRemoved);
+      81              :     } catch (e) {
+      82            1 :       Log.error('Erro ao deletar todos favoritos');
+      83            1 :       return Failure(
+      84            1 :         AppError(
+      85              :           message: 'Erro ao deletar todos favoritos',
+      86              :           type: AppErrorType.local,
+      87              :         ),
+      88              :       );
+      89              :     }
+      90              :   }
+      91              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/favorites/index.html b/coverage/html/data/service/favorites/index.html new file mode 100644 index 0000000..3325c98 --- /dev/null +++ b/coverage/html/data/service/favorites/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/service/favorites + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/favoritesCoverageTotalHit
Test:lcov.infoLines:100.0 %3030
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
favorites_service_impl.dart +
100.0%
+
100.0 %3030
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/theme/index.html b/coverage/html/data/service/theme/index.html new file mode 100644 index 0000000..535bd13 --- /dev/null +++ b/coverage/html/data/service/theme/index.html @@ -0,0 +1,98 @@ + + + + + + + LCOV - lcov.info - data/service/theme + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/themeCoverageTotalHit
Test:lcov.infoLines:100.0 %1212
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
theme_service_impl.dart +
100.0%
+
100.0 %1212
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/data/service/theme/theme_service_impl.dart.gcov.html b/coverage/html/data/service/theme/theme_service_impl.dart.gcov.html new file mode 100644 index 0000000..3284310 --- /dev/null +++ b/coverage/html/data/service/theme/theme_service_impl.dart.gcov.html @@ -0,0 +1,125 @@ + + + + + + + LCOV - lcov.info - data/service/theme/theme_service_impl.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - data/service/theme - theme_service_impl.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %1212
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:flutter/material.dart';
+       2              : import 'package:result_dart/result_dart.dart';
+       3              : import 'package:shared_preferences/shared_preferences.dart';
+       4              : 
+       5              : import '../../../shared/utils/app_error.dart';
+       6              : import '../../../shared/utils/logger.dart';
+       7              : import 'theme_service.dart';
+       8              : 
+       9              : class ThemeServiceImpl implements IThemeService {
+      10              :   static const _themeModeKey = 'theme_mode';
+      11              :   final SharedPreferences _prefs;
+      12              : 
+      13            1 :   ThemeServiceImpl(this._prefs);
+      14              : 
+      15            1 :   @override
+      16              :   Future<ResultDart<ThemeMode, AppError>> getThemeMode() async {
+      17              :     try {
+      18            2 :       final themeModeIndex = _prefs.getInt(_themeModeKey);
+      19              :       if (themeModeIndex == null) {
+      20              :         return const Success(ThemeMode.system);
+      21              :       }
+      22            2 :       return Success(ThemeMode.values[themeModeIndex]);
+      23              :     } catch (e) {
+      24            1 :       Log.error('Erro ao consultar tema salvo');
+      25            1 :       return Failure(
+      26            1 :         AppError(
+      27              :           message: 'Erro ao consultar tema salvo',
+      28              :           type: AppErrorType.local,
+      29              :         ),
+      30              :       );
+      31              :     }
+      32              :   }
+      33              : 
+      34            1 :   @override
+      35              :   Future<ResultDart<bool, AppError>> saveThemeMode(ThemeMode mode) async {
+      36              :     try {
+      37            3 :       await _prefs.setInt(_themeModeKey, mode.index);
+      38              :       return const Success(true);
+      39              :     } catch (e) {
+      40            1 :       Log.error('Erro ao salvar tema');
+      41            1 :       return Failure(
+      42            1 :         AppError(
+      43              :           message: 'Erro ao salvar tema',
+      44              :           type: AppErrorType.local,
+      45              :         ),
+      46              :       );
+      47              :     }
+      48              :   }
+      49              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/enums/gender_enum.dart.gcov.html b/coverage/html/domain/enums/gender_enum.dart.gcov.html new file mode 100644 index 0000000..24ab1f7 --- /dev/null +++ b/coverage/html/domain/enums/gender_enum.dart.gcov.html @@ -0,0 +1,94 @@ + + + + + + + LCOV - lcov.info - domain/enums/gender_enum.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/enums - gender_enum.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %44
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : enum GenderEnum {
+       2              :   male('Male'),
+       3              :   female('Female'),
+       4              :   genderless('Genderless'),
+       5              :   unknown('Unknown'),
+       6              :   all('All');
+       7              : 
+       8              :   final String genderLabel;
+       9              : 
+      10              :   const GenderEnum(this.genderLabel);
+      11              : 
+      12            3 :   static GenderEnum fromString(String? genderLabel) {
+      13            3 :     return values.firstWhere(
+      14           15 :       (gender) => gender.genderLabel.toUpperCase() == genderLabel?.toUpperCase(),
+      15            2 :       orElse: () => unknown,
+      16              :     );
+      17              :   }
+      18              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/enums/index-sort-f.html b/coverage/html/domain/enums/index-sort-f.html new file mode 100644 index 0000000..e4127a3 --- /dev/null +++ b/coverage/html/domain/enums/index-sort-f.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - domain/enums + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/enumsCoverageTotalHit
Test:lcov.infoLines:100.0 %88
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
gender_enum.dart +
100.0%
+
100.0 %44
status_enum.dart +
100.0%
+
100.0 %44
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/enums/index-sort-l.html b/coverage/html/domain/enums/index-sort-l.html new file mode 100644 index 0000000..f978ebd --- /dev/null +++ b/coverage/html/domain/enums/index-sort-l.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - domain/enums + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/enumsCoverageTotalHit
Test:lcov.infoLines:100.0 %88
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
gender_enum.dart +
100.0%
+
100.0 %44
status_enum.dart +
100.0%
+
100.0 %44
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/enums/index.html b/coverage/html/domain/enums/index.html new file mode 100644 index 0000000..25a8502 --- /dev/null +++ b/coverage/html/domain/enums/index.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - domain/enums + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/enumsCoverageTotalHit
Test:lcov.infoLines:100.0 %88
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
gender_enum.dart +
100.0%
+
100.0 %44
status_enum.dart +
100.0%
+
100.0 %44
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/enums/status_enum.dart.gcov.html b/coverage/html/domain/enums/status_enum.dart.gcov.html new file mode 100644 index 0000000..635bd96 --- /dev/null +++ b/coverage/html/domain/enums/status_enum.dart.gcov.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - lcov.info - domain/enums/status_enum.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/enums - status_enum.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %44
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:flutter/material.dart';
+       2              : 
+       3              : enum StatusEnum {
+       4              :   alive('Alive', Colors.green),
+       5              :   dead('Dead', Colors.red),
+       6              :   unknown('Unknown', Colors.grey),
+       7              :   all('All', Colors.white);
+       8              : 
+       9              :   final String statusLabel;
+      10              :   final Color statusColor;
+      11              : 
+      12              :   const StatusEnum(this.statusLabel, this.statusColor);
+      13              : 
+      14            3 :   static StatusEnum fromString(String? statusLabel) {
+      15            3 :     return values.firstWhere(
+      16           15 :       (status) => status.statusLabel.toUpperCase() == statusLabel?.toUpperCase(),
+      17            2 :       orElse: () => unknown,
+      18              :     );
+      19              :   }
+      20              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/models/character_model.dart.gcov.html b/coverage/html/domain/models/character_model.dart.gcov.html new file mode 100644 index 0000000..621b85e --- /dev/null +++ b/coverage/html/domain/models/character_model.dart.gcov.html @@ -0,0 +1,119 @@ + + + + + + + LCOV - lcov.info - domain/models/character_model.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/models - character_model.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %1515
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import '../enums/gender_enum.dart';
+       2              : import '../enums/status_enum.dart';
+       3              : 
+       4              : class CharacterModel {
+       5              :   final int id;
+       6              :   final String name;
+       7              :   final String species;
+       8              :   final StatusEnum status;
+       9              :   final String image;
+      10              :   final String origin;
+      11              :   final GenderEnum gender;
+      12              :   final String location;
+      13              :   final List<int> episodesIds;
+      14              : 
+      15            3 :   CharacterModel({
+      16              :     required this.id,
+      17              :     required this.name,
+      18              :     required this.species,
+      19              :     required this.status,
+      20              :     required this.image,
+      21              :     required this.origin,
+      22              :     required this.gender,
+      23              :     required this.location,
+      24              :     required this.episodesIds,
+      25              :   });
+      26              : 
+      27            2 :   factory CharacterModel.fromJson(Map<String, dynamic> json) {
+      28            2 :     return CharacterModel(
+      29            2 :       id: json['id'],
+      30            2 :       name: json['name'] ?? 'Unknown',
+      31            2 :       species: json['species'] ?? 'Unknown',
+      32            4 :       status: StatusEnum.fromString(json['status']),
+      33            2 :       image: json['image'] ?? '',
+      34            4 :       origin: json['origin']['name'] ?? 'Unknown',
+      35            4 :       gender: GenderEnum.fromString(json['gender']),
+      36            4 :       location: json['location']['name'] ?? 'Unknown',
+      37            5 :       episodesIds: (json['episode'] as List<dynamic>).map((url) {
+      38            2 :         final uriParts = url.toString().split('/');
+      39            2 :         return int.parse(uriParts.last);
+      40            2 :       }).toList(),
+      41              :     );
+      42              :   }
+      43              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/models/episode_model.dart.gcov.html b/coverage/html/domain/models/episode_model.dart.gcov.html new file mode 100644 index 0000000..f24119f --- /dev/null +++ b/coverage/html/domain/models/episode_model.dart.gcov.html @@ -0,0 +1,95 @@ + + + + + + + LCOV - lcov.info - domain/models/episode_model.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/models - episode_model.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %66
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : class EpisodeModel {
+       2              :   final int id;
+       3              :   final String name;
+       4              :   final String episode;
+       5              : 
+       6            3 :   EpisodeModel({
+       7              :     required this.id,
+       8              :     required this.name,
+       9              :     required this.episode,
+      10              :   });
+      11              : 
+      12            2 :   factory EpisodeModel.fromJson(Map<String, dynamic> json) {
+      13            2 :     return EpisodeModel(
+      14            2 :       id: json['id'] as int,
+      15            2 :       name: json['name'] as String? ?? '',
+      16            2 :       episode: json['episode'] as String? ?? '',
+      17              :     );
+      18              :   }
+      19              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/models/index-sort-f.html b/coverage/html/domain/models/index-sort-f.html new file mode 100644 index 0000000..77294a1 --- /dev/null +++ b/coverage/html/domain/models/index-sort-f.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - domain/models + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/modelsCoverageTotalHit
Test:lcov.infoLines:100.0 %2121
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
character_model.dart +
100.0%
+
100.0 %1515
episode_model.dart +
100.0%
+
100.0 %66
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/models/index-sort-l.html b/coverage/html/domain/models/index-sort-l.html new file mode 100644 index 0000000..1b82c45 --- /dev/null +++ b/coverage/html/domain/models/index-sort-l.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - domain/models + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/modelsCoverageTotalHit
Test:lcov.infoLines:100.0 %2121
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
episode_model.dart +
100.0%
+
100.0 %66
character_model.dart +
100.0%
+
100.0 %1515
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/domain/models/index.html b/coverage/html/domain/models/index.html new file mode 100644 index 0000000..ac37c91 --- /dev/null +++ b/coverage/html/domain/models/index.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - domain/models + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - domain/modelsCoverageTotalHit
Test:lcov.infoLines:100.0 %2121
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
character_model.dart +
100.0%
+
100.0 %1515
episode_model.dart +
100.0%
+
100.0 %66
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/emerald.png b/coverage/html/emerald.png new file mode 100644 index 0000000..38ad4f4 Binary files /dev/null and b/coverage/html/emerald.png differ diff --git a/coverage/html/gcov.css b/coverage/html/gcov.css new file mode 100644 index 0000000..1cacc83 --- /dev/null +++ b/coverage/html/gcov.css @@ -0,0 +1,1125 @@ +/* All views: initial background and text color */ +body +{ + color: #000000; + background-color: #ffffff; +} + +/* All views: standard link format*/ +a:link +{ + color: #284fa8; + text-decoration: underline; +} + +/* All views: standard link - visited format */ +a:visited +{ + color: #00cb40; + text-decoration: underline; +} + +/* All views: standard link - activated format */ +a:active +{ + color: #ff0040; + text-decoration: underline; +} + +/* All views: main title format */ +td.title +{ + text-align: center; + padding-bottom: 10px; + font-family: sans-serif; + font-size: 20pt; + font-style: italic; + font-weight: bold; +} +/* table footnote */ +td.footnote +{ + text-align: left; + padding-left: 100px; + padding-right: 10px; + background-color: #dae7fe; /* light blue table background color */ + /* dark blue table header color + background-color: #6688d4; */ + white-space: nowrap; + font-family: sans-serif; + font-style: italic; + font-size:70%; +} +/* "Line coverage date bins" leader */ +td.subTableHeader +{ + text-align: center; + padding-bottom: 6px; + font-family: sans-serif; + font-weight: bold; + vertical-align: center; +} + +/* All views: header item format */ +td.headerItem +{ + text-align: right; + padding-right: 6px; + font-family: sans-serif; + font-weight: bold; + vertical-align: top; + white-space: nowrap; +} + +/* All views: header item value format */ +td.headerValue +{ + text-align: left; + color: #284fa8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; +} + +/* All views: header item coverage table heading */ +td.headerCovTableHead +{ + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; +} + +/* All views: header item coverage table entry */ +td.headerCovTableEntry +{ + text-align: right; + color: #284fa8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #dae7fe; +} + +/* All views: header item coverage table entry for high coverage rate */ +td.headerCovTableEntryHi +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #a7fc9d; +} + +/* All views: header item coverage table entry for medium coverage rate */ +td.headerCovTableEntryMed +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #ffea20; +} + +/* All views: header item coverage table entry for ow coverage rate */ +td.headerCovTableEntryLo +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #ff0000; +} + +/* All views: header legend value for legend entry */ +td.headerValueLeg +{ + text-align: left; + color: #000000; + font-family: sans-serif; + font-size: 80%; + white-space: nowrap; + padding-top: 4px; +} + +/* All views: color of horizontal ruler */ +td.ruler +{ + background-color: #6688d4; +} + +/* All views: version string format */ +td.versionInfo +{ + text-align: center; + padding-top: 2px; + font-family: sans-serif; + font-style: italic; +} + +/* Directory view/File view (all)/Test case descriptions: + table headline format */ +td.tableHead +{ + text-align: center; + color: #ffffff; + background-color: #6688d4; + font-family: sans-serif; + font-size: 120%; + font-weight: bold; + white-space: nowrap; + padding-left: 4px; + padding-right: 4px; +} + +span.tableHeadSort +{ + padding-right: 4px; +} + +/* Directory view/File view (all): filename entry format */ +td.coverFile +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + background-color: #dae7fe; + font-family: monospace; +} + +/* Directory view/File view (all): directory name entry format */ +td.coverDirectory +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + background-color: #b8d0ff; + font-family: monospace; +} + +/* Directory view/File view (all): filename entry format */ +td.overallOwner +{ + text-align: center; + font-weight: bold; + font-family: sans-serif; + background-color: #dae7fe; + padding-right: 10px; + padding-left: 10px; +} + +/* Directory view/File view (all): filename entry format */ +td.ownerName +{ + text-align: right; + font-style: italic; + font-family: sans-serif; + background-color: #E5DBDB; + padding-right: 10px; + padding-left: 20px; +} + +/* Directory view/File view (all): bar-graph entry format*/ +td.coverBar +{ + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; +} + +/* Directory view/File view (all): bar-graph entry format*/ +td.owner_coverBar +{ + padding-left: 10px; + padding-right: 10px; + background-color: #E5DBDB; +} + +/* Directory view/File view (all): bar-graph outline color */ +td.coverBarOutline +{ + background-color: #000000; +} + +/* Directory view/File view (all): percentage entry for files with + high coverage rate */ +td.coverPerHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #a7fc9d; + font-weight: bold; + font-family: sans-serif; +} + +/* 'owner' entry: slightly lighter color than 'coverPerHi' */ +td.owner_coverPerHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #82E0AA; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry */ +td.coverNumDflt +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + white-space: nowrap; + font-family: sans-serif; +} + +/* td background color and font for the 'owner' section of the table */ +td.ownerTla +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #E5DBDB; + white-space: nowrap; + font-family: sans-serif; + font-style: italic; +} + +/* Directory view/File view (all): line count entry for files with + high coverage rate */ +td.coverNumHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #a7fc9d; + white-space: nowrap; + font-family: sans-serif; +} + +td.owner_coverNumHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #82E0AA; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + medium coverage rate */ +td.coverPerMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ffea20; + font-weight: bold; + font-family: sans-serif; +} + +td.owner_coverPerMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #F9E79F; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + medium coverage rate */ +td.coverNumMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ffea20; + white-space: nowrap; + font-family: sans-serif; +} + +td.owner_coverNumMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #F9E79F; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + low coverage rate */ +td.coverPerLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ff0000; + font-weight: bold; + font-family: sans-serif; +} + +td.owner_coverPerLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #EC7063; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + low coverage rate */ +td.coverNumLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ff0000; + white-space: nowrap; + font-family: sans-serif; +} + +td.owner_coverNumLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #EC7063; + white-space: nowrap; + font-family: sans-serif; +} + +/* File view (all): "show/hide details" link format */ +a.detail:link +{ + color: #b8d0ff; + font-size:80%; +} + +/* File view (all): "show/hide details" link - visited format */ +a.detail:visited +{ + color: #b8d0ff; + font-size:80%; +} + +/* File view (all): "show/hide details" link - activated format */ +a.detail:active +{ + color: #ffffff; + font-size:80%; +} + +/* File view (detail): test name entry */ +td.testName +{ + text-align: right; + padding-right: 10px; + background-color: #dae7fe; + font-family: sans-serif; +} + +/* File view (detail): test percentage entry */ +td.testPer +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-family: sans-serif; +} + +/* File view (detail): test lines count entry */ +td.testNum +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-family: sans-serif; +} + +/* Test case descriptions: test name format*/ +dt +{ + font-family: sans-serif; + font-weight: bold; +} + +/* Test case descriptions: description table body */ +td.testDescription +{ + padding-top: 10px; + padding-left: 30px; + padding-bottom: 10px; + padding-right: 30px; + background-color: #dae7fe; +} + +/* Source code view: function entry */ +td.coverFn +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + background-color: #dae7fe; + font-family: monospace; +} + +/* Source code view: function entry zero count*/ +td.coverFnLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ff0000; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: function entry nonzero count*/ +td.coverFnHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-weight: bold; + font-family: sans-serif; +} + +td.coverFnAlias +{ + text-align: right; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + /* make this a slightly different color than the leader - otherwise, + otherwise the alias is hard to distinguish in the table */ + background-color: #E5DBDB; /* very light pale grey/blue */ + font-family: monospace; +} + +/* Source code view: function entry zero count*/ +td.coverFnAliasLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #EC7063; /* lighter red */ + font-family: sans-serif; +} + +/* Source code view: function entry nonzero count*/ +td.coverFnAliasHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: source code format */ +pre.source +{ + font-family: monospace; + white-space: pre; + margin-top: 2px; +} + +/* elided/removed code */ +span.elidedSource +{ + font-family: sans-serif; + /*font-size: 8pt; */ + font-style: italic; + background-color: lightgrey; +} + +/* Source code view: line number format */ +span.lineNum +{ + background-color: #efe383; +} + +/* Source code view: line number format when there are deleted + lines in the corresponding location */ +span.lineNumWithDelete +{ + foreground-color: #efe383; + background-color: lightgrey; +} + +/* Source code view: format for Cov legend */ +span.coverLegendCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #cad7fe; +} + +/* Source code view: format for NoCov legend */ +span.coverLegendNoCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #ff6230; +} + +/* Source code view: format for the source code heading line */ +pre.sourceHeading +{ + white-space: pre; + font-family: monospace; + font-weight: bold; + margin: 0px; +} + +/* All views: header legend value for low rate */ +td.headerValueLegL +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 4px; + padding-right: 2px; + background-color: #ff0000; + font-size: 80%; +} + +/* All views: header legend value for med rate */ +td.headerValueLegM +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 2px; + background-color: #ffea20; + font-size: 80%; +} + +/* All views: header legend value for hi rate */ +td.headerValueLegH +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 4px; + background-color: #a7fc9d; + font-size: 80%; +} + +/* All views except source code view: legend format for low coverage */ +span.coverLegendCovLo +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #ff0000; +} + +/* All views except source code view: legend format for med coverage */ +span.coverLegendCovMed +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #ffea20; +} + +/* All views except source code view: legend format for hi coverage */ +span.coverLegendCovHi +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #a7fc9d; +} + +a.branchTla:link +{ + color: #000000; +} + +a.branchTla:visited +{ + color: #000000; +} + +a.mcdcTla:link +{ + color: #000000; +} + +a.mcdcTla:visited +{ + color: #000000; +} + +/* Source code view/table entry background: format for lines classified as "Uncovered New Code (+ => 0): +Newly added code is not tested" */ +td.tlaUNC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgUNC { + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Uncovered New Code (+ => 0): +Newly added code is not tested" */ +span.tlaUNC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgUNC { + background-color: #FF6230; +} +a.tlaBgUNC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadUNC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Lost Baseline Coverage (1 => 0): +Unchanged code is no longer tested" */ +td.tlaLBC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgLBC { + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Lost Baseline Coverage (1 => 0): +Unchanged code is no longer tested" */ +span.tlaLBC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgLBC { + background-color: #FF6230; +} +a.tlaBgLBC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadLBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Uncovered Included Code (# => 0): +Previously unused code is untested" */ +td.tlaUIC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgUIC { + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Uncovered Included Code (# => 0): +Previously unused code is untested" */ +span.tlaUIC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgUIC { + background-color: #FF6230; +} +a.tlaBgUIC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadUIC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Uncovered Baseline Code (0 => 0): +Unchanged code was untested before, is untested now" */ +td.tlaUBC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgUBC { + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Uncovered Baseline Code (0 => 0): +Unchanged code was untested before, is untested now" */ +span.tlaUBC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgUBC { + background-color: #FF6230; +} +a.tlaBgUBC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadUBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry background: format for lines classified as "Gained Baseline Coverage (0 => 1): +Unchanged code is tested now" */ +td.tlaGBC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgGBC { + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Gained Baseline Coverage (0 => 1): +Unchanged code is tested now" */ +span.tlaGBC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgGBC { + background-color: #CAD7FE; +} +a.tlaBgGBC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadGBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Gained Included Coverage (# => 1): +Previously unused code is tested now" */ +td.tlaGIC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgGIC { + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Gained Included Coverage (# => 1): +Previously unused code is tested now" */ +span.tlaGIC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgGIC { + background-color: #CAD7FE; +} +a.tlaBgGIC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadGIC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Gained New Coverage (+ => 1): +Newly added code is tested" */ +td.tlaGNC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgGNC { + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Gained New Coverage (+ => 1): +Newly added code is tested" */ +span.tlaGNC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgGNC { + background-color: #CAD7FE; +} +a.tlaBgGNC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadGNC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Covered Baseline Code (1 => 1): +Unchanged code was tested before and is still tested" */ +td.tlaCBC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgCBC { + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Covered Baseline Code (1 => 1): +Unchanged code was tested before and is still tested" */ +span.tlaCBC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgCBC { + background-color: #CAD7FE; +} +a.tlaBgCBC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadCBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry background: format for lines classified as "Excluded Uncovered Baseline (0 => #): +Previously untested code is unused now" */ +td.tlaEUB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgEUB { + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Excluded Uncovered Baseline (0 => #): +Previously untested code is unused now" */ +span.tlaEUB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgEUB { + background-color: #FFFFFF; +} +a.tlaBgEUB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadEUB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Excluded Covered Baseline (1 => #): +Previously tested code is unused now" */ +td.tlaECB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgECB { + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Excluded Covered Baseline (1 => #): +Previously tested code is unused now" */ +span.tlaECB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgECB { + background-color: #FFFFFF; +} +a.tlaBgECB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadECB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Deleted Uncovered Baseline (0 => -): +Previously untested code has been deleted" */ +td.tlaDUB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgDUB { + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Deleted Uncovered Baseline (0 => -): +Previously untested code has been deleted" */ +span.tlaDUB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgDUB { + background-color: #FFFFFF; +} +a.tlaBgDUB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadDUB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Deleted Covered Baseline (1 => -): +Previously tested code has been deleted" */ +td.tlaDCB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgDCB { + background-color: #FFFFFF; +} + +/* Source code view/table entry background: format for lines classified as "Deleted Covered Baseline (1 => -): +Previously tested code has been deleted" */ +span.tlaDCB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgDCB { + background-color: #FFFFFF; +} +a.tlaBgDCB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadDCB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view: format for date/owner bin that is not hit */ +span.missBins +{ + background-color: #ff0000 /* red */ +} diff --git a/coverage/html/glass.png b/coverage/html/glass.png new file mode 100644 index 0000000..e1abc00 Binary files /dev/null and b/coverage/html/glass.png differ diff --git a/coverage/html/index-sort-f.html b/coverage/html/index-sort-f.html new file mode 100644 index 0000000..7ee07b6 --- /dev/null +++ b/coverage/html/index-sort-f.html @@ -0,0 +1,197 @@ + + + + + + + LCOV - lcov.info + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.infoLines:91.1 %202184
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
data/repository/characters/ +
100.0%
+
100.0 %55
data/repository/episodes/ +
100.0%
+
100.0 %33
data/repository/favorites/ +
100.0%
+
100.0 %99
data/repository/theme/ +
100.0%
+
100.0 %55
data/service/characters/ +
100.0%
+
100.0 %5555
data/service/episodes/ +
100.0%
+
100.0 %2222
data/service/favorites/ +
100.0%
+
100.0 %3030
data/service/theme/ +
100.0%
+
100.0 %1212
domain/enums/ +
100.0%
+
100.0 %88
domain/models/ +
100.0%
+
100.0 %2121
shared/pagination/ +
50.0%50.0%
+
50.0 %168
shared/utils/ +
37.5%37.5%
+
37.5 %166
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/index-sort-l.html b/coverage/html/index-sort-l.html new file mode 100644 index 0000000..6055674 --- /dev/null +++ b/coverage/html/index-sort-l.html @@ -0,0 +1,197 @@ + + + + + + + LCOV - lcov.info + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.infoLines:91.1 %202184
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
shared/utils/ +
37.5%37.5%
+
37.5 %166
shared/pagination/ +
50.0%50.0%
+
50.0 %168
data/repository/episodes/ +
100.0%
+
100.0 %33
data/repository/characters/ +
100.0%
+
100.0 %55
data/repository/theme/ +
100.0%
+
100.0 %55
domain/enums/ +
100.0%
+
100.0 %88
data/repository/favorites/ +
100.0%
+
100.0 %99
data/service/theme/ +
100.0%
+
100.0 %1212
domain/models/ +
100.0%
+
100.0 %2121
data/service/episodes/ +
100.0%
+
100.0 %2222
data/service/favorites/ +
100.0%
+
100.0 %3030
data/service/characters/ +
100.0%
+
100.0 %5555
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/index.html b/coverage/html/index.html new file mode 100644 index 0000000..2ef415b --- /dev/null +++ b/coverage/html/index.html @@ -0,0 +1,197 @@ + + + + + + + LCOV - lcov.info + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.infoLines:91.1 %202184
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
data/repository/characters/ +
100.0%
+
100.0 %55
data/repository/episodes/ +
100.0%
+
100.0 %33
data/repository/favorites/ +
100.0%
+
100.0 %99
data/repository/theme/ +
100.0%
+
100.0 %55
data/service/characters/ +
100.0%
+
100.0 %5555
data/service/episodes/ +
100.0%
+
100.0 %2222
data/service/favorites/ +
100.0%
+
100.0 %3030
data/service/theme/ +
100.0%
+
100.0 %1212
domain/enums/ +
100.0%
+
100.0 %88
domain/models/ +
100.0%
+
100.0 %2121
shared/pagination/ +
50.0%50.0%
+
50.0 %168
shared/utils/ +
37.5%37.5%
+
37.5 %166
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/ruby.png b/coverage/html/ruby.png new file mode 100644 index 0000000..991b6d4 Binary files /dev/null and b/coverage/html/ruby.png differ diff --git a/coverage/html/shared/pagination/index-sort-f.html b/coverage/html/shared/pagination/index-sort-f.html new file mode 100644 index 0000000..4864c36 --- /dev/null +++ b/coverage/html/shared/pagination/index-sort-f.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - shared/pagination + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/paginationCoverageTotalHit
Test:lcov.infoLines:50.0 %168
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
paginated_response.dart +
25.0%25.0%
+
25.0 %41
pagination.dart +
58.3%58.3%
+
58.3 %127
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/pagination/index-sort-l.html b/coverage/html/shared/pagination/index-sort-l.html new file mode 100644 index 0000000..9efd367 --- /dev/null +++ b/coverage/html/shared/pagination/index-sort-l.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - shared/pagination + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/paginationCoverageTotalHit
Test:lcov.infoLines:50.0 %168
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
paginated_response.dart +
25.0%25.0%
+
25.0 %41
pagination.dart +
58.3%58.3%
+
58.3 %127
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/pagination/index.html b/coverage/html/shared/pagination/index.html new file mode 100644 index 0000000..d78bc08 --- /dev/null +++ b/coverage/html/shared/pagination/index.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - shared/pagination + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/paginationCoverageTotalHit
Test:lcov.infoLines:50.0 %168
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
paginated_response.dart +
25.0%25.0%
+
25.0 %41
pagination.dart +
58.3%58.3%
+
58.3 %127
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/pagination/paginated_response.dart.gcov.html b/coverage/html/shared/pagination/paginated_response.dart.gcov.html new file mode 100644 index 0000000..e71b89e --- /dev/null +++ b/coverage/html/shared/pagination/paginated_response.dart.gcov.html @@ -0,0 +1,89 @@ + + + + + + + LCOV - lcov.info - shared/pagination/paginated_response.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/pagination - paginated_response.dartCoverageTotalHit
Test:lcov.infoLines:25.0 %41
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:doro_tech/src/shared/pagination/pagination.dart';
+       2              : 
+       3              : class PaginatedResponse<T> {
+       4              :   Pagination pagination;
+       5              :   final List<T> data;
+       6              : 
+       7            2 :   PaginatedResponse({required this.pagination, required this.data});
+       8              : 
+       9            0 :   void merge(PaginatedResponse<T> newPage) {
+      10            0 :     pagination = newPage.pagination.copyWith(page: newPage.pagination.page + 1);
+      11            0 :     data.addAll(newPage.data);
+      12              :   }
+      13              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/pagination/pagination.dart.gcov.html b/coverage/html/shared/pagination/pagination.dart.gcov.html new file mode 100644 index 0000000..c3668b3 --- /dev/null +++ b/coverage/html/shared/pagination/pagination.dart.gcov.html @@ -0,0 +1,114 @@ + + + + + + + LCOV - lcov.info - shared/pagination/pagination.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/pagination - pagination.dartCoverageTotalHit
Test:lcov.infoLines:58.3 %127
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : class Pagination {
+       2              :   final int page;
+       3              :   final int offset;
+       4              :   final int perPage;
+       5              :   final int itemsCount;
+       6              :   final int? total;
+       7              : 
+       8            2 :   Pagination({
+       9              :     this.page = 1,
+      10              :     this.offset = 0,
+      11              :     this.perPage = 10,
+      12              :     this.itemsCount = 0,
+      13              :     this.total,
+      14              :   });
+      15              : 
+      16            0 :   bool get hasMorePages {
+      17            0 :     if(total != null){
+      18            0 :       return (page <= ((total! / perPage).ceil()));
+      19              :     }
+      20            0 :     return itemsCount == perPage;
+      21              :   }
+      22              : 
+      23            2 :   Pagination copyWith({
+      24              :     int? page,
+      25              :     int? offset,
+      26              :     int? perPage,
+      27              :     int? itemsCount,
+      28              :     int? total,
+      29              :   }) {
+      30            2 :     return Pagination(
+      31            2 :       page: page ?? this.page,
+      32            2 :       offset: offset ?? this.offset,
+      33            2 :       perPage: perPage ?? this.perPage,
+      34            2 :       itemsCount: itemsCount ?? this.itemsCount,
+      35            0 :       total: total ?? this.total,
+      36              :     );
+      37              :   }
+      38              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/utils/app_error.dart.gcov.html b/coverage/html/shared/utils/app_error.dart.gcov.html new file mode 100644 index 0000000..29a9a9c --- /dev/null +++ b/coverage/html/shared/utils/app_error.dart.gcov.html @@ -0,0 +1,95 @@ + + + + + + + LCOV - lcov.info - shared/utils/app_error.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/utils - app_error.dartCoverageTotalHit
Test:lcov.infoLines:100.0 %11
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : enum AppErrorType {
+       2              :   local,      // SharedPreferences, SQLite, arquivos locais
+       3              :   network,    // Sem internet, timeout, DNS
+       4              :   server,     // 500, 404, API down
+       5              :   validation, // Dados inválidos
+       6              :   auth,       // Token expirado, não autorizado
+       7              :   requisitionLimit, // Limite de requisição
+       8              :   unknown,    // Erro não categorizado
+       9              : }
+      10              : 
+      11              : class AppError {
+      12              :   final String message;
+      13              :   final AppErrorType type;
+      14              : 
+      15            8 :   AppError({
+      16              :     required this.message,
+      17              :     required this.type,
+      18              :   });
+      19              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/utils/index-sort-f.html b/coverage/html/shared/utils/index-sort-f.html new file mode 100644 index 0000000..50cf489 --- /dev/null +++ b/coverage/html/shared/utils/index-sort-f.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - shared/utils + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/utilsCoverageTotalHit
Test:lcov.infoLines:37.5 %166
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
app_error.dart +
100.0%
+
100.0 %11
logger.dart +
33.3%33.3%
+
33.3 %155
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/utils/index-sort-l.html b/coverage/html/shared/utils/index-sort-l.html new file mode 100644 index 0000000..4ae514e --- /dev/null +++ b/coverage/html/shared/utils/index-sort-l.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - shared/utils + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/utilsCoverageTotalHit
Test:lcov.infoLines:37.5 %166
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
logger.dart +
33.3%33.3%
+
33.3 %155
app_error.dart +
100.0%
+
100.0 %11
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/utils/index.html b/coverage/html/shared/utils/index.html new file mode 100644 index 0000000..93ae410 --- /dev/null +++ b/coverage/html/shared/utils/index.html @@ -0,0 +1,107 @@ + + + + + + + LCOV - lcov.info - shared/utils + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/utilsCoverageTotalHit
Test:lcov.infoLines:37.5 %166
Test Date:2025-07-17 18:10:44Functions:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Sort by file nameLine Coverage Sort by line coverage
Rate Total Hit
app_error.dart +
100.0%
+
100.0 %11
logger.dart +
33.3%33.3%
+
33.3 %155
Note: 'Function Coverage' columns elided as function owner is not identified.
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/shared/utils/logger.dart.gcov.html b/coverage/html/shared/utils/logger.dart.gcov.html new file mode 100644 index 0000000..2e7a396 --- /dev/null +++ b/coverage/html/shared/utils/logger.dart.gcov.html @@ -0,0 +1,126 @@ + + + + + + + LCOV - lcov.info - shared/utils/logger.dart + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - shared/utils - logger.dartCoverageTotalHit
Test:lcov.infoLines:33.3 %155
Test Date:2025-07-17 18:10:44Functions:-00
+
+ + + + + + + + +

+
            Line data    Source code
+
+       1              : import 'package:logger/logger.dart';
+       2              : 
+       3              : class Log {
+       4              : 
+       5              :   // Verbose log
+       6            0 :   static void verbose(String msg) {
+       7            0 :     _getLogger().v(msg);
+       8              :   }
+       9              : 
+      10              :   // Debug log
+      11            0 :   static void debug(String msg) {
+      12            0 :     _getLogger().d(msg);
+      13              :   }
+      14              : 
+      15              :   // Info log
+      16            0 :   static void info(String msg) {
+      17            0 :     _getLogger().i(msg);
+      18              :   }
+      19              : 
+      20              :   // Warning log
+      21            0 :   static void warning(String msg) {
+      22            0 :     _getLogger().w(msg);
+      23              :   }
+      24              : 
+      25              :   // Error log
+      26            4 :   static void error(String msg) {
+      27            8 :     _getLogger().e(msg);
+      28              :   }
+      29              : 
+      30              :   // What a terrible failure log
+      31            0 :   static void wtf(String msg) {
+      32            0 :     _getLogger().wtf(msg);
+      33              :   }
+      34              : 
+      35            4 :   static Logger _getLogger () {
+      36            4 :     return Logger(
+      37              :       filter: null, // Use the default LogFilter (-> only log in debug mode)
+      38            8 :       printer: PrefixPrinter(PrettyPrinter(
+      39              : 
+      40              :           methodCount: 0, // number of method calls to be displayed
+      41              :           errorMethodCount: 8, // number of method calls if stacktrace is provided
+      42              :           lineLength: 120, // width of the output
+      43              :           colors: true, // Colorful log messages
+      44              :           printEmojis: true, // Print an emoji for each log message
+      45              :           printTime: false // Should each log print contain a timestamp
+      46              :       )), // Use the PrettyPrinter to format and print log
+      47              :       output: null, // Use the default LogOutput (-> send everything to console)
+      48              :     );
+      49              :   }
+      50              : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.3.1-1
+
+ + + diff --git a/coverage/html/snow.png b/coverage/html/snow.png new file mode 100644 index 0000000..2cdae10 Binary files /dev/null and b/coverage/html/snow.png differ diff --git a/coverage/html/updown.png b/coverage/html/updown.png new file mode 100644 index 0000000..aa56a23 Binary files /dev/null and b/coverage/html/updown.png differ diff --git a/coverage/lcov.info b/coverage/lcov.info new file mode 100644 index 0000000..14979b9 --- /dev/null +++ b/coverage/lcov.info @@ -0,0 +1,266 @@ +SF:lib/src/data/repository/favorites/favorites_repository_impl.dart +DA:9,1 +DA:11,1 +DA:13,2 +DA:16,1 +DA:18,2 +DA:21,1 +DA:23,2 +DA:26,1 +DA:28,2 +LF:9 +LH:9 +end_of_record +SF:lib/src/shared/utils/app_error.dart +DA:15,8 +LF:1 +LH:1 +end_of_record +SF:lib/src/data/service/favorites/favorites_service_impl.dart +DA:12,1 +DA:14,1 +DA:17,2 +DA:19,1 +DA:21,1 +DA:22,1 +DA:23,2 +DA:28,1 +DA:29,1 +DA:30,1 +DA:38,1 +DA:41,2 +DA:43,2 +DA:44,2 +DA:48,1 +DA:49,1 +DA:50,1 +DA:58,1 +DA:61,2 +DA:62,4 +DA:63,1 +DA:65,1 +DA:66,1 +DA:67,1 +DA:75,1 +DA:78,2 +DA:80,1 +DA:82,1 +DA:83,1 +DA:84,1 +LF:30 +LH:30 +end_of_record +SF:lib/src/shared/utils/logger.dart +DA:6,0 +DA:7,0 +DA:11,0 +DA:12,0 +DA:16,0 +DA:17,0 +DA:21,0 +DA:22,0 +DA:26,4 +DA:27,8 +DA:31,0 +DA:32,0 +DA:35,4 +DA:36,4 +DA:38,8 +LF:15 +LH:5 +end_of_record +SF:lib/src/data/repository/episodes/episodes_repository_impl.dart +DA:12,1 +DA:14,1 +DA:18,2 +LF:3 +LH:3 +end_of_record +SF:lib/src/domain/models/episode_model.dart +DA:6,3 +DA:12,2 +DA:13,2 +DA:14,2 +DA:15,2 +DA:16,2 +LF:6 +LH:6 +end_of_record +SF:lib/src/data/service/episodes/episodes_service_impl.dart +DA:12,1 +DA:14,1 +DA:19,2 +DA:20,1 +DA:23,2 +DA:24,3 +DA:27,1 +DA:28,1 +DA:30,1 +DA:33,1 +DA:34,2 +DA:37,1 +DA:38,1 +DA:40,2 +DA:44,1 +DA:45,3 +DA:46,1 +DA:47,1 +DA:48,2 +DA:53,2 +DA:54,1 +DA:55,2 +LF:22 +LH:22 +end_of_record +SF:lib/src/data/repository/theme/theme_repository_impl.dart +DA:11,1 +DA:13,1 +DA:15,2 +DA:18,1 +DA:20,2 +LF:5 +LH:5 +end_of_record +SF:lib/src/data/repository/characters/characters_repository_impl.dart +DA:15,1 +DA:17,1 +DA:25,2 +DA:33,1 +DA:37,2 +LF:5 +LH:5 +end_of_record +SF:lib/src/domain/enums/gender_enum.dart +DA:12,3 +DA:13,3 +DA:14,15 +DA:15,2 +LF:4 +LH:4 +end_of_record +SF:lib/src/domain/enums/status_enum.dart +DA:14,3 +DA:15,3 +DA:16,15 +DA:17,2 +LF:4 +LH:4 +end_of_record +SF:lib/src/domain/models/character_model.dart +DA:15,3 +DA:27,2 +DA:28,2 +DA:29,2 +DA:30,2 +DA:31,2 +DA:32,4 +DA:33,2 +DA:34,4 +DA:35,4 +DA:36,4 +DA:37,5 +DA:38,2 +DA:39,2 +DA:40,2 +LF:15 +LH:15 +end_of_record +SF:lib/src/shared/pagination/paginated_response.dart +DA:7,2 +DA:9,0 +DA:10,0 +DA:11,0 +LF:4 +LH:1 +end_of_record +SF:lib/src/shared/pagination/pagination.dart +DA:8,2 +DA:16,0 +DA:17,0 +DA:18,0 +DA:20,0 +DA:23,2 +DA:30,2 +DA:31,2 +DA:32,2 +DA:33,2 +DA:34,2 +DA:35,0 +LF:12 +LH:7 +end_of_record +SF:lib/src/data/service/theme/theme_service_impl.dart +DA:13,1 +DA:15,1 +DA:18,2 +DA:22,2 +DA:24,1 +DA:25,1 +DA:26,1 +DA:34,1 +DA:37,3 +DA:40,1 +DA:41,1 +DA:42,1 +LF:12 +LH:12 +end_of_record +SF:lib/src/data/service/characters/characters_service_impl.dart +DA:16,1 +DA:18,1 +DA:27,2 +DA:29,1 +DA:30,2 +DA:31,2 +DA:32,3 +DA:33,3 +DA:37,2 +DA:39,4 +DA:40,1 +DA:41,1 +DA:43,1 +DA:44,1 +DA:45,1 +DA:46,3 +DA:53,1 +DA:54,2 +DA:57,1 +DA:58,1 +DA:60,2 +DA:64,1 +DA:65,7 +DA:66,3 +DA:67,1 +DA:68,1 +DA:70,1 +DA:75,3 +DA:76,1 +DA:77,1 +DA:78,2 +DA:83,2 +DA:84,1 +DA:85,2 +DA:90,1 +DA:95,2 +DA:96,1 +DA:99,2 +DA:100,3 +DA:103,1 +DA:104,1 +DA:106,1 +DA:109,1 +DA:110,2 +DA:113,1 +DA:114,1 +DA:116,2 +DA:120,1 +DA:121,3 +DA:122,1 +DA:123,1 +DA:124,2 +DA:129,2 +DA:130,1 +DA:131,2 +LF:55 +LH:55 +end_of_record diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: 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..7c56964 --- /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 + 12.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..e549ee2 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,43 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '12.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..d5e6ab1 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,23 @@ +PODS: + - Flutter (1.0.0) + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + +DEPENDENCIES: + - Flutter (from `Flutter`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + +SPEC CHECKSUMS: + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 + +PODFILE CHECKSUM: 4305caec6b40dde0ae97be1573c53de1882a07e5 + +COCOAPODS: 1.16.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4680d02 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,731 @@ +// !$*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 */; }; + 701C3262E29837AD1A7D80E5 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77BDCB8A250A45B33D97C39D /* Pods_RunnerTests.framework */; }; + 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 */; }; + A7AF63ECF09FB673EB30A94D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5BF73F1DBA2041E24751135F /* Pods_Runner.framework */; }; +/* 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; }; + 3387622B46EED51E3F8B58FB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 5BF73F1DBA2041E24751135F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 617E0F27428575D854E4A798 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; 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 = ""; }; + 77BDCB8A250A45B33D97C39D /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 868C41888023AFD07C0940A0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 8F79DB6BFA32CCB2974C27C9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 8FDD19918384AEA30C1256D6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.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 = ""; }; + 97DCF060F3625EF1B94648CA /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8C12D6F830CA3AD1D03B334D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 701C3262E29837AD1A7D80E5 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A7AF63ECF09FB673EB30A94D /* Pods_Runner.framework in Frameworks */, + ); + 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 */, + EB3D8F17691B705C081497F4 /* Pods */, + E97E0FF2119277062E6029FF /* Frameworks */, + ); + 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 = ""; + }; + E97E0FF2119277062E6029FF /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5BF73F1DBA2041E24751135F /* Pods_Runner.framework */, + 77BDCB8A250A45B33D97C39D /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + EB3D8F17691B705C081497F4 /* Pods */ = { + isa = PBXGroup; + children = ( + 8F79DB6BFA32CCB2974C27C9 /* Pods-Runner.debug.xcconfig */, + 8FDD19918384AEA30C1256D6 /* Pods-Runner.release.xcconfig */, + 3387622B46EED51E3F8B58FB /* Pods-Runner.profile.xcconfig */, + 617E0F27428575D854E4A798 /* Pods-RunnerTests.debug.xcconfig */, + 97DCF060F3625EF1B94648CA /* Pods-RunnerTests.release.xcconfig */, + 868C41888023AFD07C0940A0 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 7FAAC52FABC2EAAD7BA486EC /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 8C12D6F830CA3AD1D03B334D /* Frameworks */, + ); + 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 = ( + 080C5B339C6035FBAEA9C901 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 860BB3F84B839196C4BD806F /* [CP] Embed Pods Frameworks */, + ); + 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 */ + 080C5B339C6035FBAEA9C901 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 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"; + }; + 7FAAC52FABC2EAAD7BA486EC /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 860BB3F84B839196C4BD806F /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 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 = 12.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)"; + DEVELOPMENT_TEAM = Q2P67523PU; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech; + 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; + baseConfigurationReference = 617E0F27428575D854E4A798 /* Pods-RunnerTests.debug.xcconfig */; + 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.doroTech.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; + baseConfigurationReference = 97DCF060F3625EF1B94648CA /* Pods-RunnerTests.release.xcconfig */; + 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.doroTech.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; + baseConfigurationReference = 868C41888023AFD07C0940A0 /* Pods-RunnerTests.profile.xcconfig */; + 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.doroTech.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 = 12.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 = 12.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)"; + DEVELOPMENT_TEAM = Q2P67523PU; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech; + 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)"; + DEVELOPMENT_TEAM = Q2P67523PU; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech; + 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..21a3cc1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + 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..89b248e --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Doro Tech + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + doro_tech + 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/main.dart b/lib/main.dart new file mode 100644 index 0000000..2cc02ec --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,43 @@ +import 'package:doro_tech/src/config/dependencies.dart'; +import 'package:doro_tech/src/routing/router.dart'; +import 'package:doro_tech/src/design_system/molecules/themes.dart'; +import 'package:doro_tech/src/data/repository/theme/theme_repository.dart'; +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; + +final ValueNotifier themeNotifier = ValueNotifier(ThemeMode.system); + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await setupInjections(); + + final IThemeRepository themeRepository = GetIt.I(); + + final savedThemeMode = await themeRepository.getThemeMode(); + savedThemeMode.fold( + (mode) => themeNotifier.value = mode, + (error) => themeNotifier.value = ThemeMode.system, + ); + + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return ValueListenableBuilder( + valueListenable: themeNotifier, + builder: (_, mode, __) { + return MaterialApp.router( + debugShowCheckedModeBanner: false, + theme: AppThemes.lightTheme, + darkTheme: AppThemes.darkTheme, + themeMode: mode, + routerConfig: appRouter, + ); + }, + ); + } +} diff --git a/lib/src/config/dependencies.dart b/lib/src/config/dependencies.dart new file mode 100644 index 0000000..f8716ae --- /dev/null +++ b/lib/src/config/dependencies.dart @@ -0,0 +1,19 @@ +import '../data/repository/repository_module.dart'; +import '../data/service/service_module.dart'; +import '../ui/detail/detail_module.dart'; +import '../ui/home/home_module.dart'; + +import 'package:dio/dio.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:get_it/get_it.dart'; + +Future setupInjections() async { + GetIt.instance.registerSingleton(Dio()); + GetIt.instance.registerSingleton(await SharedPreferences.getInstance()); + + ServiceModule.injections(); + RepositoryModule.injections(); + + HomeModule.injections(); + DetailModule.injections(); +} \ No newline at end of file diff --git a/lib/src/data/repository/characters/characters_repository.dart b/lib/src/data/repository/characters/characters_repository.dart new file mode 100644 index 0000000..9a58518 --- /dev/null +++ b/lib/src/data/repository/characters/characters_repository.dart @@ -0,0 +1,21 @@ +import '../../../domain/enums/gender_enum.dart'; +import '../../../domain/enums/status_enum.dart'; +import '../../../domain/models/character_model.dart'; +import '../../../shared/pagination/paginated_response.dart'; +import '../../../shared/pagination/pagination.dart'; +import '../../../shared/utils/app_error.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class ICharactersRepository { + Future, AppError>> + getCharacters({ + required Pagination pagination, + String? name, + GenderEnum? gender, + StatusEnum? status, + }); + + Future, AppError>> getFavoriteCharacters({ + required List charactersIds, + }); +} diff --git a/lib/src/data/repository/characters/characters_repository_impl.dart b/lib/src/data/repository/characters/characters_repository_impl.dart new file mode 100644 index 0000000..aed3b98 --- /dev/null +++ b/lib/src/data/repository/characters/characters_repository_impl.dart @@ -0,0 +1,41 @@ +import 'package:doro_tech/src/data/service/characters/characters_service.dart'; +import 'package:doro_tech/src/domain/models/character_model.dart'; +import 'package:doro_tech/src/shared/pagination/paginated_response.dart'; +import 'package:doro_tech/src/shared/pagination/pagination.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:result_dart/src/result_dart_base.dart'; + +import '../../../domain/enums/gender_enum.dart'; +import '../../../domain/enums/status_enum.dart'; +import 'characters_repository.dart'; + +class CharactersRepositoryImpl implements ICharactersRepository { + final ICharactersService charactersService; + + CharactersRepositoryImpl({required this.charactersService}); + + @override + Future, AppError>> + getCharacters({ + required Pagination pagination, + String? name, + GenderEnum? gender, + StatusEnum? status, + }) { + return charactersService.getCharacters( + pagination: pagination, + name: name, + gender: gender, + status: status, + ); + } + + @override + Future, AppError>> getFavoriteCharacters({ + required List charactersIds, + }) { + return charactersService.getFavoriteCharacters( + charactersIds: charactersIds, + ); + } +} diff --git a/lib/src/data/repository/episodes/episodes_repository.dart b/lib/src/data/repository/episodes/episodes_repository.dart new file mode 100644 index 0000000..434a773 --- /dev/null +++ b/lib/src/data/repository/episodes/episodes_repository.dart @@ -0,0 +1,10 @@ +import '../../../domain/models/episode_model.dart'; + +import '../../../shared/utils/app_error.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class IEpisodesRepository { + Future, AppError>> getEpisodesByIds({ + required List episodesIds, + }); +} diff --git a/lib/src/data/repository/episodes/episodes_repository_impl.dart b/lib/src/data/repository/episodes/episodes_repository_impl.dart new file mode 100644 index 0000000..8b35d57 --- /dev/null +++ b/lib/src/data/repository/episodes/episodes_repository_impl.dart @@ -0,0 +1,20 @@ +import 'package:doro_tech/src/domain/models/episode_model.dart'; + +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:result_dart/src/result_dart_base.dart'; + +import '../../service/episodes/episodes_service.dart'; +import 'episodes_repository.dart'; + +class EpisodesRepositoryImpl implements IEpisodesRepository { + final IEpisodesService episodesService; + + EpisodesRepositoryImpl({required this.episodesService}); + + @override + Future, AppError>> getEpisodesByIds({ + required List episodesIds, + }) { + return episodesService.getEpisodesByIds(episodesIds: episodesIds); + } +} diff --git a/lib/src/data/repository/favorites/favorites_repository.dart b/lib/src/data/repository/favorites/favorites_repository.dart new file mode 100644 index 0000000..cfb24ba --- /dev/null +++ b/lib/src/data/repository/favorites/favorites_repository.dart @@ -0,0 +1,12 @@ +import '../../../shared/utils/app_error.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class IFavoritesRepository { + Future> saveFavoriteId ({required int characterId}); + + Future> deleteFavoriteId ({required int characterId}); + + Future, AppError>> getFavoriteIds(); + + Future> deleteAllFavoriteIds(); +} diff --git a/lib/src/data/repository/favorites/favorites_repository_impl.dart b/lib/src/data/repository/favorites/favorites_repository_impl.dart new file mode 100644 index 0000000..7cf0be3 --- /dev/null +++ b/lib/src/data/repository/favorites/favorites_repository_impl.dart @@ -0,0 +1,30 @@ +import '../../../shared/utils/app_error.dart'; +import '../../service/favorites/favorites_service.dart'; +import 'favorites_repository.dart'; +import 'package:result_dart/result_dart.dart'; + +class FavoritesRepositoryImpl implements IFavoritesRepository { + final IFavoritesService favoritesService; + + FavoritesRepositoryImpl({required this.favoritesService}); + + @override + Future> saveFavoriteId({required int characterId}) { + return favoritesService.saveFavoriteId(characterId: characterId); + } + + @override + Future> deleteFavoriteId({required int characterId}) { + return favoritesService.deleteFavoriteId(characterId: characterId); + } + + @override + Future, AppError>> getFavoriteIds() { + return favoritesService.getFavoriteIds(); + } + + @override + Future> deleteAllFavoriteIds() { + return favoritesService.deleteAllFavoriteIds(); + } +} diff --git a/lib/src/data/repository/repository_module.dart b/lib/src/data/repository/repository_module.dart new file mode 100644 index 0000000..aba3407 --- /dev/null +++ b/lib/src/data/repository/repository_module.dart @@ -0,0 +1,28 @@ +import 'package:doro_tech/src/data/repository/characters/characters_repository.dart'; +import 'package:doro_tech/src/data/repository/characters/characters_repository_impl.dart'; +import 'package:doro_tech/src/data/repository/episodes/episodes_repository_impl.dart'; +import 'package:doro_tech/src/data/repository/theme/theme_repository.dart'; +import 'package:doro_tech/src/data/repository/theme/theme_repository_impl.dart'; + +import 'package:get_it/get_it.dart'; + +import 'episodes/episodes_repository.dart'; +import 'favorites/favorites_repository.dart'; +import 'favorites/favorites_repository_impl.dart'; + +class RepositoryModule { + static void injections() { + GetIt.instance.registerLazySingleton( + () => CharactersRepositoryImpl(charactersService: GetIt.I()), + ); + GetIt.instance.registerLazySingleton( + () => FavoritesRepositoryImpl(favoritesService: GetIt.I()), + ); + GetIt.instance.registerLazySingleton( + () => EpisodesRepositoryImpl(episodesService: GetIt.I()), + ); + GetIt.instance.registerLazySingleton( + () => ThemeRepositoryImpl(themeService: GetIt.I()), + ); + } +} diff --git a/lib/src/data/repository/theme/theme_repository.dart b/lib/src/data/repository/theme/theme_repository.dart new file mode 100644 index 0000000..362d776 --- /dev/null +++ b/lib/src/data/repository/theme/theme_repository.dart @@ -0,0 +1,8 @@ +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter/material.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class IThemeRepository { + Future> saveThemeMode(ThemeMode mode); + Future> getThemeMode(); +} \ No newline at end of file diff --git a/lib/src/data/repository/theme/theme_repository_impl.dart b/lib/src/data/repository/theme/theme_repository_impl.dart new file mode 100644 index 0000000..85793b4 --- /dev/null +++ b/lib/src/data/repository/theme/theme_repository_impl.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; +import 'package:result_dart/result_dart.dart'; + +import '../../../shared/utils/app_error.dart'; +import 'theme_repository.dart'; +import '../../service/theme/theme_service.dart'; + +class ThemeRepositoryImpl implements IThemeRepository { + final IThemeService themeService; + + ThemeRepositoryImpl({required this.themeService}); + + @override + Future> getThemeMode() { + return themeService.getThemeMode(); + } + + @override + Future> saveThemeMode(ThemeMode mode) { + return themeService.saveThemeMode(mode); + } +} \ No newline at end of file diff --git a/lib/src/data/service/characters/characters_service.dart b/lib/src/data/service/characters/characters_service.dart new file mode 100644 index 0000000..7fbb860 --- /dev/null +++ b/lib/src/data/service/characters/characters_service.dart @@ -0,0 +1,20 @@ +import '../../../domain/enums/gender_enum.dart'; +import '../../../domain/enums/status_enum.dart'; +import '../../../domain/models/character_model.dart'; +import '../../../shared/pagination/paginated_response.dart'; +import '../../../shared/pagination/pagination.dart'; +import '../../../shared/utils/app_error.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class ICharactersService { + Future, AppError>> getCharacters({ + required Pagination pagination, + String? name, + GenderEnum? gender, + StatusEnum? status, + }); + + Future, AppError>> getFavoriteCharacters({ + required List charactersIds, + }); +} diff --git a/lib/src/data/service/characters/characters_service_impl.dart b/lib/src/data/service/characters/characters_service_impl.dart new file mode 100644 index 0000000..126a892 --- /dev/null +++ b/lib/src/data/service/characters/characters_service_impl.dart @@ -0,0 +1,135 @@ +import 'package:dio/dio.dart'; +import 'package:doro_tech/src/domain/models/character_model.dart'; +import 'package:doro_tech/src/shared/pagination/paginated_response.dart'; +import 'package:doro_tech/src/shared/pagination/pagination.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:result_dart/src/result_dart_base.dart'; + +import '../../../domain/enums/gender_enum.dart'; +import '../../../domain/enums/status_enum.dart'; +import '../../../shared/utils/logger.dart'; +import 'characters_service.dart'; + +class CharactersServiceImpl implements ICharactersService { + final Dio _dio; + + CharactersServiceImpl(this._dio); + + @override + Future, AppError>> + getCharacters({ + required Pagination pagination, + String? name, + GenderEnum? gender, + StatusEnum? status, + }) async { + try { + final Response response = await _dio.get( + 'https://rickandmortyapi.com/api/character', + queryParameters: { + 'page': pagination.page, + if (name != null && name.isNotEmpty) ...{'name': name}, + if (gender != null && gender != GenderEnum.all) ...{'gender': gender.genderLabel}, + if (status != null && status != StatusEnum.all) ...{'status': status.statusLabel}, + }, + ); + + if (response.statusCode == 200) { + final List characters = + (response.data['results'] as List).map((character) { + return CharacterModel.fromJson(character); + }).toList(); + + return Success( + PaginatedResponse( + pagination: pagination.copyWith( + total: response.data['info']['count'], + ), + data: characters, + ), + ); + } + + Log.error( + "Erro ao listar personagens. Server error: ${response.statusMessage}", + ); + + return Failure( + AppError( + message: + "Erro ao listar personagens. Server error: ${response.statusMessage}", + type: AppErrorType.server, + ), + ); + } on DioException catch (e) { + if (e.response?.statusCode == 404 && e.response?.data['error'] == 'There is nothing here') { + Log.error("API retorna 404 quando nenhum item é encontrado pelo filtro: ${e.message}"); + return Success( + PaginatedResponse( + pagination: pagination, + data: [], + ), + ); + } + + Log.error("Erro de rede Dio: ${e.message}"); + return Failure( + AppError( + message: "Erro de rede Dio: ${e.message}", + type: AppErrorType.network, + ), + ); + } catch (e) { + Log.error("Erro inesperado: $e"); + return Failure( + AppError(message: "Erro inesperado: $e", type: AppErrorType.local), + ); + } + } + + @override + Future, AppError>> getFavoriteCharacters({ + required List charactersIds, + }) async { + try { + final Response response = await _dio.get( + 'https://rickandmortyapi.com/api/character/$charactersIds', + ); + + if (response.statusCode == 200) { + final List characters = (response.data as List).map(( + character, + ) { + return CharacterModel.fromJson(character); + }).toList(); + + return Success(characters); + } + + Log.error( + "Erro ao listar personagens favoritos. Server error: ${response.statusMessage}", + ); + + return Failure( + AppError( + message: + "Erro ao listar personagens favoritos. Server error: ${response.statusMessage}", + type: AppErrorType.server, + ), + ); + } on DioException catch (e) { + Log.error("Erro de rede Dio: ${e.message}"); + return Failure( + AppError( + message: "Erro de rede Dio: ${e.message}", + type: AppErrorType.network, + ), + ); + } catch (e) { + Log.error("Erro inesperado: $e"); + return Failure( + AppError(message: "Erro inesperado: $e", type: AppErrorType.local), + ); + } + } +} diff --git a/lib/src/data/service/episodes/episodes_service.dart b/lib/src/data/service/episodes/episodes_service.dart new file mode 100644 index 0000000..d3bc023 --- /dev/null +++ b/lib/src/data/service/episodes/episodes_service.dart @@ -0,0 +1,10 @@ +import 'package:doro_tech/src/domain/models/episode_model.dart'; + +import '../../../shared/utils/app_error.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class IEpisodesService { + Future, AppError>> getEpisodesByIds({ + required List episodesIds, + }); +} \ No newline at end of file diff --git a/lib/src/data/service/episodes/episodes_service_impl.dart b/lib/src/data/service/episodes/episodes_service_impl.dart new file mode 100644 index 0000000..a1b3d8d --- /dev/null +++ b/lib/src/data/service/episodes/episodes_service_impl.dart @@ -0,0 +1,59 @@ +import 'package:dio/dio.dart'; +import 'package:doro_tech/src/domain/models/episode_model.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:result_dart/src/result_dart_base.dart'; + +import '../../../shared/utils/logger.dart'; +import 'episodes_service.dart'; + +class EpisodesServiceImpl implements IEpisodesService { + final Dio _dio; + + EpisodesServiceImpl(this._dio); + + @override + Future, AppError>> getEpisodesByIds({ + required List episodesIds, + }) async { + try { + final Response response = await _dio.get( + 'https://rickandmortyapi.com/api/episode/$episodesIds', + ); + + if (response.statusCode == 200) { + final List episodes = (response.data as List).map(( + episode, + ) { + return EpisodeModel.fromJson(episode); + }).toList(); + + return Success(episodes); + } + + Log.error( + "Erro ao consultar episódios. Server error: ${response.statusMessage}", + ); + + return Failure( + AppError( + message: + "Erro ao consultar episódios. Server error: ${response.statusMessage}", + type: AppErrorType.server, + ), + ); + } on DioException catch (e) { + Log.error("Erro de rede Dio: ${e.message}"); + return Failure( + AppError( + message: "Erro de rede Dio: ${e.message}", + type: AppErrorType.network, + ), + ); + } catch (e) { + Log.error("Erro inesperado: $e"); + return Failure( + AppError(message: "Erro inesperado: $e", type: AppErrorType.local), + ); + } + } +} diff --git a/lib/src/data/service/favorites/favorites_service.dart b/lib/src/data/service/favorites/favorites_service.dart new file mode 100644 index 0000000..6c909e0 --- /dev/null +++ b/lib/src/data/service/favorites/favorites_service.dart @@ -0,0 +1,12 @@ +import '../../../shared/utils/app_error.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class IFavoritesService { + Future> saveFavoriteId ({required int characterId}); + + Future> deleteFavoriteId ({required int characterId}); + + Future, AppError>> getFavoriteIds(); + + Future> deleteAllFavoriteIds(); +} diff --git a/lib/src/data/service/favorites/favorites_service_impl.dart b/lib/src/data/service/favorites/favorites_service_impl.dart new file mode 100644 index 0000000..df5d3f5 --- /dev/null +++ b/lib/src/data/service/favorites/favorites_service_impl.dart @@ -0,0 +1,91 @@ +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:result_dart/result_dart.dart'; + +import '../../../shared/utils/app_error.dart'; +import '../../../shared/utils/logger.dart'; +import 'favorites_service.dart'; + +class FavoritesServiceImpl implements IFavoritesService { + static const String _favoritesKey = 'favorites'; + final SharedPreferences _prefs; + + FavoritesServiceImpl(this._prefs); + + @override + Future> saveFavoriteId({required int characterId}) async { + try { + final List favorites = _prefs.getStringList(_favoritesKey) ?? []; + + final String characterIdStr = characterId.toString(); + + if (!favorites.contains(characterIdStr)) { + favorites.add(characterIdStr); + await _prefs.setStringList(_favoritesKey, favorites); + } + + return const Success(true); + } catch (e) { + Log.error('Erro ao salvar favoritos'); + return Failure( + AppError( + message: 'Erro ao salvar favoritos', + type: AppErrorType.local, + ), + ); + } + } + + @override + Future> deleteFavoriteId({required int characterId}) async { + try { + final List favoriteIds = _prefs.getStringList(_favoritesKey) ?? []; + + favoriteIds.remove(characterId.toString()); + await _prefs.setStringList(_favoritesKey, favoriteIds); + + return const Success(true); + } catch (e) { + Log.error('Erro ao deletar favoritos'); + return Failure( + AppError( + message: 'Erro ao deletar favoritos', + type: AppErrorType.local, + ), + ); + } + } + + @override + Future, AppError>> getFavoriteIds() async { + try { + final List favoriteIds = _prefs.getStringList(_favoritesKey) ?? []; + final List favoritesInt = favoriteIds.map((e) => int.parse(e)).toList(); + return Success(favoritesInt); + } catch (e) { + Log.error('Erro ao buscar favoritos'); + return Failure( + AppError( + message: 'Erro ao buscar favoritos', + type: AppErrorType.local, + ), + ); + } + } + + @override + Future> deleteAllFavoriteIds() async { + try { + final isRemoved = await _prefs.remove(_favoritesKey); + + return Success(isRemoved); + } catch (e) { + Log.error('Erro ao deletar todos favoritos'); + return Failure( + AppError( + message: 'Erro ao deletar todos favoritos', + type: AppErrorType.local, + ), + ); + } + } +} diff --git a/lib/src/data/service/service_module.dart b/lib/src/data/service/service_module.dart new file mode 100644 index 0000000..2d12ef8 --- /dev/null +++ b/lib/src/data/service/service_module.dart @@ -0,0 +1,28 @@ +import 'package:doro_tech/src/data/service/characters/characters_service.dart'; +import 'package:doro_tech/src/data/service/episodes/episodes_service.dart'; +import 'package:doro_tech/src/data/service/episodes/episodes_service_impl.dart'; +import 'package:doro_tech/src/data/service/theme/theme_service.dart'; +import 'package:doro_tech/src/data/service/theme/theme_service_impl.dart'; +import 'package:get_it/get_it.dart'; + +import 'characters/characters_service_impl.dart'; + +import 'favorites/favorites_service.dart'; +import 'favorites/favorites_service_impl.dart'; + +class ServiceModule { + static void injections() { + GetIt.instance.registerLazySingleton( + () => CharactersServiceImpl(GetIt.I()), + ); + GetIt.instance.registerLazySingleton( + () => FavoritesServiceImpl(GetIt.I()), + ); + GetIt.instance.registerLazySingleton( + () => EpisodesServiceImpl(GetIt.I()), + ); + GetIt.instance.registerLazySingleton( + () => ThemeServiceImpl(GetIt.I()), + ); + } +} diff --git a/lib/src/data/service/theme/theme_service.dart b/lib/src/data/service/theme/theme_service.dart new file mode 100644 index 0000000..aeb0a4f --- /dev/null +++ b/lib/src/data/service/theme/theme_service.dart @@ -0,0 +1,8 @@ +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter/material.dart'; +import 'package:result_dart/result_dart.dart'; + +abstract class IThemeService { + Future> saveThemeMode(ThemeMode mode); + Future> getThemeMode(); +} \ No newline at end of file diff --git a/lib/src/data/service/theme/theme_service_impl.dart b/lib/src/data/service/theme/theme_service_impl.dart new file mode 100644 index 0000000..e0c3b08 --- /dev/null +++ b/lib/src/data/service/theme/theme_service_impl.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:result_dart/result_dart.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../../../shared/utils/app_error.dart'; +import '../../../shared/utils/logger.dart'; +import 'theme_service.dart'; + +class ThemeServiceImpl implements IThemeService { + static const _themeModeKey = 'theme_mode'; + final SharedPreferences _prefs; + + ThemeServiceImpl(this._prefs); + + @override + Future> getThemeMode() async { + try { + final themeModeIndex = _prefs.getInt(_themeModeKey); + if (themeModeIndex == null) { + return const Success(ThemeMode.system); + } + return Success(ThemeMode.values[themeModeIndex]); + } catch (e) { + Log.error('Erro ao consultar tema salvo'); + return Failure( + AppError( + message: 'Erro ao consultar tema salvo', + type: AppErrorType.local, + ), + ); + } + } + + @override + Future> saveThemeMode(ThemeMode mode) async { + try { + await _prefs.setInt(_themeModeKey, mode.index); + return const Success(true); + } catch (e) { + Log.error('Erro ao salvar tema'); + return Failure( + AppError( + message: 'Erro ao salvar tema', + type: AppErrorType.local, + ), + ); + } + } +} diff --git a/lib/src/design_system/atoms/colors.dart b/lib/src/design_system/atoms/colors.dart new file mode 100644 index 0000000..ea9cb37 --- /dev/null +++ b/lib/src/design_system/atoms/colors.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +abstract class AppColors { + static const Color lightPrimary = Color(0xFF42A5F5); + static const Color lightOnPrimary = Color(0xFFFFFFFF); + static const Color lightSecondary = Color(0xFFE0E0E0); + static const Color lightOnSecondary = Color(0xFF212121); + static const Color lightSurface = Color(0xFFFFFFFF); + static const Color lightOnSurface = Color(0xFF212121); + static const Color lightError = Color(0xFFB00020); + static const Color lightOnError = Color(0xFFFFFFFF); + static const Color lightScaffoldBackground = Color(0xFFF5F5F5); + + static const Color darkPrimary = Color(0xFFBB86FC); + static const Color darkOnPrimary = Color(0xFF000000); + static const Color darkSecondary = Color(0xFF2C2C2C); + static const Color darkOnSecondary = Color(0xFFFFFFFF); + static const Color darkSurface = Color(0xFF1E1E1E); + static const Color darkOnSurface = Color(0xFFFFFFFF); + static const Color darkError = Color(0xFFCF6679); + static const Color darkOnError = Color(0xFF000000); + static const Color darkScaffoldBackground = Color(0xFF121212); +} \ No newline at end of file diff --git a/lib/src/design_system/molecules/app_dropdown.dart b/lib/src/design_system/molecules/app_dropdown.dart new file mode 100644 index 0000000..e3f4672 --- /dev/null +++ b/lib/src/design_system/molecules/app_dropdown.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +class AppDropdown extends StatelessWidget { + final String? label; + final T? value; + final List items; + final String Function(T) itemLabelBuilder; + final void Function(T?) onChanged; + + const AppDropdown({ + this.label, + required this.value, + required this.items, + required this.itemLabelBuilder, + required this.onChanged, + super.key, + }); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (label != null) ...[ + Text(label!), + const SizedBox(height: 8), + ], + IntrinsicWidth( + child: DropdownButtonFormField( + value: value, + decoration: InputDecoration( + contentPadding: const EdgeInsets.all(8), + filled: true, + fillColor: Theme.of(context).colorScheme.surface, + enabledBorder: InputBorder.none, + ), + items: items + .map( + (item) => DropdownMenuItem( + value: item, + child: Text(itemLabelBuilder(item)), + ), + ) + .toList(), + onChanged: onChanged, + ), + ), + ], + ); + } +} diff --git a/lib/src/design_system/molecules/characters_card.dart b/lib/src/design_system/molecules/characters_card.dart new file mode 100644 index 0000000..6a6230c --- /dev/null +++ b/lib/src/design_system/molecules/characters_card.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; +import '../../domain/models/character_model.dart'; +import 'dialogs/warning_dialog.dart'; + +class CharactersCard extends StatefulWidget { + final CharacterModel characterModel; + final Function(bool isFavorite) onTapFavoriteIcon; + final VoidCallback onTapCard; + final bool isFavorite; + + const CharactersCard({ + required this.characterModel, + required this.onTapFavoriteIcon, + required this.isFavorite, + required this.onTapCard, + super.key, + }); + + @override + State createState() => _CharactersCardState(); +} + +class _CharactersCardState extends State { + late bool isFavorite; + + @override + void initState() { + isFavorite = widget.isFavorite; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: widget.onTapCard, + child: Card( + color: Theme.of(context).colorScheme.secondary, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + child: Padding( + padding: const EdgeInsets.all(12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Hero( + tag: 'character_image_${widget.characterModel.id}', + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Image.network( + widget.characterModel.image, + fit: BoxFit.cover, + ), + ), + ), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.characterModel.name, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + + const SizedBox(height: 4), + + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 5), + child: Icon( + Icons.circle, + color: widget.characterModel.status.statusColor, + size: 10, + ), + ), + const SizedBox(width: 6), + Expanded( + child: Text( + '${widget.characterModel.status.statusLabel} - ${widget.characterModel.species}', + style: TextStyle(color: Theme.of(context).colorScheme.onSecondary), + ), + ), + ], + ), + ], + ), + ), + + GestureDetector( + onTap: () { + if (isFavorite) { + WarningDialog.show( + title: 'Remover dos favoritos', + content: + 'Deseja remover ${widget.characterModel.name} dos favoritos?', + onConfirm: () { + setState(() { + isFavorite = !isFavorite; + widget.onTapFavoriteIcon(isFavorite); + }); + }, + ); + } else { + setState(() { + isFavorite = !isFavorite; + widget.onTapFavoriteIcon(isFavorite); + }); + } + }, + child: Icon( + size: 35, + isFavorite ? Icons.favorite : Icons.favorite_border, + color: isFavorite ? Theme.of(context).colorScheme.error : null, + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/src/design_system/molecules/dialogs/app_snackbar.dart b/lib/src/design_system/molecules/dialogs/app_snackbar.dart new file mode 100644 index 0000000..8ee22a6 --- /dev/null +++ b/lib/src/design_system/molecules/dialogs/app_snackbar.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +import '../../../routing/router.dart'; + +abstract class AppSnackBar { + static void show({ + required String message, + Duration duration = const Duration(seconds: 2), + }) { + final context = navigatorKey.currentContext; + if (context == null) return; + + ScaffoldMessenger.of(context) + ..removeCurrentSnackBar() + ..showSnackBar( + SnackBar( + backgroundColor: Theme.of(context).colorScheme.surface, + content: Text( + message, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + duration: duration, + ), + ); + } +} diff --git a/lib/src/design_system/molecules/dialogs/info_dialog.dart b/lib/src/design_system/molecules/dialogs/info_dialog.dart new file mode 100644 index 0000000..291aeb9 --- /dev/null +++ b/lib/src/design_system/molecules/dialogs/info_dialog.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; + +import '../../../routing/router.dart'; + +abstract class InfoDialog { + static bool _isAlreadyShowing = false; + + static void show({required String title, required String content}) { + if (_isAlreadyShowing) return; + final context = navigatorKey.currentContext; + if (context == null) return; + + _isAlreadyShowing = true; + + showDialog( + context: context, + barrierDismissible: false, + builder: (context) { + return AlertDialog( + backgroundColor: Theme.of(context).colorScheme.surface, + title: Text( + title, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + content: Text( + content, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + actions: [ + TextButton( + onPressed: () { + _isAlreadyShowing = false; + Navigator.of(context).pop(); + }, + child: Text( + 'Ok', + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + ), + ], + ); + }, + ); + } +} diff --git a/lib/src/design_system/molecules/dialogs/warning_dialog.dart b/lib/src/design_system/molecules/dialogs/warning_dialog.dart new file mode 100644 index 0000000..d5ea8cb --- /dev/null +++ b/lib/src/design_system/molecules/dialogs/warning_dialog.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; + +import '../../../routing/router.dart'; + +abstract class WarningDialog { + static bool _isAlreadyShowing = false; + + static void show({ + required String title, + required String content, + required VoidCallback onConfirm, + String confirmText = 'Confirmar', + String cancelText = 'Cancelar', + }) { + if (_isAlreadyShowing) return; + final context = navigatorKey.currentContext; + if (context == null) return; + + _isAlreadyShowing = true; + + showDialog( + context: context, + barrierDismissible: false, + builder: (context) { + return AlertDialog( + backgroundColor: Theme.of(context).colorScheme.surface, + title: Text( + title, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + content: Text( + content, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + actions: [ + TextButton( + onPressed: () { + _isAlreadyShowing = false; + Navigator.of(context).pop(); + }, + child: Text( + cancelText, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + ), + TextButton( + onPressed: () { + _isAlreadyShowing = false; + Navigator.of(context).pop(); + onConfirm(); + }, + child: Text( + confirmText, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ), + ], + ); + }, + ); + } +} diff --git a/lib/src/design_system/molecules/manual_pagination.dart b/lib/src/design_system/molecules/manual_pagination.dart new file mode 100644 index 0000000..097f0f8 --- /dev/null +++ b/lib/src/design_system/molecules/manual_pagination.dart @@ -0,0 +1,142 @@ +import 'package:flutter/material.dart'; + +import '../../shared/controllers/manual_pagination_controller.dart'; +import 'app_dropdown.dart'; + +class ManualPagination extends StatelessWidget { + final ManualPaginationController controller; + final Widget Function(BuildContext, T) itemBuilder; + + const ManualPagination({ + super.key, + required this.controller, + required this.itemBuilder, + }); + + @override + Widget build(BuildContext context) { + return ValueListenableBuilder( + valueListenable: controller.paginationState, + builder: (context, state, child) { + if (state == PaginationState.loading && + controller.currentPageData.value.isEmpty) { + return const Center(child: CircularProgressIndicator()); + } + + if (state == PaginationState.error) { + return LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: Center( + child: Text("Ops! Algo deu errado."), + ), + ), + ); + }, + ); + } + + if (state == PaginationState.success && + controller.currentPageData.value.isEmpty) { + return LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: Center( + child: Text("Nada encontrado"), + ), + ), + ); + }, + ); + } + + return ValueListenableBuilder( + valueListenable: controller.currentPageData, + builder: (_, data, __) { + return Column( + children: [ + Expanded( + child: ScrollConfiguration( + behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), + child: SingleChildScrollView( + controller: controller.scrollController, + physics: const AlwaysScrollableScrollPhysics(), + child: Wrap( + spacing: 8, + runSpacing: 8, + children: data.map((item) { + return SizedBox( + width: 400, + height: 150, + child: itemBuilder(context, item), + ); + }).toList(), + ), + ), + ), + ), + _buildFooter(context), + ], + ); + }, + ); + }, + ); + } + + Widget _buildFooter(BuildContext context) { + return Container( + color: Theme.of(context).colorScheme.secondary, + margin: EdgeInsets.only(top: 16), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text('Pág. ${controller.currentPage} '), + if (controller.cachedData.pagination.total != null) + Text('de ${controller.currentPagesAmount}'), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: controller.onTapBack + ), + IconButton( + icon: const Icon(Icons.arrow_forward), + onPressed:controller.onTapForward, + ), + ], + ), + if (controller.availableDisplayLimits.length > 1) + Row( + children: [ + Text('Itens/pág. '), + AppDropdown( + value: controller.currentDisplayLimit, + items: controller.availableDisplayLimits, + itemLabelBuilder: (count) => count.toString(), + onChanged: controller.onChangeItemsPerPage, + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/src/design_system/molecules/themes.dart b/lib/src/design_system/molecules/themes.dart new file mode 100644 index 0000000..1275057 --- /dev/null +++ b/lib/src/design_system/molecules/themes.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import '../atoms/colors.dart'; + +abstract class AppThemes { + static final ThemeData lightTheme = ThemeData( + brightness: Brightness.light, + scaffoldBackgroundColor: AppColors.lightScaffoldBackground, + colorScheme: const ColorScheme.light( + primary: AppColors.lightPrimary, + onPrimary: AppColors.lightOnPrimary, + secondary: AppColors.lightSecondary, + onSecondary: AppColors.lightOnSecondary, + surface: AppColors.lightSurface, + onSurface: AppColors.lightOnSurface, + error: AppColors.lightError, + onError: AppColors.lightOnError, + ), + ); + + static final ThemeData darkTheme = ThemeData( + brightness: Brightness.dark, + scaffoldBackgroundColor: AppColors.darkScaffoldBackground, + colorScheme: const ColorScheme.dark( + primary: AppColors.darkPrimary, + onPrimary: AppColors.darkOnPrimary, + secondary: AppColors.darkSecondary, + onSecondary: AppColors.darkOnSecondary, + surface: AppColors.darkSurface, + onSurface: AppColors.darkOnSurface, + error: AppColors.darkError, + onError: AppColors.darkOnError, + ), + ); +} \ No newline at end of file diff --git a/lib/src/domain/enums/gender_enum.dart b/lib/src/domain/enums/gender_enum.dart new file mode 100644 index 0000000..8176a84 --- /dev/null +++ b/lib/src/domain/enums/gender_enum.dart @@ -0,0 +1,18 @@ +enum GenderEnum { + male('Male'), + female('Female'), + genderless('Genderless'), + unknown('Unknown'), + all('All'); + + final String genderLabel; + + const GenderEnum(this.genderLabel); + + static GenderEnum fromString(String? genderLabel) { + return values.firstWhere( + (gender) => gender.genderLabel.toUpperCase() == genderLabel?.toUpperCase(), + orElse: () => unknown, + ); + } +} diff --git a/lib/src/domain/enums/status_enum.dart b/lib/src/domain/enums/status_enum.dart new file mode 100644 index 0000000..3fc9970 --- /dev/null +++ b/lib/src/domain/enums/status_enum.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +enum StatusEnum { + alive('Alive', Colors.green), + dead('Dead', Colors.red), + unknown('Unknown', Colors.grey), + all('All', Colors.white); + + final String statusLabel; + final Color statusColor; + + const StatusEnum(this.statusLabel, this.statusColor); + + static StatusEnum fromString(String? statusLabel) { + return values.firstWhere( + (status) => status.statusLabel.toUpperCase() == statusLabel?.toUpperCase(), + orElse: () => unknown, + ); + } +} diff --git a/lib/src/domain/models/character_model.dart b/lib/src/domain/models/character_model.dart new file mode 100644 index 0000000..f039328 --- /dev/null +++ b/lib/src/domain/models/character_model.dart @@ -0,0 +1,43 @@ +import '../enums/gender_enum.dart'; +import '../enums/status_enum.dart'; + +class CharacterModel { + final int id; + final String name; + final String species; + final StatusEnum status; + final String image; + final String origin; + final GenderEnum gender; + final String location; + final List episodesIds; + + CharacterModel({ + required this.id, + required this.name, + required this.species, + required this.status, + required this.image, + required this.origin, + required this.gender, + required this.location, + required this.episodesIds, + }); + + factory CharacterModel.fromJson(Map json) { + return CharacterModel( + id: json['id'], + name: json['name'] ?? 'Unknown', + species: json['species'] ?? 'Unknown', + status: StatusEnum.fromString(json['status']), + image: json['image'] ?? '', + origin: json['origin']['name'] ?? 'Unknown', + gender: GenderEnum.fromString(json['gender']), + location: json['location']['name'] ?? 'Unknown', + episodesIds: (json['episode'] as List).map((url) { + final uriParts = url.toString().split('/'); + return int.parse(uriParts.last); + }).toList(), + ); + } +} diff --git a/lib/src/domain/models/episode_model.dart b/lib/src/domain/models/episode_model.dart new file mode 100644 index 0000000..8b3dbb3 --- /dev/null +++ b/lib/src/domain/models/episode_model.dart @@ -0,0 +1,19 @@ +class EpisodeModel { + final int id; + final String name; + final String episode; + + EpisodeModel({ + required this.id, + required this.name, + required this.episode, + }); + + factory EpisodeModel.fromJson(Map json) { + return EpisodeModel( + id: json['id'] as int, + name: json['name'] as String? ?? '', + episode: json['episode'] as String? ?? '', + ); + } +} \ No newline at end of file diff --git a/lib/src/routing/router.dart b/lib/src/routing/router.dart new file mode 100644 index 0000000..a6f6a9a --- /dev/null +++ b/lib/src/routing/router.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; +import 'package:go_router/go_router.dart'; + +import '../domain/models/character_model.dart'; +import '../ui/detail/widgets/detail_screen.dart'; +import '../ui/home/widgets/home_screen.dart'; +import 'routes.dart'; + +final GlobalKey navigatorKey = GlobalKey(); + +final GoRouter appRouter = GoRouter( + navigatorKey: navigatorKey, + initialLocation: Routes.home.path, + debugLogDiagnostics: true, + routes: [ + GoRoute( + path: Routes.home.path, + name: Routes.home.name, + builder: (context, state) { + return HomeScreen(homeViewModel: GetIt.I()); + }, + ), + GoRoute( + path: Routes.detail.path, + name: Routes.detail.name, + builder: (context, state) { + final CharacterModel character = state.extra as CharacterModel; + + return DetailScreen(detailViewModel: GetIt.I(), character: character); + }, + ), + ], +); diff --git a/lib/src/routing/routes.dart b/lib/src/routing/routes.dart new file mode 100644 index 0000000..bd39748 --- /dev/null +++ b/lib/src/routing/routes.dart @@ -0,0 +1,9 @@ +enum Routes { + home('/home', 'home'), + detail('/detail', 'detail'); + + final String path; + final String name; + + const Routes(this.path, this.name); +} \ No newline at end of file diff --git a/lib/src/shared/controllers/manual_pagination_controller.dart b/lib/src/shared/controllers/manual_pagination_controller.dart new file mode 100644 index 0000000..24e2e6a --- /dev/null +++ b/lib/src/shared/controllers/manual_pagination_controller.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; + +import '../pagination/paginated_response.dart'; +import '../pagination/pagination.dart'; + +enum PaginationState { loading, error, success } + +class ManualPaginationController { + final ValueNotifier paginationState = ValueNotifier( + PaginationState.loading, + ); + + final ScrollController scrollController = ScrollController(); + + final Future?> Function({required Pagination pagination}) + fetchPage; + + final int itemsPerPage; + final ValueNotifier> currentPageData = ValueNotifier([]); + PaginatedResponse cachedData; + int currentPage = 1; + late int currentDisplayLimit; + + final List availableDisplayLimits; + + ManualPaginationController({ + required this.itemsPerPage, + required this.fetchPage, + this.availableDisplayLimits = const [5, 10, 20], + }) : cachedData = PaginatedResponse( + pagination: Pagination(perPage: itemsPerPage), + data: [], + ) { + currentDisplayLimit = availableDisplayLimits.last; + getData(); + } + + Future getData() async { + try { + paginationState.value = PaginationState.loading; + final newPage = await fetchPage(pagination: cachedData.pagination); + if (newPage != null) { + cachedData.merge(newPage); + paginationState.value = PaginationState.success; + updateCurrentPageData(); + } else { + paginationState.value = PaginationState.error; + } + } catch (e) { + paginationState.value = PaginationState.error; + } + } + + void updateCurrentPageData() { + if (_isCacheSufficient || !cachedData.pagination.hasMorePages) { + _updateCurrentPageFromCache(); + return; + } + + getData(); + } + + bool get _isCacheSufficient => + cachedData.data.length >= currentPage * currentDisplayLimit; + + void _updateCurrentPageFromCache() { + final start = (currentPage - 1) * currentDisplayLimit; + final end = (start + currentDisplayLimit).clamp(0, cachedData.data.length); + currentPageData.value = cachedData.data.sublist(start, end); + } + + int get currentPagesAmount => + (cachedData.pagination.total! / currentDisplayLimit).ceil(); + + void onTapBack() { + if (currentPage > 1) { + scrollController.animateTo(0, duration: Duration(seconds: 1), curve: Curves.easeOut); + currentPage--; + updateCurrentPageData(); + } + } + + void onTapForward() { + if (currentPage < currentPagesAmount) { + scrollController.animateTo(0, duration: Duration(seconds: 1), curve: Curves.easeOut); + currentPage++; + updateCurrentPageData(); + } + } + + void onChangeItemsPerPage(int? items) { + if (items != null) { + final currentIndex = (currentPage - 1) * currentDisplayLimit; + final newCurrentPage = (currentIndex ~/ items) + 1; + currentPage = newCurrentPage; + + currentDisplayLimit = items; + updateCurrentPageData(); + } + } + + Future reset() async { + cachedData = PaginatedResponse( + pagination: Pagination(perPage: itemsPerPage), + data: [], + ); + currentPageData.value = []; + currentPage = 1; + getData(); + } + + void dispose() { + paginationState.dispose(); + } +} diff --git a/lib/src/shared/pagination/paginated_response.dart b/lib/src/shared/pagination/paginated_response.dart new file mode 100644 index 0000000..2c324da --- /dev/null +++ b/lib/src/shared/pagination/paginated_response.dart @@ -0,0 +1,13 @@ +import 'package:doro_tech/src/shared/pagination/pagination.dart'; + +class PaginatedResponse { + Pagination pagination; + final List data; + + PaginatedResponse({required this.pagination, required this.data}); + + void merge(PaginatedResponse newPage) { + pagination = newPage.pagination.copyWith(page: newPage.pagination.page + 1); + data.addAll(newPage.data); + } +} \ No newline at end of file diff --git a/lib/src/shared/pagination/pagination.dart b/lib/src/shared/pagination/pagination.dart new file mode 100644 index 0000000..48291fc --- /dev/null +++ b/lib/src/shared/pagination/pagination.dart @@ -0,0 +1,38 @@ +class Pagination { + final int page; + final int offset; + final int perPage; + final int itemsCount; + final int? total; + + Pagination({ + this.page = 1, + this.offset = 0, + this.perPage = 10, + this.itemsCount = 0, + this.total, + }); + + bool get hasMorePages { + if(total != null){ + return (page <= ((total! / perPage).ceil())); + } + return itemsCount == perPage; + } + + Pagination copyWith({ + int? page, + int? offset, + int? perPage, + int? itemsCount, + int? total, + }) { + return Pagination( + page: page ?? this.page, + offset: offset ?? this.offset, + perPage: perPage ?? this.perPage, + itemsCount: itemsCount ?? this.itemsCount, + total: total ?? this.total, + ); + } +} \ No newline at end of file diff --git a/lib/src/shared/utils/app_error.dart b/lib/src/shared/utils/app_error.dart new file mode 100644 index 0000000..af6619c --- /dev/null +++ b/lib/src/shared/utils/app_error.dart @@ -0,0 +1,19 @@ +enum AppErrorType { + local, // SharedPreferences, SQLite, arquivos locais + network, // Sem internet, timeout, DNS + server, // 500, 404, API down + validation, // Dados inválidos + auth, // Token expirado, não autorizado + requisitionLimit, // Limite de requisição + unknown, // Erro não categorizado +} + +class AppError { + final String message; + final AppErrorType type; + + AppError({ + required this.message, + required this.type, + }); +} \ No newline at end of file diff --git a/lib/src/shared/utils/app_state.dart b/lib/src/shared/utils/app_state.dart new file mode 100644 index 0000000..1ddacfb --- /dev/null +++ b/lib/src/shared/utils/app_state.dart @@ -0,0 +1,64 @@ + +class AppState { + get data => data; + + static SuccessState success({T? data}) { + return SuccessState(data: data); + } + + static ErrorState error({String? message}) { + return ErrorState(message: message); + } + + static FailState fail({String? message}) { + return FailState(message: message); + } + + static LoadingState loading({String? message}) { + return LoadingState(message: message); + } + + static EmptyState empty({String? message}) { + return EmptyState(message: message); + } + + static InitialState initial({String? message}) { + return InitialState(message: message); + } +} + +class SuccessState extends AppState { + T? data; + + SuccessState({this.data}); +} + +class ErrorState extends AppState { + String? message; + + ErrorState({this.message}); +} + +class FailState extends AppState { + String? message; + + FailState({this.message}); +} + +class LoadingState extends AppState { + String? message; + + LoadingState({this.message}); +} + +class EmptyState extends AppState { + String? message; + + EmptyState({this.message}); +} + +class InitialState extends AppState { + String? message; + + InitialState({this.message}); +} \ No newline at end of file diff --git a/lib/src/shared/utils/logger.dart b/lib/src/shared/utils/logger.dart new file mode 100644 index 0000000..a052477 --- /dev/null +++ b/lib/src/shared/utils/logger.dart @@ -0,0 +1,50 @@ +import 'package:logger/logger.dart'; + +class Log { + + // Verbose log + static void verbose(String msg) { + _getLogger().v(msg); + } + + // Debug log + static void debug(String msg) { + _getLogger().d(msg); + } + + // Info log + static void info(String msg) { + _getLogger().i(msg); + } + + // Warning log + static void warning(String msg) { + _getLogger().w(msg); + } + + // Error log + static void error(String msg) { + _getLogger().e(msg); + } + + // What a terrible failure log + static void wtf(String msg) { + _getLogger().wtf(msg); + } + + static Logger _getLogger () { + return Logger( + filter: null, // Use the default LogFilter (-> only log in debug mode) + printer: PrefixPrinter(PrettyPrinter( + + methodCount: 0, // number of method calls to be displayed + errorMethodCount: 8, // number of method calls if stacktrace is provided + lineLength: 120, // width of the output + colors: true, // Colorful log messages + printEmojis: true, // Print an emoji for each log message + printTime: false // Should each log print contain a timestamp + )), // Use the PrettyPrinter to format and print log + output: null, // Use the default LogOutput (-> send everything to console) + ); + } +} diff --git a/lib/src/shared/utils/validator.dart b/lib/src/shared/utils/validator.dart new file mode 100644 index 0000000..45eaf6e --- /dev/null +++ b/lib/src/shared/utils/validator.dart @@ -0,0 +1,28 @@ +class Validator { + final String? value; + final List _errors = []; + + Validator(this.value); + + Validator isNotEmpty({String message = "O campo não pode estar vazio"}) { + if (value == null || value!.trim().isEmpty) { + _errors.add(message); + } + return this; + } + + Validator hasMinimumCharacters({required int charactersAmount, String? message}) { + if (value != null) { + if (value!.length < charactersAmount) { + _errors.add( + message ?? 'Digite pelo menos $charactersAmount caracteres', + ); + } + } + return this; + } + + String? validate() { + return _errors.isNotEmpty ? _errors.first : null; + } +} diff --git a/lib/src/ui/detail/detail_module.dart b/lib/src/ui/detail/detail_module.dart new file mode 100644 index 0000000..2a86843 --- /dev/null +++ b/lib/src/ui/detail/detail_module.dart @@ -0,0 +1,10 @@ +import 'package:doro_tech/src/ui/detail/viewmodel/detail_viewmodel.dart'; +import 'package:get_it/get_it.dart'; + +class DetailModule { + static void injections() { + GetIt.instance.registerFactory( + () => DetailViewModel(episodesRepository: GetIt.I()), + ); + } +} diff --git a/lib/src/ui/detail/viewmodel/detail_viewmodel.dart b/lib/src/ui/detail/viewmodel/detail_viewmodel.dart new file mode 100644 index 0000000..7024624 --- /dev/null +++ b/lib/src/ui/detail/viewmodel/detail_viewmodel.dart @@ -0,0 +1,37 @@ +import 'package:doro_tech/src/data/repository/episodes/episodes_repository.dart'; +import 'package:doro_tech/src/domain/models/episode_model.dart'; +import 'package:flutter/material.dart'; +import 'package:result_dart/result_dart.dart'; + +import '../../../design_system/molecules/dialogs/info_dialog.dart'; +import '../../../shared/utils/app_error.dart'; +import '../../../shared/utils/app_state.dart'; + +class DetailViewModel { + final IEpisodesRepository episodesRepository; + + DetailViewModel({required this.episodesRepository}); + + final ValueNotifier>> episodesState = + ValueNotifier>>(LoadingState()); + + Future getEpisodes({required List episodesIds}) async { + episodesState.value = LoadingState(); + + final ResultDart, AppError> result = + await episodesRepository.getEpisodesByIds(episodesIds: episodesIds); + + result.fold( + (episodes) { + episodesState.value = SuccessState(data: episodes); + }, + (error) { + episodesState.value = ErrorState(message: error.message); + InfoDialog.show( + title: "Erro ao consultar episódios", + content: error.message, + ); + }, + ); + } +} diff --git a/lib/src/ui/detail/widgets/detail_screen.dart b/lib/src/ui/detail/widgets/detail_screen.dart new file mode 100644 index 0000000..afceff5 --- /dev/null +++ b/lib/src/ui/detail/widgets/detail_screen.dart @@ -0,0 +1,220 @@ +import 'package:doro_tech/src/domain/models/episode_model.dart'; +import 'package:flutter/material.dart'; +import 'package:doro_tech/src/domain/models/character_model.dart'; +import 'package:doro_tech/src/shared/utils/app_state.dart'; + +import '../../../domain/enums/status_enum.dart'; +import '../viewmodel/detail_viewmodel.dart'; + +class DetailScreen extends StatefulWidget { + final DetailViewModel detailViewModel; + final CharacterModel character; + + const DetailScreen({ + required this.detailViewModel, + required this.character, + super.key, + }); + + @override + State createState() => _DetailScreenState(); +} + +class _DetailScreenState extends State { + @override + void initState() { + widget.detailViewModel.getEpisodes( + episodesIds: widget.character.episodesIds, + ); + super.initState(); + } + + @override + void dispose() { + widget.detailViewModel.episodesState.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Detalhes do Personagem')), + body: SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Hero( + tag: 'character_image_${widget.character.id}', + child: CircleAvatar( + radius: 80, + backgroundImage: NetworkImage(widget.character.image), + ), + ), + + const SizedBox(height: 16), + + Text(widget.character.name), + + const SizedBox(height: 8), + + _buildStatusBadge(widget.character.status), + + const SizedBox(height: 24), + + _buildDetailCard([ + _buildDetailRow( + Icons.category, + 'Espécie', + widget.character.species, + ), + _buildDetailRow( + Icons.transgender, + 'Gênero', + widget.character.gender.genderLabel, + ), + _buildDetailRow(Icons.public, 'Origem', widget.character.origin), + _buildDetailRow( + Icons.location_on, + 'Localização', + widget.character.location, + ), + ]), + + const SizedBox(height: 24), + + _buildEpisodesSection( + episodesState: widget.detailViewModel.episodesState, + ), + ], + ), + ), + ); + } + + Widget _buildStatusBadge(StatusEnum status) { + return Chip( + label: Text(status.statusLabel), + backgroundColor: status.statusColor, + ); + } + + Widget _buildDetailCard(List rows) { + return Card( + color: Theme.of(context).colorScheme.secondary, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column(children: rows), + ), + ); + } + + Widget _buildDetailRow(IconData icon, String label, String value) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Row( + children: [ + Icon(icon, size: 20, color: Theme.of(context).colorScheme.onSecondary), + const SizedBox(width: 12), + Expanded( + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: '$label: ', + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + TextSpan( + text: value, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _buildEpisodesSection({ + required ValueNotifier>> episodesState, + }) { + return ValueListenableBuilder>>( + valueListenable: episodesState, + builder: (context, state, _) { + if (state is LoadingState) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.5, + child: const Center(child: CircularProgressIndicator()), + ); + } + + if (state is ErrorState) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.5, + child: const Center( + child: Text( + "Ops! Parece que algo não saiu como o esperado.", + textAlign: TextAlign.center, + ), + ), + ); + } + + if (state is SuccessState && state.data.isEmpty) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.5, + child: const Center( + child: Text( + "Nenhuma informação sobre episódios encontrada", + textAlign: TextAlign.center, + ), + ), + ); + } + + final List episodes = state.data!; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Episódios em que apareceu', + style: TextStyle(color: Theme.of(context).colorScheme.onSurface), + ), + const SizedBox(height: 12), + Card( + color: Theme.of(context).colorScheme.secondary, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: episodes.length, + itemBuilder: (_, index) { + return ListTile( + title: Text( + '${episodes[index].episode} - ${episodes[index].name}', + style: TextStyle(color: Theme.of(context).colorScheme.onSecondary), + ), + leading: Icon( + Icons.tv, + color: Theme.of(context).colorScheme.onSecondary, + ), + ); + }, + ), + ), + ], + ); + }, + ); + } +} diff --git a/lib/src/ui/home/home_module.dart b/lib/src/ui/home/home_module.dart new file mode 100644 index 0000000..760efec --- /dev/null +++ b/lib/src/ui/home/home_module.dart @@ -0,0 +1,22 @@ +import 'package:doro_tech/src/ui/home/viewmodel/home_viewmodel.dart'; +import 'package:doro_tech/src/ui/home/viewmodel/tabs/characters_tab_viewmodel.dart'; +import 'package:get_it/get_it.dart'; + +class HomeModule { + static void injections() { + GetIt.instance.registerLazySingleton( + () => HomeViewModel( + charactersRepository: GetIt.I(), + favoritesRepository: GetIt.I(), + themeRepository: GetIt.I(), + ), + ); + + GetIt.instance.registerLazySingleton( + () => CharactersTabViewModel( + charactersRepository: GetIt.I(), + favoritesRepository: GetIt.I(), + ), + ); + } +} diff --git a/lib/src/ui/home/viewmodel/home_viewmodel.dart b/lib/src/ui/home/viewmodel/home_viewmodel.dart new file mode 100644 index 0000000..eb68e98 --- /dev/null +++ b/lib/src/ui/home/viewmodel/home_viewmodel.dart @@ -0,0 +1,152 @@ +import 'package:doro_tech/src/data/repository/characters/characters_repository.dart'; +import 'package:doro_tech/src/data/repository/theme/theme_repository.dart'; +import 'package:flutter/material.dart'; + +import '../../../../main.dart'; +import '../../../data/repository/favorites/favorites_repository.dart'; +import '../../../design_system/molecules/dialogs/app_snackbar.dart'; +import '../../../design_system/molecules/dialogs/info_dialog.dart'; + +import '../../../domain/models/character_model.dart'; + +import '../../../shared/utils/app_error.dart'; + +import 'package:result_dart/result_dart.dart'; + +import '../../../shared/utils/app_state.dart'; + +class HomeViewModel { + final ICharactersRepository charactersRepository; + final IFavoritesRepository favoritesRepository; + final IThemeRepository themeRepository; + + final ValueNotifier>> + favoritesCharactersState = ValueNotifier>>( + LoadingState(), + ); + final List favoritesCharactersIdsList = []; + + HomeViewModel({ + required this.charactersRepository, + required this.favoritesRepository, + required this.themeRepository, + }); + + Future getFavoritesCharacters() async { + favoritesCharactersState.value = LoadingState(); + + await _getLocalFavoritesCharactersId(); + + if (favoritesCharactersIdsList.isEmpty) { + favoritesCharactersState.value = SuccessState(data: []); + return; + } + + final ResultDart, AppError> result = + await charactersRepository.getFavoriteCharacters( + charactersIds: favoritesCharactersIdsList, + ); + + result.fold( + (favoriteCharacters) { + favoritesCharactersState.value = SuccessState( + data: favoriteCharacters, + ); + }, + (error) { + favoritesCharactersState.value = ErrorState(message: error.message); + InfoDialog.show( + title: "Erro ao consultar personagens favoritos", + content: error.message, + ); + }, + ); + } + + Future _getLocalFavoritesCharactersId() async { + final ResultDart, AppError> result = await favoritesRepository + .getFavoriteIds(); + + result.fold( + (favoritesCharactersIds) { + favoritesCharactersIdsList.clear(); + favoritesCharactersIdsList.addAll(favoritesCharactersIds); + }, + (error) { + InfoDialog.show( + title: "Erro ao consultar Personagens favoritas", + content: "Algo deu errado ao consultar personagens favoritas", + ); + }, + ); + } + + Future saveLocalFavoriteCharacterId({required int characterId}) async { + final ResultDart result = await favoritesRepository + .saveFavoriteId(characterId: characterId); + + result.fold( + (isSuccess) async { + getFavoritesCharacters(); + AppSnackBar.show(message: 'Personagem adicionado aos favoritos!'); + }, + (error) { + InfoDialog.show( + title: "Erro ao favotitar personagem", + content: "Algo deu errado ao favoritar o personagem", + ); + }, + ); + } + + Future deleteLocalFavoriteCharacterId({ + required int characterId, + }) async { + final ResultDart result = await favoritesRepository + .deleteFavoriteId(characterId: characterId); + + result.fold( + (isSuccess) async { + getFavoritesCharacters(); + AppSnackBar.show(message: 'Personagem removido dos favoritos!'); + }, + (error) { + InfoDialog.show( + title: "Erro ao deletar personagem", + content: "Algo deu errado ao desfavoritar o personagem", + ); + }, + ); + } + + Future deleteAllLocalFavoritesCharactersIds() async { + final ResultDart result = await favoritesRepository + .deleteAllFavoriteIds(); + + result.fold( + (isSuccess) async { + getFavoritesCharacters(); + AppSnackBar.show(message: 'Todos os favoritos foram removidos!'); + }, + (error) { + InfoDialog.show( + title: "Erro ao remover todos favoritos", + content: "Algo deu errado ao remover todos favoritos", + ); + }, + ); + } + + void changeThemeMode() { + final newThemeMode = themeNotifier.value == ThemeMode.light + ? ThemeMode.dark + : ThemeMode.light; + + themeNotifier.value = newThemeMode; + saveThemeMode(theme: newThemeMode); + } + + Future saveThemeMode({required ThemeMode theme}) async { + await themeRepository.saveThemeMode(theme); + } +} diff --git a/lib/src/ui/home/viewmodel/tabs/characters_tab_viewmodel.dart b/lib/src/ui/home/viewmodel/tabs/characters_tab_viewmodel.dart new file mode 100644 index 0000000..78511ba --- /dev/null +++ b/lib/src/ui/home/viewmodel/tabs/characters_tab_viewmodel.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; +import 'package:result_dart/result_dart.dart'; + +import '../../../../data/repository/characters/characters_repository.dart'; +import '../../../../data/repository/favorites/favorites_repository.dart'; +import '../../../../design_system/molecules/dialogs/info_dialog.dart'; +import '../../../../domain/enums/gender_enum.dart'; +import '../../../../domain/enums/status_enum.dart'; +import '../../../../domain/models/character_model.dart'; +import '../../../../shared/controllers/manual_pagination_controller.dart'; +import '../../../../shared/pagination/paginated_response.dart'; +import '../../../../shared/pagination/pagination.dart'; +import '../../../../shared/utils/app_error.dart'; + +class CharactersTabViewModel { + final ICharactersRepository charactersRepository; + final IFavoritesRepository favoritesRepository; + + final GlobalKey formKey = GlobalKey(); + final TextEditingController searchController = TextEditingController(); + + late ManualPaginationController charactersListController; + + PaginatedResponse? noFilterCache; + + GenderEnum selectedGender = GenderEnum.all; + StatusEnum selectedStatus = StatusEnum.all; + + CharactersTabViewModel({ + required this.charactersRepository, + required this.favoritesRepository, + }) { + charactersListController = ManualPaginationController( + itemsPerPage: 20, + fetchPage: getCharacters, + availableDisplayLimits: [5, 10, 20], + ); + } + + Future?> getCharacters({ + Pagination? pagination, + }) async { + final ResultDart, AppError> result = + await charactersRepository.getCharacters( + pagination: pagination ?? Pagination(), + name: searchController.text, + gender: selectedGender, + status: selectedStatus, + ); + + result.fold((_) {}, (error) { + InfoDialog.show( + title: "Erro ao listar personagens", + content: error.message, + ); + }); + + return result.getOrNull(); + } + + void onChangeGenderFilter(GenderEnum currentSelectedGEnder) { + selectedGender = currentSelectedGEnder; + onChangeFilters(); + } + + void onChangeStatusFilter(StatusEnum currentSelectedStatus) { + selectedStatus = currentSelectedStatus; + onChangeFilters(); + } + + void onChangeFilters() { + final isNoFilter = searchController.text.isEmpty && + selectedGender == GenderEnum.all && + selectedStatus == StatusEnum.all; + + if (isNoFilter) { + if (noFilterCache != null) { + charactersListController + ..cachedData = noFilterCache! + ..currentPage = 1 + ..updateCurrentPageData(); + noFilterCache = null; + } + return; + } + + if(charactersListController.cachedData.data.isNotEmpty){ + noFilterCache ??= charactersListController.cachedData; + } + + charactersListController.reset(); + } +} diff --git a/lib/src/ui/home/widgets/home_screen.dart b/lib/src/ui/home/widgets/home_screen.dart new file mode 100644 index 0000000..4d8e63e --- /dev/null +++ b/lib/src/ui/home/widgets/home_screen.dart @@ -0,0 +1,103 @@ +import 'package:doro_tech/src/ui/home/widgets/tabs/characters_tab.dart'; +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; + +import '../viewmodel/home_viewmodel.dart'; +import '../viewmodel/tabs/characters_tab_viewmodel.dart'; +import 'tabs/favorities_tab.dart'; + +class HomeScreen extends StatefulWidget { + final HomeViewModel homeViewModel; + + const HomeScreen({required this.homeViewModel, super.key}); + + @override + State createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State with SingleTickerProviderStateMixin { + late final CharactersTabViewModel charactersTabViewModel; + late TabController _tabController; + + @override + void initState() { + super.initState(); + charactersTabViewModel = GetIt.I(); + _tabController = TabController(length: 2, vsync: this); + widget.homeViewModel.getFavoritesCharacters(); + } + + @override + void dispose() { + _tabController.dispose(); + widget.homeViewModel.favoritesCharactersState.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('DoroTech'), + centerTitle: true, + actions: [ + IconButton( + icon: const Icon(Icons.brightness_6), + onPressed: widget.homeViewModel.changeThemeMode + ), + const SizedBox(width: 20), + ], + ), + body: Column( + children: [ + Container( + color: Theme.of(context).colorScheme.surface, + child: TabBar( + controller: _tabController, + dividerColor: Theme.of(context).colorScheme.onSurface.withAlpha(51), + labelColor: Theme.of(context).colorScheme.onSurface, + unselectedLabelColor: Theme.of(context).colorScheme.onSurface.withAlpha(51), + tabs: const [ + Tab(icon: Icon(Icons.people_alt), text: 'Personagens'), + Tab(icon: Icon(Icons.favorite), text: 'Favoritos'), + ], + ), + ), + const SizedBox(height: 16), + Expanded( + child: TabBarView( + controller: _tabController, + children: [ + CharactersTab( + charactersTabViewModel: charactersTabViewModel, + favoriteCharactersId: widget.homeViewModel + .favoritesCharactersIdsList, + onFavorite: (int characterId) { + widget.homeViewModel.saveLocalFavoriteCharacterId( + characterId: characterId, + ); + }, + onUnFavorite: (int characterId) { + widget.homeViewModel.deleteLocalFavoriteCharacterId( + characterId: characterId, + ); + }, + ), + FavoritesTab( + favoriteCharactersState: widget.homeViewModel.favoritesCharactersState, + onUnFavorite: (int characterId) { + widget.homeViewModel.deleteLocalFavoriteCharacterId( + characterId: characterId, + ); + }, + removeAllFavorites: widget.homeViewModel.deleteAllLocalFavoritesCharactersIds, + onRefresh: () => widget.homeViewModel.getFavoritesCharacters(), + ), + ], + ), + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/src/ui/home/widgets/tabs/characters_tab.dart b/lib/src/ui/home/widgets/tabs/characters_tab.dart new file mode 100644 index 0000000..618d9d5 --- /dev/null +++ b/lib/src/ui/home/widgets/tabs/characters_tab.dart @@ -0,0 +1,149 @@ +import 'package:doro_tech/src/design_system/molecules/manual_pagination.dart'; +import 'package:doro_tech/src/domain/enums/gender_enum.dart'; +import 'package:doro_tech/src/domain/enums/status_enum.dart'; +import 'package:doro_tech/src/ui/home/viewmodel/tabs/characters_tab_viewmodel.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../design_system/molecules/app_dropdown.dart'; +import '../../../../design_system/molecules/characters_card.dart'; +import '../../../../domain/models/character_model.dart'; +import '../../../../routing/routes.dart'; +import '../../../../shared/utils/validator.dart'; + +class CharactersTab extends StatelessWidget { + final CharactersTabViewModel charactersTabViewModel; + + final List favoriteCharactersId; + final Function(int characterId) onFavorite; + final Function(int characterId) onUnFavorite; + + const CharactersTab({ + required this.charactersTabViewModel, + required this.favoriteCharactersId, + required this.onFavorite, + required this.onUnFavorite, + + super.key, + }); + + @override + Widget build(BuildContext context) { + return RefreshIndicator( + onRefresh: () async { + charactersTabViewModel.charactersListController.reset(); + }, + child: Column( + children: [ + Container( + color: Theme.of(context).colorScheme.secondary, + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), + child: Column( + children: [ + _searchBarForm(context), + + const SizedBox(height: 16), + + _filtersRow(), + ], + ), + ), + + const SizedBox(height: 16), + + _charactersList(), + ], + ), + ); + } + + Widget _searchBarForm(BuildContext context) { + return Form( + key: charactersTabViewModel.formKey, + child: TextFormField( + controller: charactersTabViewModel.searchController, + onEditingComplete: () { + if (charactersTabViewModel.formKey.currentState!.validate()) { + charactersTabViewModel.onChangeFilters(); + } + }, + onChanged: (value) { + if (value.isEmpty) { + charactersTabViewModel.onChangeFilters(); + } + }, + decoration: InputDecoration( + filled: true, + fillColor: Theme.of(context).colorScheme.surface, + hintText: 'Pesquisar personagens...', + prefixIcon: const Icon(Icons.search), + enabledBorder: InputBorder.none, + ), + validator: (value) { + return Validator(value) + .isNotEmpty(message: 'Digite o nome do personagem para pesquisar') + .hasMinimumCharacters(charactersAmount: 2) + .validate(); + }, + ), + ); + } + + Widget _filtersRow() { + return Row( + children: [ + AppDropdown( + label: 'Gênero', + value: charactersTabViewModel.selectedGender, + items: GenderEnum.values, + itemLabelBuilder: (gender) => gender.genderLabel, + onChanged: (newGender) { + if (newGender != null) { + charactersTabViewModel.selectedGender = newGender; + charactersTabViewModel.onChangeGenderFilter(newGender); + } + }, + ), + const SizedBox(width: 16), + AppDropdown( + label: 'Status', + value: charactersTabViewModel.selectedStatus, + items: StatusEnum.values, + itemLabelBuilder: (status) => status.statusLabel, + onChanged: (newStatus) { + if (newStatus != null) { + charactersTabViewModel.selectedStatus = newStatus; + charactersTabViewModel.onChangeStatusFilter(newStatus); + } + }, + ), + ], + ); + } + + Widget _charactersList() { + return Expanded( + flex: 15, + child: ManualPagination( + controller: charactersTabViewModel.charactersListController, + itemBuilder: (context, character) { + return CharactersCard( + key: ValueKey(character.id), + characterModel: character, + isFavorite: favoriteCharactersId.contains(character.id), + onTapFavoriteIcon: (bool favorite) { + if (favorite) { + onFavorite(character.id); + return; + } + onUnFavorite(character.id); + }, + onTapCard: () { + context.push(Routes.detail.path, extra: character); + }, + ); + }, + ), + ); + } +} diff --git a/lib/src/ui/home/widgets/tabs/favorities_tab.dart b/lib/src/ui/home/widgets/tabs/favorities_tab.dart new file mode 100644 index 0000000..a455e29 --- /dev/null +++ b/lib/src/ui/home/widgets/tabs/favorities_tab.dart @@ -0,0 +1,132 @@ +import 'package:doro_tech/src/design_system/molecules/characters_card.dart'; +import 'package:doro_tech/src/shared/utils/app_state.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../design_system/molecules/dialogs/warning_dialog.dart'; +import '../../../../domain/models/character_model.dart'; +import '../../../../routing/routes.dart'; + +class FavoritesTab extends StatelessWidget { + final ValueNotifier>> favoriteCharactersState; + final Function(int characterId) onUnFavorite; + final VoidCallback removeAllFavorites; + final VoidCallback onRefresh; + + const FavoritesTab({ + required this.favoriteCharactersState, + required this.onUnFavorite, + required this.removeAllFavorites, + required this.onRefresh, + super.key, + }); + + @override + Widget build(BuildContext context) { + return RefreshIndicator( + onRefresh: () async{ + onRefresh(); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + _removeAllWidgetsMenu(context), + const SizedBox(height: 16), + Expanded( + child: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + padding: const EdgeInsets.all(10), + child: ValueListenableBuilder>>( + valueListenable: favoriteCharactersState, + builder: (_, state, __) { + if (state is LoadingState) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.5, + child: const Center(child: CircularProgressIndicator()), + ); + } + + if (state is ErrorState) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.5, + child: const Center( + child: Text( + "Ops! Parece que algo não saiu como o esperado.", + textAlign: TextAlign.center, + ), + ), + ); + } + + if (state is SuccessState && state.data.isEmpty) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.5, + child: const Center( + child: Text( + "Nenhum favorito encontrado", + textAlign: TextAlign.center, + ), + ), + ); + } + + return LayoutBuilder( + builder: (context, constraints) { + return Wrap( + spacing: 8, + runSpacing: 8, + children: state.data.map((character) { + return SizedBox( + width: 400, + height: 150, + child: CharactersCard( + characterModel: character, + onTapFavoriteIcon: (_) => onUnFavorite(character.id), + isFavorite: true, + onTapCard: () { + context.push(Routes.detail.path, extra: character); + }, + ), + ); + }).toList(), + ); + }, + ); + }, + ), + ), + ), + ], + ), + ); + } + + Widget _removeAllWidgetsMenu (BuildContext context){ + return Container( + color: Theme.of(context).colorScheme.secondary, + padding: const EdgeInsets.all(20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Seus personagens Favoritos', + style: TextStyle(color: Theme.of(context).colorScheme.onSecondary), + ), + TextButton( + onPressed: () { + WarningDialog.show( + title: 'Limpar Favoritos', + content: 'Deseja remover todos os favoritos?', + onConfirm: removeAllFavorites, + ); + }, + child: Text( + 'Limpar Todos', + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ), + ], + ), + ); + } +} \ No newline at end of file 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..525152e --- /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 "doro_tech") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.doro_tech") + +# 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..7dc8ec1 --- /dev/null +++ b/linux/runner/my_application.cc @@ -0,0 +1,130 @@ +#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) + +// 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, "doro_tech"); + 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, "doro_tech"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + 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); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), 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..72271d5 --- /dev/null +++ b/linux/runner/my_application.h @@ -0,0 +1,18 @@ +#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..4b81f9b --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#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..5caa9d1 --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#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/Podfile b/macos/Podfile new file mode 100644 index 0000000..29c8eb3 --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,42 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/macos/Podfile.lock b/macos/Podfile.lock new file mode 100644 index 0000000..abad2fe --- /dev/null +++ b/macos/Podfile.lock @@ -0,0 +1,23 @@ +PODS: + - FlutterMacOS (1.0.0) + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral`) + - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral + shared_preferences_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin + +SPEC CHECKSUMS: + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 + +PODFILE CHECKSUM: 7eb978b976557c8c1cd717d8185ec483fd090a82 + +COCOAPODS: 1.16.2 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2db93b0 --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,801 @@ +// !$*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 */; }; + 4F511C40C77D8F530491908E /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 652FD5C5C3EF31D9E1F8DD38 /* Pods_RunnerTests.framework */; }; + 787B1E3B6728615FF990C38F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB49CABC098BCE94D342A660 /* Pods_Runner.framework */; }; +/* 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 */ + 2AF274C74F0CE9570B10FBC7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 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 /* doro_tech.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = doro_tech.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 = ""; }; + 54C56C76E8C011CF18152508 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 652FD5C5C3EF31D9E1F8DD38 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 867E6E62EE92C4A5D54B5714 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 997226E5FB4BFC11B74F70C4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + BB49CABC098BCE94D342A660 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BDFE0AAC63FCF519EC3D8984 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + CC36A9AA995A657B6C5BD0B6 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F511C40C77D8F530491908E /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 787B1E3B6728615FF990C38F /* Pods_Runner.framework in Frameworks */, + ); + 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 */, + C075A94731BB1A649CED7787 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* doro_tech.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 = ""; + }; + C075A94731BB1A649CED7787 /* Pods */ = { + isa = PBXGroup; + children = ( + 997226E5FB4BFC11B74F70C4 /* Pods-Runner.debug.xcconfig */, + 2AF274C74F0CE9570B10FBC7 /* Pods-Runner.release.xcconfig */, + 867E6E62EE92C4A5D54B5714 /* Pods-Runner.profile.xcconfig */, + 54C56C76E8C011CF18152508 /* Pods-RunnerTests.debug.xcconfig */, + CC36A9AA995A657B6C5BD0B6 /* Pods-RunnerTests.release.xcconfig */, + BDFE0AAC63FCF519EC3D8984 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + BB49CABC098BCE94D342A660 /* Pods_Runner.framework */, + 652FD5C5C3EF31D9E1F8DD38 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + FD1AA5D64AAC3A87E66A19D2 /* [CP] Check Pods Manifest.lock */, + 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 = ( + 52399A0A3964D3C062DF3F96 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 789558F6AEE6E99D9E27808A /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* doro_tech.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"; + }; + 52399A0A3964D3C062DF3F96 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 789558F6AEE6E99D9E27808A /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + FD1AA5D64AAC3A87E66A19D2 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* 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; + baseConfigurationReference = 54C56C76E8C011CF18152508 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/doro_tech.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/doro_tech"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CC36A9AA995A657B6C5BD0B6 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/doro_tech.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/doro_tech"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BDFE0AAC63FCF519EC3D8984 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/doro_tech.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/doro_tech"; + }; + 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.14; + 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.14; + 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.14; + 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..10e74f3 --- /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..21a3cc1 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + 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..cc5bb17 --- /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 = doro_tech + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.doroTech + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 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..856ef6a --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,426 @@ +# 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" + dio: + dependency: "direct main" + description: + name: dio + sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9" + url: "https://pub.dev" + source: hosted + version: "5.8.0+1" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + 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: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + 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: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.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" + get_it: + dependency: "direct main" + description: + name: get_it + sha256: f126a3e286b7f5b578bf436d5592968706c4c1de28a228b870ce375d9f743103 + url: "https://pub.dev" + source: hosted + version: "8.0.3" + go_router: + dependency: "direct main" + description: + name: go_router + sha256: f02fd7d2a4dc512fec615529824fdd217fecb3a3d3de68360293a551f21634b3 + url: "https://pub.dev" + source: hosted + version: "14.8.1" + 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: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + url: "https://pub.dev" + source: hosted + version: "10.0.9" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" + source: hosted + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logger: + dependency: "direct main" + description: + name: logger + sha256: "2621da01aabaf223f8f961e751f2c943dbb374dc3559b982f200ccedadaa6999" + url: "https://pub.dev" + source: hosted + version: "2.6.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: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + mocktail: + dependency: "direct dev" + description: + name: mocktail + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + 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" + result_dart: + dependency: "direct main" + description: + name: result_dart + sha256: "0666b21fbdf697b3bdd9986348a380aa204b3ebe7c146d8e4cdaa7ce735e6054" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac" + url: "https://pub.dev" + source: hosted + version: "2.4.10" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + 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: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + 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: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + 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: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + url: "https://pub.dev" + source: hosted + version: "15.0.0" + 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.8.0 <4.0.0" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..9856b21 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,97 @@ +name: doro_tech +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.8.0 + +# 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 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + + get_it: ^8.0.3 + go_router: ^14.8.1 + result_dart: ^2.0.0 + shared_preferences: ^2.5.3 + dio: ^5.6.0 + logger: ^2.6.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: ^5.0.0 + mocktail: ^1.0.3 + +# 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/src/data/repository/characters/characters_repository_impl_test.dart b/test/src/data/repository/characters/characters_repository_impl_test.dart new file mode 100644 index 0000000..87d0d97 --- /dev/null +++ b/test/src/data/repository/characters/characters_repository_impl_test.dart @@ -0,0 +1,142 @@ +import 'package:doro_tech/src/data/repository/characters/characters_repository_impl.dart'; +import 'package:doro_tech/src/data/service/characters/characters_service.dart'; +import 'package:doro_tech/src/domain/enums/gender_enum.dart'; +import 'package:doro_tech/src/domain/enums/status_enum.dart'; +import 'package:doro_tech/src/domain/models/character_model.dart'; +import 'package:doro_tech/src/shared/pagination/paginated_response.dart'; +import 'package:doro_tech/src/shared/pagination/pagination.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:result_dart/result_dart.dart'; + +class MockCharactersService extends Mock implements ICharactersService {} + +void main() { + late CharactersRepositoryImpl repository; + late MockCharactersService mockCharactersService; + + setUp(() { + mockCharactersService = MockCharactersService(); + repository = CharactersRepositoryImpl(charactersService: mockCharactersService); + }); + + group('getCharacters', () { + final pagination = Pagination(page: 1); + final characterModel = CharacterModel( + id: 1, + name: 'Rick Sanchez', + status: StatusEnum.alive, + species: 'Human', + gender: GenderEnum.male, + origin: 'Earth', + location: 'Earth', + image: '', + episodesIds: [], + ); + final PaginatedResponse paginatedResponse = PaginatedResponse( + pagination: pagination.copyWith(total: 1), + data: [characterModel], + ); + + test('should return a PaginatedResponse of CharacterModel on success', () async { + when(() => mockCharactersService.getCharacters( + pagination: pagination, + name: any(named: 'name'), + gender: any(named: 'gender'), + status: any(named: 'status'), + )).thenAnswer((_) async => Success(paginatedResponse)); + + final result = await repository.getCharacters( + pagination: pagination, + name: 'Rick', + gender: GenderEnum.male, + status: StatusEnum.alive, + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), paginatedResponse); + verify(() => mockCharactersService.getCharacters( + pagination: pagination, + name: 'Rick', + gender: GenderEnum.male, + status: StatusEnum.alive, + )).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockCharactersService.getCharacters( + pagination: pagination, + name: any(named: 'name'), + gender: any(named: 'gender'), + status: any(named: 'status'), + )).thenAnswer((_) async => Failure(appError)); + + final result = await repository.getCharacters( + pagination: pagination, + name: 'Rick', + gender: GenderEnum.male, + status: StatusEnum.alive, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockCharactersService.getCharacters( + pagination: pagination, + name: 'Rick', + gender: GenderEnum.male, + status: StatusEnum.alive, + )).called(1); + }); + }); + + group('getFavoriteCharacters', () { + final charactersIds = [1, 2, 3]; + final characterModel = CharacterModel( + id: 1, + name: 'Rick Sanchez', + status: StatusEnum.alive, + species: 'Human', + gender: GenderEnum.male, + origin: 'Earth', + location: 'Earth', + image: '', + episodesIds: [], + ); + final List characterList = [characterModel]; + + test('should return a list of CharacterModel on success', () async { + when(() => mockCharactersService.getFavoriteCharacters( + charactersIds: charactersIds, + )).thenAnswer((_) async => Success(characterList)); + + final result = await repository.getFavoriteCharacters( + charactersIds: charactersIds, + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), characterList); + verify(() => mockCharactersService.getFavoriteCharacters( + charactersIds: charactersIds, + )).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockCharactersService.getFavoriteCharacters( + charactersIds: charactersIds, + )).thenAnswer((_) async => Failure(appError)); + + final result = await repository.getFavoriteCharacters( + charactersIds: charactersIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockCharactersService.getFavoriteCharacters( + charactersIds: charactersIds, + )).called(1); + }); + }); +} \ No newline at end of file diff --git a/test/src/data/repository/episodes/episodes_repository_impl_test.dart b/test/src/data/repository/episodes/episodes_repository_impl_test.dart new file mode 100644 index 0000000..efa8420 --- /dev/null +++ b/test/src/data/repository/episodes/episodes_repository_impl_test.dart @@ -0,0 +1,62 @@ +import 'package:doro_tech/src/data/repository/episodes/episodes_repository_impl.dart'; +import 'package:doro_tech/src/data/service/episodes/episodes_service.dart'; +import 'package:doro_tech/src/domain/models/episode_model.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:result_dart/result_dart.dart'; + +class MockEpisodesService extends Mock implements IEpisodesService {} + +void main() { + late EpisodesRepositoryImpl repository; + late MockEpisodesService mockEpisodesService; + + setUp(() { + mockEpisodesService = MockEpisodesService(); + repository = EpisodesRepositoryImpl(episodesService: mockEpisodesService); + }); + + group('getEpisodesByIds', () { + final episodesIds = [1, 2, 3]; + final episodeModel = EpisodeModel( + id: 1, + name: 'Pilot', + episode: 'S01E01', + ); + final List episodeList = [episodeModel]; + + test('should return a list of EpisodeModel on success', () async { + when(() => mockEpisodesService.getEpisodesByIds( + episodesIds: episodesIds, + )).thenAnswer((_) async => Success(episodeList)); + + final result = await repository.getEpisodesByIds( + episodesIds: episodesIds, + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), episodeList); + verify(() => mockEpisodesService.getEpisodesByIds( + episodesIds: episodesIds, + )).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockEpisodesService.getEpisodesByIds( + episodesIds: episodesIds, + )).thenAnswer((_) async => Failure(appError)); + + final result = await repository.getEpisodesByIds( + episodesIds: episodesIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockEpisodesService.getEpisodesByIds( + episodesIds: episodesIds, + )).called(1); + }); + }); +} diff --git a/test/src/data/repository/favorites/favorites_repository_impl_test.dart b/test/src/data/repository/favorites/favorites_repository_impl_test.dart new file mode 100644 index 0000000..e9ffc0f --- /dev/null +++ b/test/src/data/repository/favorites/favorites_repository_impl_test.dart @@ -0,0 +1,118 @@ +import 'package:doro_tech/src/data/repository/favorites/favorites_repository_impl.dart'; +import 'package:doro_tech/src/data/service/favorites/favorites_service.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:result_dart/result_dart.dart'; + +class MockFavoritesService extends Mock implements IFavoritesService {} + +void main() { + late FavoritesRepositoryImpl repository; + late MockFavoritesService mockFavoritesService; + + setUp(() { + mockFavoritesService = MockFavoritesService(); + repository = FavoritesRepositoryImpl(favoritesService: mockFavoritesService); + }); + + group('saveFavoriteId', () { + test('should return true on success', () async { + when(() => mockFavoritesService.saveFavoriteId(characterId: any(named: 'characterId'))) + .thenAnswer((_) async => const Success(true)); + + final result = await repository.saveFavoriteId(characterId: 1); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockFavoritesService.saveFavoriteId(characterId: 1)).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockFavoritesService.saveFavoriteId(characterId: any(named: 'characterId'))) + .thenAnswer((_) async => Failure(appError)); + + final result = await repository.saveFavoriteId(characterId: 1); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockFavoritesService.saveFavoriteId(characterId: 1)).called(1); + }); + }); + + group('deleteFavoriteId', () { + test('should return true on success', () async { + when(() => mockFavoritesService.deleteFavoriteId(characterId: any(named: 'characterId'))) + .thenAnswer((_) async => const Success(true)); + + final result = await repository.deleteFavoriteId(characterId: 1); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockFavoritesService.deleteFavoriteId(characterId: 1)).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockFavoritesService.deleteFavoriteId(characterId: any(named: 'characterId'))) + .thenAnswer((_) async => Failure(appError)); + + final result = await repository.deleteFavoriteId(characterId: 1); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockFavoritesService.deleteFavoriteId(characterId: 1)).called(1); + }); + }); + + group('getFavoriteIds', () { + test('should return a list of int on success', () async { + when(() => mockFavoritesService.getFavoriteIds()) + .thenAnswer((_) async => const Success([1, 2, 3])); + + final result = await repository.getFavoriteIds(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), [1, 2, 3]); + verify(() => mockFavoritesService.getFavoriteIds()).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockFavoritesService.getFavoriteIds()) + .thenAnswer((_) async => Failure(appError)); + + final result = await repository.getFavoriteIds(); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockFavoritesService.getFavoriteIds()).called(1); + }); + }); + + group('deleteAllFavoriteIds', () { + test('should return true on success', () async { + when(() => mockFavoritesService.deleteAllFavoriteIds()) + .thenAnswer((_) async => const Success(true)); + + final result = await repository.deleteAllFavoriteIds(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockFavoritesService.deleteAllFavoriteIds()).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockFavoritesService.deleteAllFavoriteIds()) + .thenAnswer((_) async => Failure(appError)); + + final result = await repository.deleteAllFavoriteIds(); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockFavoritesService.deleteAllFavoriteIds()).called(1); + }); + }); +} diff --git a/test/src/data/repository/theme/theme_repository_impl_test.dart b/test/src/data/repository/theme/theme_repository_impl_test.dart new file mode 100644 index 0000000..6ddc4bd --- /dev/null +++ b/test/src/data/repository/theme/theme_repository_impl_test.dart @@ -0,0 +1,73 @@ +import 'package:doro_tech/src/data/repository/theme/theme_repository_impl.dart'; +import 'package:doro_tech/src/data/service/theme/theme_service.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:result_dart/result_dart.dart'; + +class MockThemeService extends Mock implements IThemeService {} + +void main() { + setUpAll(() { + registerFallbackValue(ThemeMode.system); + }); + + late ThemeRepositoryImpl repository; + late MockThemeService mockThemeService; + + setUp(() { + mockThemeService = MockThemeService(); + repository = ThemeRepositoryImpl(themeService: mockThemeService); + }); + + group('saveThemeMode', () { + test('should return true on success', () async { + when(() => mockThemeService.saveThemeMode(any())) + .thenAnswer((_) async => const Success(true)); + + final result = await repository.saveThemeMode(ThemeMode.dark); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockThemeService.saveThemeMode(ThemeMode.dark)).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockThemeService.saveThemeMode(any())) + .thenAnswer((_) async => Failure(appError)); + + final result = await repository.saveThemeMode(ThemeMode.dark); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockThemeService.saveThemeMode(ThemeMode.dark)).called(1); + }); + }); + + group('getThemeMode', () { + test('should return ThemeMode on success', () async { + when(() => mockThemeService.getThemeMode()) + .thenAnswer((_) async => const Success(ThemeMode.light)); + + final result = await repository.getThemeMode(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), ThemeMode.light); + verify(() => mockThemeService.getThemeMode()).called(1); + }); + + test('should return an AppError on failure', () async { + final appError = AppError(message: 'Error', type: AppErrorType.local); + when(() => mockThemeService.getThemeMode()) + .thenAnswer((_) async => Failure(appError)); + + final result = await repository.getThemeMode(); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), appError); + verify(() => mockThemeService.getThemeMode()).called(1); + }); + }); +} \ No newline at end of file diff --git a/test/src/data/service/characters/characters_service_impl_test.dart b/test/src/data/service/characters/characters_service_impl_test.dart new file mode 100644 index 0000000..f4bcf68 --- /dev/null +++ b/test/src/data/service/characters/characters_service_impl_test.dart @@ -0,0 +1,255 @@ +import 'package:dio/dio.dart'; +import 'package:doro_tech/src/data/service/characters/characters_service_impl.dart'; +import 'package:doro_tech/src/domain/enums/gender_enum.dart'; +import 'package:doro_tech/src/domain/enums/status_enum.dart'; +import 'package:doro_tech/src/domain/models/character_model.dart'; +import 'package:doro_tech/src/shared/pagination/paginated_response.dart'; +import 'package:doro_tech/src/shared/pagination/pagination.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; + +class MockDio extends Mock implements Dio {} + +void main() { + late CharactersServiceImpl service; + late MockDio mockDio; + + setUp(() { + mockDio = MockDio(); + service = CharactersServiceImpl(mockDio); + }); + + group('getCharacters', () { + final pagination = Pagination(page: 1); + final characterJson = { + "id": 1, + "name": "Rick Sanchez", + "status": "Alive", + "species": "Human", + "type": "", + "gender": "Male", + "origin": {"name": "Earth", "url": ""}, + "location": {"name": "Earth", "url": ""}, + "image": "", + "episode": [], + "url": "", + "created": "" + }; + final characterModel = CharacterModel.fromJson(characterJson); + final successResponseData = { + "info": {"count": 1, "pages": 1, "next": null, "prev": null}, + "results": [characterJson] + }; + + test('should return a PaginatedResponse of CharacterModel on success', () async { + when(() => mockDio.get( + any(), + queryParameters: any(named: 'queryParameters'), + )).thenAnswer((_) async => Response( + requestOptions: RequestOptions(path: ''), + data: successResponseData, + statusCode: 200, + )); + + final result = await service.getCharacters( + pagination: pagination, + name: 'Rick', + gender: GenderEnum.male, + status: StatusEnum.alive, + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), isA>()); + expect(result.getOrNull()!.data.first.id, characterModel.id); + verify(() => mockDio.get( + 'https://rickandmortyapi.com/api/character', + queryParameters: { + 'page': 1, + 'name': 'Rick', + 'gender': 'Male', + 'status': 'Alive', + }, + )).called(1); + }); + + test('should return an empty PaginatedResponse when 404 and "There is nothing here"', () async { + when(() => mockDio.get( + any(), + queryParameters: any(named: 'queryParameters'), + )).thenThrow(DioException( + requestOptions: RequestOptions(path: ''), + response: Response( + requestOptions: RequestOptions(path: ''), + data: {'error': 'There is nothing here'}, + statusCode: 404, + ), + type: DioExceptionType.badResponse, + )); + + final result = await service.getCharacters( + pagination: pagination, + name: 'NonExistent', + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), isA>()); + expect(result.getOrNull()!.data, isEmpty); + }); + + test('should return an AppError on server error (non-200 status)', () async { + when(() => mockDio.get( + any(), + queryParameters: any(named: 'queryParameters'), + )).thenAnswer((_) async => Response( + requestOptions: RequestOptions(path: ''), + statusCode: 500, + statusMessage: 'Internal Server Error', + )); + + final result = await service.getCharacters(pagination: pagination); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.server); + }); + + test('should return an AppError on DioException (network error)', () async { + when(() => mockDio.get( + any(), + queryParameters: any(named: 'queryParameters'), + )).thenThrow(DioException( + requestOptions: RequestOptions(path: ''), + type: DioExceptionType.connectionError, + error: 'Network Error', + )); + + final result = await service.getCharacters(pagination: pagination); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.network); + }); + + test('should return an AppError on unexpected error', () async { + when(() => mockDio.get( + any(), + queryParameters: any(named: 'queryParameters'), + )).thenThrow(Exception('Unexpected error')); + + final result = await service.getCharacters(pagination: pagination); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.local); + }); + }); + + group('getFavoriteCharacters', () { + final charactersIds = [1, 2]; + final characterJson1 = { + "id": 1, + "name": "Rick Sanchez", + "status": "Alive", + "species": "Human", + "type": "", + "gender": "Male", + "origin": {"name": "Earth", "url": ""}, + "location": {"name": "Earth", "url": ""}, + "image": "", + "episode": [], + "url": "", + "created": "" + }; + final characterJson2 = { + "id": 2, + "name": "Morty Smith", + "status": "Alive", + "species": "Human", + "type": "", + "gender": "Male", + "origin": {"name": "Earth", "url": ""}, + "location": {"name": "Earth", "url": ""}, + "image": "", + "episode": [], + "url": "", + "created": "" + }; + final characterModel1 = CharacterModel.fromJson(characterJson1); + final characterModel2 = CharacterModel.fromJson(characterJson2); + final successResponseData = [characterJson1, characterJson2]; + + test('should return a list of CharacterModel on success', () async { + when(() => mockDio.get( + any(), + )).thenAnswer((_) async => Response( + requestOptions: RequestOptions(path: ''), + data: successResponseData, + statusCode: 200, + )); + + final result = await service.getFavoriteCharacters( + charactersIds: charactersIds, + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), isA>()); + expect(result.getOrNull()!.length, 2); + expect(result.getOrNull()![0].id, characterModel1.id); + expect(result.getOrNull()![1].id, characterModel2.id); + verify(() => mockDio.get( + 'https://rickandmortyapi.com/api/character/[1, 2]', + )).called(1); + }); + + test('should return an AppError on server error (non-200 status)', () async { + when(() => mockDio.get( + any(), + )).thenAnswer((_) async => Response( + requestOptions: RequestOptions(path: ''), + statusCode: 500, + statusMessage: 'Internal Server Error', + )); + + final result = await service.getFavoriteCharacters( + charactersIds: charactersIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.server); + }); + + test('should return an AppError on DioException (network error)', () async { + when(() => mockDio.get( + any(), + )).thenThrow(DioException( + requestOptions: RequestOptions(path: ''), + type: DioExceptionType.connectionError, + error: 'Network Error', + )); + + final result = await service.getFavoriteCharacters( + charactersIds: charactersIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.network); + }); + + test('should return an AppError on unexpected error', () async { + when(() => mockDio.get( + any(), + )).thenThrow(Exception('Unexpected error')); + + final result = await service.getFavoriteCharacters( + charactersIds: charactersIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.local); + }); + }); +} \ No newline at end of file diff --git a/test/src/data/service/episodes/episodes_service_impl_test.dart b/test/src/data/service/episodes/episodes_service_impl_test.dart new file mode 100644 index 0000000..7bb12c6 --- /dev/null +++ b/test/src/data/service/episodes/episodes_service_impl_test.dart @@ -0,0 +1,116 @@ +import 'package:dio/dio.dart'; +import 'package:doro_tech/src/data/service/episodes/episodes_service_impl.dart'; +import 'package:doro_tech/src/domain/models/episode_model.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; + +class MockDio extends Mock implements Dio {} + +void main() { + late EpisodesServiceImpl service; + late MockDio mockDio; + + setUp(() { + mockDio = MockDio(); + service = EpisodesServiceImpl(mockDio); + }); + + group('getEpisodesByIds', () { + final episodesIds = [1, 2]; + final episodeJson1 = { + "id": 1, + "name": "Pilot", + "air_date": "December 2, 2013", + "episode": "S01E01", + "characters": [], + "url": "", + "created": "" + }; + final episodeJson2 = { + "id": 2, + "name": "Lawnmower Dog", + "air_date": "December 9, 2013", + "episode": "S01E02", + "characters": [], + "url": "", + "created": "" + }; + final episodeModel1 = EpisodeModel.fromJson(episodeJson1); + final episodeModel2 = EpisodeModel.fromJson(episodeJson2); + final successResponseData = [episodeJson1, episodeJson2]; + + test('should return a list of EpisodeModel on success', () async { + when(() => mockDio.get( + 'https://rickandmortyapi.com/api/episode/$episodesIds', + )).thenAnswer((_) async => Response( + requestOptions: RequestOptions(path: ''), + data: successResponseData, + statusCode: 200, + )); + + final result = await service.getEpisodesByIds( + episodesIds: episodesIds, + ); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), isA>()); + expect(result.getOrNull()!.length, 2); + expect(result.getOrNull()![0].id, episodeModel1.id); + expect(result.getOrNull()![1].id, episodeModel2.id); + verify(() => mockDio.get( + 'https://rickandmortyapi.com/api/episode/[1, 2]', + )).called(1); + }); + + test('should return an AppError on server error (non-200 status)', () async { + when(() => mockDio.get( + 'https://rickandmortyapi.com/api/episode/$episodesIds', + )).thenAnswer((_) async => Response( + requestOptions: RequestOptions(path: ''), + statusCode: 500, + statusMessage: 'Internal Server Error', + )); + + final result = await service.getEpisodesByIds( + episodesIds: episodesIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.server); + }); + + test('should return an AppError on DioException (network error)', () async { + when(() => mockDio.get( + 'https://rickandmortyapi.com/api/episode/$episodesIds', + )).thenThrow(DioException( + requestOptions: RequestOptions(path: ''), + type: DioExceptionType.connectionError, + error: 'Network Error', + )); + + final result = await service.getEpisodesByIds( + episodesIds: episodesIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.network); + }); + + test('should return an AppError on unexpected error', () async { + when(() => mockDio.get( + 'https://rickandmortyapi.com/api/episode/$episodesIds', + )).thenThrow(Exception('Unexpected error')); + + final result = await service.getEpisodesByIds( + episodesIds: episodesIds, + ); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + expect(result.exceptionOrNull()!.type, AppErrorType.local); + }); + }); +} diff --git a/test/src/data/service/favorites/favorites_service_impl_test.dart b/test/src/data/service/favorites/favorites_service_impl_test.dart new file mode 100644 index 0000000..d622dd2 --- /dev/null +++ b/test/src/data/service/favorites/favorites_service_impl_test.dart @@ -0,0 +1,139 @@ +import 'package:doro_tech/src/data/service/favorites/favorites_service_impl.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class MockSharedPreferences extends Mock implements SharedPreferences {} + +void main() { + late FavoritesServiceImpl service; + late MockSharedPreferences mockSharedPreferences; + + setUp(() { + mockSharedPreferences = MockSharedPreferences(); + service = FavoritesServiceImpl(mockSharedPreferences); + }); + + group('saveFavoriteId', () { + test('should save character ID to shared preferences', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenReturn([]); + when(() => mockSharedPreferences.setStringList('favorites', any())) + .thenAnswer((_) async => true); + + final result = await service.saveFavoriteId(characterId: 1); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockSharedPreferences.getStringList('favorites')).called(1); + verify(() => mockSharedPreferences.setStringList('favorites', ['1'])).called(1); + }); + + test('should not save if character ID already exists', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenReturn(['1']); + when(() => mockSharedPreferences.setStringList('favorites', any())) + .thenAnswer((_) async => true); + + final result = await service.saveFavoriteId(characterId: 1); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockSharedPreferences.getStringList('favorites')).called(1); + verifyNever(() => mockSharedPreferences.setStringList(any(), any())); + }); + + test('should return AppError on exception', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenThrow(Exception('Error')); + + final result = await service.saveFavoriteId(characterId: 1); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + }); + }); + + group('deleteFavoriteId', () { + test('should delete character ID from shared preferences', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenReturn(['1', '2']); + when(() => mockSharedPreferences.setStringList('favorites', any())) + .thenAnswer((_) async => true); + + final result = await service.deleteFavoriteId(characterId: 1); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockSharedPreferences.getStringList('favorites')).called(1); + verify(() => mockSharedPreferences.setStringList('favorites', ['2'])).called(1); + }); + + test('should return AppError on exception', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenThrow(Exception('Error')); + + final result = await service.deleteFavoriteId(characterId: 1); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + }); + }); + + group('getFavoriteIds', () { + test('should return list of favorite IDs from shared preferences', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenReturn(['1', '2', '3']); + + final result = await service.getFavoriteIds(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), [1, 2, 3]); + verify(() => mockSharedPreferences.getStringList('favorites')).called(1); + }); + + test('should return empty list if no favorites', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenReturn([]); + + final result = await service.getFavoriteIds(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), []); + }); + + test('should return AppError on exception', () async { + when(() => mockSharedPreferences.getStringList('favorites')) + .thenThrow(Exception('Error')); + + final result = await service.getFavoriteIds(); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + }); + }); + + group('deleteAllFavoriteIds', () { + test('should delete all favorite IDs from shared preferences', () async { + when(() => mockSharedPreferences.remove('favorites')) + .thenAnswer((_) async => true); + + final result = await service.deleteAllFavoriteIds(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockSharedPreferences.remove('favorites')).called(1); + }); + + test('should return AppError on exception', () async { + when(() => mockSharedPreferences.remove('favorites')) + .thenThrow(Exception('Error')); + + final result = await service.deleteAllFavoriteIds(); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + }); + }); +} \ No newline at end of file diff --git a/test/src/data/service/theme/theme_service_impl_test.dart b/test/src/data/service/theme/theme_service_impl_test.dart new file mode 100644 index 0000000..788911a --- /dev/null +++ b/test/src/data/service/theme/theme_service_impl_test.dart @@ -0,0 +1,79 @@ +import 'package:doro_tech/src/data/service/theme/theme_service_impl.dart'; +import 'package:doro_tech/src/shared/utils/app_error.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class MockSharedPreferences extends Mock implements SharedPreferences {} + +void main() { + setUpAll(() { + registerFallbackValue(ThemeMode.system); + }); + + late ThemeServiceImpl service; + late MockSharedPreferences mockSharedPreferences; + + setUp(() { + mockSharedPreferences = MockSharedPreferences(); + service = ThemeServiceImpl(mockSharedPreferences); + }); + + group('getThemeMode', () { + test('should return saved ThemeMode on success', () async { + when(() => mockSharedPreferences.getInt('theme_mode')) + .thenReturn(ThemeMode.dark.index); + + final result = await service.getThemeMode(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), ThemeMode.dark); + verify(() => mockSharedPreferences.getInt('theme_mode')).called(1); + }); + + test('should return system ThemeMode if no saved value', () async { + when(() => mockSharedPreferences.getInt('theme_mode')) + .thenReturn(null); + + final result = await service.getThemeMode(); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), ThemeMode.system); + verify(() => mockSharedPreferences.getInt('theme_mode')).called(1); + }); + + test('should return AppError on exception', () async { + when(() => mockSharedPreferences.getInt('theme_mode')) + .thenThrow(Exception('Error')); + + final result = await service.getThemeMode(); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + }); + }); + + group('saveThemeMode', () { + test('should save ThemeMode on success', () async { + when(() => mockSharedPreferences.setInt('theme_mode', any())) + .thenAnswer((_) async => true); + + final result = await service.saveThemeMode(ThemeMode.light); + + expect(result.isSuccess(), true); + expect(result.getOrNull(), true); + verify(() => mockSharedPreferences.setInt('theme_mode', ThemeMode.light.index)).called(1); + }); + + test('should return AppError on exception', () async { + when(() => mockSharedPreferences.setInt('theme_mode', any())) + .thenThrow(Exception('Error')); + + final result = await service.saveThemeMode(ThemeMode.light); + + expect(result.isError(), true); + expect(result.exceptionOrNull(), isA()); + }); + }); +} diff --git a/test/src/domain/enums/gender_enum_test.dart b/test/src/domain/enums/gender_enum_test.dart new file mode 100644 index 0000000..20fdc59 --- /dev/null +++ b/test/src/domain/enums/gender_enum_test.dart @@ -0,0 +1,25 @@ +import 'package:doro_tech/src/domain/enums/gender_enum.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('GenderEnum', () { + test('fromString should return correct GenderEnum for valid string', () { + expect(GenderEnum.fromString('Male'), GenderEnum.male); + expect(GenderEnum.fromString('Female'), GenderEnum.female); + expect(GenderEnum.fromString('Genderless'), GenderEnum.genderless); + expect(GenderEnum.fromString('Unknown'), GenderEnum.unknown); + expect(GenderEnum.fromString('All'), GenderEnum.all); + }); + + test('fromString should be case-insensitive', () { + expect(GenderEnum.fromString('male'), GenderEnum.male); + expect(GenderEnum.fromString('FEMALE'), GenderEnum.female); + }); + + test('fromString should return unknown for invalid string', () { + expect(GenderEnum.fromString('Invalid'), GenderEnum.unknown); + expect(GenderEnum.fromString(null), GenderEnum.unknown); + expect(GenderEnum.fromString(''), GenderEnum.unknown); + }); + }); +} diff --git a/test/src/domain/enums/status_enum_test.dart b/test/src/domain/enums/status_enum_test.dart new file mode 100644 index 0000000..110c2b1 --- /dev/null +++ b/test/src/domain/enums/status_enum_test.dart @@ -0,0 +1,32 @@ +import 'package:doro_tech/src/domain/enums/status_enum.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('StatusEnum', () { + test('fromString should return correct StatusEnum for valid string', () { + expect(StatusEnum.fromString('Alive'), StatusEnum.alive); + expect(StatusEnum.fromString('Dead'), StatusEnum.dead); + expect(StatusEnum.fromString('Unknown'), StatusEnum.unknown); + expect(StatusEnum.fromString('All'), StatusEnum.all); + }); + + test('fromString should be case-insensitive', () { + expect(StatusEnum.fromString('alive'), StatusEnum.alive); + expect(StatusEnum.fromString('DEAD'), StatusEnum.dead); + }); + + test('fromString should return unknown for invalid string', () { + expect(StatusEnum.fromString('Invalid'), StatusEnum.unknown); + expect(StatusEnum.fromString(null), StatusEnum.unknown); + expect(StatusEnum.fromString(''), StatusEnum.unknown); + }); + + test('statusColor should return correct color', () { + expect(StatusEnum.alive.statusColor, Colors.green); + expect(StatusEnum.dead.statusColor, Colors.red); + expect(StatusEnum.unknown.statusColor, Colors.grey); + expect(StatusEnum.all.statusColor, Colors.white); + }); + }); +} diff --git a/test/src/domain/models/character_model_test.dart b/test/src/domain/models/character_model_test.dart new file mode 100644 index 0000000..00722a4 --- /dev/null +++ b/test/src/domain/models/character_model_test.dart @@ -0,0 +1,69 @@ +import 'package:doro_tech/src/domain/enums/gender_enum.dart'; +import 'package:doro_tech/src/domain/enums/status_enum.dart'; +import 'package:doro_tech/src/domain/models/character_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('CharacterModel', () { + test('fromJson should correctly parse JSON', () { + final json = { + "id": 1, + "name": "Rick Sanchez", + "status": "Alive", + "species": "Human", + "type": "", + "gender": "Male", + "origin": {"name": "Earth (C-137)", "url": "https://rickandmortyapi.com/api/location/1"}, + "location": {"name": "Citadel of Ricks", "url": "https://rickandmortyapi.com/api/location/3"}, + "image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg", + "episode": [ + "https://rickandmortyapi.com/api/episode/1", + "https://rickandmortyapi.com/api/episode/2" + ], + "url": "https://rickandmortyapi.com/api/character/1", + "created": "2017-11-04T18:48:46.250Z" + }; + + final character = CharacterModel.fromJson(json); + + expect(character.id, 1); + expect(character.name, "Rick Sanchez"); + expect(character.status, StatusEnum.alive); + expect(character.species, "Human"); + expect(character.gender, GenderEnum.male); + expect(character.origin, "Earth (C-137)"); + expect(character.location, "Citadel of Ricks"); + expect(character.image, "https://rickandmortyapi.com/api/character/avatar/1.jpeg"); + expect(character.episodesIds, [1, 2]); + }); + + test('fromJson should handle null or missing values gracefully', () { + final json = { + "id": 2, + "name": null, + "status": null, + "species": null, + "type": null, + "gender": null, + "origin": {"name": null, "url": null}, + "location": {"name": null, "url": null}, + "image": null, + "episode": [], + "url": null, + "created": null + }; + + final character = CharacterModel.fromJson(json); + + expect(character.id, 2); + expect(character.name, "Unknown"); + expect(character.status, StatusEnum.unknown); + expect(character.species, "Unknown"); + expect(character.gender, GenderEnum.unknown); + expect(character.origin, "Unknown"); + expect(character.location, "Unknown"); + expect(character.image, ''); + expect(character.episodesIds, isEmpty); + }); + }); +} \ No newline at end of file diff --git a/test/src/domain/models/episode_model_test.dart b/test/src/domain/models/episode_model_test.dart new file mode 100644 index 0000000..2d3a30d --- /dev/null +++ b/test/src/domain/models/episode_model_test.dart @@ -0,0 +1,41 @@ +import 'package:doro_tech/src/domain/models/episode_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('EpisodeModel', () { + test('fromJson should correctly parse JSON', () { + final json = { + "id": 1, + "name": "Pilot", + "air_date": "December 2, 2013", + "episode": "S01E01", + "characters": [ + "https://rickandmortyapi.com/api/character/1", + "https://rickandandmortyapi.com/api/character/2" + ], + "url": "https://rickandmortyapi.com/api/episode/1", + "created": "2017-11-10T12:42:04.162Z" + }; + + final episode = EpisodeModel.fromJson(json); + + expect(episode.id, 1); + expect(episode.name, "Pilot"); + expect(episode.episode, "S01E01"); + }); + + test('fromJson should handle missing values gracefully', () { + final json = { + "id": 2, + "name": null, + "episode": null, + }; + + final episode = EpisodeModel.fromJson(json); + + expect(episode.id, 2); + expect(episode.name, ''); + expect(episode.episode, ''); + }); + }); +} \ No newline at end of file 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..af6d606 --- /dev/null +++ b/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + doro_tech + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..3b99cc4 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "doro_tech", + "short_name": "doro_tech", + "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..7cfea14 --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(doro_tech 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 "doro_tech") + +# 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..81fc2f4 --- /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", "doro_tech" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "doro_tech" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "doro_tech.exe" "\0" + VALUE "ProductName", "doro_tech" "\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..60223f3 --- /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"doro_tech", 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_