├── lib
├── app
│ ├── auth
│ │ ├── pages
│ │ │ ├── login
│ │ │ │ └── index.dart
│ │ │ ├── forgot_password
│ │ │ │ └── index.dart
│ │ │ ├── register
│ │ │ │ ├── tabs
│ │ │ │ │ ├── index.dart
│ │ │ │ │ ├── information.tab.dart
│ │ │ │ │ └── verification.tab.dart
│ │ │ │ ├── widgets
│ │ │ │ │ └── app_bar.widget.dart
│ │ │ │ ├── register.view.dart
│ │ │ │ └── register.vm.dart
│ │ │ └── index.dart
│ │ ├── utils
│ │ │ └── index.dart
│ │ ├── widgets
│ │ │ └── index.dart
│ │ └── index.dart
│ ├── shared
│ │ └── ui
│ │ │ ├── models
│ │ │ └── index.dart
│ │ │ ├── widgets
│ │ │ ├── index.dart
│ │ │ └── checkbox
│ │ │ │ ├── index.dart
│ │ │ │ ├── checkbox.style.dart
│ │ │ │ └── checkbox.widget.dart
│ │ │ ├── enums
│ │ │ └── index.dart
│ │ │ ├── styles
│ │ │ ├── index.dart
│ │ │ ├── fonts.style.dart
│ │ │ └── colors.style.dart
│ │ │ ├── utils
│ │ │ └── index.dart
│ │ │ └── index.dart
│ ├── app.vm.dart
│ └── app.view.dart
├── infrastructure
│ ├── articles
│ │ ├── index.dart
│ │ ├── models
│ │ │ ├── index.dart
│ │ │ ├── article_mini.model.dart
│ │ │ ├── article.model.dart
│ │ │ ├── article_mini.model.g.dart
│ │ │ ├── article.model.g.dart
│ │ │ ├── article_mini.model.freezed.dart
│ │ │ └── article.model.freezed.dart
│ │ └── articles.repo.dart
│ ├── shared
│ │ ├── index.dart
│ │ └── models
│ │ │ ├── index.dart
│ │ │ ├── validation_result.model.dart
│ │ │ └── validation_result.model.freezed.dart
│ ├── http
│ │ ├── exceptions
│ │ │ ├── index.dart
│ │ │ └── api.exception.dart
│ │ ├── models
│ │ │ ├── index.dart
│ │ │ ├── api_result.model.dart
│ │ │ └── api_result.model.freezed.dart
│ │ ├── index.dart
│ │ ├── api.dart
│ │ └── dio_client.dart
│ └── auth
│ │ ├── index.dart
│ │ ├── models
│ │ ├── index.dart
│ │ ├── value_failures.model.dart
│ │ ├── value_objects.model.dart
│ │ └── value_objects.model.g.dart
│ │ ├── auth.repo.dart
│ │ └── validations
│ │ └── index.dart
├── packages.dart
├── injection.dart
├── config.dart
├── main.dart
└── injection.config.dart
├── ios
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── 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
├── Runner.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── xcshareddata
│ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ └── project.pbxproj
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
└── .gitignore
├── .gitattributes
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ └── Icon-512.png
├── manifest.json
└── index.html
├── 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
│ │ │ │ │ └── scalable_flutter_app
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── .gitignore
├── settings.gradle
└── build.gradle
├── assets
└── fonts
│ ├── Montserrat-Bold.ttf
│ ├── Montserrat-Light.ttf
│ ├── Montserrat-Medium.ttf
│ ├── Montserrat-Regular.ttf
│ └── Montserrat-SemiBold.ttf
├── windows
├── runner
│ ├── resources
│ │ └── app_icon.ico
│ ├── resource.h
│ ├── CMakeLists.txt
│ ├── utils.h
│ ├── runner.exe.manifest
│ ├── run_loop.h
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── utils.cpp
│ ├── flutter_window.cpp
│ ├── run_loop.cpp
│ ├── Runner.rc
│ ├── win32_window.h
│ └── win32_window.cpp
├── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ ├── generated_plugins.cmake
│ └── CMakeLists.txt
├── .gitignore
└── CMakeLists.txt
├── analysis_options.yaml
├── README.md
├── .metadata
├── .gitignore
├── LICENSE
├── pubspec.yaml
└── pubspec.lock
/lib/app/auth/pages/login/index.dart:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/app/auth/utils/index.dart:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/lib/app/auth/widgets/index.dart:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/models/index.dart:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/lib/app/auth/pages/forgot_password/index.dart:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/widgets/index.dart:
--------------------------------------------------------------------------------
1 | export './checkbox/index.dart';
2 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/index.dart:
--------------------------------------------------------------------------------
1 | export './models/index.dart';
2 |
--------------------------------------------------------------------------------
/lib/infrastructure/shared/index.dart:
--------------------------------------------------------------------------------
1 | export './models/index.dart';
2 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/exceptions/index.dart:
--------------------------------------------------------------------------------
1 | export 'api.exception.dart';
2 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/models/index.dart:
--------------------------------------------------------------------------------
1 | export 'api_result.model.dart';
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/enums/index.dart:
--------------------------------------------------------------------------------
1 | enum IWidgetState { enabled, focus, disabled }
2 |
--------------------------------------------------------------------------------
/lib/infrastructure/shared/models/index.dart:
--------------------------------------------------------------------------------
1 | export 'validation_result.model.dart';
2 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/styles/index.dart:
--------------------------------------------------------------------------------
1 | export './colors.style.dart';
2 | export './fonts.style.dart';
3 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/web/favicon.png
--------------------------------------------------------------------------------
/lib/infrastructure/auth/index.dart:
--------------------------------------------------------------------------------
1 | export './models/index.dart';
2 | export './validations/index.dart';
3 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/index.dart:
--------------------------------------------------------------------------------
1 | export './exceptions/index.dart';
2 | export './models/index.dart';
3 |
--------------------------------------------------------------------------------
/lib/app/auth/pages/register/tabs/index.dart:
--------------------------------------------------------------------------------
1 | export './information.tab.dart';
2 | export './verification.tab.dart';
3 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/widgets/checkbox/index.dart:
--------------------------------------------------------------------------------
1 | export 'checkbox.style.dart';
2 | export 'checkbox.widget.dart';
3 |
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/lib/app/auth/index.dart:
--------------------------------------------------------------------------------
1 | export 'pages/index.dart';
2 | export './utils/index.dart';
3 | export './widgets/index.dart';
4 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/index.dart:
--------------------------------------------------------------------------------
1 | export './article.model.dart';
2 | export './article_mini.model.dart';
3 |
--------------------------------------------------------------------------------
/lib/infrastructure/auth/models/index.dart:
--------------------------------------------------------------------------------
1 | export 'value_failures.model.dart';
2 | export 'value_objects.model.dart';
3 |
--------------------------------------------------------------------------------
/assets/fonts/Montserrat-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/assets/fonts/Montserrat-Bold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Montserrat-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/assets/fonts/Montserrat-Light.ttf
--------------------------------------------------------------------------------
/assets/fonts/Montserrat-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/assets/fonts/Montserrat-Medium.ttf
--------------------------------------------------------------------------------
/assets/fonts/Montserrat-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/assets/fonts/Montserrat-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/Montserrat-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/assets/fonts/Montserrat-SemiBold.ttf
--------------------------------------------------------------------------------
/lib/app/shared/ui/utils/index.dart:
--------------------------------------------------------------------------------
1 | String enumToString(dynamic e) {
2 | String str = e.toString();
3 | return str.split('.').last;
4 | }
5 |
--------------------------------------------------------------------------------
/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/lib/app/auth/pages/index.dart:
--------------------------------------------------------------------------------
1 | export './register/register.view.dart';
2 | export './login/index.dart';
3 | export './forgot_password/index.dart';
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/lib/packages.dart:
--------------------------------------------------------------------------------
1 | export 'package:dio/dio.dart';
2 | export 'package:get_it/get_it.dart';
3 | export 'package:injectable/injectable.dart';
4 | export 'package:pmvvm/pmvvm.dart';
5 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/index.dart:
--------------------------------------------------------------------------------
1 | export 'models/index.dart';
2 | export 'styles/index.dart';
3 | export 'utils/index.dart';
4 | export 'widgets/index.dart';
5 | export 'enums/index.dart';
6 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/lib/app/app.vm.dart:
--------------------------------------------------------------------------------
1 | import 'package:scalable_flutter_app/packages.dart';
2 |
3 | class AppVm extends ViewModel {
4 | @override
5 | void init() {}
6 | @override
7 | void onBuild() {}
8 | }
9 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NourEldinShobier/scalable_flutter_app/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/NourEldinShobier/scalable_flutter_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/lib/injection.dart:
--------------------------------------------------------------------------------
1 | import 'injection.config.dart';
2 |
3 | import 'packages.dart';
4 |
5 | final getIt = GetIt.instance;
6 |
7 | @injectableInit
8 | void configureInjection(String env) => $initGetIt(getIt, environment: env);
9 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/scalable_flutter_app/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.scalable_flutter_app
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | #include "generated_plugin_registrant.h"
6 |
7 |
8 | void RegisterPlugins(flutter::PluginRegistry* registry) {
9 | }
10 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | analyzer:
2 | exclude:
3 | - "**/generated_plugin_registrant.dart"
4 | - "**/build/**"
5 | - "**/generated_*.dart"
6 | - "**/*.g.dart"
7 | - "**/*.freezed.dart"
8 | - "**/*.gr.dart"
9 | - "**/l10n*.dart"
10 | - "**/*.gen.dart"
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Scalable flutter app
2 |
3 | You probably need to read this article before inspecting the repo's code. [Building scalable Flutter apps (Architecture, Styling, Conventions, State management)](https://dev.to/noureldinshobier/building-scalable-flutter-apps-architecture-styling-conventions-state-management-40c9)
4 |
--------------------------------------------------------------------------------
/ios/Runner.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.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 and should not be manually edited.
5 |
6 | version:
7 | revision: b22742018b3edf16c6cadd7b76d9db5e7f9064b5
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/lib/config.dart:
--------------------------------------------------------------------------------
1 | abstract class Config {
2 | static const env = Env.dev;
3 | static const apiVersion = 'v1';
4 | static const apiRootUrl = 'http://192.168.1.8:5000';
5 | static const apiUrl = '$apiRootUrl/api/$apiVersion';
6 | }
7 |
8 | abstract class Env {
9 | static const dev = 'dev';
10 | static const prod = 'prod';
11 | static const test = 'test';
12 | }
13 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | #ifndef GENERATED_PLUGIN_REGISTRANT_
6 | #define GENERATED_PLUGIN_REGISTRANT_
7 |
8 | #include
9 |
10 | // Registers Flutter plugins.
11 | void RegisterPlugins(flutter::PluginRegistry* registry);
12 |
13 | #endif // GENERATED_PLUGIN_REGISTRANT_
14 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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/shared/ui/styles/fonts.style.dart:
--------------------------------------------------------------------------------
1 | abstract class IFont {
2 | static const String primaryFontLight = 'Montserrat-Light';
3 | static const String primaryFontRegular = 'Montserrat-Regular';
4 | static const String primaryFontMedium = 'Montserrat-Medium';
5 | static const String primaryFontSemiBold = 'Montserrat-SemiBold';
6 | static const String primaryFontBold = 'Montserrat-Bold';
7 | }
8 |
--------------------------------------------------------------------------------
/lib/infrastructure/shared/models/validation_result.model.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'validation_result.model.freezed.dart';
4 |
5 | @freezed
6 | class ValidationResult with _$ValidationResult {
7 | const factory ValidationResult.success({required S data}) =
8 | ValidationSuccess;
9 |
10 | const factory ValidationResult.failure({required F data}) =
11 | ValidationFailure;
12 | }
13 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/app/auth/pages/register/tabs/information.tab.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/packages.dart';
3 |
4 | import '../register.vm.dart';
5 |
6 | class InformationTabView extends StatelessView {
7 | InformationTabView({Key? key}) : super(key: key);
8 |
9 | Widget render(BuildContext context, RegisterPageVM vm) {
10 | return SingleChildScrollView(physics: const BouncingScrollPhysics());
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/lib/app/auth/pages/register/tabs/verification.tab.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/packages.dart';
3 |
4 | import '../register.vm.dart';
5 |
6 | class VerificationTabView extends StatelessView {
7 | VerificationTabView({Key? key}) : super(key: key);
8 |
9 | Widget render(BuildContext context, RegisterPageVM vm) {
10 | return SingleChildScrollView(physics: const BouncingScrollPhysics());
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/app/app.view.dart';
3 |
4 | import 'config.dart';
5 | import 'injection.dart';
6 |
7 | void main() {
8 | configureInjection(Config.env);
9 | runApp(Root());
10 | }
11 |
12 | class Root extends StatelessWidget {
13 | const Root({Key? key}) : super(key: key);
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return MaterialApp(home: App());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/android/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 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/models/api_result.model.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 | import 'package:scalable_flutter_app/infrastructure/http/index.dart';
3 |
4 | part 'api_result.model.freezed.dart';
5 |
6 | @freezed
7 | class ApiResponse with _$ApiResponse {
8 | const factory ApiResponse.success({required T data}) = ApiResult;
9 |
10 | const factory ApiResponse.failure({
11 | required ApiException exception,
12 | String? caption,
13 | }) = ApiFailure;
14 | }
15 |
--------------------------------------------------------------------------------
/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/app/auth/pages/register/widgets/app_bar.widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'package:scalable_flutter_app/packages.dart';
4 |
5 | import '../register.vm.dart';
6 |
7 | class IAppbar extends StatelessView
8 | implements PreferredSizeWidget {
9 | const IAppbar({Key? key}) : super(key: key);
10 |
11 | @override
12 | Size get preferredSize => Size.fromHeight(72);
13 |
14 | Widget render(BuildContext context, RegisterPageVM vm) {
15 | return Container(height: 72);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | set(PLUGIN_BUNDLED_LIBRARIES)
9 |
10 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
15 | endforeach(plugin)
16 |
--------------------------------------------------------------------------------
/lib/app/app.view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/packages.dart';
3 | import 'app.vm.dart';
4 |
5 | class App extends StatelessWidget {
6 | const App({Key? key}) : super(key: key);
7 |
8 | Widget build(context) {
9 | return MVVM(
10 | view: (_, __) => _AppView(),
11 | viewModel: AppVm(),
12 | );
13 | }
14 | }
15 |
16 | class _AppView extends StatelessView {
17 | const _AppView({Key? key}) : super(key: key);
18 |
19 | Widget render(context, vm) {
20 | return Container();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/article_mini.model.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'article_mini.model.freezed.dart';
4 | part 'article_mini.model.g.dart';
5 |
6 | @freezed
7 | class ArticleMini with _$ArticleMini {
8 | @JsonSerializable(explicitToJson: true)
9 | const factory ArticleMini({
10 | @Default(-1) int id,
11 | @Default('') String summary,
12 | @Default('') String title,
13 | @Default('') String image,
14 | }) = _ArticleMini;
15 |
16 | factory ArticleMini.fromJson(Map json) =>
17 | _$ArticleMiniFromJson(json);
18 | Map toJson() => toJson();
19 | }
20 |
--------------------------------------------------------------------------------
/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "run_loop.cpp"
8 | "utils.cpp"
9 | "win32_window.cpp"
10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
11 | "Runner.rc"
12 | "runner.exe.manifest"
13 | )
14 | apply_standard_settings(${BINARY_NAME})
15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
18 | add_dependencies(${BINARY_NAME} flutter_assemble)
19 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/article.model.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'article.model.freezed.dart';
4 | part 'article.model.g.dart';
5 |
6 | @freezed
7 | class Article with _$Article {
8 | @JsonSerializable(explicitToJson: true)
9 | const factory Article({
10 | @Default(-1) int id,
11 | @Default('') String title,
12 | @Default('') String content,
13 | @Default('') String imageFileName,
14 | @Default('') String shortDescription,
15 | }) = _Article;
16 |
17 | factory Article.fromJson(Map json) =>
18 | _$ArticleFromJson(json);
19 | Map toJson() => super.toJson();
20 | }
21 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "scalable_flutter_app",
3 | "short_name": "scalable_flutter_app",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/ephemeral/
22 | Flutter/app.flx
23 | Flutter/app.zip
24 | Flutter/flutter_assets/
25 | Flutter/flutter_export_environment.sh
26 | ServiceDefinitions.json
27 | Runner/GeneratedPluginRegistrant.*
28 |
29 | # Exceptions to above rules.
30 | !default.mode1v3
31 | !default.mode2v3
32 | !default.pbxuser
33 | !default.perspectivev3
34 |
--------------------------------------------------------------------------------
/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/lib/app/auth/pages/register/register.view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/packages.dart';
3 |
4 | import 'register.vm.dart';
5 | import 'widgets/app_bar.widget.dart';
6 |
7 | class RegisterPage extends StatelessWidget {
8 | const RegisterPage({Key? key}) : super(key: key);
9 |
10 | Widget build(BuildContext context) {
11 | return MVVM(
12 | view: (_, __) => _RegisterPageView(),
13 | viewModel: RegisterPageVM(),
14 | );
15 | }
16 | }
17 |
18 | class _RegisterPageView extends StatelessView {
19 | const _RegisterPageView({Key? key}) : super(key: key);
20 |
21 | Widget render(BuildContext context, RegisterPageVM vm) {
22 | return SafeArea(
23 | child: Scaffold(
24 | appBar: IAppbar(),
25 | backgroundColor: Colors.white,
26 | ),
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/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 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/article_mini.model.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'article_mini.model.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | _$_ArticleMini _$_$_ArticleMiniFromJson(Map json) {
10 | return _$_ArticleMini(
11 | id: json['id'] as int? ?? -1,
12 | summary: json['summary'] as String? ?? '',
13 | title: json['title'] as String? ?? '',
14 | image: json['image'] as String? ?? '',
15 | );
16 | }
17 |
18 | Map _$_$_ArticleMiniToJson(_$_ArticleMini instance) =>
19 | {
20 | 'id': instance.id,
21 | 'summary': instance.summary,
22 | 'title': instance.title,
23 | 'image': instance.image,
24 | };
25 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/styles/colors.style.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | abstract class IColors {
4 | static const blue1 = Color(0xFF5468FF); // #5468FF
5 | static const blue2 = Color(0xFF3D56F0); // #3D56F0
6 | static const blue3 = Color(0xFF3C80D1); // #3C80D1
7 |
8 | static const grey1 = Color(0xFFF3F5F9); // #F3F5F9
9 | static const grey2 = Color(0xFFC2C6CC); // #C2C6CC
10 | static const grey3 = Color(0xFFAEB4BB); // #AEB4BB
11 | static const grey4 = Color(0xFF5B6777); // #5B6777
12 | static const grey5 = Color(0xFF344356); // #344356
13 | static const grey6 = Color(0xFFD4DCE7); // #D4DCE7
14 | static const grey7 = Color(0xFFD5D5D5); // #D5D5D5
15 | static const grey8 = Color(0xFF777777); // #777777
16 |
17 | static const red1 = Color(0xFFFA4D56); // #fA4D56
18 |
19 | static const green1 = Color(0XFF37B34A); //#37B34A
20 | static const green2 = Color(0xFFE9F6EB); //#E9F6EB
21 | }
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/article.model.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'article.model.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | _$_Article _$_$_ArticleFromJson(Map json) {
10 | return _$_Article(
11 | id: json['id'] as int? ?? -1,
12 | title: json['title'] as String? ?? '',
13 | content: json['content'] as String? ?? '',
14 | imageFileName: json['imageFileName'] as String? ?? '',
15 | shortDescription: json['shortDescription'] as String? ?? '',
16 | );
17 | }
18 |
19 | Map _$_$_ArticleToJson(_$_Article instance) =>
20 | {
21 | 'id': instance.id,
22 | 'title': instance.title,
23 | 'content': instance.content,
24 | 'imageFileName': instance.imageFileName,
25 | 'shortDescription': instance.shortDescription,
26 | };
27 |
--------------------------------------------------------------------------------
/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/infrastructure/auth/models/value_failures.model.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'value_failures.model.freezed.dart';
4 |
5 | @freezed
6 | class AuthValueFailure with _$AuthValueFailure {
7 | factory AuthValueFailure.register({
8 | String? emailError,
9 | String? passwordError,
10 | String? firstNameError,
11 | String? lastNameError,
12 | }) = InvalidRegisterInfo;
13 |
14 | factory AuthValueFailure.login({
15 | String? emailError,
16 | String? passwordError,
17 | }) = InvalidLoginInfo;
18 |
19 | factory AuthValueFailure.reset({String? emailError}) = InvalidResetInfo;
20 |
21 | factory AuthValueFailure.confrimRegister({
22 | String? emailError,
23 | String? confirmationTokenError,
24 | }) = InvalidConfrimRegisterInfo;
25 |
26 | factory AuthValueFailure.confirmReset({
27 | String? emailError,
28 | String? confirmationTokenError,
29 | }) = InvalidConfirmResetInfo;
30 |
31 | factory AuthValueFailure.password({
32 | String? oldPasswordError,
33 | String? newPasswordError,
34 | }) = InvalidPasswordInfo;
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Nour El-Din Shobier
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/windows/runner/run_loop.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_RUN_LOOP_H_
2 | #define RUNNER_RUN_LOOP_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | // A runloop that will service events for Flutter instances as well
10 | // as native messages.
11 | class RunLoop {
12 | public:
13 | RunLoop();
14 | ~RunLoop();
15 |
16 | // Prevent copying
17 | RunLoop(RunLoop const&) = delete;
18 | RunLoop& operator=(RunLoop const&) = delete;
19 |
20 | // Runs the run loop until the application quits.
21 | void Run();
22 |
23 | // Registers the given Flutter instance for event servicing.
24 | void RegisterFlutterInstance(
25 | flutter::FlutterEngine* flutter_instance);
26 |
27 | // Unregisters the given Flutter instance from event servicing.
28 | void UnregisterFlutterInstance(
29 | flutter::FlutterEngine* flutter_instance);
30 |
31 | private:
32 | using TimePoint = std::chrono::steady_clock::time_point;
33 |
34 | // Processes all currently pending messages for registered Flutter instances.
35 | TimePoint ProcessFlutterMessages();
36 |
37 | std::set flutter_instances_;
38 | };
39 |
40 | #endif // RUNNER_RUN_LOOP_H_
41 |
--------------------------------------------------------------------------------
/lib/infrastructure/auth/models/value_objects.model.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 |
3 | part 'value_objects.model.freezed.dart';
4 | part 'value_objects.model.g.dart';
5 |
6 | @freezed
7 | class AuthValueObject with _$AuthValueObject {
8 | factory AuthValueObject.register({
9 | required String email,
10 | required String password,
11 | required String firstName,
12 | @Default('') String lastName,
13 | }) = RegisterInfo;
14 |
15 | factory AuthValueObject.login({
16 | required String email,
17 | required String password,
18 | }) = LoginInfo;
19 |
20 | factory AuthValueObject.reset({required String email}) = ResetInfo;
21 |
22 | factory AuthValueObject.confrimRegister({
23 | required String email,
24 | required String confirmationToken,
25 | }) = ConfrimRegisterInfo;
26 |
27 | factory AuthValueObject.confirmReset({
28 | required String email,
29 | required String confirmationToken,
30 | }) = ConfirmResetInfo;
31 |
32 | factory AuthValueObject.password({
33 | required String oldPassword,
34 | required String newPassword,
35 | }) = PasswordInfo;
36 |
37 | factory AuthValueObject.fromJson(Map json) =>
38 | _$AuthValueObjectFromJson(json);
39 | }
40 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "run_loop.h"
10 | #include "win32_window.h"
11 |
12 | // A window that does nothing but host a Flutter view.
13 | class FlutterWindow : public Win32Window {
14 | public:
15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a
16 | // Flutter view running |project|.
17 | explicit FlutterWindow(RunLoop* run_loop,
18 | const flutter::DartProject& project);
19 | virtual ~FlutterWindow();
20 |
21 | protected:
22 | // Win32Window:
23 | bool OnCreate() override;
24 | void OnDestroy() override;
25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
26 | LPARAM const lparam) noexcept override;
27 |
28 | private:
29 | // The run loop driving events for this window.
30 | RunLoop* run_loop_;
31 |
32 | // The project to run.
33 | flutter::DartProject project_;
34 |
35 | // The Flutter instance hosted by this window.
36 | std::unique_ptr flutter_controller_;
37 | };
38 |
39 | #endif // RUNNER_FLUTTER_WINDOW_H_
40 |
--------------------------------------------------------------------------------
/lib/injection.config.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | // **************************************************************************
4 | // InjectableConfigGenerator
5 | // **************************************************************************
6 |
7 | import 'package:get_it/get_it.dart' as _i1;
8 | import 'package:injectable/injectable.dart' as _i2;
9 |
10 | import 'infrastructure/articles/articles.repo.dart' as _i5;
11 | import 'infrastructure/auth/auth.repo.dart' as _i6;
12 | import 'infrastructure/http/api.dart' as _i4;
13 | import 'infrastructure/http/dio_client.dart'
14 | as _i3; // ignore_for_file: unnecessary_lambdas
15 |
16 | // ignore_for_file: lines_longer_than_80_chars
17 | /// initializes the registration of provided dependencies inside of [GetIt]
18 | _i1.GetIt $initGetIt(_i1.GetIt get,
19 | {String? environment, _i2.EnvironmentFilter? environmentFilter}) {
20 | final gh = _i2.GetItHelper(get, environment, environmentFilter);
21 | gh.singleton<_i3.DioClient>(_i3.DioClient());
22 | gh.singleton<_i4.API>(_i4.API(get<_i3.DioClient>()));
23 | gh.singleton<_i5.ArticlesRepository>(
24 | _i5.ArticlesRepository(api: get<_i4.API>()));
25 | gh.singleton<_i6.AuthRepository>(_i6.AuthRepository(api: get<_i4.API>()));
26 | return get;
27 | }
28 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/api.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:scalable_flutter_app/infrastructure/articles/index.dart';
4 | import 'package:scalable_flutter_app/infrastructure/auth/index.dart';
5 | import 'package:scalable_flutter_app/packages.dart';
6 |
7 | import 'dio_client.dart';
8 | import 'exceptions/index.dart';
9 | import 'models/index.dart';
10 |
11 | @singleton
12 | class API {
13 | API(this._dioClient);
14 |
15 | final DioClient _dioClient;
16 |
17 | DioClient get client => _dioClient;
18 |
19 | // Articles
20 |
21 | Future> getArticle(int id) async {
22 | try {
23 | final response = await client.get('/articles/$id');
24 |
25 | return ApiResponse.success(
26 | data: Article.fromJson(response.data['data']),
27 | );
28 | } on Exception catch (e) {
29 | return ApiResponse.failure(exception: ApiException.getException(e));
30 | }
31 | }
32 |
33 | // Auth
34 |
35 | Future> register(RegisterInfo info) async {
36 | try {
37 | final response = await client.post(
38 | '/users/register',
39 | data: info.toJson(),
40 | );
41 |
42 | return ApiResponse.success(data: response.statusCode == HttpStatus.ok);
43 | } on Exception catch (e) {
44 | return ApiResponse.failure(exception: ApiException.getException(e));
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/widgets/checkbox/checkbox.style.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/app/shared/ui/index.dart';
3 |
4 | abstract class ICheckboxStyle {
5 | static const Map layouts = {
6 | 'checkbox-border-color-animation-duration': Duration(milliseconds: 65),
7 | 'checkbox-border-color-animation-curve': Curves.linear,
8 | 'checkbox-fill-color-animation-duration': Duration(milliseconds: 100),
9 | 'checkbox-fill-color-animation-curve': Curves.linear,
10 | };
11 |
12 | static const Map colors = {
13 | // border-color
14 | 'checkbox-enabled-border-color': IColors.green1,
15 | 'checkbox-focus-border-color': IColors.green1,
16 | 'checkbox-disabled-border-color': IColors.green1,
17 |
18 | // fill-color
19 | 'checkbox-enabled-fill-color': IColors.green1,
20 | 'checkbox-focus-fill-color': IColors.green1,
21 | 'checkbox-disabled-fill-color': IColors.green1,
22 |
23 | // checkmark-color
24 | 'checkbox-enabled-checkmark-color': IColors.green1,
25 | 'checkbox-focus-checkmark-color': IColors.green1,
26 | 'checkbox-disabled-checkmark-color': IColors.green1,
27 |
28 | // label-color
29 | 'checkbox-enabled-label-color': IColors.green1,
30 | 'checkbox-focus-label-color': IColors.green1,
31 | 'checkbox-disabled-label-color': IColors.green1,
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/articles.repo.dart:
--------------------------------------------------------------------------------
1 | import 'package:scalable_flutter_app/infrastructure/articles/index.dart';
2 | import 'package:scalable_flutter_app/infrastructure/http/api.dart';
3 | import 'package:scalable_flutter_app/infrastructure/http/index.dart';
4 |
5 | import 'package:scalable_flutter_app/packages.dart';
6 |
7 | @singleton
8 | class ArticlesRepository {
9 | ArticlesRepository({required this.api});
10 |
11 | final API api;
12 |
13 | // methods
14 |
15 | Future> getArticle(int id) async {
16 | final response = await api.getArticle(id);
17 |
18 | return response.map(
19 | success: (result) => result,
20 | failure: (failure) {
21 | late String caption;
22 |
23 | failure.exception.maybeWhen(
24 | unexpectedError: () {
25 | caption = ApiException.getExceptionMessage(failure.exception);
26 | /* Report failure */
27 | },
28 | unableToProcess: () {
29 | caption = ApiException.getExceptionMessage(failure.exception);
30 | /* Report failure */
31 | },
32 | orElse: () {
33 | caption = ApiException.getExceptionMessage(failure.exception);
34 | /* Report failure */
35 | },
36 | );
37 |
38 | return failure.copyWith(exception: failure.exception, caption: caption);
39 | },
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "run_loop.h"
7 | #include "utils.h"
8 |
9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
10 | _In_ wchar_t *command_line, _In_ int show_command) {
11 | // Attach to console when present (e.g., 'flutter run') or create a
12 | // new console when running with a debugger.
13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
14 | CreateAndAttachConsole();
15 | }
16 |
17 | // Initialize COM, so that it is available for use in the library and/or
18 | // plugins.
19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
20 |
21 | RunLoop run_loop;
22 |
23 | flutter::DartProject project(L"data");
24 |
25 | std::vector command_line_arguments =
26 | GetCommandLineArguments();
27 |
28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
29 |
30 | FlutterWindow window(&run_loop, project);
31 | Win32Window::Point origin(10, 10);
32 | Win32Window::Size size(1280, 720);
33 | if (!window.CreateAndShow(L"scalable_flutter_app", origin, size)) {
34 | return EXIT_FAILURE;
35 | }
36 | window.SetQuitOnClose(true);
37 |
38 | run_loop.Run();
39 |
40 | ::CoUninitialize();
41 | return EXIT_SUCCESS;
42 | }
43 |
--------------------------------------------------------------------------------
/lib/infrastructure/auth/auth.repo.dart:
--------------------------------------------------------------------------------
1 | import 'package:scalable_flutter_app/infrastructure/auth/index.dart';
2 | import 'package:scalable_flutter_app/infrastructure/http/api.dart';
3 | import 'package:scalable_flutter_app/infrastructure/http/index.dart';
4 |
5 | import 'package:scalable_flutter_app/packages.dart';
6 |
7 | @singleton
8 | class AuthRepository {
9 | AuthRepository({required this.api});
10 |
11 | final API api;
12 |
13 | Future> register(RegisterInfo info) async {
14 | final response = await api.register(info);
15 |
16 | return response.map(
17 | success: (result) => result,
18 | failure: (failure) {
19 | late String caption;
20 |
21 | failure.exception.maybeWhen(
22 | unauthorisedRequest: () => caption = 'Invalid input',
23 | conflict: () => caption = 'User already exists',
24 | unexpectedError: () {
25 | caption = ApiException.getExceptionMessage(failure.exception);
26 | /* Report failure */
27 | },
28 | unableToProcess: () {
29 | caption = ApiException.getExceptionMessage(failure.exception);
30 | /* Report failure */
31 | },
32 | orElse: () {
33 | caption = ApiException.getExceptionMessage(failure.exception);
34 | /* Report failure */
35 | },
36 | );
37 |
38 | return failure.copyWith(exception: failure.exception, caption: caption);
39 | },
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | scalable_flutter_app
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 30
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | defaultConfig {
36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37 | applicationId "com.example.scalable_flutter_app"
38 | minSdkVersion 16
39 | targetSdkVersion 30
40 | versionCode flutterVersionCode.toInteger()
41 | versionName flutterVersionName
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59 | }
60 |
--------------------------------------------------------------------------------
/lib/app/auth/pages/register/register.vm.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/infrastructure/auth/index.dart';
3 | import 'package:scalable_flutter_app/infrastructure/auth/auth.repo.dart';
4 | import 'package:scalable_flutter_app/packages.dart';
5 |
6 | class RegisterPageVM extends ViewModel {
7 | late AuthRepository _authRepository;
8 |
9 | final pageController = PageController(initialPage: 0);
10 |
11 | final emailTextfield = TextEditingController();
12 | final nameTextfield = TextEditingController();
13 | final passwordTextfield = TextEditingController();
14 | final codeTextfield = TextEditingController();
15 |
16 | @override
17 | void init() {
18 | _authRepository = context.fetch();
19 | }
20 |
21 | @override
22 | void onBuild() {}
23 |
24 | void nextPage() {
25 | pageController.nextPage(
26 | duration: Duration(milliseconds: 200),
27 | curve: Curves.easeIn,
28 | );
29 | }
30 |
31 | // Information tab
32 |
33 | void backButton_onTap() => Navigator.of(context).pop();
34 |
35 | void registerButton_onTap() async {
36 | final info = RegisterInfo(
37 | email: emailTextfield.text.trim(),
38 | password: passwordTextfield.text.trim(),
39 | firstName: nameTextfield.text.trim(),
40 | );
41 |
42 | final isValideInfo = _validateRegisterationInfo(info);
43 |
44 | if (isValideInfo) {
45 | final response = await _authRepository.register(info);
46 |
47 | response.when(
48 | success: (_) {
49 | nextPage();
50 | },
51 | failure: (_, caption) {
52 | debugPrint(caption!);
53 | },
54 | );
55 | }
56 | }
57 |
58 | void loginButton_onTap() => Navigator.of(context).pop();
59 |
60 | bool _validateRegisterationInfo(RegisterInfo info) {
61 | final validator = AuthValueValidatior();
62 | final result = validator.validate(info);
63 |
64 | return result.when(
65 | success: (_) => true,
66 | failure: (failure) {
67 | // showToast('Invalid user name.');
68 |
69 | return false;
70 | },
71 | );
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(RunLoop* run_loop,
8 | const flutter::DartProject& project)
9 | : run_loop_(run_loop), project_(project) {}
10 |
11 | FlutterWindow::~FlutterWindow() {}
12 |
13 | bool FlutterWindow::OnCreate() {
14 | if (!Win32Window::OnCreate()) {
15 | return false;
16 | }
17 |
18 | RECT frame = GetClientArea();
19 |
20 | // The size here must match the window dimensions to avoid unnecessary surface
21 | // creation / destruction in the startup path.
22 | flutter_controller_ = std::make_unique(
23 | frame.right - frame.left, frame.bottom - frame.top, project_);
24 | // Ensure that basic setup of the controller was successful.
25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
26 | return false;
27 | }
28 | RegisterPlugins(flutter_controller_->engine());
29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
30 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
31 | return true;
32 | }
33 |
34 | void FlutterWindow::OnDestroy() {
35 | if (flutter_controller_) {
36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
37 | flutter_controller_ = nullptr;
38 | }
39 |
40 | Win32Window::OnDestroy();
41 | }
42 |
43 | LRESULT
44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
45 | WPARAM const wparam,
46 | LPARAM const lparam) noexcept {
47 | // Give Flutter, including plugins, an opportunity to handle window messages.
48 | if (flutter_controller_) {
49 | std::optional result =
50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
51 | lparam);
52 | if (result) {
53 | return *result;
54 | }
55 | }
56 |
57 | switch (message) {
58 | case WM_FONTCHANGE:
59 | flutter_controller_->engine()->ReloadSystemFonts();
60 | break;
61 | }
62 |
63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
64 | }
65 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
21 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
37 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/windows/runner/run_loop.cpp:
--------------------------------------------------------------------------------
1 | #include "run_loop.h"
2 |
3 | #include
4 |
5 | #include
6 |
7 | RunLoop::RunLoop() {}
8 |
9 | RunLoop::~RunLoop() {}
10 |
11 | void RunLoop::Run() {
12 | bool keep_running = true;
13 | TimePoint next_flutter_event_time = TimePoint::clock::now();
14 | while (keep_running) {
15 | std::chrono::nanoseconds wait_duration =
16 | std::max(std::chrono::nanoseconds(0),
17 | next_flutter_event_time - TimePoint::clock::now());
18 | ::MsgWaitForMultipleObjects(
19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000),
20 | QS_ALLINPUT);
21 | bool processed_events = false;
22 | MSG message;
23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects
24 | // won't return again for items left in the queue after PeekMessage.
25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) {
26 | processed_events = true;
27 | if (message.message == WM_QUIT) {
28 | keep_running = false;
29 | break;
30 | }
31 | ::TranslateMessage(&message);
32 | ::DispatchMessage(&message);
33 | // Allow Flutter to process messages each time a Windows message is
34 | // processed, to prevent starvation.
35 | next_flutter_event_time =
36 | std::min(next_flutter_event_time, ProcessFlutterMessages());
37 | }
38 | // If the PeekMessage loop didn't run, process Flutter messages.
39 | if (!processed_events) {
40 | next_flutter_event_time =
41 | std::min(next_flutter_event_time, ProcessFlutterMessages());
42 | }
43 | }
44 | }
45 |
46 | void RunLoop::RegisterFlutterInstance(
47 | flutter::FlutterEngine* flutter_instance) {
48 | flutter_instances_.insert(flutter_instance);
49 | }
50 |
51 | void RunLoop::UnregisterFlutterInstance(
52 | flutter::FlutterEngine* flutter_instance) {
53 | flutter_instances_.erase(flutter_instance);
54 | }
55 |
56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() {
57 | TimePoint next_event_time = TimePoint::max();
58 | for (auto instance : flutter_instances_) {
59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages();
60 | if (wait_duration != std::chrono::nanoseconds::max()) {
61 | next_event_time =
62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration);
63 | }
64 | }
65 | return next_event_time;
66 | }
67 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/dio_client.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:scalable_flutter_app/config.dart';
4 | import 'package:scalable_flutter_app/packages.dart';
5 |
6 | const _defaultConnectTimeout = Duration.millisecondsPerMinute;
7 | const _defaultReceiveTimeout = Duration.millisecondsPerMinute;
8 | const _defaultSendTimeout = Duration.millisecondsPerMinute;
9 |
10 | @singleton
11 | class DioClient {
12 | final _dio = Dio();
13 |
14 | DioClient() {
15 | _dio.options.baseUrl = Config.apiUrl;
16 | _dio.options.connectTimeout = _defaultConnectTimeout;
17 | _dio.options.receiveTimeout = _defaultReceiveTimeout;
18 | _dio.options.sendTimeout = _defaultSendTimeout;
19 | _dio.options.headers = {'Content-Type': 'application/json; charset=UTF-8'};
20 |
21 | // Add interceptors here.
22 |
23 | if (Config.env == Env.dev || Config.env == Env.test) {
24 | _dio.interceptors.add(
25 | LogInterceptor(
26 | responseBody: true,
27 | error: true,
28 | requestHeader: false,
29 | responseHeader: false,
30 | request: false,
31 | requestBody: false,
32 | ),
33 | );
34 | }
35 | }
36 |
37 | Future get(
38 | String uri, {
39 | Map? queryParameters,
40 | Options? options,
41 | CancelToken? cancelToken,
42 | ProgressCallback? onReceiveProgress,
43 | }) async {
44 | try {
45 | final response = await _dio.get(
46 | uri,
47 | queryParameters: queryParameters,
48 | options: options,
49 | cancelToken: cancelToken,
50 | onReceiveProgress: onReceiveProgress,
51 | );
52 |
53 | return response;
54 | } on SocketException catch (e) {
55 | throw SocketException(e.toString());
56 | } on FormatException catch (_) {
57 | throw FormatException("Unable to process the data");
58 | } on Exception catch (_) {
59 | rethrow;
60 | }
61 | }
62 |
63 | Future post(
64 | String uri, {
65 | dynamic data,
66 | Map? queryParameters,
67 | Options? options,
68 | CancelToken? cancelToken,
69 | ProgressCallback? onSendProgress,
70 | ProgressCallback? onReceiveProgress,
71 | }) async {
72 | try {
73 | final response = await _dio.post(
74 | uri,
75 | data: data,
76 | queryParameters: queryParameters,
77 | options: options,
78 | cancelToken: cancelToken,
79 | onSendProgress: onSendProgress,
80 | onReceiveProgress: onReceiveProgress,
81 | );
82 |
83 | return response;
84 | } on FormatException catch (_) {
85 | throw FormatException("Unable to process the data");
86 | } on Exception catch (_) {
87 | rethrow;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/infrastructure/auth/models/value_objects.model.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'value_objects.model.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | _$RegisterInfo _$_$RegisterInfoFromJson(Map json) {
10 | return _$RegisterInfo(
11 | email: json['email'] as String,
12 | password: json['password'] as String,
13 | firstName: json['firstName'] as String,
14 | lastName: json['lastName'] as String? ?? '',
15 | );
16 | }
17 |
18 | Map _$_$RegisterInfoToJson(_$RegisterInfo instance) =>
19 | {
20 | 'email': instance.email,
21 | 'password': instance.password,
22 | 'firstName': instance.firstName,
23 | 'lastName': instance.lastName,
24 | };
25 |
26 | _$LoginInfo _$_$LoginInfoFromJson(Map json) {
27 | return _$LoginInfo(
28 | email: json['email'] as String,
29 | password: json['password'] as String,
30 | );
31 | }
32 |
33 | Map _$_$LoginInfoToJson(_$LoginInfo instance) =>
34 | {
35 | 'email': instance.email,
36 | 'password': instance.password,
37 | };
38 |
39 | _$ResetInfo _$_$ResetInfoFromJson(Map json) {
40 | return _$ResetInfo(
41 | email: json['email'] as String,
42 | );
43 | }
44 |
45 | Map _$_$ResetInfoToJson(_$ResetInfo instance) =>
46 | {
47 | 'email': instance.email,
48 | };
49 |
50 | _$ConfrimRegisterInfo _$_$ConfrimRegisterInfoFromJson(
51 | Map json) {
52 | return _$ConfrimRegisterInfo(
53 | email: json['email'] as String,
54 | confirmationToken: json['confirmationToken'] as String,
55 | );
56 | }
57 |
58 | Map _$_$ConfrimRegisterInfoToJson(
59 | _$ConfrimRegisterInfo instance) =>
60 | {
61 | 'email': instance.email,
62 | 'confirmationToken': instance.confirmationToken,
63 | };
64 |
65 | _$ConfirmResetInfo _$_$ConfirmResetInfoFromJson(Map json) {
66 | return _$ConfirmResetInfo(
67 | email: json['email'] as String,
68 | confirmationToken: json['confirmationToken'] as String,
69 | );
70 | }
71 |
72 | Map _$_$ConfirmResetInfoToJson(_$ConfirmResetInfo instance) =>
73 | {
74 | 'email': instance.email,
75 | 'confirmationToken': instance.confirmationToken,
76 | };
77 |
78 | _$PasswordInfo _$_$PasswordInfoFromJson(Map json) {
79 | return _$PasswordInfo(
80 | oldPassword: json['oldPassword'] as String,
81 | newPassword: json['newPassword'] as String,
82 | );
83 | }
84 |
85 | Map _$_$PasswordInfoToJson(_$PasswordInfo instance) =>
86 | {
87 | 'oldPassword': instance.oldPassword,
88 | 'newPassword': instance.newPassword,
89 | };
90 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: scalable_flutter_app
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.12.0 <3.0.0"
22 |
23 | dependencies:
24 | # For Dependency Injection
25 | injectable: ^1.2.0
26 | get_it: ^6.0.0
27 |
28 | # For Model
29 | freezed_annotation: ^0.14.0
30 | json_annotation: ^4.0.0
31 |
32 | # For Architecture
33 | pmvvm: ^2.0.1
34 |
35 | # For Networking
36 | dio: ^4.0.0-beta5
37 |
38 | flutter:
39 | sdk: flutter
40 |
41 |
42 | # The following adds the Cupertino Icons font to your application.
43 | # Use with the CupertinoIcons class for iOS style icons.
44 | cupertino_icons: ^1.0.2
45 |
46 | dev_dependencies:
47 |
48 | # For Model
49 | freezed: ^0.14.0+1
50 | json_serializable: ^4.0.2
51 |
52 | # For Dependency Injection
53 | injectable_generator: ^1.2.0
54 |
55 | # For Code Generation
56 | build_runner:
57 | source_gen: ^0.9.10+3
58 |
59 | flutter_test:
60 | sdk: flutter
61 |
62 | # For information on the generic Dart part of this file, see the
63 | # following page: https://dart.dev/tools/pub/pubspec
64 |
65 | # The following section is specific to Flutter.
66 | flutter:
67 |
68 | # The following line ensures that the Material Icons font is
69 | # included with your application, so that you can use the icons in
70 | # the material Icons class.
71 | uses-material-design: true
72 |
73 | assets:
74 | - assets/
75 |
76 | fonts:
77 | - family: Montserrat-Light
78 | fonts:
79 | - asset: assets/fonts/Montserrat-Light.ttf
80 | - family: Montserrat-Regular
81 | fonts:
82 | - asset: assets/fonts/Montserrat-Regular.ttf
83 | - family: Montserrat-Medium
84 | fonts:
85 | - asset: assets/fonts/Montserrat-Medium.ttf
86 | - family: Montserrat-SemiBold
87 | fonts:
88 | - asset: assets/fonts/Montserrat-SemiBold.ttf
89 | - family: Montserrat-Bold
90 | fonts:
91 | - asset: assets/fonts/Montserrat-Bold.ttf
92 | #------------------------------------------------------------------
93 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.example" "\0"
93 | VALUE "FileDescription", "A new Flutter project." "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "scalable_flutter_app" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "scalable_flutter_app.exe" "\0"
98 | VALUE "ProductName", "scalable_flutter_app" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(scalable_flutter_app LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "scalable_flutter_app")
5 |
6 | cmake_policy(SET CMP0063 NEW)
7 |
8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9 |
10 | # Configure build options.
11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12 | if(IS_MULTICONFIG)
13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
14 | CACHE STRING "" FORCE)
15 | else()
16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
17 | set(CMAKE_BUILD_TYPE "Debug" CACHE
18 | STRING "Flutter build mode" FORCE)
19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
20 | "Debug" "Profile" "Release")
21 | endif()
22 | endif()
23 |
24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
28 |
29 | # Use Unicode for all projects.
30 | add_definitions(-DUNICODE -D_UNICODE)
31 |
32 | # Compilation settings that should be applied to most targets.
33 | function(APPLY_STANDARD_SETTINGS TARGET)
34 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
36 | target_compile_options(${TARGET} PRIVATE /EHsc)
37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
39 | endfunction()
40 |
41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42 |
43 | # Flutter library and tool build rules.
44 | add_subdirectory(${FLUTTER_MANAGED_DIR})
45 |
46 | # Application build
47 | add_subdirectory("runner")
48 |
49 | # Generated plugin build rules, which manage building the plugins and adding
50 | # them to the application.
51 | include(flutter/generated_plugins.cmake)
52 |
53 |
54 | # === Installation ===
55 | # Support files are copied into place next to the executable, so that it can
56 | # run in place. This is done instead of making a separate bundle (as on Linux)
57 | # so that building and running from within Visual Studio will work.
58 | set(BUILD_BUNDLE_DIR "$")
59 | # Make the "install" step default, as it's required to run.
60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63 | endif()
64 |
65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67 |
68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69 | COMPONENT Runtime)
70 |
71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72 | COMPONENT Runtime)
73 |
74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75 | COMPONENT Runtime)
76 |
77 | if(PLUGIN_BUNDLED_LIBRARIES)
78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80 | COMPONENT Runtime)
81 | endif()
82 |
83 | # Fully re-copy the assets directory on each build to avoid having stale files
84 | # from a previous install.
85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86 | install(CODE "
87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88 | " COMPONENT Runtime)
89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91 |
92 | # Install the AOT library on non-Debug builds only.
93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94 | CONFIGURATIONS Profile;Release
95 | COMPONENT Runtime)
96 |
--------------------------------------------------------------------------------
/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
11 |
12 | # === Flutter Library ===
13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
14 |
15 | # Published to parent scope for install step.
16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
20 |
21 | list(APPEND FLUTTER_LIBRARY_HEADERS
22 | "flutter_export.h"
23 | "flutter_windows.h"
24 | "flutter_messenger.h"
25 | "flutter_plugin_registrar.h"
26 | "flutter_texture_registrar.h"
27 | )
28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
29 | add_library(flutter INTERFACE)
30 | target_include_directories(flutter INTERFACE
31 | "${EPHEMERAL_DIR}"
32 | )
33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
34 | add_dependencies(flutter flutter_assemble)
35 |
36 | # === Wrapper ===
37 | list(APPEND CPP_WRAPPER_SOURCES_CORE
38 | "core_implementations.cc"
39 | "standard_codec.cc"
40 | )
41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
43 | "plugin_registrar.cc"
44 | )
45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
46 | list(APPEND CPP_WRAPPER_SOURCES_APP
47 | "flutter_engine.cc"
48 | "flutter_view_controller.cc"
49 | )
50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
51 |
52 | # Wrapper sources needed for a plugin.
53 | add_library(flutter_wrapper_plugin STATIC
54 | ${CPP_WRAPPER_SOURCES_CORE}
55 | ${CPP_WRAPPER_SOURCES_PLUGIN}
56 | )
57 | apply_standard_settings(flutter_wrapper_plugin)
58 | set_target_properties(flutter_wrapper_plugin PROPERTIES
59 | POSITION_INDEPENDENT_CODE ON)
60 | set_target_properties(flutter_wrapper_plugin PROPERTIES
61 | CXX_VISIBILITY_PRESET hidden)
62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
63 | target_include_directories(flutter_wrapper_plugin PUBLIC
64 | "${WRAPPER_ROOT}/include"
65 | )
66 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
67 |
68 | # Wrapper sources needed for the runner.
69 | add_library(flutter_wrapper_app STATIC
70 | ${CPP_WRAPPER_SOURCES_CORE}
71 | ${CPP_WRAPPER_SOURCES_APP}
72 | )
73 | apply_standard_settings(flutter_wrapper_app)
74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
75 | target_include_directories(flutter_wrapper_app PUBLIC
76 | "${WRAPPER_ROOT}/include"
77 | )
78 | add_dependencies(flutter_wrapper_app flutter_assemble)
79 |
80 | # === Flutter tool backend ===
81 | # _phony_ is a non-existent file to force this command to run every time,
82 | # since currently there's no way to get a full input/output list from the
83 | # flutter tool.
84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
86 | add_custom_command(
87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
89 | ${CPP_WRAPPER_SOURCES_APP}
90 | ${PHONY_OUTPUT}
91 | COMMAND ${CMAKE_COMMAND} -E env
92 | ${FLUTTER_TOOL_ENVIRONMENT}
93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94 | windows-x64 $
95 | VERBATIM
96 | )
97 | add_custom_target(flutter_assemble DEPENDS
98 | "${FLUTTER_LIBRARY}"
99 | ${FLUTTER_LIBRARY_HEADERS}
100 | ${CPP_WRAPPER_SOURCES_CORE}
101 | ${CPP_WRAPPER_SOURCES_PLUGIN}
102 | ${CPP_WRAPPER_SOURCES_APP}
103 | )
104 |
--------------------------------------------------------------------------------
/lib/app/shared/ui/widgets/checkbox/checkbox.widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:scalable_flutter_app/app/shared/ui/index.dart';
3 |
4 | import 'checkbox.style.dart';
5 |
6 | class ICheckbox extends StatefulWidget {
7 | ICheckbox({
8 | Key? key,
9 | required this.onChange,
10 | this.value = false,
11 | this.label,
12 | this.labelSize = 14,
13 | this.enable = true,
14 | }) : super(key: key);
15 |
16 | final bool value;
17 | final bool enable;
18 | final String? label;
19 | final double labelSize;
20 | final void Function(bool value) onChange;
21 |
22 | @override
23 | _ICheckboxState createState() => _ICheckboxState();
24 | }
25 |
26 | class _ICheckboxState extends State {
27 | final colors = ICheckboxStyle.colors;
28 | final layouts = ICheckboxStyle.layouts;
29 |
30 | /// styles helpers
31 | late String state, selector;
32 |
33 | var _state = IWidgetState.enabled;
34 | var _value = false;
35 | var _focused = false;
36 |
37 | @override
38 | void initState() {
39 | _value = widget.value;
40 | super.initState();
41 | }
42 |
43 | @override
44 | void didChangeDependencies() {
45 | _value = widget.value;
46 | super.didChangeDependencies();
47 | }
48 |
49 | void _evaluateStateVariables() {
50 | /// determine the [_state] of the widget.
51 |
52 | if (!widget.enable) {
53 | _state = IWidgetState.disabled;
54 | } else if (widget.enable && _focused) {
55 | _state = IWidgetState.focus;
56 | } else {
57 | _state = IWidgetState.enabled;
58 | }
59 |
60 | state = enumToString(_state);
61 | selector = 'checkbox-$state';
62 | }
63 |
64 | @override
65 | Widget build(BuildContext context) {
66 | _evaluateStateVariables();
67 |
68 | return IgnorePointer(
69 | ignoring: !widget.enable,
70 | child: GestureDetector(
71 | onTapDown: (_) => setState(() => _focused = true),
72 | onTapUp: (_) => setState(() {
73 | _focused = false;
74 | _value = !_value;
75 | widget.onChange(_value);
76 | }),
77 | onTapCancel: () => setState(() => _focused = false),
78 | child: Row(
79 | mainAxisSize: MainAxisSize.min,
80 | mainAxisAlignment: MainAxisAlignment.center,
81 | crossAxisAlignment: CrossAxisAlignment.center,
82 | children: [
83 | Stack(
84 | children: [
85 | AnimatedContainer(
86 | height: 20,
87 | width: 20,
88 | duration: layouts['checkbox-border-color-animation-duration'],
89 | curve: layouts['checkbox-border-color-animation-curve'],
90 | decoration: BoxDecoration(
91 | borderRadius: BorderRadius.circular(2),
92 | border: Border.all(
93 | color: colors['$selector-border-color']!,
94 | width: _focused ? 2 : 1,
95 | ),
96 | ),
97 | ),
98 | Container(
99 | height: 20,
100 | width: 20,
101 | decoration: BoxDecoration(
102 | borderRadius: BorderRadius.circular(2),
103 | color: _value
104 | ? colors['$selector-fill-color']
105 | : Colors.transparent,
106 | ),
107 | ),
108 | ],
109 | ),
110 | if (widget.label != null) ...[
111 | const SizedBox(width: 10),
112 | Text(
113 | widget.label!,
114 | style: TextStyle(
115 | fontSize: widget.labelSize,
116 | color: colors['$selector-label-color'],
117 | ),
118 | ),
119 | ],
120 | ],
121 | ),
122 | ),
123 | );
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | scalable_flutter_app
27 |
28 |
29 |
30 |
33 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/lib/infrastructure/auth/validations/index.dart:
--------------------------------------------------------------------------------
1 | import 'package:scalable_flutter_app/infrastructure/auth/index.dart';
2 | import 'package:scalable_flutter_app/infrastructure/shared/index.dart';
3 |
4 | class AuthValueValidatior {
5 | ValidationResult validate(AuthValueObject object) {
6 | if (S == RegisterInfo) return _validateRegisterInfo(object as RegisterInfo);
7 | if (S == LoginInfo) return _validateLoginInfo(object as LoginInfo);
8 | if (S == ResetInfo) return _validateResetInfo(object as ResetInfo);
9 |
10 | if (S == ConfrimRegisterInfo) {
11 | return _validateConfrimRegisterInfo(object as ConfrimRegisterInfo);
12 | }
13 |
14 | if (S == ConfirmResetInfo) {
15 | return _validateConfirmResetInfo(object as ConfirmResetInfo);
16 | }
17 |
18 | if (S == PasswordInfo) {
19 | return _validatePasswordInfo(object as PasswordInfo);
20 | }
21 |
22 | throw Exception('[APP]: Unkown AuthValueObject');
23 | }
24 |
25 | ValidationResult _validateRegisterInfo(RegisterInfo info) {
26 | final failures = [];
27 |
28 | _Fns.isEmail(info.email)
29 | ? failures.add(null)
30 | : failures.add('Invalid E-mail');
31 | _Fns.isPassword(info.password)
32 | ? failures.add(null)
33 | : failures.add('Invalid password');
34 | _Fns.isName(info.firstName)
35 | ? failures.add(null)
36 | : failures.add('Invalid user name');
37 | _Fns.isName(info.lastName)
38 | ? failures.add(null)
39 | : failures.add('Invalid user name');
40 |
41 | final isValid = failures.every((v) => v == null);
42 |
43 | if (isValid) {
44 | return ValidationResult.success(data: info as S);
45 | } else {
46 | return ValidationResult.failure(
47 | data: InvalidRegisterInfo(
48 | emailError: failures[0],
49 | passwordError: failures[1],
50 | firstNameError: failures[2],
51 | lastNameError: failures[3],
52 | ) as F,
53 | );
54 | }
55 | }
56 |
57 | ValidationResult _validateLoginInfo(LoginInfo info) {
58 | final failures = [];
59 |
60 | _Fns.isEmail(info.email)
61 | ? failures.add(null)
62 | : failures.add('Invalid E-mail');
63 | _Fns.isPassword(info.password)
64 | ? failures.add(null)
65 | : failures.add('Invalid password');
66 |
67 | final isValid = failures.every((v) => v == null);
68 |
69 | if (isValid) {
70 | return ValidationResult.success(data: info as S);
71 | } else {
72 | return ValidationResult.failure(
73 | data: InvalidLoginInfo(
74 | emailError: failures[0],
75 | passwordError: failures[1],
76 | ) as F,
77 | );
78 | }
79 | }
80 |
81 | ValidationResult _validateResetInfo(ResetInfo info) {
82 | final failures = [];
83 |
84 | _Fns.isEmail(info.email)
85 | ? failures.add(null)
86 | : failures.add('Invalid E-mail');
87 |
88 | final isValid = failures.every((v) => v == null);
89 |
90 | if (isValid) {
91 | return ValidationResult.success(data: info as S);
92 | } else {
93 | return ValidationResult.failure(
94 | data: InvalidResetInfo(emailError: failures[0]) as F,
95 | );
96 | }
97 | }
98 |
99 | ValidationResult _validateConfrimRegisterInfo(
100 | ConfrimRegisterInfo info,
101 | ) {
102 | final failures = [];
103 |
104 | _Fns.isEmail(info.email)
105 | ? failures.add(null)
106 | : failures.add('Invalid E-mail');
107 | _Fns.isConfirmationToken(info.confirmationToken)
108 | ? failures.add(null)
109 | : failures.add('Invalid Token');
110 |
111 | final isValid = failures.every((v) => v == null);
112 |
113 | if (isValid) {
114 | return ValidationResult.success(data: info as S);
115 | } else {
116 | return ValidationResult.failure(
117 | data: InvalidConfrimRegisterInfo(
118 | emailError: failures[0],
119 | confirmationTokenError: failures[1],
120 | ) as F,
121 | );
122 | }
123 | }
124 |
125 | ValidationResult _validateConfirmResetInfo(ConfirmResetInfo info) {
126 | final failures = [];
127 |
128 | _Fns.isEmail(info.email)
129 | ? failures.add(null)
130 | : failures.add('Invalid E-mail');
131 | _Fns.isConfirmationToken(info.confirmationToken)
132 | ? failures.add(null)
133 | : failures.add('Invalid Token');
134 |
135 | final isValid = failures.every((v) => v == null);
136 |
137 | if (isValid) {
138 | return ValidationResult.success(data: info as S);
139 | } else {
140 | return ValidationResult.failure(
141 | data: InvalidConfirmResetInfo(
142 | emailError: failures[0],
143 | confirmationTokenError: failures[1],
144 | ) as F,
145 | );
146 | }
147 | }
148 |
149 | ValidationResult _validatePasswordInfo(PasswordInfo info) {
150 | final failures = [];
151 |
152 | _Fns.isPassword(info.oldPassword)
153 | ? failures.add(null)
154 | : failures.add('Invalid password');
155 | _Fns.isPassword(info.oldPassword)
156 | ? failures.add(null)
157 | : failures.add('Invalid password');
158 |
159 | final isValid = failures.every((v) => v == null);
160 |
161 | if (isValid) {
162 | return ValidationResult.success(data: info as S);
163 | } else {
164 | return ValidationResult.failure(
165 | data: InvalidPasswordInfo(
166 | oldPasswordError: failures[0],
167 | newPasswordError: failures[1],
168 | ) as F,
169 | );
170 | }
171 | }
172 | }
173 |
174 | abstract class _Fns {
175 | static bool isEmail(String value) {
176 | return RegExp(
177 | r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+",
178 | ).hasMatch(value.trim());
179 | }
180 |
181 | static bool isPassword(String value) => value.trim().length >= 5;
182 |
183 | static bool isName(String value) => value.trim().length >= 2;
184 |
185 | static bool isConfirmationToken(String value) => value.trim().length == 4;
186 | }
187 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/exceptions/api.exception.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:freezed_annotation/freezed_annotation.dart';
4 | import 'package:scalable_flutter_app/packages.dart';
5 |
6 | part 'api.exception.freezed.dart';
7 |
8 | @freezed
9 | class ApiException with _$ApiException {
10 | const factory ApiException.requestCancelled() = RequestCancelled;
11 |
12 | const factory ApiException.unauthorisedRequest() = UnauthorisedRequest;
13 |
14 | const factory ApiException.badRequest() = BadRequest;
15 |
16 | const factory ApiException.notFound(String reason) = NotFound;
17 |
18 | const factory ApiException.methodNotAllowed() = MethodNotAllowed;
19 |
20 | const factory ApiException.notAcceptable() = NotAcceptable;
21 |
22 | const factory ApiException.requestTimeout() = RequestTimeout;
23 |
24 | const factory ApiException.sendTimeout() = SendTimeout;
25 |
26 | const factory ApiException.conflict() = Conflict;
27 |
28 | const factory ApiException.internalServerError() = InternalServerError;
29 |
30 | const factory ApiException.notImplemented() = NotImplemented;
31 |
32 | const factory ApiException.serviceUnavailable() = ServiceUnavailable;
33 |
34 | const factory ApiException.noInternetConnection() = NoInternetConnection;
35 |
36 | const factory ApiException.formatException() = FormatException;
37 |
38 | const factory ApiException.unableToProcess() = UnableToProcess;
39 |
40 | const factory ApiException.defaultError(String error) = DefaultError;
41 |
42 | const factory ApiException.unexpectedError() = UnexpectedError;
43 |
44 | static ApiException getException(dynamic exception) {
45 | if (exception is Exception) {
46 | try {
47 | late ApiException networkExceptions;
48 | if (exception is DioError) {
49 | switch (exception.type) {
50 | case DioErrorType.cancel:
51 | networkExceptions = ApiException.requestCancelled();
52 | break;
53 | case DioErrorType.connectTimeout:
54 | networkExceptions = ApiException.requestTimeout();
55 | break;
56 | case DioErrorType.other:
57 | networkExceptions = ApiException.noInternetConnection();
58 | break;
59 | case DioErrorType.receiveTimeout:
60 | networkExceptions = ApiException.sendTimeout();
61 | break;
62 | case DioErrorType.response:
63 | switch (exception.response!.statusCode) {
64 | case 400:
65 | networkExceptions = ApiException.unauthorisedRequest();
66 | break;
67 | case 401:
68 | networkExceptions = ApiException.unauthorisedRequest();
69 | break;
70 | case 403:
71 | networkExceptions = ApiException.unauthorisedRequest();
72 | break;
73 | case 404:
74 | networkExceptions = ApiException.notFound("Not found");
75 | break;
76 | case 409:
77 | networkExceptions = ApiException.conflict();
78 | break;
79 | case 408:
80 | networkExceptions = ApiException.requestTimeout();
81 | break;
82 | case 500:
83 | networkExceptions = ApiException.internalServerError();
84 | break;
85 | case 503:
86 | networkExceptions = ApiException.serviceUnavailable();
87 | break;
88 | default:
89 | var responseCode = exception.response!.statusCode;
90 | networkExceptions = ApiException.defaultError(
91 | "Received invalid status code: $responseCode",
92 | );
93 | }
94 | break;
95 | case DioErrorType.sendTimeout:
96 | networkExceptions = ApiException.sendTimeout();
97 | break;
98 | case DioErrorType.connectTimeout:
99 | // todo: Handle this case.
100 | break;
101 | case DioErrorType.sendTimeout:
102 | // todo: Handle this case.
103 | break;
104 | case DioErrorType.receiveTimeout:
105 | // todo: Handle this case.
106 | break;
107 | case DioErrorType.response:
108 | // todo: Handle this case.
109 | break;
110 | case DioErrorType.cancel:
111 | // todo: Handle this case.
112 | break;
113 | case DioErrorType.other:
114 | // todo: Handle this case.
115 | break;
116 | }
117 | } else if (exception is SocketException) {
118 | networkExceptions = ApiException.noInternetConnection();
119 | } else {
120 | networkExceptions = ApiException.unexpectedError();
121 | }
122 | return networkExceptions;
123 | } on FormatException {
124 | return ApiException.formatException();
125 | } on Exception catch (_) {
126 | // todo: can be useful for analytics
127 | return ApiException.unexpectedError();
128 | }
129 | } else {
130 | if (exception.toString().contains("is not a subtype of")) {
131 | // todo: can be useful for analytics
132 | return ApiException.unableToProcess();
133 | } else {
134 | return ApiException.unexpectedError();
135 | }
136 | }
137 | }
138 |
139 | static String getExceptionMessage(ApiException exception) {
140 | var errorMessage = "";
141 | exception.when(notImplemented: () {
142 | errorMessage = "Not Implemented";
143 | }, requestCancelled: () {
144 | errorMessage = "Request Cancelled";
145 | }, internalServerError: () {
146 | errorMessage = "Internal Server Error";
147 | }, notFound: (reason) {
148 | errorMessage = reason;
149 | }, serviceUnavailable: () {
150 | errorMessage = "Service unavailable";
151 | }, methodNotAllowed: () {
152 | errorMessage = "Method Allowed";
153 | }, badRequest: () {
154 | errorMessage = "Bad request";
155 | }, unauthorisedRequest: () {
156 | errorMessage = "Unauthorised request";
157 | }, unexpectedError: () {
158 | errorMessage = "Unexpected error occurred";
159 | }, requestTimeout: () {
160 | errorMessage = "Connection request timeout";
161 | }, noInternetConnection: () {
162 | errorMessage = "No internet connection";
163 | }, conflict: () {
164 | errorMessage = "Error due to a conflict";
165 | }, sendTimeout: () {
166 | errorMessage = "Send timeout in connection with API server";
167 | }, unableToProcess: () {
168 | errorMessage = "Unable to process the data";
169 | }, defaultError: (error) {
170 | errorMessage = error;
171 | }, formatException: () {
172 | errorMessage = "Unexpected error occurred";
173 | }, notAcceptable: () {
174 | errorMessage = "Not acceptable";
175 | });
176 | return errorMessage;
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/windows/runner/win32_window.cpp:
--------------------------------------------------------------------------------
1 | #include "win32_window.h"
2 |
3 | #include
4 |
5 | #include "resource.h"
6 |
7 | namespace {
8 |
9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
10 |
11 | // The number of Win32Window objects that currently exist.
12 | static int g_active_window_count = 0;
13 |
14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
15 |
16 | // Scale helper to convert logical scaler values to physical using passed in
17 | // scale factor
18 | int Scale(int source, double scale_factor) {
19 | return static_cast(source * scale_factor);
20 | }
21 |
22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
23 | // This API is only needed for PerMonitor V1 awareness mode.
24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) {
25 | HMODULE user32_module = LoadLibraryA("User32.dll");
26 | if (!user32_module) {
27 | return;
28 | }
29 | auto enable_non_client_dpi_scaling =
30 | reinterpret_cast(
31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
32 | if (enable_non_client_dpi_scaling != nullptr) {
33 | enable_non_client_dpi_scaling(hwnd);
34 | FreeLibrary(user32_module);
35 | }
36 | }
37 |
38 | } // namespace
39 |
40 | // Manages the Win32Window's window class registration.
41 | class WindowClassRegistrar {
42 | public:
43 | ~WindowClassRegistrar() = default;
44 |
45 | // Returns the singleton registar instance.
46 | static WindowClassRegistrar* GetInstance() {
47 | if (!instance_) {
48 | instance_ = new WindowClassRegistrar();
49 | }
50 | return instance_;
51 | }
52 |
53 | // Returns the name of the window class, registering the class if it hasn't
54 | // previously been registered.
55 | const wchar_t* GetWindowClass();
56 |
57 | // Unregisters the window class. Should only be called if there are no
58 | // instances of the window.
59 | void UnregisterWindowClass();
60 |
61 | private:
62 | WindowClassRegistrar() = default;
63 |
64 | static WindowClassRegistrar* instance_;
65 |
66 | bool class_registered_ = false;
67 | };
68 |
69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
70 |
71 | const wchar_t* WindowClassRegistrar::GetWindowClass() {
72 | if (!class_registered_) {
73 | WNDCLASS window_class{};
74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
75 | window_class.lpszClassName = kWindowClassName;
76 | window_class.style = CS_HREDRAW | CS_VREDRAW;
77 | window_class.cbClsExtra = 0;
78 | window_class.cbWndExtra = 0;
79 | window_class.hInstance = GetModuleHandle(nullptr);
80 | window_class.hIcon =
81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
82 | window_class.hbrBackground = 0;
83 | window_class.lpszMenuName = nullptr;
84 | window_class.lpfnWndProc = Win32Window::WndProc;
85 | RegisterClass(&window_class);
86 | class_registered_ = true;
87 | }
88 | return kWindowClassName;
89 | }
90 |
91 | void WindowClassRegistrar::UnregisterWindowClass() {
92 | UnregisterClass(kWindowClassName, nullptr);
93 | class_registered_ = false;
94 | }
95 |
96 | Win32Window::Win32Window() {
97 | ++g_active_window_count;
98 | }
99 |
100 | Win32Window::~Win32Window() {
101 | --g_active_window_count;
102 | Destroy();
103 | }
104 |
105 | bool Win32Window::CreateAndShow(const std::wstring& title,
106 | const Point& origin,
107 | const Size& size) {
108 | Destroy();
109 |
110 | const wchar_t* window_class =
111 | WindowClassRegistrar::GetInstance()->GetWindowClass();
112 |
113 | const POINT target_point = {static_cast(origin.x),
114 | static_cast(origin.y)};
115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
117 | double scale_factor = dpi / 96.0;
118 |
119 | HWND window = CreateWindow(
120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor),
123 | nullptr, nullptr, GetModuleHandle(nullptr), this);
124 |
125 | if (!window) {
126 | return false;
127 | }
128 |
129 | return OnCreate();
130 | }
131 |
132 | // static
133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window,
134 | UINT const message,
135 | WPARAM const wparam,
136 | LPARAM const lparam) noexcept {
137 | if (message == WM_NCCREATE) {
138 | auto window_struct = reinterpret_cast(lparam);
139 | SetWindowLongPtr(window, GWLP_USERDATA,
140 | reinterpret_cast(window_struct->lpCreateParams));
141 |
142 | auto that = static_cast(window_struct->lpCreateParams);
143 | EnableFullDpiSupportIfAvailable(window);
144 | that->window_handle_ = window;
145 | } else if (Win32Window* that = GetThisFromHandle(window)) {
146 | return that->MessageHandler(window, message, wparam, lparam);
147 | }
148 |
149 | return DefWindowProc(window, message, wparam, lparam);
150 | }
151 |
152 | LRESULT
153 | Win32Window::MessageHandler(HWND hwnd,
154 | UINT const message,
155 | WPARAM const wparam,
156 | LPARAM const lparam) noexcept {
157 | switch (message) {
158 | case WM_DESTROY:
159 | window_handle_ = nullptr;
160 | Destroy();
161 | if (quit_on_close_) {
162 | PostQuitMessage(0);
163 | }
164 | return 0;
165 |
166 | case WM_DPICHANGED: {
167 | auto newRectSize = reinterpret_cast(lparam);
168 | LONG newWidth = newRectSize->right - newRectSize->left;
169 | LONG newHeight = newRectSize->bottom - newRectSize->top;
170 |
171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
173 |
174 | return 0;
175 | }
176 | case WM_SIZE: {
177 | RECT rect = GetClientArea();
178 | if (child_content_ != nullptr) {
179 | // Size and position the child window.
180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
181 | rect.bottom - rect.top, TRUE);
182 | }
183 | return 0;
184 | }
185 |
186 | case WM_ACTIVATE:
187 | if (child_content_ != nullptr) {
188 | SetFocus(child_content_);
189 | }
190 | return 0;
191 | }
192 |
193 | return DefWindowProc(window_handle_, message, wparam, lparam);
194 | }
195 |
196 | void Win32Window::Destroy() {
197 | OnDestroy();
198 |
199 | if (window_handle_) {
200 | DestroyWindow(window_handle_);
201 | window_handle_ = nullptr;
202 | }
203 | if (g_active_window_count == 0) {
204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
205 | }
206 | }
207 |
208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
209 | return reinterpret_cast(
210 | GetWindowLongPtr(window, GWLP_USERDATA));
211 | }
212 |
213 | void Win32Window::SetChildContent(HWND content) {
214 | child_content_ = content;
215 | SetParent(content, window_handle_);
216 | RECT frame = GetClientArea();
217 |
218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
219 | frame.bottom - frame.top, true);
220 |
221 | SetFocus(child_content_);
222 | }
223 |
224 | RECT Win32Window::GetClientArea() {
225 | RECT frame;
226 | GetClientRect(window_handle_, &frame);
227 | return frame;
228 | }
229 |
230 | HWND Win32Window::GetHandle() {
231 | return window_handle_;
232 | }
233 |
234 | void Win32Window::SetQuitOnClose(bool quit_on_close) {
235 | quit_on_close_ = quit_on_close;
236 | }
237 |
238 | bool Win32Window::OnCreate() {
239 | // No-op; provided for subclasses.
240 | return true;
241 | }
242 |
243 | void Win32Window::OnDestroy() {
244 | // No-op; provided for subclasses.
245 | }
246 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/article_mini.model.freezed.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides
3 |
4 | part of 'article_mini.model.dart';
5 |
6 | // **************************************************************************
7 | // FreezedGenerator
8 | // **************************************************************************
9 |
10 | T _$identity(T value) => value;
11 |
12 | final _privateConstructorUsedError = UnsupportedError(
13 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
14 |
15 | ArticleMini _$ArticleMiniFromJson(Map json) {
16 | return _ArticleMini.fromJson(json);
17 | }
18 |
19 | /// @nodoc
20 | class _$ArticleMiniTearOff {
21 | const _$ArticleMiniTearOff();
22 |
23 | _ArticleMini call(
24 | {int id = -1,
25 | String summary = '',
26 | String title = '',
27 | String image = ''}) {
28 | return _ArticleMini(
29 | id: id,
30 | summary: summary,
31 | title: title,
32 | image: image,
33 | );
34 | }
35 |
36 | ArticleMini fromJson(Map json) {
37 | return ArticleMini.fromJson(json);
38 | }
39 | }
40 |
41 | /// @nodoc
42 | const $ArticleMini = _$ArticleMiniTearOff();
43 |
44 | /// @nodoc
45 | mixin _$ArticleMini {
46 | int get id => throw _privateConstructorUsedError;
47 | String get summary => throw _privateConstructorUsedError;
48 | String get title => throw _privateConstructorUsedError;
49 | String get image => throw _privateConstructorUsedError;
50 |
51 | Map toJson() => throw _privateConstructorUsedError;
52 | @JsonKey(ignore: true)
53 | $ArticleMiniCopyWith get copyWith =>
54 | throw _privateConstructorUsedError;
55 | }
56 |
57 | /// @nodoc
58 | abstract class $ArticleMiniCopyWith<$Res> {
59 | factory $ArticleMiniCopyWith(
60 | ArticleMini value, $Res Function(ArticleMini) then) =
61 | _$ArticleMiniCopyWithImpl<$Res>;
62 | $Res call({int id, String summary, String title, String image});
63 | }
64 |
65 | /// @nodoc
66 | class _$ArticleMiniCopyWithImpl<$Res> implements $ArticleMiniCopyWith<$Res> {
67 | _$ArticleMiniCopyWithImpl(this._value, this._then);
68 |
69 | final ArticleMini _value;
70 | // ignore: unused_field
71 | final $Res Function(ArticleMini) _then;
72 |
73 | @override
74 | $Res call({
75 | Object? id = freezed,
76 | Object? summary = freezed,
77 | Object? title = freezed,
78 | Object? image = freezed,
79 | }) {
80 | return _then(_value.copyWith(
81 | id: id == freezed
82 | ? _value.id
83 | : id // ignore: cast_nullable_to_non_nullable
84 | as int,
85 | summary: summary == freezed
86 | ? _value.summary
87 | : summary // ignore: cast_nullable_to_non_nullable
88 | as String,
89 | title: title == freezed
90 | ? _value.title
91 | : title // ignore: cast_nullable_to_non_nullable
92 | as String,
93 | image: image == freezed
94 | ? _value.image
95 | : image // ignore: cast_nullable_to_non_nullable
96 | as String,
97 | ));
98 | }
99 | }
100 |
101 | /// @nodoc
102 | abstract class _$ArticleMiniCopyWith<$Res>
103 | implements $ArticleMiniCopyWith<$Res> {
104 | factory _$ArticleMiniCopyWith(
105 | _ArticleMini value, $Res Function(_ArticleMini) then) =
106 | __$ArticleMiniCopyWithImpl<$Res>;
107 | @override
108 | $Res call({int id, String summary, String title, String image});
109 | }
110 |
111 | /// @nodoc
112 | class __$ArticleMiniCopyWithImpl<$Res> extends _$ArticleMiniCopyWithImpl<$Res>
113 | implements _$ArticleMiniCopyWith<$Res> {
114 | __$ArticleMiniCopyWithImpl(
115 | _ArticleMini _value, $Res Function(_ArticleMini) _then)
116 | : super(_value, (v) => _then(v as _ArticleMini));
117 |
118 | @override
119 | _ArticleMini get _value => super._value as _ArticleMini;
120 |
121 | @override
122 | $Res call({
123 | Object? id = freezed,
124 | Object? summary = freezed,
125 | Object? title = freezed,
126 | Object? image = freezed,
127 | }) {
128 | return _then(_ArticleMini(
129 | id: id == freezed
130 | ? _value.id
131 | : id // ignore: cast_nullable_to_non_nullable
132 | as int,
133 | summary: summary == freezed
134 | ? _value.summary
135 | : summary // ignore: cast_nullable_to_non_nullable
136 | as String,
137 | title: title == freezed
138 | ? _value.title
139 | : title // ignore: cast_nullable_to_non_nullable
140 | as String,
141 | image: image == freezed
142 | ? _value.image
143 | : image // ignore: cast_nullable_to_non_nullable
144 | as String,
145 | ));
146 | }
147 | }
148 |
149 | @JsonSerializable(explicitToJson: true)
150 |
151 | /// @nodoc
152 | class _$_ArticleMini implements _ArticleMini {
153 | const _$_ArticleMini(
154 | {this.id = -1, this.summary = '', this.title = '', this.image = ''});
155 |
156 | factory _$_ArticleMini.fromJson(Map json) =>
157 | _$_$_ArticleMiniFromJson(json);
158 |
159 | @JsonKey(defaultValue: -1)
160 | @override
161 | final int id;
162 | @JsonKey(defaultValue: '')
163 | @override
164 | final String summary;
165 | @JsonKey(defaultValue: '')
166 | @override
167 | final String title;
168 | @JsonKey(defaultValue: '')
169 | @override
170 | final String image;
171 |
172 | @override
173 | String toString() {
174 | return 'ArticleMini(id: $id, summary: $summary, title: $title, image: $image)';
175 | }
176 |
177 | @override
178 | bool operator ==(dynamic other) {
179 | return identical(this, other) ||
180 | (other is _ArticleMini &&
181 | (identical(other.id, id) ||
182 | const DeepCollectionEquality().equals(other.id, id)) &&
183 | (identical(other.summary, summary) ||
184 | const DeepCollectionEquality()
185 | .equals(other.summary, summary)) &&
186 | (identical(other.title, title) ||
187 | const DeepCollectionEquality().equals(other.title, title)) &&
188 | (identical(other.image, image) ||
189 | const DeepCollectionEquality().equals(other.image, image)));
190 | }
191 |
192 | @override
193 | int get hashCode =>
194 | runtimeType.hashCode ^
195 | const DeepCollectionEquality().hash(id) ^
196 | const DeepCollectionEquality().hash(summary) ^
197 | const DeepCollectionEquality().hash(title) ^
198 | const DeepCollectionEquality().hash(image);
199 |
200 | @JsonKey(ignore: true)
201 | @override
202 | _$ArticleMiniCopyWith<_ArticleMini> get copyWith =>
203 | __$ArticleMiniCopyWithImpl<_ArticleMini>(this, _$identity);
204 |
205 | @override
206 | Map toJson() {
207 | return _$_$_ArticleMiniToJson(this);
208 | }
209 | }
210 |
211 | abstract class _ArticleMini implements ArticleMini {
212 | const factory _ArticleMini(
213 | {int id, String summary, String title, String image}) = _$_ArticleMini;
214 |
215 | factory _ArticleMini.fromJson(Map json) =
216 | _$_ArticleMini.fromJson;
217 |
218 | @override
219 | int get id => throw _privateConstructorUsedError;
220 | @override
221 | String get summary => throw _privateConstructorUsedError;
222 | @override
223 | String get title => throw _privateConstructorUsedError;
224 | @override
225 | String get image => throw _privateConstructorUsedError;
226 | @override
227 | @JsonKey(ignore: true)
228 | _$ArticleMiniCopyWith<_ArticleMini> get copyWith =>
229 | throw _privateConstructorUsedError;
230 | }
231 |
--------------------------------------------------------------------------------
/lib/infrastructure/articles/models/article.model.freezed.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides
3 |
4 | part of 'article.model.dart';
5 |
6 | // **************************************************************************
7 | // FreezedGenerator
8 | // **************************************************************************
9 |
10 | T _$identity(T value) => value;
11 |
12 | final _privateConstructorUsedError = UnsupportedError(
13 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
14 |
15 | Article _$ArticleFromJson(Map json) {
16 | return _Article.fromJson(json);
17 | }
18 |
19 | /// @nodoc
20 | class _$ArticleTearOff {
21 | const _$ArticleTearOff();
22 |
23 | _Article call(
24 | {int id = -1,
25 | String title = '',
26 | String content = '',
27 | String imageFileName = '',
28 | String shortDescription = ''}) {
29 | return _Article(
30 | id: id,
31 | title: title,
32 | content: content,
33 | imageFileName: imageFileName,
34 | shortDescription: shortDescription,
35 | );
36 | }
37 |
38 | Article fromJson(Map json) {
39 | return Article.fromJson(json);
40 | }
41 | }
42 |
43 | /// @nodoc
44 | const $Article = _$ArticleTearOff();
45 |
46 | /// @nodoc
47 | mixin _$Article {
48 | int get id => throw _privateConstructorUsedError;
49 | String get title => throw _privateConstructorUsedError;
50 | String get content => throw _privateConstructorUsedError;
51 | String get imageFileName => throw _privateConstructorUsedError;
52 | String get shortDescription => throw _privateConstructorUsedError;
53 |
54 | Map toJson() => throw _privateConstructorUsedError;
55 | @JsonKey(ignore: true)
56 | $ArticleCopyWith get copyWith => throw _privateConstructorUsedError;
57 | }
58 |
59 | /// @nodoc
60 | abstract class $ArticleCopyWith<$Res> {
61 | factory $ArticleCopyWith(Article value, $Res Function(Article) then) =
62 | _$ArticleCopyWithImpl<$Res>;
63 | $Res call(
64 | {int id,
65 | String title,
66 | String content,
67 | String imageFileName,
68 | String shortDescription});
69 | }
70 |
71 | /// @nodoc
72 | class _$ArticleCopyWithImpl<$Res> implements $ArticleCopyWith<$Res> {
73 | _$ArticleCopyWithImpl(this._value, this._then);
74 |
75 | final Article _value;
76 | // ignore: unused_field
77 | final $Res Function(Article) _then;
78 |
79 | @override
80 | $Res call({
81 | Object? id = freezed,
82 | Object? title = freezed,
83 | Object? content = freezed,
84 | Object? imageFileName = freezed,
85 | Object? shortDescription = freezed,
86 | }) {
87 | return _then(_value.copyWith(
88 | id: id == freezed
89 | ? _value.id
90 | : id // ignore: cast_nullable_to_non_nullable
91 | as int,
92 | title: title == freezed
93 | ? _value.title
94 | : title // ignore: cast_nullable_to_non_nullable
95 | as String,
96 | content: content == freezed
97 | ? _value.content
98 | : content // ignore: cast_nullable_to_non_nullable
99 | as String,
100 | imageFileName: imageFileName == freezed
101 | ? _value.imageFileName
102 | : imageFileName // ignore: cast_nullable_to_non_nullable
103 | as String,
104 | shortDescription: shortDescription == freezed
105 | ? _value.shortDescription
106 | : shortDescription // ignore: cast_nullable_to_non_nullable
107 | as String,
108 | ));
109 | }
110 | }
111 |
112 | /// @nodoc
113 | abstract class _$ArticleCopyWith<$Res> implements $ArticleCopyWith<$Res> {
114 | factory _$ArticleCopyWith(_Article value, $Res Function(_Article) then) =
115 | __$ArticleCopyWithImpl<$Res>;
116 | @override
117 | $Res call(
118 | {int id,
119 | String title,
120 | String content,
121 | String imageFileName,
122 | String shortDescription});
123 | }
124 |
125 | /// @nodoc
126 | class __$ArticleCopyWithImpl<$Res> extends _$ArticleCopyWithImpl<$Res>
127 | implements _$ArticleCopyWith<$Res> {
128 | __$ArticleCopyWithImpl(_Article _value, $Res Function(_Article) _then)
129 | : super(_value, (v) => _then(v as _Article));
130 |
131 | @override
132 | _Article get _value => super._value as _Article;
133 |
134 | @override
135 | $Res call({
136 | Object? id = freezed,
137 | Object? title = freezed,
138 | Object? content = freezed,
139 | Object? imageFileName = freezed,
140 | Object? shortDescription = freezed,
141 | }) {
142 | return _then(_Article(
143 | id: id == freezed
144 | ? _value.id
145 | : id // ignore: cast_nullable_to_non_nullable
146 | as int,
147 | title: title == freezed
148 | ? _value.title
149 | : title // ignore: cast_nullable_to_non_nullable
150 | as String,
151 | content: content == freezed
152 | ? _value.content
153 | : content // ignore: cast_nullable_to_non_nullable
154 | as String,
155 | imageFileName: imageFileName == freezed
156 | ? _value.imageFileName
157 | : imageFileName // ignore: cast_nullable_to_non_nullable
158 | as String,
159 | shortDescription: shortDescription == freezed
160 | ? _value.shortDescription
161 | : shortDescription // ignore: cast_nullable_to_non_nullable
162 | as String,
163 | ));
164 | }
165 | }
166 |
167 | @JsonSerializable(explicitToJson: true)
168 |
169 | /// @nodoc
170 | class _$_Article implements _Article {
171 | const _$_Article(
172 | {this.id = -1,
173 | this.title = '',
174 | this.content = '',
175 | this.imageFileName = '',
176 | this.shortDescription = ''});
177 |
178 | factory _$_Article.fromJson(Map json) =>
179 | _$_$_ArticleFromJson(json);
180 |
181 | @JsonKey(defaultValue: -1)
182 | @override
183 | final int id;
184 | @JsonKey(defaultValue: '')
185 | @override
186 | final String title;
187 | @JsonKey(defaultValue: '')
188 | @override
189 | final String content;
190 | @JsonKey(defaultValue: '')
191 | @override
192 | final String imageFileName;
193 | @JsonKey(defaultValue: '')
194 | @override
195 | final String shortDescription;
196 |
197 | @override
198 | String toString() {
199 | return 'Article(id: $id, title: $title, content: $content, imageFileName: $imageFileName, shortDescription: $shortDescription)';
200 | }
201 |
202 | @override
203 | bool operator ==(dynamic other) {
204 | return identical(this, other) ||
205 | (other is _Article &&
206 | (identical(other.id, id) ||
207 | const DeepCollectionEquality().equals(other.id, id)) &&
208 | (identical(other.title, title) ||
209 | const DeepCollectionEquality().equals(other.title, title)) &&
210 | (identical(other.content, content) ||
211 | const DeepCollectionEquality()
212 | .equals(other.content, content)) &&
213 | (identical(other.imageFileName, imageFileName) ||
214 | const DeepCollectionEquality()
215 | .equals(other.imageFileName, imageFileName)) &&
216 | (identical(other.shortDescription, shortDescription) ||
217 | const DeepCollectionEquality()
218 | .equals(other.shortDescription, shortDescription)));
219 | }
220 |
221 | @override
222 | int get hashCode =>
223 | runtimeType.hashCode ^
224 | const DeepCollectionEquality().hash(id) ^
225 | const DeepCollectionEquality().hash(title) ^
226 | const DeepCollectionEquality().hash(content) ^
227 | const DeepCollectionEquality().hash(imageFileName) ^
228 | const DeepCollectionEquality().hash(shortDescription);
229 |
230 | @JsonKey(ignore: true)
231 | @override
232 | _$ArticleCopyWith<_Article> get copyWith =>
233 | __$ArticleCopyWithImpl<_Article>(this, _$identity);
234 |
235 | @override
236 | Map toJson() {
237 | return _$_$_ArticleToJson(this);
238 | }
239 | }
240 |
241 | abstract class _Article implements Article {
242 | const factory _Article(
243 | {int id,
244 | String title,
245 | String content,
246 | String imageFileName,
247 | String shortDescription}) = _$_Article;
248 |
249 | factory _Article.fromJson(Map json) = _$_Article.fromJson;
250 |
251 | @override
252 | int get id => throw _privateConstructorUsedError;
253 | @override
254 | String get title => throw _privateConstructorUsedError;
255 | @override
256 | String get content => throw _privateConstructorUsedError;
257 | @override
258 | String get imageFileName => throw _privateConstructorUsedError;
259 | @override
260 | String get shortDescription => throw _privateConstructorUsedError;
261 | @override
262 | @JsonKey(ignore: true)
263 | _$ArticleCopyWith<_Article> get copyWith =>
264 | throw _privateConstructorUsedError;
265 | }
266 |
--------------------------------------------------------------------------------
/lib/infrastructure/shared/models/validation_result.model.freezed.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides
3 |
4 | part of 'validation_result.model.dart';
5 |
6 | // **************************************************************************
7 | // FreezedGenerator
8 | // **************************************************************************
9 |
10 | T _$identity(T value) => value;
11 |
12 | final _privateConstructorUsedError = UnsupportedError(
13 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
14 |
15 | /// @nodoc
16 | class _$ValidationResultTearOff {
17 | const _$ValidationResultTearOff();
18 |
19 | ValidationSuccess success({required S data}) {
20 | return ValidationSuccess(
21 | data: data,
22 | );
23 | }
24 |
25 | ValidationFailure failure({required F data}) {
26 | return ValidationFailure(
27 | data: data,
28 | );
29 | }
30 | }
31 |
32 | /// @nodoc
33 | const $ValidationResult = _$ValidationResultTearOff();
34 |
35 | /// @nodoc
36 | mixin _$ValidationResult {
37 | @optionalTypeArgs
38 | TResult when({
39 | required TResult Function(S data) success,
40 | required TResult Function(F data) failure,
41 | }) =>
42 | throw _privateConstructorUsedError;
43 | @optionalTypeArgs
44 | TResult maybeWhen({
45 | TResult Function(S data)? success,
46 | TResult Function(F data)? failure,
47 | required TResult orElse(),
48 | }) =>
49 | throw _privateConstructorUsedError;
50 | @optionalTypeArgs
51 | TResult map({
52 | required TResult Function(ValidationSuccess value) success,
53 | required TResult Function(ValidationFailure value) failure,
54 | }) =>
55 | throw _privateConstructorUsedError;
56 | @optionalTypeArgs
57 | TResult maybeMap({
58 | TResult Function(ValidationSuccess value)? success,
59 | TResult Function(ValidationFailure value)? failure,
60 | required TResult orElse(),
61 | }) =>
62 | throw _privateConstructorUsedError;
63 | }
64 |
65 | /// @nodoc
66 | abstract class $ValidationResultCopyWith {
67 | factory $ValidationResultCopyWith(ValidationResult value,
68 | $Res Function(ValidationResult) then) =
69 | _$ValidationResultCopyWithImpl;
70 | }
71 |
72 | /// @nodoc
73 | class _$ValidationResultCopyWithImpl
74 | implements $ValidationResultCopyWith {
75 | _$ValidationResultCopyWithImpl(this._value, this._then);
76 |
77 | final ValidationResult _value;
78 | // ignore: unused_field
79 | final $Res Function(ValidationResult) _then;
80 | }
81 |
82 | /// @nodoc
83 | abstract class $ValidationSuccessCopyWith {
84 | factory $ValidationSuccessCopyWith(ValidationSuccess value,
85 | $Res Function(ValidationSuccess) then) =
86 | _$ValidationSuccessCopyWithImpl;
87 | $Res call({S data});
88 | }
89 |
90 | /// @nodoc
91 | class _$ValidationSuccessCopyWithImpl
92 | extends _$ValidationResultCopyWithImpl
93 | implements $ValidationSuccessCopyWith {
94 | _$ValidationSuccessCopyWithImpl(ValidationSuccess _value,
95 | $Res Function(ValidationSuccess) _then)
96 | : super(_value, (v) => _then(v as ValidationSuccess));
97 |
98 | @override
99 | ValidationSuccess get _value => super._value as ValidationSuccess;
100 |
101 | @override
102 | $Res call({
103 | Object? data = freezed,
104 | }) {
105 | return _then(ValidationSuccess(
106 | data: data == freezed
107 | ? _value.data
108 | : data // ignore: cast_nullable_to_non_nullable
109 | as S,
110 | ));
111 | }
112 | }
113 |
114 | /// @nodoc
115 | class _$ValidationSuccess implements ValidationSuccess {
116 | const _$ValidationSuccess({required this.data});
117 |
118 | @override
119 | final S data;
120 |
121 | @override
122 | String toString() {
123 | return 'ValidationResult<$S, $F>.success(data: $data)';
124 | }
125 |
126 | @override
127 | bool operator ==(dynamic other) {
128 | return identical(this, other) ||
129 | (other is ValidationSuccess &&
130 | (identical(other.data, data) ||
131 | const DeepCollectionEquality().equals(other.data, data)));
132 | }
133 |
134 | @override
135 | int get hashCode =>
136 | runtimeType.hashCode ^ const DeepCollectionEquality().hash(data);
137 |
138 | @JsonKey(ignore: true)
139 | @override
140 | $ValidationSuccessCopyWith> get copyWith =>
141 | _$ValidationSuccessCopyWithImpl>(
142 | this, _$identity);
143 |
144 | @override
145 | @optionalTypeArgs
146 | TResult when({
147 | required TResult Function(S data) success,
148 | required TResult Function(F data) failure,
149 | }) {
150 | return success(data);
151 | }
152 |
153 | @override
154 | @optionalTypeArgs
155 | TResult maybeWhen({
156 | TResult Function(S data)? success,
157 | TResult Function(F data)? failure,
158 | required TResult orElse(),
159 | }) {
160 | if (success != null) {
161 | return success(data);
162 | }
163 | return orElse();
164 | }
165 |
166 | @override
167 | @optionalTypeArgs
168 | TResult map({
169 | required TResult Function(ValidationSuccess value) success,
170 | required TResult Function(ValidationFailure value) failure,
171 | }) {
172 | return success(this);
173 | }
174 |
175 | @override
176 | @optionalTypeArgs
177 | TResult maybeMap({
178 | TResult Function(ValidationSuccess value)? success,
179 | TResult Function(ValidationFailure value)? failure,
180 | required TResult orElse(),
181 | }) {
182 | if (success != null) {
183 | return success(this);
184 | }
185 | return orElse();
186 | }
187 | }
188 |
189 | abstract class ValidationSuccess implements ValidationResult {
190 | const factory ValidationSuccess({required S data}) =
191 | _$ValidationSuccess;
192 |
193 | S get data => throw _privateConstructorUsedError;
194 | @JsonKey(ignore: true)
195 | $ValidationSuccessCopyWith> get copyWith =>
196 | throw _privateConstructorUsedError;
197 | }
198 |
199 | /// @nodoc
200 | abstract class $ValidationFailureCopyWith {
201 | factory $ValidationFailureCopyWith(ValidationFailure value,
202 | $Res Function(ValidationFailure) then) =
203 | _$ValidationFailureCopyWithImpl;
204 | $Res call({F data});
205 | }
206 |
207 | /// @nodoc
208 | class _$ValidationFailureCopyWithImpl
209 | extends _$ValidationResultCopyWithImpl
210 | implements $ValidationFailureCopyWith {
211 | _$ValidationFailureCopyWithImpl(ValidationFailure _value,
212 | $Res Function(ValidationFailure) _then)
213 | : super(_value, (v) => _then(v as ValidationFailure));
214 |
215 | @override
216 | ValidationFailure get _value => super._value as ValidationFailure;
217 |
218 | @override
219 | $Res call({
220 | Object? data = freezed,
221 | }) {
222 | return _then(ValidationFailure(
223 | data: data == freezed
224 | ? _value.data
225 | : data // ignore: cast_nullable_to_non_nullable
226 | as F,
227 | ));
228 | }
229 | }
230 |
231 | /// @nodoc
232 | class _$ValidationFailure implements ValidationFailure {
233 | const _$ValidationFailure({required this.data});
234 |
235 | @override
236 | final F data;
237 |
238 | @override
239 | String toString() {
240 | return 'ValidationResult<$S, $F>.failure(data: $data)';
241 | }
242 |
243 | @override
244 | bool operator ==(dynamic other) {
245 | return identical(this, other) ||
246 | (other is ValidationFailure &&
247 | (identical(other.data, data) ||
248 | const DeepCollectionEquality().equals(other.data, data)));
249 | }
250 |
251 | @override
252 | int get hashCode =>
253 | runtimeType.hashCode ^ const DeepCollectionEquality().hash(data);
254 |
255 | @JsonKey(ignore: true)
256 | @override
257 | $ValidationFailureCopyWith> get copyWith =>
258 | _$ValidationFailureCopyWithImpl>(
259 | this, _$identity);
260 |
261 | @override
262 | @optionalTypeArgs
263 | TResult when({
264 | required TResult Function(S data) success,
265 | required TResult Function(F data) failure,
266 | }) {
267 | return failure(data);
268 | }
269 |
270 | @override
271 | @optionalTypeArgs
272 | TResult maybeWhen({
273 | TResult Function(S data)? success,
274 | TResult Function(F data)? failure,
275 | required TResult orElse(),
276 | }) {
277 | if (failure != null) {
278 | return failure(data);
279 | }
280 | return orElse();
281 | }
282 |
283 | @override
284 | @optionalTypeArgs
285 | TResult map({
286 | required TResult Function(ValidationSuccess value) success,
287 | required TResult Function(ValidationFailure value) failure,
288 | }) {
289 | return failure(this);
290 | }
291 |
292 | @override
293 | @optionalTypeArgs
294 | TResult maybeMap({
295 | TResult Function(ValidationSuccess value)? success,
296 | TResult Function(ValidationFailure value)? failure,
297 | required TResult orElse(),
298 | }) {
299 | if (failure != null) {
300 | return failure(this);
301 | }
302 | return orElse();
303 | }
304 | }
305 |
306 | abstract class ValidationFailure implements ValidationResult {
307 | const factory ValidationFailure({required F data}) =
308 | _$ValidationFailure;
309 |
310 | F get data => throw _privateConstructorUsedError;
311 | @JsonKey(ignore: true)
312 | $ValidationFailureCopyWith> get copyWith =>
313 | throw _privateConstructorUsedError;
314 | }
315 |
--------------------------------------------------------------------------------
/lib/infrastructure/http/models/api_result.model.freezed.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides
3 |
4 | part of 'api_result.model.dart';
5 |
6 | // **************************************************************************
7 | // FreezedGenerator
8 | // **************************************************************************
9 |
10 | T _$identity(T value) => value;
11 |
12 | final _privateConstructorUsedError = UnsupportedError(
13 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
14 |
15 | /// @nodoc
16 | class _$ApiResponseTearOff {
17 | const _$ApiResponseTearOff();
18 |
19 | ApiResult success({required T data}) {
20 | return ApiResult(
21 | data: data,
22 | );
23 | }
24 |
25 | ApiFailure failure({required ApiException exception, String? caption}) {
26 | return ApiFailure(
27 | exception: exception,
28 | caption: caption,
29 | );
30 | }
31 | }
32 |
33 | /// @nodoc
34 | const $ApiResponse = _$ApiResponseTearOff();
35 |
36 | /// @nodoc
37 | mixin _$ApiResponse {
38 | @optionalTypeArgs
39 | TResult when({
40 | required TResult Function(T data) success,
41 | required TResult Function(ApiException exception, String? caption) failure,
42 | }) =>
43 | throw _privateConstructorUsedError;
44 | @optionalTypeArgs
45 | TResult maybeWhen({
46 | TResult Function(T data)? success,
47 | TResult Function(ApiException exception, String? caption)? failure,
48 | required TResult orElse(),
49 | }) =>
50 | throw _privateConstructorUsedError;
51 | @optionalTypeArgs
52 | TResult map({
53 | required TResult Function(ApiResult value) success,
54 | required TResult Function(ApiFailure value) failure,
55 | }) =>
56 | throw _privateConstructorUsedError;
57 | @optionalTypeArgs
58 | TResult maybeMap({
59 | TResult Function(ApiResult value)? success,
60 | TResult Function(ApiFailure value)? failure,
61 | required TResult orElse(),
62 | }) =>
63 | throw _privateConstructorUsedError;
64 | }
65 |
66 | /// @nodoc
67 | abstract class $ApiResponseCopyWith {
68 | factory $ApiResponseCopyWith(
69 | ApiResponse value, $Res Function(ApiResponse) then) =
70 | _$ApiResponseCopyWithImpl;
71 | }
72 |
73 | /// @nodoc
74 | class _$ApiResponseCopyWithImpl
75 | implements $ApiResponseCopyWith