├── ios
├── Runner
│ ├── Runner-Bridging-Header.h
│ ├── Assets.xcassets
│ │ ├── LaunchImage.imageset
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ ├── README.md
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ └── Info.plist
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── Runner.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
├── .gitignore
├── Podfile.lock
└── Podfile
├── lib
├── app
│ ├── constants
│ │ ├── app_assets.dart
│ │ ├── app_urls.dart
│ │ ├── app_constants.dart
│ │ ├── mock_paths.dart
│ │ └── app_colors.dart
│ ├── config
│ │ ├── app_theme.dart
│ │ ├── environment_config.dart
│ │ └── app_fonts.dart
│ ├── utils
│ │ └── string_validators.dart
│ ├── extensions
│ │ └── context_extensions.dart
│ ├── di
│ │ ├── modules
│ │ │ ├── remote_modules.dart
│ │ │ ├── repository_modules.dart
│ │ │ ├── ui_modules.dart
│ │ │ ├── local_modules.dart
│ │ │ └── api_modules.dart
│ │ ├── top_bloc_provider.dart
│ │ └── di.dart
│ ├── routes
│ │ ├── app_paths.dart
│ │ └── app_routes.dart
│ ├── l10n
│ │ ├── app_en.arb
│ │ └── app_es.arb
│ └── types
│ │ ├── auth_status.dart
│ │ ├── result.dart
│ │ ├── screen_status.dart
│ │ ├── repository_error.dart
│ │ ├── errors
│ │ ├── network_error_utils.dart
│ │ └── network_error.dart
│ │ ├── result.freezed.dart
│ │ └── auth_status.freezed.dart
├── data
│ ├── repositories
│ │ ├── data_source_contracts
│ │ │ ├── local
│ │ │ │ └── app_local_datasource_contract.dart
│ │ │ └── remote
│ │ │ │ └── app_remote_data_source_contract.dart
│ │ └── app_repository.dart
│ ├── datasources
│ │ ├── remote_data_source
│ │ │ ├── api
│ │ │ │ ├── app_api.dart
│ │ │ │ ├── network
│ │ │ │ │ ├── interceptors
│ │ │ │ │ │ ├── mock_interceptor.dart
│ │ │ │ │ │ └── curl_dio_interceptor.dart
│ │ │ │ │ └── dio_http_client.dart
│ │ │ │ └── app_api.g.dart
│ │ │ └── app_remote_data_source.dart
│ │ └── local_data_source
│ │ │ └── app_local_datasource.dart
│ └── models
│ │ ├── example_remote_entity.dart
│ │ ├── example_remote_entity.g.dart
│ │ └── example_remote_entity.freezed.dart
├── domain
│ ├── repository_contracts
│ │ └── app_repository_contract.dart
│ └── models
│ │ ├── example_entity.dart
│ │ ├── example_entity.g.dart
│ │ └── example_entity.freezed.dart
├── presentation
│ ├── top_blocs
│ │ └── language_bloc
│ │ │ ├── language_bloc_event.dart
│ │ │ ├── language_bloc_state.dart
│ │ │ ├── language_bloc.dart
│ │ │ ├── language_bloc_state.freezed.dart
│ │ │ └── language_bloc_event.freezed.dart
│ ├── features
│ │ ├── splash
│ │ │ ├── splash_bloc
│ │ │ │ ├── splash_event.dart
│ │ │ │ ├── splash_state.dart
│ │ │ │ ├── splash_bloc.dart
│ │ │ │ ├── splash_event.freezed.dart
│ │ │ │ └── splash_state.freezed.dart
│ │ │ ├── splash_controller.dart
│ │ │ └── splash_screen.dart
│ │ ├── authentication
│ │ │ ├── auth_bloc
│ │ │ │ ├── auth_event.dart
│ │ │ │ ├── auth_state.dart
│ │ │ │ ├── auth_bloc.dart
│ │ │ │ ├── auth_state.freezed.dart
│ │ │ │ └── auth_event.freezed.dart
│ │ │ ├── auth_controller.dart
│ │ │ └── authentication_screen.dart
│ │ └── home
│ │ │ └── home_screen.dart
│ └── widgets
│ │ └── custom_circular_loader.dart
└── main.dart
├── android
├── gradle.properties
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable-v21
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── values-night
│ │ │ │ │ └── styles.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── clean_architecture_template
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── .gitignore
├── settings.gradle
└── build.gradle
├── l10n.yaml
├── assets
└── fonts
│ ├── Merriweather-Black.ttf
│ ├── Merriweather-Bold.ttf
│ ├── Merriweather-Regular.ttf
│ ├── NunitoSans_10pt-Bold.ttf
│ └── NunitoSans_10pt-Regular.ttf
├── cleanBuild.sh
├── cleanIos.sh
├── .gitignore
├── test
└── widget_test.dart
├── .metadata
├── analysis_options.yaml
├── pubspec.yaml
└── README.md
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/app/constants/app_assets.dart:
--------------------------------------------------------------------------------
1 | class AppAssets {
2 | AppAssets._();
3 | }
4 |
--------------------------------------------------------------------------------
/lib/app/config/app_theme.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | class AppTheme {
4 | AppTheme._();
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/lib/app/constants/app_urls.dart:
--------------------------------------------------------------------------------
1 | class AppUrls {
2 | static const String baseUrl = 'https://baseUrl.com/';
3 |
4 | AppUrls._();
5 | }
6 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/l10n.yaml:
--------------------------------------------------------------------------------
1 | arb-dir: lib/app/l10n
2 | template-arb-file: app_es.arb
3 | output-localization-file: app_localizations.dart
4 | nullable-getter: false
--------------------------------------------------------------------------------
/lib/app/constants/app_constants.dart:
--------------------------------------------------------------------------------
1 | class AppConstants {
2 | static const String appName = 'Funciona';
3 |
4 | AppConstants._();
5 | }
6 |
--------------------------------------------------------------------------------
/assets/fonts/Merriweather-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/Merriweather-Black.ttf
--------------------------------------------------------------------------------
/assets/fonts/Merriweather-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/Merriweather-Bold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Merriweather-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/Merriweather-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/NunitoSans_10pt-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/NunitoSans_10pt-Bold.ttf
--------------------------------------------------------------------------------
/assets/fonts/NunitoSans_10pt-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/NunitoSans_10pt-Regular.ttf
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/lib/app/constants/mock_paths.dart:
--------------------------------------------------------------------------------
1 | class MocksPaths {
2 | static String error = 'mockError';
3 | static String mockPathBaseAssets = 'assets/mock';
4 |
5 | MocksPaths._();
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/lib/app/config/environment_config.dart:
--------------------------------------------------------------------------------
1 | class EnvironmentConfig {
2 | static const environment = String.fromEnvironment(
3 | 'ENVIRONMENT',
4 | defaultValue: 'prod',
5 | );
6 | }
7 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/cleanBuild.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | flutter clean
3 | find . -name "*.g.dart" -delete
4 | find . -name "*.freezed.dart" -delete
5 | flutter pub get
6 | flutter pub run build_runner build --delete-conflicting-outputs
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/lib/app/utils/string_validators.dart:
--------------------------------------------------------------------------------
1 | class StringValidators {
2 | static bool emailValidator(String email) => RegExp(
3 | r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$',
4 | ).hasMatch(email);
5 | }
6 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/lib/data/repositories/data_source_contracts/local/app_local_datasource_contract.dart:
--------------------------------------------------------------------------------
1 | abstract class AppLocalDataSourceContract {
2 | Future getValidToken();
3 |
4 | Future setValidToken(bool value);
5 | }
6 |
--------------------------------------------------------------------------------
/cleanIos.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | flutter clean
3 | rm -Rf ios/Pods
4 | rm -Rf ios/.symlinks
5 | rm -Rf ios/Flutter/Flutter.framework
6 | rm -Rf ios/Flutter/Flutter.podspec
7 | flutter pub get
8 | cd ios
9 | pod install
10 | cd ..
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/clean_architecture_template/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.clean_architecture_template
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6 |
--------------------------------------------------------------------------------
/lib/app/extensions/context_extensions.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart';
3 |
4 | extension LocalizedBuildContext on BuildContext {
5 | AppLocalizations get localizations => AppLocalizations.of(this);
6 | }
7 |
--------------------------------------------------------------------------------
/lib/data/repositories/data_source_contracts/remote/app_remote_data_source_contract.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart';
2 |
3 | abstract class AppRemoteDataSourceContract {
4 | Future getExamples();
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lib/app/di/modules/remote_modules.dart:
--------------------------------------------------------------------------------
1 | part of '../di.dart';
2 |
3 | final remoteModulesDi = GetIt.instance;
4 |
5 | void _remoteModulesInit() {
6 | // Data sources
7 | remoteModulesDi.registerLazySingleton(
8 | () => AppRemoteDataSource(remoteModulesDi()),
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lib/app/di/modules/repository_modules.dart:
--------------------------------------------------------------------------------
1 | part of '../di.dart';
2 |
3 | final repositoryModulesDi = GetIt.instance;
4 |
5 | void _repositoryModulesInit() {
6 | repositoryModulesDi.registerLazySingleton(
7 | () => AppRepository(
8 | repositoryModulesDi(),
9 | ),
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/lib/domain/repository_contracts/app_repository_contract.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/app/types/result.dart';
2 |
3 | abstract class AppRepositoryContract {
4 | Future> getValidToken();
5 |
6 | Future> setValidToken(bool value);
7 |
8 | Future> logIn();
9 |
10 | Future> logOut();
11 | }
12 |
--------------------------------------------------------------------------------
/lib/app/routes/app_paths.dart:
--------------------------------------------------------------------------------
1 | class AppRoutePath {
2 | static String main = '/';
3 | static String authController = '/authenticationController';
4 | static String authenticationScreen = '$authController/authenticationScreen';
5 | static String onBoardingScreen = '$authenticationScreen/onBoardingScreen';
6 | static String homeScreen = '$authenticationScreen/homeScreen';
7 | }
8 |
--------------------------------------------------------------------------------
/lib/app/l10n/app_en.arb:
--------------------------------------------------------------------------------
1 | {
2 | "@@locale":"en",
3 | "home_screen_title" : "Home",
4 | "english_language_text" : "English",
5 | "spanish_language_text" : "Español",
6 | "log_in_text" : "login",
7 | "log_out_text" : "logout",
8 | "user_text": "user",
9 | "password_text": "password",
10 | "welcome_text" : "Welcome to your app"
11 |
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/lib/app/l10n/app_es.arb:
--------------------------------------------------------------------------------
1 | {
2 | "@@locale":"es",
3 | "home_screen_title": "Inicio",
4 | "english_language_text": "English",
5 | "spanish_language_text": "Español",
6 | "log_in_text": "Iniciar sesión",
7 | "log_out_text": "Cerrar sesión",
8 | "user_text": "Usuario",
9 | "password_text": "Contraseña",
10 | "welcome_text" : "Bienvenido a tu aplicación"
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/lib/presentation/top_blocs/language_bloc/language_bloc_event.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:freezed_annotation/freezed_annotation.dart';
4 |
5 | part 'language_bloc_event.freezed.dart';
6 |
7 | @freezed
8 | class LanguageBlocEvent with _$LanguageBlocEvent {
9 | const factory LanguageBlocEvent.changedLanguage(Locale locale) =
10 | _ChangedLanguage;
11 | }
12 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/lib/app/di/modules/ui_modules.dart:
--------------------------------------------------------------------------------
1 | part of '../di.dart';
2 |
3 | final uiModulesDi = GetIt.instance;
4 |
5 | void _uiModulesInit() {
6 | uiModulesDi.registerFactory(
7 | () => LanguagesBloc(),
8 | );
9 | uiModulesDi.registerFactory(
10 | () => SplashBloc(),
11 | );
12 |
13 | uiModulesDi.registerFactory(
14 | () => AuthBloc(repositoryContract: uiModulesDi()),
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/lib/app/di/modules/local_modules.dart:
--------------------------------------------------------------------------------
1 | part of '../di.dart';
2 |
3 | final localModulesDi = GetIt.instance;
4 |
5 | void _localModulesInit({required SharedPreferences instance}) {
6 | // Data sources
7 | localModulesDi.registerLazySingleton(
8 | () {
9 | return AppLocalDataSource(
10 | sharedPreferencesInstance: instance,
11 | );
12 | },
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/lib/data/datasources/remote_data_source/api/app_api.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart';
3 | import 'package:retrofit/http.dart';
4 |
5 | part 'app_api.g.dart';
6 |
7 | @RestApi()
8 | abstract class AppApi {
9 | factory AppApi(Dio dio, {String? baseUrl}) = _AppApi;
10 |
11 | @GET('/api/example')
12 | Future getMyExamples();
13 |
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/presentation/features/splash/splash_bloc/splash_event.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'splash_event.freezed.dart';
4 |
5 | /// The `SplashEvent` class represents the events that can occur during the splash screen.
6 | @freezed
7 | class SplashEvent with _$SplashEvent {
8 | /// Creates an instance of `SplashEvent` that will cause the splash screen to be dismissed after a certain amount of time.
9 | const factory SplashEvent.unSplashInNMilliseconds(int milliseconds) =
10 | _UnSplashInNMilliseconds;
11 | }
12 |
--------------------------------------------------------------------------------
/lib/app/routes/app_routes.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/presentation/features/authentication/auth_controller.dart';
2 | import 'package:clean_architecture_template/presentation/features/splash/splash_controller.dart';
3 | import 'package:go_router/go_router.dart';
4 |
5 | List appRoutes = [
6 | GoRoute(
7 | path: '/',
8 | builder: (context, state) => const SplashController(),
9 | routes: [
10 | GoRoute(
11 | path: 'authenticationController',
12 | builder: (context, state) => const AuthController(),
13 | ),
14 | ],
15 | ),
16 | ];
17 |
--------------------------------------------------------------------------------
/lib/presentation/top_blocs/language_bloc/language_bloc_state.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:freezed_annotation/freezed_annotation.dart';
4 |
5 | part 'language_bloc_state.freezed.dart';
6 |
7 | @freezed
8 | class LanguageBlocState with _$LanguageBlocState {
9 | const factory LanguageBlocState({
10 | required Locale locale,
11 | }) = _LanguageBlocState;
12 | }
13 |
14 | extension LanguageBlocStateExtension on LanguageBlocState {
15 | bool isSelected(Locale localePassed) => localePassed == locale;
16 |
17 | String getLocaleUpper() => locale.languageCode.toUpperCase();
18 | }
19 |
--------------------------------------------------------------------------------
/lib/presentation/widgets/custom_circular_loader.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class CustomCircularLoader extends StatelessWidget {
4 | const CustomCircularLoader({Key? key}) : super(key: key);
5 |
6 | @override
7 | Widget build(BuildContext context) {
8 | return const Center(
9 | child: SizedBox(
10 | height: 20,
11 | width: 20,
12 | child: CircularProgressIndicator(
13 | color: Color.fromRGBO(23, 69, 232, 1),
14 | backgroundColor: Color.fromRGBO(0, 122, 255, 1),
15 | strokeWidth: 2,
16 | ),
17 | ),
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/lib/presentation/features/authentication/auth_bloc/auth_event.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'auth_event.freezed.dart';
4 |
5 | /// The `AuthEvent` class is a sealed class that represents the various types of events that can occur during authentication.
6 | @freezed
7 | class AuthEvent with _$AuthEvent {
8 | const factory AuthEvent.signInEvent() = _SignInEvent;
9 |
10 | /// This factory method represents the event where the user has signed out.
11 | const factory AuthEvent.signOutEvent() = _SignOutEvent;
12 |
13 | const factory AuthEvent.checkForValidToken() = _CheckForValidToken;
14 | }
15 |
--------------------------------------------------------------------------------
/lib/data/datasources/remote_data_source/app_remote_data_source.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/data/datasources/remote_data_source/api/app_api.dart';
2 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart';
3 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/remote/app_remote_data_source_contract.dart';
4 |
5 | class AppRemoteDataSource implements AppRemoteDataSourceContract{
6 | final AppApi _api;
7 |
8 | AppRemoteDataSource(this._api);
9 | @override
10 | Future getExamples() async{
11 | final response = await _api.getMyExamples();
12 |
13 | return response;
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/lib/data/models/example_remote_entity.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'example_remote_entity.freezed.dart';
4 |
5 | part 'example_remote_entity.g.dart';
6 |
7 | @freezed
8 | class ExampleRemoteEntity with _$ExampleRemoteEntity {
9 | const factory ExampleRemoteEntity({
10 | required int id,
11 | required int pk,
12 | required String status,
13 | required String title,
14 | @JsonKey(name: 'primary_description') required String primaryDescription,
15 | required String description,
16 | }) = _ExampleRemoteEntity;
17 |
18 | factory ExampleRemoteEntity.fromJson(Map json) =>
19 | _$ExampleRemoteEntityFromJson(json);
20 | }
21 |
--------------------------------------------------------------------------------
/lib/presentation/features/splash/splash_bloc/splash_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'splash_state.freezed.dart';
4 |
5 | /// The `SplashState` class represents the current state of the splash screen.
6 | @freezed
7 | class SplashState with _$SplashState {
8 | /// Creates an instance of `SplashState` representing an initial state.
9 | const factory SplashState.initial() = _Initial;
10 |
11 | /// Creates an instance of `SplashState` representing a splashed state.
12 | const factory SplashState.splashed() = _Splashed;
13 | }
14 |
15 | extension SplashStateExtension on SplashState {
16 | bool isSplashed() => when(initial: () => false, splashed: () => true);
17 | }
18 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/lib/app/types/auth_status.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'auth_status.freezed.dart';
4 |
5 | @freezed
6 | class UserAuthStatus with _$UserAuthStatus {
7 | const factory UserAuthStatus.unidentified() = _Unidentified;
8 |
9 | const factory UserAuthStatus.loggedIn() = _LoggedIn;
10 |
11 | const factory UserAuthStatus.error() = _Error;
12 | }
13 |
14 | extension UserLoadingStatusExtension on UserAuthStatus {
15 | bool isUnidentified() =>
16 | maybeWhen(orElse: () => false, unidentified: () => true);
17 |
18 | bool isLoggedIn() => maybeWhen(orElse: () => false, loggedIn: () => true);
19 |
20 | bool isError() => maybeWhen(orElse: () => false, error: () => true);
21 | }
22 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/lib/app/di/modules/api_modules.dart:
--------------------------------------------------------------------------------
1 | part of '../di.dart';
2 |
3 | final apiModulesDi = GetIt.instance;
4 |
5 | void _apiModulesInit() {
6 | apiModulesDi.registerLazySingleton(() {
7 | var dioClient = DioClient();
8 |
9 | dioClient.addInterceptors([
10 | ...EnvironmentConfig.environment == 'dev'
11 | ? [CurlLoggerDioInterceptor(printOnSuccess: true)]
12 | : [],
13 | ...EnvironmentConfig.environment == 'mock' ? [MockInterceptor()] : [],
14 | ]);
15 | dioClient.addBadCertificateCallBack();
16 | dioClient.addBadCertificateCallBack();
17 |
18 | return dioClient.getDio();
19 | });
20 |
21 | apiModulesDi.registerLazySingleton(
22 | () => AppApi(
23 | apiModulesDi(),
24 | baseUrl: AppUrls.baseUrl,
25 | ),
26 | );
27 | }
28 |
--------------------------------------------------------------------------------
/lib/app/types/result.dart:
--------------------------------------------------------------------------------
1 | // Part file that contains the generated code for the 'Result' class.
2 | import 'package:freezed_annotation/freezed_annotation.dart';
3 | import 'package:clean_architecture_template/app/types/repository_error.dart';
4 |
5 | part 'result.freezed.dart';
6 |
7 | // Annotating the 'Result' class with '@freezed' to generate the necessary boilerplate code.
8 | @freezed
9 | class Result with _$Result {
10 | // Factory constructor for representing a failure.
11 | // Takes an instance of 'RepositoryError' as a required parameter.
12 | const factory Result.failure({required RepositoryError error}) = Failure;
13 |
14 | // Factory constructor for representing a success.
15 | // Takes an instance of 'T' as the data.
16 | const factory Result.success(T data) = Success;
17 | }
18 |
--------------------------------------------------------------------------------
/lib/data/datasources/local_data_source/app_local_datasource.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/local/app_local_datasource_contract.dart';
2 | import 'package:shared_preferences/shared_preferences.dart';
3 |
4 | class AppLocalDataSource implements AppLocalDataSourceContract {
5 | final SharedPreferences sharedPreferencesInstance;
6 | final String _hadValidToken = 'hadValidToken';
7 |
8 | AppLocalDataSource({
9 | required this.sharedPreferencesInstance,
10 | });
11 |
12 | @override
13 | Future getValidToken() async {
14 | return sharedPreferencesInstance.getBool(_hadValidToken) ?? false;
15 | }
16 |
17 | @override
18 | Future setValidToken(bool value) async {
19 | await sharedPreferencesInstance.setBool(_hadValidToken, value);
20 |
21 | return;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/presentation/top_blocs/language_bloc/language_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc_event.dart';
4 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc_state.dart';
5 | import 'package:flutter_bloc/flutter_bloc.dart';
6 |
7 | class LanguagesBloc extends Bloc {
8 | LanguagesBloc()
9 | : super(
10 | const LanguageBlocState(
11 | locale: Locale('es', 'ES'),
12 | ),
13 | ) {
14 | on(
15 | (event, emit) async {
16 | event.when(changedLanguage: (locale) {
17 | emit(
18 | state.copyWith(locale: locale),
19 | );
20 | });
21 | },
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - shared_preferences_foundation (0.0.1):
4 | - Flutter
5 | - FlutterMacOS
6 | - url_launcher_ios (0.0.1):
7 | - Flutter
8 |
9 | DEPENDENCIES:
10 | - Flutter (from `Flutter`)
11 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
12 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
13 |
14 | EXTERNAL SOURCES:
15 | Flutter:
16 | :path: Flutter
17 | shared_preferences_foundation:
18 | :path: ".symlinks/plugins/shared_preferences_foundation/ios"
19 | url_launcher_ios:
20 | :path: ".symlinks/plugins/url_launcher_ios/ios"
21 |
22 | SPEC CHECKSUMS:
23 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
24 | shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
25 | url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
26 |
27 | PODFILE CHECKSUM: fe4eb30d369f536b67bd22237ea178cc45b777c4
28 |
29 | COCOAPODS: 1.13.0
30 |
--------------------------------------------------------------------------------
/lib/domain/models/example_entity.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart';
3 |
4 | part 'example_entity.freezed.dart';
5 |
6 | part 'example_entity.g.dart';
7 |
8 | @freezed
9 | class ExampleEntity with _$ExampleEntity {
10 | const factory ExampleEntity({
11 | required int id,
12 | required int pk,
13 | required String status,
14 | required String title,
15 | required String primaryDescription,
16 | required String description,
17 | }) = _ExampleEntity;
18 |
19 | factory ExampleEntity.fromJson(Map json) =>
20 | _$ExampleEntityFromJson(json);
21 | }
22 |
23 | extension ExampleRemoteEntityExtension on ExampleRemoteEntity {
24 | ExampleEntity toExampleEntity() => ExampleEntity(
25 | id: id,
26 | pk: pk,
27 | status: status,
28 | title: title,
29 | primaryDescription: primaryDescription,
30 | description: description,
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/lib/domain/models/example_entity.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'example_entity.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | _$_ExampleEntity _$$_ExampleEntityFromJson(Map json) =>
10 | _$_ExampleEntity(
11 | id: json['id'] as int,
12 | pk: json['pk'] as int,
13 | status: json['status'] as String,
14 | title: json['title'] as String,
15 | primaryDescription: json['primaryDescription'] as String,
16 | description: json['description'] as String,
17 | );
18 |
19 | Map _$$_ExampleEntityToJson(_$_ExampleEntity instance) =>
20 | {
21 | 'id': instance.id,
22 | 'pk': instance.pk,
23 | 'status': instance.status,
24 | 'title': instance.title,
25 | 'primaryDescription': instance.primaryDescription,
26 | 'description': instance.description,
27 | };
28 |
--------------------------------------------------------------------------------
/lib/presentation/features/splash/splash_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/app/routes/app_paths.dart';
2 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_bloc.dart';
3 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_state.dart';
4 | import 'package:clean_architecture_template/presentation/features/splash/splash_screen.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_bloc/flutter_bloc.dart';
7 | import 'package:go_router/go_router.dart';
8 |
9 | class SplashController extends StatelessWidget {
10 | const SplashController({super.key});
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return BlocConsumer(
15 | listener: (context, state) {
16 | if (state.isSplashed()) {
17 | context.go(AppRoutePath.authController);
18 | }
19 | },
20 | builder: (context, state) {
21 | return const SplashScreen();
22 | },
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/lib/presentation/features/splash/splash_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/app/config/app_fonts.dart';
2 | import 'package:clean_architecture_template/app/constants/app_colors.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class SplashScreen extends StatelessWidget {
6 | const SplashScreen({Key? key}) : super(key: key);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return Scaffold(
11 | backgroundColor: AppColors.primary,
12 | body: SafeArea(
13 | child: Column(
14 | children: [
15 | const Spacer(
16 | flex: 1,
17 | ),
18 | Text(
19 | 'Clean Template',
20 | style: AppFonts.bodyMd.copyWith(color: AppColors.primaryWhite),
21 | ),
22 | const Divider(
23 | color: Colors.white,
24 | endIndent: 15,
25 | indent: 15,
26 | ),
27 | const Spacer(
28 | flex: 1,
29 | ),
30 | ],
31 | ),
32 | ),
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/presentation/features/authentication/auth_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart';
2 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_state.dart';
3 | import 'package:clean_architecture_template/presentation/features/authentication/authentication_screen.dart';
4 | import 'package:clean_architecture_template/presentation/features/home/home_screen.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_bloc/flutter_bloc.dart';
7 |
8 | class AuthController extends StatelessWidget {
9 | const AuthController({Key? key}) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | return BlocBuilder(
14 | builder: (context, state) {
15 | return state.userAuthStatus.when(
16 | unidentified: () => const AuthenticationScreen(),
17 | loggedIn: () => const HomeScreen(),
18 | error: () => const Text('An error happened'),
19 | );
20 | },
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/data/models/example_remote_entity.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'example_remote_entity.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | _$_ExampleRemoteEntity _$$_ExampleRemoteEntityFromJson(
10 | Map json) =>
11 | _$_ExampleRemoteEntity(
12 | id: json['id'] as int,
13 | pk: json['pk'] as int,
14 | status: json['status'] as String,
15 | title: json['title'] as String,
16 | primaryDescription: json['primary_description'] as String,
17 | description: json['description'] as String,
18 | );
19 |
20 | Map _$$_ExampleRemoteEntityToJson(
21 | _$_ExampleRemoteEntity instance) =>
22 | {
23 | 'id': instance.id,
24 | 'pk': instance.pk,
25 | 'status': instance.status,
26 | 'title': instance.title,
27 | 'primary_description': instance.primaryDescription,
28 | 'description': instance.description,
29 | };
30 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | void main() {
12 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
13 | // Build our app and trigger a frame.
14 | await tester.pumpWidget(const SizedBox());
15 |
16 | // Verify that our counter starts at 0.
17 | expect(find.text('0'), findsOneWidget);
18 | expect(find.text('1'), findsNothing);
19 |
20 | // Tap the '+' icon and trigger a frame.
21 | await tester.tap(find.byIcon(Icons.add));
22 | await tester.pump();
23 |
24 | // Verify that our counter has incremented.
25 | expect(find.text('0'), findsNothing);
26 | expect(find.text('1'), findsOneWidget);
27 | });
28 | }
29 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
17 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
18 | - platform: android
19 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
20 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
21 | - platform: ios
22 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
23 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
24 |
25 | # User provided section
26 |
27 | # List of Local paths (relative to this file) that should be
28 | # ignored by the migrate tool.
29 | #
30 | # Files that are not part of the templates will be ignored by default.
31 | unmanaged_files:
32 | - 'lib/main.dart'
33 | - 'ios/Runner.xcodeproj/project.pbxproj'
34 |
--------------------------------------------------------------------------------
/lib/presentation/features/authentication/auth_bloc/auth_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 | import 'package:clean_architecture_template/app/types/auth_status.dart';
3 | import 'package:clean_architecture_template/app/types/screen_status.dart';
4 |
5 | part 'auth_state.freezed.dart';
6 |
7 | /// The `AuthState` class represents the current state of the user's authentication status.
8 | ///
9 | /// [user] - An optional instance of the `User` class that contains the user's information.
10 | ///
11 | /// [userAuthStatus] - An instance of the `UserAuthStatus` class that represents the current authentication status of the user.
12 | @freezed
13 | class AuthState with _$AuthState {
14 | const factory AuthState({
15 | required ScreenStatus screenStatus,
16 | required UserAuthStatus userAuthStatus,
17 | required bool isWelcomeTourFinished,
18 | }) = _AuthState;
19 |
20 | /// This factory method creates a new instance of `AuthState` with initial state.
21 | factory AuthState.initial() {
22 | return const AuthState(
23 | screenStatus: ScreenStatus.initial(),
24 | userAuthStatus: UserAuthStatus.unidentified(),
25 | isWelcomeTourFinished: false,
26 | );
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/app/types/screen_status.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'screen_status.freezed.dart';
4 |
5 | /// Represents the different statuses of a screen.
6 | @freezed
7 | class ScreenStatus with _$ScreenStatus {
8 | /// Represents the initial status of a screen.
9 | const factory ScreenStatus.initial() = _Initial;
10 |
11 | /// Represents the loading status of a screen.
12 | const factory ScreenStatus.loading() = _Loading;
13 |
14 | /// Represents the success status of a screen.
15 | const factory ScreenStatus.success() = _Success;
16 |
17 | /// Represents the success status of a screen.
18 | const factory ScreenStatus.loadingMore() = _LoadingMore;
19 |
20 | /// Represents the error status of a screen.
21 | const factory ScreenStatus.error([String? error]) = _Error;
22 | }
23 |
24 | /// Provides utility methods for the `ScreenStatus` class.
25 | extension ScreenStatusExtension on ScreenStatus {
26 | /// Returns `true` if the current status is `loading`, otherwise `false`.
27 | bool isLoading() => maybeWhen(orElse: () => false, loading: () => true);
28 |
29 | bool isLoadingMore() =>
30 | maybeWhen(orElse: () => false, loadingMore: () => true);
31 |
32 | bool isError() => maybeWhen(orElse: () => false, error: (_) => true);
33 | }
34 |
--------------------------------------------------------------------------------
/lib/data/datasources/remote_data_source/api/network/interceptors/mock_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:clean_architecture_template/app/constants/mock_paths.dart';
6 |
7 | // Class to handle mock requests
8 | class MockInterceptor extends InterceptorsWrapper {
9 | // Overrides the onRequest method to handle mock requests
10 | @override
11 | Future onRequest(
12 | RequestOptions options,
13 | RequestInterceptorHandler handler,
14 | ) async {
15 | try {
16 | // Loads the JSON data from assets
17 | final jsonData = await getJsonFromAssets(
18 | '${MocksPaths.mockPathBaseAssets}${options.path}.json',
19 | );
20 | // Resolves the request with the loaded JSON data
21 | handler.resolve(Response(requestOptions: options, data: jsonData));
22 | } catch (e) {
23 | // Rejects the request with a mock error
24 | handler.reject(DioError(
25 | requestOptions: options,
26 | type: DioErrorType.other,
27 | error: MocksPaths.error,
28 | ));
29 | }
30 | }
31 |
32 | // Loads JSON data from assets
33 | Future getJsonFromAssets(String path) async {
34 | final result = await rootBundle.loadString(path);
35 |
36 | return json.decode(result);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/lib/app/di/top_bloc_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart';
2 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_event.dart';
3 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_bloc.dart';
4 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_event.dart';
5 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_bloc/flutter_bloc.dart';
8 | import 'package:get_it/get_it.dart';
9 |
10 | class TopBlocProviders extends StatelessWidget {
11 | final Widget child;
12 | final _getIt = GetIt.instance;
13 |
14 | TopBlocProviders({Key? key, required this.child}) : super(key: key);
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return MultiBlocProvider(
19 | providers: [
20 | BlocProvider(create: (context) => _getIt()),
21 | BlocProvider(
22 | create: (context) => _getIt()
23 | ..add(
24 | const AuthEvent.checkForValidToken(),
25 | ),
26 | ),
27 | BlocProvider(
28 | create: (context) => _getIt()
29 | ..add(
30 | const SplashEvent.unSplashInNMilliseconds(3000),
31 | ),
32 | ),
33 | ],
34 | child: child,
35 | );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/app/constants/app_colors.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class AppColors {
4 | static const Color primary = Color.fromRGBO(34, 77, 112, 1);
5 | static const Color primary200 = Color.fromRGBO(239, 243, 245, 1);
6 | static const Color secondary800 = Color(0xFF35759C);
7 | static const Color secondary = Color.fromRGBO(34, 77, 112, 1);
8 | static const Color complementary = Color.fromRGBO(14, 129, 149, 1);
9 | static const Color complementaryDisabled = Color.fromRGBO(216, 184, 236, 1);
10 | static const Color linkLight = Color(0xFF154481);
11 | static const Color a1 = Color.fromRGBO(205, 204, 52, 1);
12 | static const Color primaryWhite = Color.fromRGBO(255, 255, 255, 1);
13 | static const Color softGrey = Color.fromRGBO(249, 250, 251, 1);
14 | static const Color semanticInformation = Color.fromRGBO(0, 87, 255, 1);
15 | static const Color secondary900 = Color.fromRGBO(204, 165, 0, 1);
16 | static const Color greySoftColor = Color.fromRGBO(8, 9, 7, 0.7);
17 | static const Color naturalGrey = Color.fromRGBO(201, 201, 201, 1);
18 | static const Color naturalGrey2 = Color.fromRGBO(249, 249, 249, 1);
19 | static const Color naturalGrey50 = Color.fromRGBO(118, 118, 118, 1);
20 | static const Color naturalGrey70 = Color.fromRGBO(70, 70, 70, 1);
21 | static const Color black = Color.fromRGBO(14, 32, 47, 1);
22 | static const Color information100 = Color.fromRGBO(229, 238, 255, 1);
23 | static const Color softBlack = Color.fromRGBO(14, 32, 47, 0.7);
24 | static const Color disableBlack = Color.fromRGBO(24, 54, 78, 0.6);
25 | static const Color semanticInformation100 = Color.fromRGBO(255, 241, 229, 1);
26 |
27 | AppColors._();
28 | }
29 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/data/datasources/remote_data_source/api/network/dio_http_client.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:dio/adapter.dart';
4 | import 'package:dio/dio.dart';
5 | import 'package:flutter/foundation.dart';
6 |
7 | const _defaultConnectTimeout = Duration.millisecondsPerMinute;
8 | const _defaultReceiveTimeout = Duration.millisecondsPerMinute;
9 |
10 | class DioClient {
11 | static List? interceptors;
12 | static DioClient? _instance;
13 | static final Dio _dio = Dio();
14 |
15 | factory DioClient() => _instance ?? DioClient._internal();
16 |
17 | DioClient._internal() {
18 | _instance = this;
19 | }
20 |
21 | void addInterceptors(List interceptors) {
22 | _dio
23 | ..options.connectTimeout = _defaultConnectTimeout
24 | ..options.receiveTimeout = _defaultReceiveTimeout
25 | ..httpClientAdapter
26 | ..options.headers = {'Content-Type': 'application/json'};
27 | if (interceptors.isNotEmpty) {
28 | _dio.interceptors.addAll(interceptors);
29 | }
30 | if (kDebugMode) {
31 | _dio.interceptors.add(LogInterceptor(
32 | responseBody: true,
33 | error: true,
34 | requestHeader: true,
35 | responseHeader: true,
36 | request: true,
37 | requestBody: true,
38 | ));
39 | }
40 | }
41 |
42 | void addBadCertificateCallBack() {
43 | (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
44 | (HttpClient client) {
45 | client.badCertificateCallback =
46 | (X509Certificate cert, String host, int port) => true;
47 |
48 | return client;
49 | };
50 | }
51 |
52 | /// Get Dio instance
53 | Dio getDio() {
54 | return _dio;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | linter:
4 | rules:
5 | prefer_single_quotes: true
6 | always_use_package_imports: true
7 |
8 | analyzer:
9 | plugins:
10 | - dart_code_metrics
11 | exclude:
12 | - "**/*.g.dart"
13 | - "**/*.freezed.dart"
14 | errors:
15 | invalid_annotation_target: ignore
16 |
17 | dart_code_metrics:
18 | anti-patterns:
19 | - long-method
20 | - long-parameter-list
21 | metrics-exclude:
22 | - test/**
23 | metrics:
24 | cyclomatic-complexity: 20
25 | maximum-nesting-level: 5
26 | number-of-parameters: 4
27 | source-lines-of-code: 100
28 | metrics-exclude:
29 | - test/**
30 | rules:
31 | - avoid-returning-widgets:
32 | ignored-names:
33 | - testFunction
34 | ignored-annotations:
35 | - allowedAnnotation
36 | - newline-before-return
37 | - no-boolean-literal-compare
38 | - no-empty-block
39 | - prefer-trailing-comma
40 | - prefer-conditional-expressions
41 | - no-equal-then-else
42 | - avoid-shrink-wrap-in-lists
43 | - avoid-non-null-assertion
44 | - avoid-redundant-async
45 | - avoid-throw-in-catch-block
46 | - avoid-unnecessary-type-casts
47 | - member-ordering:
48 | widgets-order:
49 | - constructor
50 | - named-constructor
51 | - const-fields
52 | - static-methods
53 | - final-fields
54 | - init-state-method
55 | - var-fields
56 | - init-state-method
57 | - private-methods
58 | - overridden-public-methods
59 | - build-method
60 |
61 | - always-remove-listener
62 | - avoid-wrapping-in-padding
63 | - avoid-expanded-as-spacer
64 |
--------------------------------------------------------------------------------
/lib/app/config/app_fonts.dart:
--------------------------------------------------------------------------------
1 | import 'package:clean_architecture_template/app/constants/app_colors.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class AppFonts {
5 | static const TextStyle heading2 = TextStyle(
6 | fontFamily: 'Merriweather',
7 | fontWeight: FontWeight.w700,
8 | color: AppColors.black,
9 | fontSize: 19,
10 | );
11 | static const TextStyle heading3 = TextStyle(
12 | fontFamily: 'Merriweather',
13 | fontWeight: FontWeight.w900,
14 | color: AppColors.black,
15 | fontSize: 20,
16 | );
17 | static const TextStyle heading5 = TextStyle(
18 | fontFamily: 'Merriweather',
19 | fontWeight: FontWeight.w700,
20 | color: AppColors.black,
21 | fontSize: 16,
22 | );
23 |
24 | static const TextStyle heading6 = TextStyle(
25 | fontFamily: 'Merriweather',
26 | fontWeight: FontWeight.w700,
27 | color: AppColors.black,
28 | fontSize: 16,
29 | );
30 | static const TextStyle bodyMd = TextStyle(
31 | fontFamily: 'Nunito Sans',
32 | fontWeight: FontWeight.w400,
33 | color: AppColors.black,
34 | fontSize: 16,
35 | );
36 | static const TextStyle bodyMdDisable = TextStyle(
37 | fontFamily: 'Nunito Sans',
38 | fontWeight: FontWeight.w700,
39 | color: AppColors.disableBlack,
40 | fontSize: 16,
41 | );
42 | static const TextStyle labelXs = TextStyle(
43 | fontFamily: 'Nunito Sans',
44 | fontWeight: FontWeight.w500,
45 | color: AppColors.black,
46 | fontSize: 14,
47 | );
48 | static const TextStyle labelXsUnderline = TextStyle(
49 | fontFamily: 'Nunito Sans',
50 | fontWeight: FontWeight.w500,
51 | color: AppColors.black,
52 | fontSize: 14,
53 | decoration: TextDecoration.underline,
54 | );
55 |
56 | AppFonts._();
57 | }
58 |
--------------------------------------------------------------------------------
/lib/presentation/features/splash/splash_bloc/splash_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_event.dart';
4 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_state.dart';
5 | import 'package:flutter_bloc/flutter_bloc.dart';
6 |
7 | /// The SplashBloc class extends the Bloc class from the flutter_bloc library, which implements the bloc design pattern for state management.
8 | ///
9 | /// This class handles the logic related to the splash screen of the application.
10 | class SplashBloc extends Bloc {
11 | /// Creates a new instance of the SplashBloc with an initial state of
12 | /// [SplashState.initial()].
13 | SplashBloc() : super(const SplashState.initial()) {
14 | /// Listen for [SplashEvent]s and handle them with the [_unSplashInNMilliseconds] method.
15 | on((event, emit) async {
16 | await event.when(
17 | unSplashInNMilliseconds: (milliseconds) =>
18 | _unSplashInNMilliseconds(event, emit, milliseconds),
19 | );
20 | });
21 | }
22 |
23 | /// Delays for the specified [milliseconds] and then emits a [SplashState.splashed()] state using the provided [emit] function.
24 | ///
25 | /// @param event The [SplashEvent] that triggered this method call.
26 | /// @param emit The function to use for emitting a new state.
27 | /// @param milliseconds The number of milliseconds to delay before emitting a new state.
28 | FutureOr _unSplashInNMilliseconds(
29 | SplashEvent event,
30 | Emitter emit,
31 | int milliseconds,
32 | ) async {
33 | await Future.delayed(Duration(milliseconds: milliseconds));
34 | emit(const SplashState.splashed());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/lib/app/types/repository_error.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 | import 'package:clean_architecture_template/app/types/errors/network_error.dart';
3 |
4 | part 'repository_error.freezed.dart';
5 |
6 | @freezed
7 | class RepositoryError with _$RepositoryError {
8 | const factory RepositoryError.badRequestListErrors(List listErrors) =
9 | badRequestListErrors;
10 |
11 | const factory RepositoryError.securityError() = SecurityError;
12 |
13 | const factory RepositoryError.badRequest() = badRequest;
14 |
15 | const factory RepositoryError.noAccess() = NoAccess;
16 |
17 | const factory RepositoryError.notFoundResource() = NotFoundResource;
18 |
19 | const factory RepositoryError.serverError() = ServerError;
20 |
21 | const factory RepositoryError.noInternetConnection() = NoInternetConnection;
22 |
23 | const factory RepositoryError.authExpired() = AuthExpired;
24 |
25 | const factory RepositoryError.infoNotMatching() = InfoNotMatching;
26 |
27 | const factory RepositoryError.listErrors(List errorList) =
28 | ListErrorsM;
29 |
30 | static RepositoryError fromDataSourceError(NetworkError error) {
31 | return error.maybeWhen(
32 | badRequestListErrors: (errors) =>
33 | RepositoryError.badRequestListErrors(errors),
34 | infoNotMatching: RepositoryError.infoNotMatching,
35 | badRequest: () => const RepositoryError.badRequest(),
36 | forbidden: () => const RepositoryError.noAccess(),
37 | notFound: (_) => const RepositoryError.notFoundResource(),
38 | internalServerError: () => const RepositoryError.serverError(),
39 | noInternetConnection: () => const RepositoryError.noInternetConnection(),
40 | unauthorizedRequest: () => const RepositoryError.authExpired(),
41 | orElse: () => const RepositoryError.serverError(),
42 | );
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/lib/data/datasources/remote_data_source/api/app_api.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'app_api.dart';
4 |
5 | // **************************************************************************
6 | // RetrofitGenerator
7 | // **************************************************************************
8 |
9 | // ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers
10 |
11 | class _AppApi implements AppApi {
12 | _AppApi(
13 | this._dio, {
14 | this.baseUrl,
15 | });
16 |
17 | final Dio _dio;
18 |
19 | String? baseUrl;
20 |
21 | @override
22 | Future getMyExamples() async {
23 | const _extra = {};
24 | final queryParameters = {};
25 | final _headers = {};
26 | final _data = {};
27 | final _result = await _dio.fetch