├── .gitattributes ├── .gitignore ├── .run └── Template Flutter.run.xml ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── bloc_clean_coding │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── 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 │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── bloc_clean_coding_android.iml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── bloc_clean_coding.iml ├── devtools_options.yaml ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ ├── dev.xcscheme │ │ └── prod.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── 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-83.5x83.5@2x.png │ │ ├── Contents.json │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── RunnerTests │ └── RunnerTests.swift ├── l10n.yaml ├── lib ├── bloc │ ├── login_bloc │ │ ├── login_bloc.dart │ │ ├── login_events.dart │ │ └── login_states.dart │ └── movies_bloc │ │ ├── movies_bloc.dart │ │ ├── movies_event.dart │ │ └── movies_state.dart ├── configs │ ├── color │ │ └── color.dart │ ├── components │ │ ├── internet_exception_widget.dart │ │ ├── loading_widget.dart │ │ ├── network_image_widget.dart │ │ └── round_button.dart │ ├── routes │ │ ├── routes.dart │ │ └── routes_name.dart │ └── themes │ │ ├── dark_theme.dart │ │ ├── light_theme.dart │ │ ├── theme_config.dart │ │ └── themes.dart ├── data │ ├── exception │ │ └── app_exceptions.dart │ ├── network │ │ ├── base_api_services.dart │ │ ├── network.dart │ │ └── network_api_services.dart │ └── response │ │ ├── api_response.dart │ │ ├── response.dart │ │ └── status.dart ├── dependency_injection │ ├── dependency_injection.dart │ └── locator.dart ├── l10n │ ├── app_en.arb │ └── app_es.arb ├── main.dart ├── model │ ├── movie_list │ │ ├── movie_list_model.dart │ │ ├── movie_list_model.freezed.dart │ │ └── movie_list_model.g.dart │ └── user │ │ ├── user_model.dart │ │ ├── user_model.freezed.dart │ │ └── user_model.g.dart ├── repository │ ├── auth_api │ │ ├── auth_api_repository.dart │ │ ├── auth_http_api_repository.dart │ │ ├── auth_mock_api_repository.dart │ │ └── auth_repository.dart │ └── movies_api │ │ ├── movies_api_repository.dart │ │ ├── movies_http_api_repository.dart │ │ ├── movies_mock_api_repository.dart │ │ └── movies_repository.dart ├── services │ ├── session_manager │ │ └── session_controller.dart │ ├── splash │ │ └── splash_services.dart │ └── storage │ │ └── local_storage.dart ├── utils │ ├── app_url.dart │ ├── enums.dart │ └── extensions │ │ ├── flush_bar_extension.dart │ │ ├── general_ectensions.dart │ │ └── validations_exception.dart └── view │ ├── login │ ├── login_screen.dart │ └── widget │ │ ├── email_input_widget.dart │ │ ├── password_input_widget.dart │ │ ├── submit_button_widget.dart │ │ └── widgets.dart │ ├── movies │ ├── movies_screen.dart │ └── widget │ │ ├── error_widget.dart │ │ ├── logout_button_widget.dart │ │ └── widgets.dart │ ├── splash │ └── splash_view.dart │ └── views.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── DerivedData │ └── Runner │ │ ├── Logs │ │ ├── Launch │ │ │ └── LogStoreManifest.plist │ │ ├── Localization │ │ │ └── LogStoreManifest.plist │ │ ├── Package │ │ │ └── LogStoreManifest.plist │ │ └── Test │ │ │ └── LogStoreManifest.plist │ │ └── info.plist ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── RunnerTests │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test └── login │ └── login_bloc │ ├── login_bloc_test.dart │ ├── login_event_test.dart │ └── login_state_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .dart_tool 2 | build 3 | .idea 4 | .flutter-plugins 5 | .flutter-plugins-dependencies 6 | # Miscellaneous 7 | *.class 8 | *.log 9 | *.pyc 10 | *.swp 11 | .DS_Store 12 | .atom/ 13 | .buildlog/ 14 | .history 15 | .svn/ 16 | 17 | # IntelliJ related 18 | *.iml 19 | *.ipr 20 | *.iws 21 | .idea/ 22 | 23 | # Visual Studio Code related 24 | .vscode/ 25 | 26 | # Flutter/Dart/Pub related 27 | **/doc/api/ 28 | .dart_tool/ 29 | .flutter-plugins 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Android related 36 | **/android/**/gradle-wrapper.jar 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/gradlew 40 | **/android/gradlew.bat 41 | **/android/local.properties 42 | **/android/**/GeneratedPluginRegistrant.java 43 | 44 | # iOS/XCode related 45 | **/ios/**/*.mode1v3 46 | **/ios/**/*.mode2v3 47 | **/ios/**/*.moved-aside 48 | **/ios/**/*.pbxuser 49 | **/ios/**/*.perspectivev3 50 | **/ios/**/*sync/ 51 | **/ios/**/.sconsign.dblite 52 | **/ios/**/.tags* 53 | **/ios/**/.vagrant/ 54 | **/ios/**/DerivedData/ 55 | **/ios/**/Icon? 56 | **/ios/**/Pods/ 57 | **/ios/**/.symlinks/ 58 | **/ios/**/profile 59 | **/ios/**/xcuserdata 60 | **/ios/.generated/ 61 | **/ios/Flutter/App.framework 62 | **/ios/Flutter/Flutter.framework 63 | **/ios/Flutter/Generated.xcconfig 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | -------------------------------------------------------------------------------- /.run/Template Flutter.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bloc_clean_coding 2 | 3 | We're using 3rd party services API's: 4 | 5 | Login details: 6 | 7 | Email: eve.holt@reqres.in 8 | 9 | Password: cityslicka 10 | 11 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | avoid_print: true # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | analyzer: 27 | exclude: 28 | - "**/*.g.dart" 29 | - "**/*.freezed.dart" 30 | errors: 31 | invalid_annotation_target: ignore 32 | # Additional information about this file can be found at 33 | # https://dart.dev/guides/language/analysis-options 34 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.bloc_clean_coding" 27 | compileSdk flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.bloc_clean_coding" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | flavorDimensions "app" 55 | productFlavors { 56 | dev { 57 | dimension "app" 58 | resValue "Sting" , "app_name" , "Dev Flavour Test" 59 | versionNameSuffix "-dev" , 60 | applicationId 'com.example.bloc_clean_coding' 61 | } 62 | 63 | production { 64 | dimension "app" 65 | resValue "Sting" , "app_name" , "Flavour Test" , 66 | applicationId "com.example.bloc_clean_coding" 67 | } 68 | } 69 | buildTypes { 70 | release { 71 | // TODO: Add your own signing config for the release build. 72 | // Signing with the debug keys for now, so `flutter run --release` works. 73 | signingConfig signingConfigs.debug 74 | } 75 | } 76 | } 77 | 78 | flutter { 79 | source '../..' 80 | } 81 | 82 | dependencies {} 83 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/bloc_clean_coding/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.bloc_clean_coding 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/bloc_clean_coding_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | } 19 | 20 | plugins { 21 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 22 | id "com.android.application" version "7.3.0" apply false 23 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 24 | } 25 | 26 | include ":app" 27 | -------------------------------------------------------------------------------- /bloc_clean_coding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /devtools_options.yaml: -------------------------------------------------------------------------------- 1 | description: This file stores settings for Dart & Flutter DevTools. 2 | documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states 3 | extensions: 4 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_localization (0.0.1): 4 | - Flutter 5 | - flutter_secure_storage (6.0.0): 6 | - Flutter 7 | - fluttertoast (0.0.2): 8 | - Flutter 9 | - Toast 10 | - path_provider_foundation (0.0.1): 11 | - Flutter 12 | - FlutterMacOS 13 | - shared_preferences_foundation (0.0.1): 14 | - Flutter 15 | - FlutterMacOS 16 | - sqflite_darwin (0.0.4): 17 | - Flutter 18 | - FlutterMacOS 19 | - Toast (4.1.1) 20 | 21 | DEPENDENCIES: 22 | - Flutter (from `Flutter`) 23 | - flutter_localization (from `.symlinks/plugins/flutter_localization/ios`) 24 | - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) 25 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) 26 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) 27 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) 28 | - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) 29 | 30 | SPEC REPOS: 31 | trunk: 32 | - Toast 33 | 34 | EXTERNAL SOURCES: 35 | Flutter: 36 | :path: Flutter 37 | flutter_localization: 38 | :path: ".symlinks/plugins/flutter_localization/ios" 39 | flutter_secure_storage: 40 | :path: ".symlinks/plugins/flutter_secure_storage/ios" 41 | fluttertoast: 42 | :path: ".symlinks/plugins/fluttertoast/ios" 43 | path_provider_foundation: 44 | :path: ".symlinks/plugins/path_provider_foundation/darwin" 45 | shared_preferences_foundation: 46 | :path: ".symlinks/plugins/shared_preferences_foundation/darwin" 47 | sqflite_darwin: 48 | :path: ".symlinks/plugins/sqflite_darwin/darwin" 49 | 50 | SPEC CHECKSUMS: 51 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 52 | flutter_localization: f43b18844a2b3d2c71fd64f04ffd6b1e64dd54d4 53 | flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 54 | fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c 55 | path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 56 | shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 57 | sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d 58 | Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e 59 | 60 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 61 | 62 | COCOAPODS: 1.16.2 63 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/dev.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 16 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/prod.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/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/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | CFBundleDisplayName 8 | $(APP_DISPLAY_NAME) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | riverpod_tut 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /l10n.yaml: -------------------------------------------------------------------------------- 1 | arb-dir: lib/l10n 2 | template-arb-file: app_en.arb 3 | output-localization-file: app_localizations.dart -------------------------------------------------------------------------------- /lib/bloc/login_bloc/login_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:bloc_clean_coding/data/response/api_response.dart'; 5 | import 'package:equatable/equatable.dart'; 6 | 7 | import '../../repository/auth_api/auth_api_repository.dart'; 8 | import '../../services/session_manager/session_controller.dart'; 9 | part 'login_events.dart'; 10 | part 'login_states.dart'; 11 | 12 | class LoginBloc extends Bloc { 13 | AuthApiRepository authApiRepository; 14 | 15 | LoginBloc({required this.authApiRepository}) : super(const LoginStates()) { 16 | on(_onEmailChanged); 17 | on(_onPasswordChanged); 18 | on(_onFormSubmitted); 19 | } 20 | 21 | void _onEmailChanged(EmailChanged event, Emitter emit) { 22 | emit( 23 | state.copyWith( 24 | email: event.email, 25 | ), 26 | ); 27 | } 28 | 29 | void _onPasswordChanged(PasswordChanged event, Emitter emit) { 30 | emit( 31 | state.copyWith( 32 | password: event.password, 33 | ), 34 | ); 35 | } 36 | 37 | Future _onFormSubmitted( 38 | LoginApi event, 39 | Emitter emit, 40 | ) async { 41 | Map data = { 42 | 'email': state.email, 43 | 'password': state.password, 44 | }; 45 | emit(state.copyWith(loginApi: const ApiResponse.loading())); 46 | 47 | await authApiRepository.loginApi(data).then((value) async { 48 | if (value.error.isNotEmpty) { 49 | emit(state.copyWith(loginApi: ApiResponse.error(value.error))); 50 | } else { 51 | await SessionController().saveUserInPreference(value); 52 | await SessionController().getUserFromPreference(); 53 | emit(state.copyWith(loginApi: const ApiResponse.completed('lOGIN'))); 54 | } 55 | }).onError((error, stackTrace) { 56 | emit(state.copyWith(loginApi: ApiResponse.error(error.toString()))); 57 | }); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/bloc/login_bloc/login_events.dart: -------------------------------------------------------------------------------- 1 | part of 'login_bloc.dart'; 2 | 3 | sealed class LoginEvents extends Equatable { 4 | const LoginEvents(); 5 | @override 6 | List get props => []; 7 | } 8 | 9 | class EmailChanged extends LoginEvents { 10 | final String email; 11 | const EmailChanged({required this.email}); 12 | @override 13 | List get props => [email]; 14 | } 15 | 16 | class PasswordChanged extends LoginEvents { 17 | final String password; 18 | const PasswordChanged({required this.password}); 19 | 20 | @override 21 | List get props => [password]; 22 | } 23 | 24 | class LoginApi extends LoginEvents { 25 | const LoginApi() ; 26 | } 27 | -------------------------------------------------------------------------------- /lib/bloc/login_bloc/login_states.dart: -------------------------------------------------------------------------------- 1 | part of 'login_bloc.dart'; 2 | 3 | 4 | class LoginStates extends Equatable { 5 | const LoginStates({ 6 | this.email = '', 7 | this.password = '', 8 | this.loginApi = const ApiResponse.completed(''), 9 | }); 10 | 11 | final String email; 12 | final String password; 13 | final ApiResponse loginApi; 14 | 15 | LoginStates copyWith({ 16 | String? email, 17 | String? password, 18 | ApiResponse? loginApi 19 | }) { 20 | return LoginStates( 21 | email: email ?? this.email, 22 | password: password ?? this.password, 23 | loginApi: loginApi ?? this.loginApi 24 | ); 25 | } 26 | 27 | @override 28 | List get props => [email, password, loginApi]; 29 | } 30 | -------------------------------------------------------------------------------- /lib/bloc/movies_bloc/movies_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:bloc_clean_coding/data/response/api_response.dart'; 5 | import 'package:bloc_clean_coding/data/response/response.dart'; 6 | import 'package:bloc_clean_coding/repository/movies_api/movies_api_repository.dart'; 7 | import 'package:equatable/equatable.dart'; 8 | import 'package:flutter/foundation.dart'; 9 | 10 | import '../../model/movie_list/movie_list_model.dart'; 11 | 12 | part 'movies_event.dart'; 13 | part 'movies_state.dart'; 14 | 15 | class MoviesBloc extends Bloc { 16 | MoviesApiRepository moviesApiRepository; 17 | MoviesBloc({required this.moviesApiRepository}) : super(MoviesState(moviesList: ApiResponse.loading())) { 18 | on(fetchMoviesListApi); 19 | } 20 | 21 | Future fetchMoviesListApi(MoviesFetch event, Emitter emit) async { 22 | await moviesApiRepository.fetchMoviesList().then((response) { 23 | emit(state.copyWith( 24 | moviesList: ApiResponse.completed(response), 25 | )); 26 | }).onError((error, stackTrace) { 27 | if (kDebugMode) { 28 | print(stackTrace); 29 | print(error); 30 | } 31 | 32 | emit(state.copyWith( 33 | moviesList: ApiResponse.error(error.toString()), 34 | )); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/bloc/movies_bloc/movies_event.dart: -------------------------------------------------------------------------------- 1 | part of 'movies_bloc.dart'; 2 | 3 | abstract class MoviesEvent {} 4 | 5 | class MoviesFetch extends MoviesEvent {} 6 | -------------------------------------------------------------------------------- /lib/bloc/movies_bloc/movies_state.dart: -------------------------------------------------------------------------------- 1 | part of 'movies_bloc.dart'; 2 | 3 | 4 | class MoviesState extends Equatable { 5 | 6 | const MoviesState({ 7 | required this.moviesList , 8 | }) ; 9 | 10 | final ApiResponse moviesList ; 11 | 12 | MoviesState copyWith({ 13 | ApiResponse? moviesList, 14 | }) { 15 | return MoviesState( 16 | moviesList: moviesList ?? this.moviesList, 17 | ); 18 | } 19 | 20 | @override 21 | // TODO: implement props 22 | List get props => [moviesList]; 23 | 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/configs/color/color.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | class AppColors { 5 | 6 | static const Color blackColor = Color(0x0ff00000); 7 | static const Color whiteColor = Color(0xFFFFFFFF); 8 | static const Color buttonColor = Colors.green; 9 | 10 | } -------------------------------------------------------------------------------- /lib/configs/components/internet_exception_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class InterNetExceptionWidget extends StatefulWidget { 4 | final VoidCallback onPress; 5 | const InterNetExceptionWidget({super.key, required this.onPress}); 6 | 7 | @override 8 | State createState() => _InterNetExceptionWidgetState(); 9 | } 10 | 11 | class _InterNetExceptionWidgetState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Padding( 15 | padding: const EdgeInsets.symmetric(horizontal: 20), 16 | child: Column( 17 | children: [ 18 | SizedBox(height: MediaQuery.of(context).size.height * .15), 19 | const Icon( 20 | Icons.cloud_off, 21 | color: Colors.red, 22 | size: 50, 23 | ), 24 | Padding( 25 | padding: const EdgeInsets.only(top: 30), 26 | child: Center( 27 | child: Text('We’re unable to show results.\nPlease check your data\nconnection.', textAlign: TextAlign.center, style: Theme.of(context).textTheme.displayMedium!.copyWith(fontSize: 20)), 28 | ), 29 | ), 30 | SizedBox(height: MediaQuery.of(context).size.height * .15), 31 | ElevatedButton( 32 | onPressed: widget.onPress, 33 | child: Center( 34 | child: Text( 35 | 'RETRY', 36 | style: Theme.of(context).textTheme.bodySmall, 37 | ), 38 | ), 39 | ) 40 | ], 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/configs/components/loading_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io' show Platform; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | //custom loading widget, we will used this widget show user some action depending on it's need 7 | // this widget is generic, we can change it and this change will appear across the app 8 | class LoadingWidget extends StatelessWidget { 9 | final double size; 10 | const LoadingWidget({super.key, this.size = 36.0}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Center( 15 | child: SizedBox( 16 | width: size, 17 | height: size, 18 | child: Platform.isIOS 19 | ? const CupertinoActivityIndicator( 20 | ) 21 | : const CircularProgressIndicator( 22 | strokeWidth: 2.0, 23 | color: Colors.blue, 24 | ), 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/configs/components/network_image_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'loading_widget.dart'; 4 | 5 | //custom network image widget, we will used this widget show images, also handled exceptions 6 | // this widget is generic, we can change it and this change will appear across the app 7 | class NetworkImageWidget extends StatelessWidget { 8 | final String imageUrl; 9 | final double width, height, borderRadius , iconSize; 10 | final BoxFit boxFit ; 11 | const NetworkImageWidget( 12 | {super.key, 13 | required this.imageUrl, 14 | this.width = 40, 15 | this.height = 40, 16 | this.borderRadius = 18 , 17 | this.iconSize = 20 , 18 | this.boxFit = BoxFit.cover 19 | }); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return ClipRRect( 24 | borderRadius: BorderRadius.circular(borderRadius), 25 | child: imageUrl == '' ? 26 | Container( 27 | width: width, 28 | height: height, 29 | decoration: BoxDecoration( 30 | color: Colors.grey.shade900, 31 | borderRadius: BorderRadius.circular(borderRadius), 32 | ), 33 | child: Icon(Icons.person_outline , size: iconSize,)) : 34 | CachedNetworkImage( 35 | imageUrl: imageUrl, 36 | width: width, 37 | height: height, 38 | imageBuilder: (context, imageProvider) => Container( 39 | width: width, 40 | height: height, 41 | decoration: BoxDecoration( 42 | borderRadius: BorderRadius.circular(borderRadius), 43 | image: DecorationImage( 44 | image: imageProvider, 45 | fit: boxFit, 46 | ), 47 | ), 48 | ), 49 | placeholder: (context, url) => Container( 50 | width: width, 51 | height: height, 52 | decoration: BoxDecoration( 53 | color: Colors.grey.shade900, 54 | borderRadius: BorderRadius.circular(borderRadius), 55 | ), 56 | child: const Padding( 57 | padding: EdgeInsets.all(12.0), 58 | child: LoadingWidget(), 59 | ), 60 | ), 61 | errorWidget: (context, url, error) => Container( 62 | width: width, 63 | height: height, 64 | decoration: BoxDecoration( 65 | color: Colors.grey.shade900, 66 | borderRadius: BorderRadius.circular(13), 67 | ), 68 | child: Icon(Icons.error_outline , size: iconSize,)), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/configs/components/round_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/configs/components/loading_widget.dart'; 2 | import 'package:flutter/material.dart'; 3 | import '../color/color.dart'; 4 | 5 | //custom round button component, we will used this widget show to show button 6 | // this widget is generic, we can change it and this change will appear across the app 7 | class RoundButton extends StatelessWidget { 8 | final String title; 9 | final bool loading; 10 | final VoidCallback onPress; 11 | 12 | const RoundButton({ 13 | super.key, 14 | required this.title, 15 | this.loading = false, 16 | required this.onPress, 17 | }); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return ElevatedButton( 22 | onPressed: onPress, 23 | child: Center( 24 | child: loading 25 | ? const LoadingWidget() 26 | : Text( 27 | title, 28 | style: const TextStyle(color: AppColors.whiteColor), 29 | ))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/configs/routes/routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/configs/routes/routes_name.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import '../../view/views.dart'; 5 | 6 | class Routes { 7 | static Route generateRoute(RouteSettings settings) { 8 | switch (settings.name) { 9 | case RoutesName.splash: 10 | return MaterialPageRoute(builder: (BuildContext context) => const SplashView()); 11 | 12 | case RoutesName.home: 13 | return MaterialPageRoute(builder: (BuildContext context) => const MoviesScreen()); 14 | 15 | case RoutesName.login: 16 | return MaterialPageRoute(builder: (BuildContext context) => const LoginScreen()); 17 | 18 | default: 19 | return MaterialPageRoute(builder: (_) { 20 | return const Scaffold( 21 | body: Center( 22 | child: Text('No route defined'), 23 | ), 24 | ); 25 | }); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/configs/routes/routes_name.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | class RoutesName { 4 | 5 | static const String splash = 'splash_view' ; 6 | 7 | //accounts routes name 8 | static const String login = 'login_screen' ; 9 | 10 | //home screen routes name 11 | static const String home = 'home_screen' ; 12 | 13 | 14 | } -------------------------------------------------------------------------------- /lib/configs/themes/dark_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | 4 | import 'themes.dart'; 5 | 6 | ThemeData darkTheme = ThemeData.dark().copyWith( 7 | appBarTheme: AppBarTheme( 8 | toolbarTextStyle: ThemeData.light().textTheme.displayMedium!.copyWith(fontFamily: ThemeConfig.pangramRegular, color: Colors.white, fontWeight: FontWeight.w500), 9 | iconTheme: const IconThemeData( 10 | color: Colors.white, 11 | )), 12 | textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.white), 13 | textTheme: ThemeData.dark().textTheme.copyWith( 14 | titleMedium: GoogleFonts.roboto(color: Colors.white), 15 | titleSmall: GoogleFonts.roboto( 16 | color: Colors.white.withOpacity(.5), 17 | ), 18 | displayLarge: GoogleFonts.roboto( 19 | color: Colors.white, 20 | ), 21 | displayMedium: GoogleFonts.roboto( 22 | color: Colors.white, 23 | fontWeight: FontWeight.w400, 24 | ), 25 | headlineMedium: GoogleFonts.roboto( 26 | color: ThemeConfig.textColor6B698E, 27 | ), 28 | displaySmall: GoogleFonts.roboto( 29 | color: Colors.white, 30 | fontWeight: FontWeight.w400, 31 | ), 32 | bodyMedium: GoogleFonts.roboto( 33 | color: ThemeConfig.textColorBCBFC2, 34 | ), 35 | ), 36 | radioTheme: RadioThemeData( 37 | fillColor: MaterialStateColor.resolveWith((states) => Colors.white.withOpacity(.3)), 38 | ), 39 | colorScheme: const ColorScheme.dark().copyWith( 40 | secondary: const Color(0xff73777a), 41 | primary: Colors.white, 42 | onPrimary: const Color(0xffA0A0A0), 43 | outline: Colors.black, 44 | onBackground: const Color(0xff202934), 45 | brightness: Brightness.dark, 46 | background: const Color(0xff202934), 47 | primaryContainer: const Color(0xff2d3236), 48 | onPrimaryContainer: const Color(0xff5a5f62)), 49 | progressIndicatorTheme: const ProgressIndicatorThemeData(linearTrackColor: Colors.white, color: ThemeConfig.primaryColor), 50 | primaryColor: ThemeConfig.primaryColor, 51 | scaffoldBackgroundColor: ThemeConfig.darkBackColor); 52 | -------------------------------------------------------------------------------- /lib/configs/themes/light_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | 5 | import 'themes.dart'; 6 | 7 | ThemeData lightTheme = ThemeData.light().copyWith( 8 | appBarTheme: const AppBarTheme( 9 | systemOverlayStyle: SystemUiOverlayStyle(statusBarBrightness: Brightness.light), 10 | iconTheme: IconThemeData( 11 | color: Colors.black, 12 | )), 13 | colorScheme: ThemeData.light().colorScheme.copyWith( 14 | secondary: const Color(0xffa1a1a1), 15 | primary: const Color(0xff0F0425), 16 | onPrimary: const Color(0xff9694B8), 17 | outline: const Color(0xfff0f0f0), 18 | onBackground: const Color(0xfff6f8f8), 19 | background: const Color(0xffDCE8E8), 20 | primaryContainer: Colors.white, 21 | onPrimaryContainer: const Color(0xffd8d8da)), 22 | textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.black), 23 | scaffoldBackgroundColor: Colors.white, 24 | progressIndicatorTheme: const ProgressIndicatorThemeData(linearTrackColor: Color(0xffECEAEA), color: ThemeConfig.primaryColor), 25 | primaryColor: ThemeConfig.primaryColor, 26 | radioTheme: RadioThemeData( 27 | fillColor: MaterialStateColor.resolveWith( 28 | (states) => Colors.black.withOpacity(.4), 29 | ), 30 | ), 31 | textTheme: ThemeData.light().textTheme.copyWith( 32 | titleMedium: GoogleFonts.roboto(color: Colors.black), 33 | titleSmall: GoogleFonts.roboto( 34 | color: Colors.black.withOpacity(.5), 35 | ), 36 | displayLarge: GoogleFonts.roboto( 37 | color: Colors.black, 38 | ), 39 | displayMedium: GoogleFonts.roboto( 40 | color: Colors.black, 41 | fontWeight: FontWeight.w400, 42 | ), 43 | headlineMedium: GoogleFonts.roboto( 44 | color: ThemeConfig.textColor6B698E, 45 | ), 46 | displaySmall: GoogleFonts.roboto( 47 | color: Colors.black, 48 | fontWeight: FontWeight.w400, 49 | ), 50 | bodyMedium: GoogleFonts.roboto( 51 | color: ThemeConfig.textColorBCBFC2, 52 | ), 53 | ), 54 | ); 55 | -------------------------------------------------------------------------------- /lib/configs/themes/theme_config.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ThemeConfig { 4 | 5 | static const primaryColor = Color(0xff115CCD); 6 | static const darkBackColor = Color(0xff141A1F); 7 | 8 | static const textColo151152 = Color(0xff151152); 9 | static const dividerColor = Color(0xffECEAEA); 10 | static const borderColorLight = Color(0xff151152); 11 | static const borderColorDark = Color(0xffFEFEFE); 12 | 13 | static const textColorBCBFC2 = Color(0xffBCBFC2); 14 | static const textColor6B698E = Color(0xff6B698E); 15 | 16 | static const alertColorFE373D = Color(0xffFE373D); 17 | static const textColorEFECEC = Color(0xffEFECEC); 18 | static const textColorFAFAFA = Color(0xffFAFAFA); 19 | 20 | static const textColor141A1F = Color(0xff141A1F); 21 | static const textColor202934 = Color(0xff202934); 22 | 23 | static const textColor151152 = Color(0xff151152); 24 | static const textColorF6F8F8 = Color(0xffF6F8F8); 25 | static const textColor0F0425 = Color(0xff0F0425); 26 | 27 | static const textColor808080 = Color(0xff808080); 28 | static const textColorDCE8E8 = Color(0xffDCE8E8); 29 | static const textColor37C9EE = Color(0xff37C9EE); 30 | 31 | /// fonts family 32 | static const pangramRegular = 'Pangram Regular'; 33 | static const pangramMedium = 'Pangram Medium'; 34 | static const pangramBold = 'Pangram Bold'; 35 | static const pangramExtraBold = 'Pangram Extra Bold'; 36 | static const pangramLight = 'Pangram Light'; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /lib/configs/themes/themes.dart: -------------------------------------------------------------------------------- 1 | export 'dark_theme.dart'; 2 | export 'light_theme.dart'; 3 | export 'theme_config.dart'; 4 | -------------------------------------------------------------------------------- /lib/data/exception/app_exceptions.dart: -------------------------------------------------------------------------------- 1 | /// Base class for custom application exceptions. 2 | class AppException implements Exception { 3 | final _message; // Message associated with the exception 4 | final _prefix; // Prefix for the exception 5 | 6 | /// Constructor for creating an [AppException] instance. 7 | /// 8 | /// The [message] parameter represents the message associated with the exception, 9 | /// and the [prefix] parameter represents the prefix for the exception. 10 | AppException([this._message, this._prefix]); 11 | 12 | @override 13 | String toString() { 14 | return '$_message$_prefix'; // Returns the formatted error message 15 | } 16 | } 17 | 18 | /// Exception class representing a fetch data error during communication. 19 | class FetchDataException extends AppException { 20 | /// Constructor for creating a [FetchDataException] instance. 21 | /// 22 | /// The [message] parameter represents the error message. 23 | FetchDataException([String? message]) : super(message, 'Error During Communication'); 24 | } 25 | 26 | /// Exception class representing a bad request error. 27 | class BadRequestException extends AppException { 28 | /// Constructor for creating a [BadRequestException] instance. 29 | /// 30 | /// The [message] parameter represents the error message. 31 | BadRequestException([String? message]) : super(message, 'Invalid request'); 32 | } 33 | 34 | /// Exception class representing an unauthorized request error. 35 | class UnauthorisedException extends AppException { 36 | /// Constructor for creating an [UnauthorisedException] instance. 37 | /// 38 | /// The [message] parameter represents the error message. 39 | UnauthorisedException([String? message]) : super(message, 'Unauthorised request'); 40 | } 41 | 42 | /// Exception class representing an invalid input error. 43 | class InvalidInputException extends AppException { 44 | /// Constructor for creating an [InvalidInputException] instance. 45 | /// 46 | /// The [message] parameter represents the error message. 47 | InvalidInputException([String? message]) : super(message, 'Invalid Input'); 48 | } 49 | 50 | /// Exception class representing a no internet connection error. 51 | class NoInternetException extends AppException { 52 | /// Constructor for creating a [NoInternetException] instance. 53 | /// 54 | /// The [message] parameter represents the error message. 55 | NoInternetException([String? message]) : super(message, 'No Internet Connection'); 56 | } 57 | -------------------------------------------------------------------------------- /lib/data/network/base_api_services.dart: -------------------------------------------------------------------------------- 1 | /// Abstract class for defining base API services. 2 | abstract class BaseApiServices { 3 | /// Fetches data from the API using a GET request. 4 | /// 5 | /// Takes a [url] parameter representing the endpoint URL. 6 | Future getApi(String url); 7 | 8 | /// Sends data to the API using a POST request. 9 | /// 10 | /// Takes a [url] parameter representing the endpoint URL and a [data] parameter 11 | /// representing the data to be sent. 12 | Future postApi(String url, dynamic data); 13 | } 14 | -------------------------------------------------------------------------------- /lib/data/network/network.dart: -------------------------------------------------------------------------------- 1 | /// This file exports the necessary classes related to network API services. 2 | 3 | export 'network_api_services.dart'; 4 | export 'base_api_services.dart'; 5 | -------------------------------------------------------------------------------- /lib/data/network/network_api_services.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:io'; 4 | 5 | import 'package:bloc_clean_coding/data/network/base_api_services.dart'; 6 | import 'package:flutter/foundation.dart'; 7 | import 'package:http/http.dart' as http; 8 | import 'package:http/http.dart'; 9 | 10 | import '../exception/app_exceptions.dart'; 11 | 12 | /// Class for handling network API requests. 13 | class NetworkApiService implements BaseApiServices { 14 | /// Sends a GET request to the specified [url] and returns the response. 15 | /// 16 | /// Throws a [NoInternetException] if there is no internet connection. 17 | /// Throws a [FetchDataException] if the network request times out. 18 | @override 19 | Future getApi(String url) async { 20 | if (kDebugMode) { 21 | print(url); 22 | } 23 | dynamic responseJson; 24 | try { 25 | final response = await http.get(Uri.parse(url)).timeout(const Duration(seconds: 20)); 26 | responseJson = returnResponse(response); 27 | } on SocketException { 28 | throw NoInternetException(''); 29 | } on TimeoutException { 30 | throw FetchDataException('Network Request time out'); 31 | } 32 | 33 | if (kDebugMode) { 34 | print(responseJson); 35 | } 36 | return responseJson; 37 | } 38 | 39 | /// Sends a POST request to the specified [url] with the provided [data] 40 | /// and returns the response. 41 | /// 42 | /// Throws a [NoInternetException] if there is no internet connection. 43 | /// Throws a [FetchDataException] if the network request times out. 44 | @override 45 | Future postApi(String url, dynamic data) async { 46 | if (kDebugMode) { 47 | print(url); 48 | print(data); 49 | } 50 | 51 | dynamic responseJson; 52 | try { 53 | final Response response = await post(Uri.parse(url), body: data).timeout(const Duration(seconds: 10)); 54 | responseJson = returnResponse(response); 55 | } on SocketException { 56 | throw NoInternetException('No Internet Connection'); 57 | } on TimeoutException { 58 | throw FetchDataException('Network Request time out'); 59 | } 60 | 61 | if (kDebugMode) { 62 | print(responseJson); 63 | } 64 | return responseJson; 65 | } 66 | 67 | /// Parses the [response] and returns the corresponding JSON data. 68 | /// 69 | /// Throws a [FetchDataException] with the appropriate error message if the response status code is not successful. 70 | dynamic returnResponse(http.Response response) { 71 | if (kDebugMode) { 72 | print(response.statusCode); 73 | } 74 | 75 | switch (response.statusCode) { 76 | case 200: 77 | dynamic responseJson = jsonDecode(response.body); 78 | return responseJson; 79 | case 400: 80 | dynamic responseJson = jsonDecode(response.body); 81 | return responseJson; 82 | case 401: 83 | throw BadRequestException(response.body.toString()); 84 | case 500: 85 | case 404: 86 | throw UnauthorisedException(response.body.toString()); 87 | default: 88 | throw FetchDataException('Error occurred while communicating with server'); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/data/response/api_response.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/data/response/status.dart'; 2 | 3 | 4 | class ApiResponse { 5 | final Status status; 6 | final T? data; 7 | final String? message; 8 | 9 | const ApiResponse._({required this.status, this.data, this.message}); 10 | 11 | const ApiResponse.loading() : this._(status: Status.loading); 12 | 13 | const ApiResponse.completed(T data) : this._(status: Status.completed, data: data); 14 | 15 | const ApiResponse.error(String message) : this._(status: Status.error, message: message); 16 | 17 | @override 18 | String toString() { 19 | return "Status: $status\nMessage: $message\nData: $data"; 20 | } 21 | } 22 | 23 | // class ApiResponse { 24 | // Status? status; 25 | // T? data; 26 | // String? message; 27 | // 28 | // ApiResponse(this.status, this.data, this.message); 29 | // 30 | // ApiResponse.loading() : status = Status.loading; 31 | // 32 | // ApiResponse.completed(this.data) : status = Status.completed; 33 | // 34 | // ApiResponse.error(this.message) : status = Status.error; 35 | // 36 | // @override 37 | // String toString() { 38 | // return "Status : $status \n Message : $message \n Data: $data"; 39 | // } 40 | // } 41 | -------------------------------------------------------------------------------- /lib/data/response/response.dart: -------------------------------------------------------------------------------- 1 | export 'status.dart'; 2 | export 'api_response.dart'; -------------------------------------------------------------------------------- /lib/data/response/status.dart: -------------------------------------------------------------------------------- 1 | enum Status {loading, completed, error} -------------------------------------------------------------------------------- /lib/dependency_injection/dependency_injection.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | export 'package:get_it/get_it.dart'; 4 | export 'package:bloc_clean_coding/repository/auth_api/auth_repository.dart'; 5 | export 'package:bloc_clean_coding/repository/movies_api/movies_repository.dart'; 6 | -------------------------------------------------------------------------------- /lib/dependency_injection/locator.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'dependency_injection.dart'; 3 | 4 | // GetIt is a package used for service locator or to manage dependency injection 5 | GetIt getIt = GetIt.instance; 6 | 7 | class ServiceLocator { 8 | void servicesLocator() { 9 | getIt.registerLazySingleton(() => AuthHttpApiRepository()); // Registering AuthHttpApiRepository as a lazy singleton for AuthApiRepository 10 | getIt.registerLazySingleton(() => MoviesHttpApiRepository()); // Registering MoviesHttpApiRepository as a lazy singleton for MoviesApiRepository 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /lib/l10n/app_en.arb: -------------------------------------------------------------------------------- 1 | { 2 | "helloWorld": "Hello World", 3 | "email": "Email", 4 | "password": "Password", 5 | "login": "Login", 6 | "aCompleteValidEmailExamplejoegmailcom": "A complete, valid email e.g. joe@gmail.com", 7 | "pleaseEnsureTheEmailEnteredIsValid": "Please ensure the email entered is valid", 8 | "passwordShouldbeatleast_characterswithatleastoneletterandnumber": "Password should be at least 8 characters with at least one letter and number", 9 | "passwordRequirements": "Password must be at least 8 characters and contain at least one letter and number", 10 | "submit": "Submit", 11 | "submitting": "Submitting...", 12 | "splashScreen": "Splash screen", 13 | "popularShows": "Popular Shows", 14 | "noDataFound": "No Data Found", 15 | "noInternetConnection": "No Internet Connection", 16 | "logout": "Logout" 17 | } 18 | -------------------------------------------------------------------------------- /lib/l10n/app_es.arb: -------------------------------------------------------------------------------- 1 | { 2 | "helloWorld": "¡Hola Mundo!", 3 | "email": "Correo electrónico", 4 | "password": "Contraseña", 5 | "login": "Acceso", 6 | "aCompleteValidEmailExamplejoegmailcom": "Un correo electrónico completo y válido, por ejemplo, joe@gmail.com", 7 | "pleaseEnsureTheEmailEnteredIsValid": "Por favor, asegúrese de que el correo electrónico ingresado sea válido", 8 | "passwordShouldbeatleast_characterswithatleastoneletterandnumber": "La contraseña debe tener al menos 8 caracteres con al menos una letra y un número", 9 | "passwordRequirements": "La contraseña debe tener al menos 8 caracteres y contener al menos una letra y un número", 10 | "submit": "Enviar", 11 | "submitting": "Enviando...", 12 | "splashScreen": "Pantalla de bienvenida", 13 | "popularShows": "Shows Populares", 14 | "noDataFound": "No se encontraron datos", 15 | "noInternetConnection": "Sin conexión a internet", 16 | "logout": "Cerrar sesión" 17 | } 18 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | // Importing necessary packages and files 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; // Localization support 5 | import 'package:flutter_localizations/flutter_localizations.dart'; 6 | import 'configs/routes/routes.dart'; // Custom routes 7 | import 'configs/routes/routes_name.dart'; // Route names 8 | import 'configs/themes/dark_theme.dart'; // Dark theme configuration 9 | import 'configs/themes/light_theme.dart'; 10 | import 'dependency_injection/locator.dart'; // Light theme configuration 11 | 12 | ServiceLocator dependencyInjector = ServiceLocator(); 13 | 14 | void main() { 15 | 16 | WidgetsFlutterBinding.ensureInitialized(); // Ensuring that Flutter bindings are initialized 17 | dependencyInjector.servicesLocator(); // Initializing service locator for dependency injection 18 | 19 | runApp(const MyApp()); // Running the application 20 | } 21 | 22 | class MyApp extends StatelessWidget { 23 | const MyApp({Key? key}); // Constructor for MyApp widget 24 | 25 | // This widget is the root of your application. 26 | @override 27 | Widget build(BuildContext context) { 28 | return MaterialApp( 29 | // Material app configuration 30 | title: 'Flutter Demo', 31 | themeMode: ThemeMode.dark, // Setting theme mode to dark 32 | theme: lightTheme, // Setting light theme 33 | darkTheme: darkTheme, // Setting dark theme 34 | localizationsDelegates: const [ 35 | AppLocalizations.delegate, 36 | GlobalMaterialLocalizations.delegate, 37 | GlobalWidgetsLocalizations.delegate, 38 | GlobalCupertinoLocalizations.delegate, 39 | ], 40 | supportedLocales: const [ 41 | Locale('en'), // English locale 42 | Locale('es'), // Spanish locale 43 | ], 44 | initialRoute: RoutesName.splash, // Initial route 45 | onGenerateRoute: Routes.generateRoute, // Generating routes 46 | ); 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /lib/model/movie_list/movie_list_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; // Importing freezed_annotation package 2 | 3 | part 'movie_list_model.freezed.dart'; // Importing generated code for Freezed classes 4 | part 'movie_list_model.g.dart'; // Importing generated code for JSON serialization 5 | 6 | /// Freezed class representing a list of movies. 7 | @freezed 8 | class MovieListModel with _$MovieListModel { 9 | /// Factory constructor for creating a [MovieListModel] instance. 10 | factory MovieListModel({ 11 | @Default(0) int total, // Total number of movies 12 | @Default(0) int page, // Current page number 13 | @Default(0) int pages, // Total number of pages 14 | @Default([]) @JsonKey(name: 'tv_shows') List tvShow, // List of TV shows 15 | }) = _MovieListModel; // Constructor for the freezed class 16 | 17 | /// Factory constructor for creating a [MovieListModel] instance from JSON. 18 | factory MovieListModel.fromJson(Map json) => 19 | _$MovieListModelFromJson(json); // JSON deserialization method 20 | } 21 | 22 | /// Freezed class representing a TV show. 23 | @freezed 24 | class TvShows with _$TvShows { 25 | /// Factory constructor for creating a [TvShows] instance. 26 | factory TvShows({ 27 | @JsonKey(name: 'name') @Default('') String name, // Name of the TV show 28 | @Default('') String permalink, // Permalink of the TV show 29 | @Default('') String endDate, // End date of the TV show 30 | @Default('') String network, // Network of the TV show 31 | @Default('') String imageThumbnailPath, // Image thumbnail path of the TV show 32 | @Default('') String status, // Status of the TV show 33 | }) = _TvShows; // Constructor for the freezed class 34 | 35 | /// Factory constructor for creating a [TvShows] instance from JSON. 36 | factory TvShows.fromJson(Map json) => 37 | _$TvShowsFromJson(json); // JSON deserialization method 38 | } 39 | -------------------------------------------------------------------------------- /lib/model/movie_list/movie_list_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'movie_list_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$MovieListModelImpl _$$MovieListModelImplFromJson(Map json) => 10 | _$MovieListModelImpl( 11 | total: (json['total'] as num?)?.toInt() ?? 0, 12 | page: (json['page'] as num?)?.toInt() ?? 0, 13 | pages: (json['pages'] as num?)?.toInt() ?? 0, 14 | tvShow: (json['tv_shows'] as List?) 15 | ?.map((e) => TvShows.fromJson(e as Map)) 16 | .toList() ?? 17 | const [], 18 | ); 19 | 20 | Map _$$MovieListModelImplToJson( 21 | _$MovieListModelImpl instance) => 22 | { 23 | 'total': instance.total, 24 | 'page': instance.page, 25 | 'pages': instance.pages, 26 | 'tv_shows': instance.tvShow, 27 | }; 28 | 29 | _$TvShowsImpl _$$TvShowsImplFromJson(Map json) => 30 | _$TvShowsImpl( 31 | name: json['name'] as String? ?? '', 32 | permalink: json['permalink'] as String? ?? '', 33 | endDate: json['endDate'] as String? ?? '', 34 | network: json['network'] as String? ?? '', 35 | imageThumbnailPath: json['imageThumbnailPath'] as String? ?? '', 36 | status: json['status'] as String? ?? '', 37 | ); 38 | 39 | Map _$$TvShowsImplToJson(_$TvShowsImpl instance) => 40 | { 41 | 'name': instance.name, 42 | 'permalink': instance.permalink, 43 | 'endDate': instance.endDate, 44 | 'network': instance.network, 45 | 'imageThumbnailPath': instance.imageThumbnailPath, 46 | 'status': instance.status, 47 | }; 48 | -------------------------------------------------------------------------------- /lib/model/user/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; // Importing freezed_annotation package 2 | 3 | part 'user_model.freezed.dart'; // Importing generated code for Freezed class 4 | part 'user_model.g.dart'; // Importing generated code for JSON serialization 5 | 6 | /// Freezed class representing a user model. 7 | @freezed 8 | class UserModel with _$UserModel { 9 | /// Factory constructor for creating a [UserModel] instance. 10 | factory UserModel({ 11 | @Default('') String token, // User token 12 | @Default('') String error, // Error message 13 | }) = _UserModel; // Constructor for the freezed class 14 | 15 | /// Factory constructor for creating a [UserModel] instance from JSON. 16 | factory UserModel.fromJson(Map json) => 17 | _$UserModelFromJson(json); // JSON deserialization method 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib/model/user/user_model.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // 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, invalid_annotation_target, unnecessary_question_mark 5 | 6 | part of 'user_model.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | '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 information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); 16 | 17 | UserModel _$UserModelFromJson(Map json) { 18 | return _UserModel.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$UserModel { 23 | String get token => throw _privateConstructorUsedError; // User token 24 | String get error => throw _privateConstructorUsedError; 25 | 26 | /// Serializes this UserModel to a JSON map. 27 | Map toJson() => throw _privateConstructorUsedError; 28 | 29 | /// Create a copy of UserModel 30 | /// with the given fields replaced by the non-null parameter values. 31 | @JsonKey(includeFromJson: false, includeToJson: false) 32 | $UserModelCopyWith get copyWith => 33 | throw _privateConstructorUsedError; 34 | } 35 | 36 | /// @nodoc 37 | abstract class $UserModelCopyWith<$Res> { 38 | factory $UserModelCopyWith(UserModel value, $Res Function(UserModel) then) = 39 | _$UserModelCopyWithImpl<$Res, UserModel>; 40 | @useResult 41 | $Res call({String token, String error}); 42 | } 43 | 44 | /// @nodoc 45 | class _$UserModelCopyWithImpl<$Res, $Val extends UserModel> 46 | implements $UserModelCopyWith<$Res> { 47 | _$UserModelCopyWithImpl(this._value, this._then); 48 | 49 | // ignore: unused_field 50 | final $Val _value; 51 | // ignore: unused_field 52 | final $Res Function($Val) _then; 53 | 54 | /// Create a copy of UserModel 55 | /// with the given fields replaced by the non-null parameter values. 56 | @pragma('vm:prefer-inline') 57 | @override 58 | $Res call({ 59 | Object? token = null, 60 | Object? error = null, 61 | }) { 62 | return _then(_value.copyWith( 63 | token: null == token 64 | ? _value.token 65 | : token // ignore: cast_nullable_to_non_nullable 66 | as String, 67 | error: null == error 68 | ? _value.error 69 | : error // ignore: cast_nullable_to_non_nullable 70 | as String, 71 | ) as $Val); 72 | } 73 | } 74 | 75 | /// @nodoc 76 | abstract class _$$UserModelImplCopyWith<$Res> 77 | implements $UserModelCopyWith<$Res> { 78 | factory _$$UserModelImplCopyWith( 79 | _$UserModelImpl value, $Res Function(_$UserModelImpl) then) = 80 | __$$UserModelImplCopyWithImpl<$Res>; 81 | @override 82 | @useResult 83 | $Res call({String token, String error}); 84 | } 85 | 86 | /// @nodoc 87 | class __$$UserModelImplCopyWithImpl<$Res> 88 | extends _$UserModelCopyWithImpl<$Res, _$UserModelImpl> 89 | implements _$$UserModelImplCopyWith<$Res> { 90 | __$$UserModelImplCopyWithImpl( 91 | _$UserModelImpl _value, $Res Function(_$UserModelImpl) _then) 92 | : super(_value, _then); 93 | 94 | /// Create a copy of UserModel 95 | /// with the given fields replaced by the non-null parameter values. 96 | @pragma('vm:prefer-inline') 97 | @override 98 | $Res call({ 99 | Object? token = null, 100 | Object? error = null, 101 | }) { 102 | return _then(_$UserModelImpl( 103 | token: null == token 104 | ? _value.token 105 | : token // ignore: cast_nullable_to_non_nullable 106 | as String, 107 | error: null == error 108 | ? _value.error 109 | : error // ignore: cast_nullable_to_non_nullable 110 | as String, 111 | )); 112 | } 113 | } 114 | 115 | /// @nodoc 116 | @JsonSerializable() 117 | class _$UserModelImpl implements _UserModel { 118 | _$UserModelImpl({this.token = '', this.error = ''}); 119 | 120 | factory _$UserModelImpl.fromJson(Map json) => 121 | _$$UserModelImplFromJson(json); 122 | 123 | @override 124 | @JsonKey() 125 | final String token; 126 | // User token 127 | @override 128 | @JsonKey() 129 | final String error; 130 | 131 | @override 132 | String toString() { 133 | return 'UserModel(token: $token, error: $error)'; 134 | } 135 | 136 | @override 137 | bool operator ==(Object other) { 138 | return identical(this, other) || 139 | (other.runtimeType == runtimeType && 140 | other is _$UserModelImpl && 141 | (identical(other.token, token) || other.token == token) && 142 | (identical(other.error, error) || other.error == error)); 143 | } 144 | 145 | @JsonKey(includeFromJson: false, includeToJson: false) 146 | @override 147 | int get hashCode => Object.hash(runtimeType, token, error); 148 | 149 | /// Create a copy of UserModel 150 | /// with the given fields replaced by the non-null parameter values. 151 | @JsonKey(includeFromJson: false, includeToJson: false) 152 | @override 153 | @pragma('vm:prefer-inline') 154 | _$$UserModelImplCopyWith<_$UserModelImpl> get copyWith => 155 | __$$UserModelImplCopyWithImpl<_$UserModelImpl>(this, _$identity); 156 | 157 | @override 158 | Map toJson() { 159 | return _$$UserModelImplToJson( 160 | this, 161 | ); 162 | } 163 | } 164 | 165 | abstract class _UserModel implements UserModel { 166 | factory _UserModel({final String token, final String error}) = 167 | _$UserModelImpl; 168 | 169 | factory _UserModel.fromJson(Map json) = 170 | _$UserModelImpl.fromJson; 171 | 172 | @override 173 | String get token; // User token 174 | @override 175 | String get error; 176 | 177 | /// Create a copy of UserModel 178 | /// with the given fields replaced by the non-null parameter values. 179 | @override 180 | @JsonKey(includeFromJson: false, includeToJson: false) 181 | _$$UserModelImplCopyWith<_$UserModelImpl> get copyWith => 182 | throw _privateConstructorUsedError; 183 | } 184 | -------------------------------------------------------------------------------- /lib/model/user/user_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'user_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$UserModelImpl _$$UserModelImplFromJson(Map json) => 10 | _$UserModelImpl( 11 | token: json['token'] as String? ?? '', 12 | error: json['error'] as String? ?? '', 13 | ); 14 | 15 | Map _$$UserModelImplToJson(_$UserModelImpl instance) => 16 | { 17 | 'token': instance.token, 18 | 'error': instance.error, 19 | }; 20 | -------------------------------------------------------------------------------- /lib/repository/auth_api/auth_api_repository.dart: -------------------------------------------------------------------------------- 1 | import '../../model/user/user_model.dart'; 2 | 3 | /// Abstract class defining methods for authentication API repositories. 4 | abstract class AuthApiRepository { 5 | /// Sends a login request to the authentication API with the provided [data]. 6 | /// 7 | /// Returns a [UserModel] representing the user data if the login is successful. 8 | Future loginApi(dynamic data); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /lib/repository/auth_api/auth_http_api_repository.dart: -------------------------------------------------------------------------------- 1 | import '../../data/network/base_api_services.dart'; 2 | import '../../data/network/network_api_services.dart'; 3 | import '../../model/user/user_model.dart'; 4 | import '../../utils/app_url.dart'; 5 | import 'auth_api_repository.dart'; 6 | 7 | /// Implementation of [AuthApiRepository] for making HTTP requests to the authentication API. 8 | class AuthHttpApiRepository implements AuthApiRepository { 9 | final BaseApiServices _apiServices = NetworkApiService(); 10 | 11 | /// Sends a login request to the authentication API with the provided [data]. 12 | /// 13 | /// Returns a [UserModel] representing the user data if the login is successful. 14 | @override 15 | Future loginApi(dynamic data) async { 16 | dynamic response = await _apiServices.postApi(AppUrl.loginEndPint, data); 17 | return UserModel.fromJson(response); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/repository/auth_api/auth_mock_api_repository.dart: -------------------------------------------------------------------------------- 1 | import '../../model/user/user_model.dart'; 2 | import 'auth_api_repository.dart'; 3 | 4 | /// Mock implementation of [AuthApiRepository] for simulating login requests. 5 | class AuthMockApiRepository implements AuthApiRepository { 6 | 7 | @override 8 | Future loginApi(dynamic data) async { 9 | // Simulate a delay to mimic network latency 10 | await Future.delayed(const Duration(seconds: 2)); 11 | // Mock response data 12 | var responseData = {'token': 'a23z345xert'}; 13 | return UserModel.fromJson(responseData); 14 | } 15 | 16 | 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /lib/repository/auth_api/auth_repository.dart: -------------------------------------------------------------------------------- 1 | /// This file exports the necessary classes related to authentication API repositories. 2 | 3 | export 'auth_api_repository.dart'; 4 | export 'auth_http_api_repository.dart'; 5 | export 'auth_mock_api_repository.dart'; 6 | -------------------------------------------------------------------------------- /lib/repository/movies_api/movies_api_repository.dart: -------------------------------------------------------------------------------- 1 | import '../../model/movie_list/movie_list_model.dart'; 2 | 3 | /// Abstract class defining methods for movies API repositories. 4 | abstract class MoviesApiRepository { 5 | /// Fetches the list of movies from the API. 6 | /// 7 | /// Returns a [MovieListModel] representing the list of movies. 8 | Future fetchMoviesList(); 9 | } 10 | -------------------------------------------------------------------------------- /lib/repository/movies_api/movies_http_api_repository.dart: -------------------------------------------------------------------------------- 1 | import '../../data/network/network_api_services.dart'; 2 | import '../../model/movie_list/movie_list_model.dart'; 3 | import '../../utils/app_url.dart'; 4 | import 'movies_api_repository.dart'; 5 | 6 | /// Implementation of [MoviesApiRepository] for making HTTP requests to fetch movies list. 7 | class MoviesHttpApiRepository implements MoviesApiRepository { 8 | final _apiServices = NetworkApiService(); 9 | 10 | /// Fetches the list of movies from the API. 11 | /// 12 | /// Returns a [MovieListModel] representing the list of movies. 13 | @override 14 | Future fetchMoviesList() async { 15 | final response = await _apiServices.getApi(AppUrl.popularMoviesListEndPoint); 16 | return MovieListModel.fromJson(response); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/repository/movies_api/movies_mock_api_repository.dart: -------------------------------------------------------------------------------- 1 | import '../../model/movie_list/movie_list_model.dart'; 2 | import 'movies_api_repository.dart'; 3 | 4 | /// Mock implementation of [MoviesApiRepository] for simulating fetching movies list. 5 | class MoviesMockApiRepository implements MoviesApiRepository { 6 | @override 7 | Future fetchMoviesList() async { 8 | // Simulate a delay to mimic network latency 9 | await Future.delayed(const Duration(seconds: 2)); 10 | // Mock response data 11 | dynamic responseData = { 12 | "total": "25369", 13 | "page": 1, 14 | "pages": 1269, 15 | "tv_shows": [ 16 | { 17 | "id": 35624, 18 | "name": "The Flash", 19 | "permalink": "the-flash", 20 | "start_date": "2014-10-07", 21 | "end_date": null, 22 | "country": "US", 23 | "network": "The CW", 24 | "status": "Ended", 25 | "image_thumbnail_path": 26 | "https://static.episodate.com/images/tv-show/thumbnail/35624.jpg" 27 | } 28 | ] 29 | }; 30 | return MovieListModel.fromJson(responseData); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/repository/movies_api/movies_repository.dart: -------------------------------------------------------------------------------- 1 | /// This file exports the necessary classes related to movies API repositories. 2 | 3 | export 'movies_api_repository.dart'; 4 | export 'movies_http_api_repository.dart'; 5 | export 'movies_mock_api_repository.dart'; 6 | -------------------------------------------------------------------------------- /lib/services/session_manager/session_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; // Importing dart:convert for JSON encoding and decoding 2 | 3 | import 'package:flutter/material.dart'; // Importing Flutter material library 4 | 5 | import '../../model/user/user_model.dart'; // Importing the user model for user data 6 | import '../storage/local_storage.dart'; // Importing local storage for storing user data 7 | 8 | /// A singleton class for managing user session data. 9 | class SessionController { 10 | /// Instance of [LocalStorage] for accessing local storage. 11 | final LocalStorage sharedPreferenceClass = LocalStorage(); 12 | 13 | /// Singleton instance of [SessionController]. 14 | static final SessionController _session = SessionController._internal(); 15 | 16 | /// Flag indicating whether the user is logged in or not. 17 | static bool? isLogin; 18 | 19 | /// Model representing the user data. 20 | static UserModel user = UserModel(); 21 | 22 | /// Private constructor for creating the singleton instance of [SessionController]. 23 | SessionController._internal() { 24 | // Initialize default values 25 | isLogin = false; 26 | } 27 | 28 | //In Dart, a factory constructor is a special kind of constructor that can return an instance of the class, 29 | // potentially a cached or pre-existing instance, instead of always creating a new one. 30 | // It's defined using the factory keyword. 31 | // This is useful for implementing patterns like singletons or when you want to control instance creat 32 | // 33 | /// Factory constructor for accessing the singleton instance of [SessionController]. 34 | factory SessionController() { 35 | return _session; 36 | } 37 | 38 | /// Saves user data into the local storage. 39 | /// 40 | /// Takes a [user] object as input and saves it into the local storage. 41 | Future saveUserInPreference(dynamic user) async { 42 | sharedPreferenceClass.setValue('token', jsonEncode(user)); 43 | // Storing value to check login 44 | sharedPreferenceClass.setValue('isLogin', 'true'); 45 | } 46 | 47 | /// Retrieves user data from the local storage. 48 | /// 49 | /// Retrieves user data from the local storage and assigns it to the session controller 50 | /// to be used across the app. 51 | Future getUserFromPreference() async { 52 | try { 53 | String userData = await sharedPreferenceClass.readValue('token'); 54 | var isLogin = await sharedPreferenceClass.readValue('isLogin'); 55 | 56 | if (userData.isNotEmpty) { 57 | SessionController.user = UserModel.fromJson(jsonDecode(userData)); 58 | } 59 | SessionController.isLogin = isLogin == 'true' ? true : false; 60 | } catch (e) { 61 | debugPrint(e.toString()); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/services/splash/splash_services.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; // Importing dart:async for asynchronous operations 2 | 3 | import 'package:flutter/material.dart'; // Importing Flutter material library 4 | 5 | import '../../../configs/routes/routes_name.dart'; // Importing routes names for navigation 6 | import '../session_manager/session_controller.dart'; // Importing session controller for managing user session 7 | 8 | /// A class containing services related to the splash screen. 9 | class SplashServices { 10 | /// Checks authentication status and navigates accordingly. 11 | /// 12 | /// Takes a [BuildContext] as input and navigates to the home screen if the user is authenticated, 13 | /// otherwise navigates to the login screen after a delay of 2 seconds. 14 | void checkAuthentication(BuildContext context) async { 15 | SessionController().getUserFromPreference().then((value) async { 16 | if (SessionController.isLogin ?? false) { 17 | Timer( 18 | const Duration(seconds: 2), 19 | () => Navigator.pushNamedAndRemoveUntil(context, RoutesName.home, (route) => false), 20 | ); 21 | } else { 22 | Timer( 23 | const Duration(seconds: 2), 24 | () => Navigator.pushNamedAndRemoveUntil(context, RoutesName.login, (route) => false), 25 | ); 26 | } 27 | }).onError((error, stackTrace) { 28 | Timer( 29 | const Duration(seconds: 2), 30 | () => Navigator.pushNamedAndRemoveUntil(context, RoutesName.login, (route) => false), 31 | ); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/services/storage/local_storage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_secure_storage/flutter_secure_storage.dart'; // Importing FlutterSecureStorage for secure local storage 2 | 3 | /// A class for managing local storage using FlutterSecureStorage. 4 | class LocalStorage { 5 | /// Instance of FlutterSecureStorage for secure local storage. 6 | final storage = const FlutterSecureStorage(); 7 | 8 | /// Sets a key-value pair in the local storage. 9 | /// 10 | /// Returns a Future indicating the success of the operation. 11 | Future setValue(String key, String value) async { 12 | await storage.write(key: key, value: value); 13 | return true; 14 | } 15 | 16 | /// Reads the value associated with the given key from the local storage. 17 | /// 18 | /// Returns a Future representing the value stored for the key. 19 | Future readValue(String key) async { 20 | return await storage.read(key: key); 21 | } 22 | 23 | /// Clears the value associated with the given key from the local storage. 24 | /// 25 | /// Returns a Future indicating the success of the operation. 26 | Future clearValue(String key) async { 27 | await storage.delete(key: key); 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/utils/app_url.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | class AppUrl { 4 | 5 | static var baseUrl = 'https://reqres.in' ; 6 | static var loginEndPint = '$baseUrl/api/login' ; 7 | static var popularMoviesListEndPoint = 'https://www.episodate.com/api/most-popular?page=1' ; 8 | 9 | 10 | } -------------------------------------------------------------------------------- /lib/utils/enums.dart: -------------------------------------------------------------------------------- 1 | 2 | enum Status { loading, completed, error } 3 | 4 | enum Flavor { 5 | dev, 6 | staging, 7 | prod, 8 | } 9 | -------------------------------------------------------------------------------- /lib/utils/extensions/flush_bar_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:another_flushbar/flushbar.dart'; 2 | import 'package:another_flushbar/flushbar_route.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | extension FlushBarErrorMessage on BuildContext { 6 | void flushBarErrorMessage({required String message}) { 7 | showFlushbar( 8 | context: this, 9 | flushbar: Flushbar( 10 | forwardAnimationCurve: Curves.decelerate, 11 | margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), 12 | padding: const EdgeInsets.all(15), 13 | message: message, 14 | duration: const Duration(seconds: 3), 15 | borderRadius: BorderRadius.circular(8), 16 | flushbarPosition: FlushbarPosition.TOP, 17 | backgroundColor: Colors.green, 18 | reverseAnimationCurve: Curves.easeInOut, 19 | positionOffset: 20, 20 | icon: const Icon( 21 | Icons.error, 22 | size: 28, 23 | color: Colors.white, 24 | ), 25 | )..show(this)); 26 | } 27 | } 28 | 29 | extension FlushBarSuccessMessage on BuildContext { 30 | void flushBarSuccessMessage({required String message}) { 31 | showFlushbar( 32 | context: this, 33 | flushbar: Flushbar( 34 | forwardAnimationCurve: Curves.decelerate, 35 | margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), 36 | padding: const EdgeInsets.all(15), 37 | message: message, 38 | duration: const Duration(seconds: 3), 39 | borderRadius: BorderRadius.circular(8), 40 | flushbarPosition: FlushbarPosition.TOP, 41 | backgroundColor: Colors.green, 42 | reverseAnimationCurve: Curves.easeInOut, 43 | positionOffset: 20, 44 | icon: const Icon( 45 | Icons.error, 46 | size: 28, 47 | color: Colors.white, 48 | ), 49 | )..show(this)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/utils/extensions/general_ectensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | extension MediaQueryValues on BuildContext { 4 | double get mediaQueryHeight => MediaQuery.sizeOf(this).height; 5 | double get mediaQueryWidth => MediaQuery.sizeOf(this).width ; 6 | } 7 | 8 | 9 | extension EmptySpace on num { 10 | SizedBox get height => SizedBox(height:toDouble()); 11 | SizedBox get width => SizedBox(width:toDouble()); 12 | } -------------------------------------------------------------------------------- /lib/utils/extensions/validations_exception.dart: -------------------------------------------------------------------------------- 1 | extension EmailValidatorExtension on String { 2 | bool emailValidator() { 3 | bool emailValid = RegExp(r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$').hasMatch(this); 4 | return emailValid; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /lib/view/login/login_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import '../../bloc/login_bloc/login_bloc.dart'; 4 | 5 | 6 | import '../../dependency_injection/locator.dart'; 7 | import 'widget/widgets.dart'; // Importing custom widget components 8 | 9 | /// A widget representing the login screen of the application. 10 | class LoginScreen extends StatefulWidget { 11 | const LoginScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | State createState() => _LoginScreenState(); 15 | } 16 | 17 | /// The state of the [LoginScreen] widget. 18 | class _LoginScreenState extends State { 19 | 20 | late LoginBloc _loginBlocs; 21 | final _formKey = GlobalKey(); 22 | 23 | @override 24 | void initState() { 25 | // TODO: implement initState 26 | super.initState(); 27 | _loginBlocs = LoginBloc(authApiRepository: getIt()); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | _loginBlocs.close(); 33 | super.dispose(); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | 39 | return Scaffold( 40 | body: BlocProvider( 41 | create: (_) => _loginBlocs, 42 | child: Form( 43 | key: _formKey, 44 | child: Padding( 45 | padding: const EdgeInsets.all(8), 46 | child: Column( 47 | mainAxisAlignment: MainAxisAlignment.center, 48 | crossAxisAlignment: CrossAxisAlignment.center, 49 | children: [ 50 | const EmailInputWidget(), // Widget for email input field 51 | const PasswordInputWidget(), 52 | const SizedBox(height: 20,),// Widget for password input field 53 | SubmitButton( 54 | formKey: _formKey, 55 | ), // Widget for submit button 56 | ], 57 | ), 58 | ), 59 | ), 60 | ), 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/view/login/widget/email_input_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/utils/extensions/validations_exception.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; // Importing app localizations for translated text 5 | 6 | import '../../../bloc/login_bloc/login_bloc.dart'; 7 | 8 | /// A widget representing the email input field. 9 | 10 | 11 | class EmailInputWidget extends StatefulWidget { 12 | const EmailInputWidget({super.key}); 13 | 14 | @override 15 | State createState() => _EmailInputWidgetState(); 16 | } 17 | 18 | class _EmailInputWidgetState extends State { 19 | 20 | final FocusNode focusNode = FocusNode(); 21 | final TextEditingController emailController = TextEditingController(); 22 | 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return BlocBuilder( 27 | buildWhen: (current, previous) => false, 28 | builder: (context, state) { 29 | return TextFormField( 30 | controller: emailController, 31 | focusNode: focusNode, // Setting focus node 32 | decoration: InputDecoration( 33 | icon: const Icon(Icons.email), // Icon for email input field 34 | labelText: AppLocalizations.of(context)!.email, // Label text for email input field 35 | helperText: AppLocalizations.of(context)!.aCompleteValidEmailExamplejoegmailcom, // Helper text for email input field 36 | ), 37 | keyboardType: TextInputType.emailAddress, // Setting keyboard type to email address 38 | onChanged: (value) { 39 | // Dispatching EmailChanged event when email input changes 40 | context.read().add(EmailChanged(email: value)); 41 | }, 42 | validator: (value) { 43 | if (value!.isEmpty) { 44 | return 'Enter email'; 45 | } 46 | 47 | if (!value.emailValidator()) { 48 | return 'Email is not correct'; 49 | } 50 | return null; 51 | }, 52 | textInputAction: TextInputAction.next, 53 | ); 54 | }, 55 | ); 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /lib/view/login/widget/password_input_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; // Importing app localizations for translated text 4 | 5 | import '../../../bloc/login_bloc/login_bloc.dart'; 6 | 7 | /// A widget representing the password input field. 8 | 9 | class PasswordInputWidget extends StatefulWidget { 10 | const PasswordInputWidget({super.key}); 11 | 12 | @override 13 | State createState() => _PasswordInputWidgetState(); 14 | } 15 | 16 | class _PasswordInputWidgetState extends State { 17 | 18 | final FocusNode focusNode = FocusNode(); 19 | final TextEditingController passwordController = TextEditingController(); 20 | 21 | @override 22 | void dispose() { 23 | // TODO: implement dispose 24 | super.dispose(); 25 | focusNode.dispose(); 26 | passwordController.dispose(); 27 | } 28 | @override 29 | Widget build(BuildContext context) { 30 | return BlocBuilder( 31 | buildWhen: (current, previous) => false, 32 | builder: (context, state) { 33 | return TextFormField( 34 | controller: passwordController, 35 | focusNode: focusNode, // Setting focus node 36 | decoration: InputDecoration( 37 | icon: const Icon(Icons.lock), // Icon for password input field 38 | helperText: AppLocalizations.of(context)!.passwordShouldbeatleast_characterswithatleastoneletterandnumber, // Helper text for password input field 39 | helperMaxLines: 2, // Maximum lines for helper text 40 | labelText: AppLocalizations.of(context)!.password, // Label text for password input field 41 | errorMaxLines: 2, // Maximum lines for error text 42 | ), 43 | obscureText: true, // Making the text input obscure (i.e., showing dots instead of actual characters) 44 | validator: (value) { 45 | if (value!.isEmpty) { 46 | return 'Enter password'; 47 | } 48 | if (value.length < 6) { 49 | return 'please enter password greater than 6 char'; 50 | } 51 | return null; 52 | }, 53 | onChanged: (value) { 54 | // Dispatching PasswordChanged event when password input changes 55 | context.read().add(PasswordChanged(password: value)); 56 | }, 57 | textInputAction: TextInputAction.done, 58 | ); 59 | }, 60 | ); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /lib/view/login/widget/submit_button_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/configs/components/round_button.dart'; 2 | import 'package:bloc_clean_coding/utils/extensions/flush_bar_extension.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | 6 | import '../../../bloc/login_bloc/login_bloc.dart'; 7 | import '../../../configs/routes/routes_name.dart'; 8 | import '../../../data/response/status.dart'; 9 | 10 | 11 | /// A widget representing the submit button for the login form. 12 | class SubmitButton extends StatelessWidget { 13 | final formKey; 14 | const SubmitButton({super.key, required this.formKey}); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return BlocConsumer( 19 | listenWhen: (current, previous) => current.loginApi.status != previous.loginApi.status, 20 | listener: (context, state) { 21 | 22 | if (state.loginApi.status == Status.error) { 23 | context.flushBarErrorMessage(message: state.loginApi.message.toString()); 24 | } 25 | 26 | if (state.loginApi.status == Status.completed) { 27 | Navigator.pushNamedAndRemoveUntil(context, RoutesName.home, (route) => false); 28 | } 29 | }, 30 | builder: (context, state) { 31 | return RoundButton( 32 | title: 'Login', 33 | loading: state.loginApi.status == Status.loading ? true :false , 34 | onPress: (){ 35 | if (formKey.currentState.validate()) { 36 | context.read().add(const LoginApi()); 37 | } 38 | }); 39 | }, 40 | 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/view/login/widget/widgets.dart: -------------------------------------------------------------------------------- 1 | // This file exports the following widgets: 2 | // 1. PasswordInputWidget 3 | // 2. EmailInputWidget 4 | // 3. SubmitButtonWidget 5 | 6 | export 'password_input_widget.dart'; // Exporting the PasswordInputWidget from password_input_widget.dart 7 | 8 | export 'email_input_widget.dart'; // Exporting the EmailInputWidget from email_input_widget.dart 9 | 10 | export 'submit_button_widget.dart'; // Exporting the SubmitButtonWidget from submit_button_widget.dart 11 | -------------------------------------------------------------------------------- /lib/view/movies/movies_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/bloc/movies_bloc/movies_bloc.dart'; 2 | import 'package:bloc_clean_coding/data/response/response.dart'; 3 | import 'package:bloc_clean_coding/data/response/status.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 7 | import '../../configs/components/network_image_widget.dart'; 8 | import '../../dependency_injection/locator.dart'; 9 | 10 | import 'widget/widgets.dart'; 11 | 12 | /// A widget representing the screen displaying a list of movies. 13 | class MoviesScreen extends StatefulWidget { 14 | const MoviesScreen({Key? key}) : super(key: key); 15 | 16 | @override 17 | State createState() => _HomeViewState(); 18 | } 19 | 20 | /// The state of the [MoviesScreen] widget. 21 | class _HomeViewState extends State { 22 | late MoviesBloc moviesBloc; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | moviesBloc = MoviesBloc(moviesApiRepository: getIt()); 28 | // Dispatches the [PostFetched] event to trigger fetching movies data 29 | } 30 | 31 | @override 32 | void dispose() { 33 | // TODO: implement dispose 34 | moviesBloc.close(); 35 | super.dispose(); 36 | } 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return Scaffold( 41 | appBar: AppBar( 42 | automaticallyImplyLeading: false, 43 | title: Text(AppLocalizations.of(context)!.popularShows), 44 | actions: const [ 45 | LogoutButtonWidget(), // Widget for logout button 46 | SizedBox( 47 | width: 20, 48 | ) 49 | ], 50 | ), 51 | body: BlocProvider( 52 | create: (_) => moviesBloc..add(MoviesFetch()), 53 | child: BlocBuilder( 54 | buildWhen: (previous, current) => previous.moviesList != current.moviesList, 55 | builder: (BuildContext context, state) { 56 | 57 | switch (state.moviesList.status) { 58 | case Status.loading: 59 | return const Center(child: CircularProgressIndicator()); 60 | case Status.error: 61 | return const MoviesErrorWidget(); // Widget for displaying error state 62 | case Status.completed: 63 | if (state.moviesList.data == null) { 64 | // Widget for displaying no data found message 65 | return Text(AppLocalizations.of(context)!.noDataFound); 66 | } 67 | final movieList = state.moviesList.data!; 68 | 69 | return ListView.builder( 70 | itemCount: movieList.tvShow.length, 71 | itemBuilder: (context, index) { 72 | final tvShow = movieList.tvShow[index]; 73 | return Card( 74 | child: ListTile( 75 | leading: NetworkImageWidget( 76 | borderRadius: 5, 77 | imageUrl: tvShow.imageThumbnailPath.toString(), 78 | ), // Widget for displaying network image 79 | title: Text(tvShow.name.toString()), // Title of the movie 80 | subtitle: Text(tvShow.network.toString()), // Network of the movie 81 | trailing: Text(tvShow.status.toString()), // Status of the movie 82 | ), 83 | ); 84 | }); 85 | default: 86 | return const SizedBox(); 87 | } 88 | }, 89 | ), 90 | ), 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/view/movies/widget/error_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_clean_coding/bloc/movies_bloc/movies_bloc.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 5 | 6 | import '../../../configs/components/internet_exception_widget.dart'; // Importing the InternetExceptionWidget 7 | 8 | /// A widget for displaying error messages related to movies. 9 | class MoviesErrorWidget extends StatelessWidget { 10 | const MoviesErrorWidget({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return BlocBuilder( 15 | buildWhen: (previous, current) => previous.moviesList != current.moviesList, 16 | builder: (context, state) { 17 | // Checking if the error message indicates no internet connection 18 | if (state.moviesList.message.toString() == AppLocalizations.of(context)!.noInternetConnection) { 19 | // Displaying InternetExceptionWidget if there's no internet connection 20 | return InterNetExceptionWidget(onPress: () { 21 | // Dispatching PostFetched event to trigger fetching movies data 22 | context.read().add(MoviesFetch()); 23 | }); 24 | } else { 25 | // Displaying error message as a clickable text if it's not related to internet connection 26 | return InkWell( 27 | onTap: () { 28 | // Dispatching PostFetched event to trigger fetching movies data 29 | context.read().add(MoviesFetch()); 30 | }, 31 | child: Center( 32 | child: Text(state.moviesList.message.toString()), 33 | ), 34 | ); 35 | } 36 | }, 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/view/movies/widget/logout_button_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../../configs/routes/routes_name.dart'; // Importing the route names 3 | import '../../../services/storage/local_storage.dart'; // Importing the LocalStorage class for managing local storage 4 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; // Importing app localizations for translated text 5 | 6 | /// A widget representing the logout button. 7 | class LogoutButtonWidget extends StatelessWidget { 8 | const LogoutButtonWidget({Key? key}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return InkWell( 13 | onTap: () { 14 | LocalStorage localStorage = LocalStorage(); 15 | localStorage.clearValue('token').then((value) { 16 | localStorage.clearValue('isLogin'); 17 | Navigator.pushNamed(context, RoutesName.login); // Navigating to the login screen after clearing token and isLogin value 18 | }); 19 | }, 20 | child: Center( 21 | child: Text( 22 | AppLocalizations.of(context)!.logout, // Localized text for logout button 23 | ), 24 | ), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/view/movies/widget/widgets.dart: -------------------------------------------------------------------------------- 1 | // This file exports the following widgets: 2 | // 1. LogoutButtonWidget 3 | // 2. ErrorWidget 4 | 5 | export 'logout_button_widget.dart'; // Exporting the LogoutButtonWidget from logout_button_widget.dart 6 | 7 | export 'error_widget.dart'; // Exporting the ErrorWidget from error_widget.dart 8 | -------------------------------------------------------------------------------- /lib/view/splash/splash_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 3 | import '../../services/splash/splash_services.dart'; // Importing the SplashServices class from the services/splash/splash_services.dart file 4 | 5 | /// A widget representing the splash screen of the application. 6 | class SplashView extends StatefulWidget { 7 | const SplashView({Key? key}) : super(key: key); 8 | 9 | @override 10 | State createState() => _SplashViewState(); 11 | } 12 | 13 | /// The state of the [SplashView] widget. 14 | class _SplashViewState extends State { 15 | final SplashServices splashServices = SplashServices(); // Instance of SplashServices for handling splash screen logic 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | // Calls the [checkAuthentication] method from [SplashServices] to handle authentication logic 21 | splashServices.checkAuthentication(context); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | body: Center( 28 | child: Text( 29 | // Displays the localized text for the splash screen 30 | AppLocalizations.of(context)!.splashScreen, 31 | style: Theme.of(context).textTheme.displayMedium, // Applies the displayMedium text style from the current theme 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/view/views.dart: -------------------------------------------------------------------------------- 1 | // This file exports the following screens: 2 | // 1. LoginScreen 3 | // 2. SplashView 4 | // 3. MoviesScreen 5 | 6 | export 'login/login_screen.dart'; // Exporting the LoginScreen widget from login/login_screen.dart 7 | export 'splash/splash_view.dart'; // Exporting the SplashView widget from splash/splash_view.dart 8 | export 'movies/movies_screen.dart'; // Exporting the MoviesScreen widget from movies/movies_screen.dart 9 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "bloc_clean_coding") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.bloc_clean_coding") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Copy the native assets provided by the build.dart from all packages. 127 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 128 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 129 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 130 | COMPONENT Runtime) 131 | 132 | # Fully re-copy the assets directory on each build to avoid having stale files 133 | # from a previous install. 134 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 135 | install(CODE " 136 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 137 | " COMPONENT Runtime) 138 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 139 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 140 | 141 | # Install the AOT library on non-Debug builds only. 142 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 143 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 144 | COMPONENT Runtime) 145 | endif() 146 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) flutter_localization_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterLocalizationPlugin"); 15 | flutter_localization_plugin_register_with_registrar(flutter_localization_registrar); 16 | g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); 18 | flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_localization 7 | flutter_secure_storage_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "bloc_clean_coding"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "bloc_clean_coding"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | return MY_APPLICATION(g_object_new(my_application_get_type(), 121 | "application-id", APPLICATION_ID, 122 | "flags", G_APPLICATION_NON_UNIQUE, 123 | nullptr)); 124 | } 125 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/DerivedData/Runner/Logs/Launch/LogStoreManifest.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | logFormatVersion 6 | 11 7 | logs 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/DerivedData/Runner/Logs/Localization/LogStoreManifest.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | logFormatVersion 6 | 11 7 | logs 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/DerivedData/Runner/Logs/Package/LogStoreManifest.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | logFormatVersion 6 | 11 7 | logs 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/DerivedData/Runner/Logs/Test/LogStoreManifest.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | logFormatVersion 6 | 11 7 | logs 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/DerivedData/Runner/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LastAccessedDate 6 | 2025-01-13T05:25:01Z 7 | WorkspacePath 8 | /Users/asiftaj/Documents/GitHub/Flutter-Bloc-Clean-Coding/macos/Runner.xcworkspace 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import flutter_localization 9 | import flutter_secure_storage_macos 10 | import path_provider_foundation 11 | import shared_preferences_foundation 12 | import sqflite_darwin 13 | 14 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 15 | FlutterLocalizationPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalizationPlugin")) 16 | FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) 17 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 18 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 19 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 20 | } 21 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = bloc_clean_coding 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.blocCleanCoding 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: bloc_clean_coding 2 | description: "A new Flutter project." 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: '>=3.3.0 <4.0.0' 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | 35 | # The following adds the Cupertino Icons font to your application. 36 | # Use with the CupertinoIcons class for iOS style icons. 37 | cupertino_icons: ^1.0.6 38 | bloc: ^8.1.4 39 | flutter_bloc: ^8.1.6 40 | http: ^1.2.2 41 | get_it: ^8.0.3 42 | freezed_annotation: ^2.4.4 43 | json_annotation: ^4.9.0 44 | fluttertoast: ^8.2.10 45 | cached_network_image: ^3.4.1 46 | another_flushbar: ^1.12.31-dev.1 47 | equatable: ^2.0.7 48 | flutter_secure_storage: ^9.2.3 49 | freezed: ^3.0.0-0.0.dev 50 | 51 | google_fonts: ^6.2.0 52 | flutter_localization: ^0.3.0 53 | mocktail: ^1.0.4 54 | flutter_localizations: 55 | sdk: flutter 56 | intl: any 57 | 58 | dev_dependencies: 59 | flutter_test: 60 | sdk: flutter 61 | 62 | # The "flutter_lints" package below contains a set of recommended lints to 63 | # encourage good coding practices. The lint set provided by the package is 64 | # activated in the `analysis_options.yaml` file located at the root of your 65 | # package. See that file for information about deactivating specific lint 66 | # rules and activating additional ones. 67 | flutter_lints: ^3.0.0 68 | bloc_test: ^9.0.0 69 | mocktail: ^1.0.0 70 | build_runner: ^2.4.14 71 | go_router: ^14.6.3 72 | json_serializable: ^6.9.2 73 | 74 | # For information on the generic Dart part of this file, see the 75 | # following page: https://dart.dev/tools/pub/pubspec 76 | 77 | # The following section is specific to Flutter packages. 78 | flutter: 79 | generate: true 80 | 81 | # The following line ensures that the Material Icons font is 82 | # included with your application, so that you can use the icons in 83 | # the material Icons class. 84 | uses-material-design: true 85 | 86 | # To add assets to your application, add an assets section, like this: 87 | # assets: 88 | # - images/a_dot_burr.jpeg 89 | # - images/a_dot_ham.jpeg 90 | 91 | # An image asset can refer to one or more resolution-specific "variants", see 92 | # https://flutter.dev/assets-and-images/#resolution-aware 93 | 94 | # For details regarding adding assets from package dependencies, see 95 | # https://flutter.dev/assets-and-images/#from-packages 96 | 97 | # To add custom fonts to your application, add a fonts section here, 98 | # in this "flutter" section. Each entry in this list should have a 99 | # "family" key with the font family name, and a "fonts" key with a 100 | # list giving the asset and other descriptors for the font. For 101 | # example: 102 | # fonts: 103 | # - family: Schyler 104 | # fonts: 105 | # - asset: fonts/Schyler-Regular.ttf 106 | # - asset: fonts/Schyler-Italic.ttf 107 | # style: italic 108 | # - family: Trajan Pro 109 | # fonts: 110 | # - asset: fonts/TrajanPro.ttf 111 | # - asset: fonts/TrajanPro_Bold.ttf 112 | # weight: 700 113 | # 114 | # For details regarding fonts from package dependencies, 115 | # see https://flutter.dev/custom-fonts/#from-packages 116 | -------------------------------------------------------------------------------- /test/login/login_bloc/login_bloc_test.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'package:bloc_clean_coding/bloc/login_bloc/login_bloc.dart'; 4 | import 'package:bloc_clean_coding/data/response/api_response.dart'; 5 | import 'package:bloc_clean_coding/model/user/user_model.dart'; 6 | import 'package:bloc_clean_coding/repository/auth_api/auth_api_repository.dart'; 7 | import 'package:bloc_clean_coding/services/session_manager/session_controller.dart'; 8 | import 'package:flutter_test/flutter_test.dart'; 9 | import 'package:mocktail/mocktail.dart'; 10 | import 'package:bloc_test/bloc_test.dart'; 11 | 12 | class MockAuthenticationRepository extends Mock 13 | implements AuthApiRepository {} 14 | 15 | class MockSessionController extends Mock implements SessionController {} 16 | 17 | void main(){ 18 | 19 | TestWidgetsFlutterBinding.ensureInitialized(); 20 | 21 | late LoginBloc loginBloc; 22 | const email = 'foe@gmail.com'; 23 | const password = 'password'; 24 | 25 | late AuthApiRepository authApiRepository; 26 | 27 | setUp(() { 28 | authApiRepository = MockAuthenticationRepository(); 29 | loginBloc = LoginBloc(authApiRepository: authApiRepository); 30 | }); 31 | 32 | group('LoginBloc', (){ 33 | test('initial state is LoginState', () { 34 | final loginBloc = LoginBloc(authApiRepository: authApiRepository); 35 | expect(loginBloc.state, const LoginStates()); 36 | }); 37 | 38 | 39 | blocTest( 40 | 'emits updated email when EmailChanged event is added', 41 | build: () => loginBloc, 42 | act: (bloc) => bloc.add(const EmailChanged(email: email)), 43 | expect: () => [ 44 | const LoginStates(email: email), 45 | ], 46 | ); 47 | 48 | 49 | blocTest( 50 | 'emits updated password when PasswordChanged event is added', 51 | build: () => loginBloc, 52 | act: (bloc) => bloc.add(const PasswordChanged(password: password)), 53 | expect: () => [ 54 | const LoginStates(password: password), 55 | ], 56 | ); 57 | 58 | blocTest( 59 | 'emits loading and completed states when LoginApi event is added and login is successful', 60 | setUp: () { 61 | Map data = { 62 | 'email': email, 63 | 'password':password, 64 | }; 65 | when(() => authApiRepository.loginApi(data)) 66 | .thenAnswer((_) async => UserModel(token: '1jxls2')); 67 | }, 68 | build: () => LoginBloc( 69 | authApiRepository: authApiRepository, 70 | ), 71 | act: (bloc) { 72 | bloc.add(const EmailChanged(email: email)); 73 | bloc.add(const PasswordChanged(password: password)); 74 | bloc.add(const LoginApi()); 75 | }, 76 | expect: () => const [ 77 | LoginStates(email: email), 78 | LoginStates(password: password), 79 | LoginStates( 80 | email: email, 81 | password: password, 82 | loginApi: ApiResponse.loading()), 83 | LoginStates( 84 | email: email, 85 | password: password, 86 | loginApi: ApiResponse.completed('Login successful')), 87 | ], 88 | ); 89 | }); 90 | } -------------------------------------------------------------------------------- /test/login/login_bloc/login_event_test.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:bloc_clean_coding/bloc/login_bloc/login_bloc.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | String email = 'test@gmail.com'; 7 | String password = 'mock-password'; 8 | group('LoginEvent', () { 9 | group('EmailChange', () { 10 | test('supports value comparisons', () { 11 | expect(EmailChanged( email: email), EmailChanged(email: email)); 12 | }); 13 | }); 14 | 15 | group('PasswordChanged', () { 16 | test('supports value comparisons', () { 17 | expect(PasswordChanged( password: password), PasswordChanged(password: password)); 18 | }); 19 | }); 20 | 21 | group('LoginApi', () { 22 | test('supports value comparisons', () { 23 | expect(LoginApi(), LoginApi()); 24 | }); 25 | }); 26 | }); 27 | } -------------------------------------------------------------------------------- /test/login/login_bloc/login_state_test.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer_const_constructors 2 | 3 | import 'package:bloc_clean_coding/bloc/login_bloc/login_bloc.dart'; 4 | import 'package:bloc_clean_coding/data/response/api_response.dart'; 5 | import 'package:bloc_clean_coding/utils/enums.dart'; 6 | import 'package:flutter_test/flutter_test.dart'; 7 | 8 | 9 | void main() { 10 | 11 | const email = 'test@khan.com' ; 12 | const password = '123456@12A' ; 13 | 14 | group('LoginStates', () { 15 | test('has default values', () { 16 | const loginState = LoginStates(); 17 | 18 | expect(loginState.email, ''); 19 | expect(loginState.password, ''); 20 | expect(loginState.loginApi, ApiResponse.completed('')); 21 | }); 22 | 23 | test('supports value comparisons', () { 24 | const state1 = LoginStates(email: email, password: password); 25 | const state2 = LoginStates(email: email, password: password); 26 | 27 | expect(state1, equals(state2)); 28 | }); 29 | 30 | test('copyWith creates a new instance with updated values', () { 31 | final loginState = LoginStates(email: email, password: password ); 32 | final updatedState = loginState.copyWith(email: 'new_email', password: 'new_password'); 33 | 34 | expect(updatedState.email, 'new_email'); 35 | expect(updatedState.password, 'new_password'); 36 | }); 37 | 38 | test('copyWith retains old values when no new values are provided', () { 39 | const loginState = LoginStates(email: 'test@khan.com', password: '123456'); 40 | final updatedState = loginState.copyWith(); 41 | 42 | expect(updatedState.email, loginState.email); 43 | expect(updatedState.password, loginState.password); 44 | expect(updatedState.loginApi, loginState.loginApi); 45 | }); 46 | 47 | test('loginApi supports copyWith updates', () { 48 | 49 | var loginApiResponse = ApiResponse.completed(''); 50 | var loginState = LoginStates(loginApi: loginApiResponse); 51 | final updatedApiResponse =ApiResponse.completed('Api Changes'); 52 | final updatedState = loginState.copyWith(loginApi: updatedApiResponse); 53 | 54 | expect(updatedState.loginApi, updatedApiResponse); 55 | 56 | }); 57 | }); 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | bloc_clean_coding 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bloc_clean_coding", 3 | "short_name": "bloc_clean_coding", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.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 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(bloc_clean_coding LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "bloc_clean_coding") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | FlutterLocalizationPluginCApiRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("FlutterLocalizationPluginCApi")); 15 | FlutterSecureStorageWindowsPluginRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); 17 | } 18 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_localization 7 | flutter_secure_storage_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "bloc_clean_coding" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "bloc_clean_coding" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "bloc_clean_coding.exe" "\0" 98 | VALUE "ProductName", "bloc_clean_coding" "\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 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"bloc_clean_coding", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axiftaj/Flutter-Bloc-Clean-Coding/94b969e0b9ea501c9be28a8bd793abad04f9647b/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------