├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h ├── my_application.cc └── CMakeLists.txt ├── lib ├── core │ ├── utils │ │ └── constants.dart │ ├── error │ │ ├── exceptions.dart │ │ └── failure.dart │ ├── values │ │ └── dimens.dart │ ├── widgets │ │ ├── app_bar_widget.dart │ │ └── default_text_field_widget.dart │ └── use_case │ │ └── base_use_case.dart ├── tasks │ ├── presentation │ │ ├── display │ │ │ ├── controller │ │ │ │ ├── tasks_event.dart │ │ │ │ ├── tasks_state.dart │ │ │ │ ├── tasks_bloc.dart │ │ │ │ └── tasks_bloc.freezed.dart │ │ │ ├── widgets │ │ │ │ └── task_list_widget.dart │ │ │ └── screens │ │ │ │ └── home_screen.dart │ │ └── add │ │ │ ├── controller │ │ │ ├── add_task_event.dart │ │ │ ├── add_task_state.dart │ │ │ └── add_task_bloc.dart │ │ │ └── screen │ │ │ └── add_task_screen.dart │ ├── domain │ │ ├── repositories │ │ │ └── task_repository.dart │ │ └── use_cases │ │ │ ├── add_task_use_case.dart │ │ │ └── get_all_tasks_use_case.dart │ └── data │ │ ├── data_sources │ │ └── local │ │ │ ├── tasks_local_data_source.dart │ │ │ ├── hive │ │ │ ├── tasks.dart │ │ │ ├── tasks.g.dart │ │ │ └── tasks_local_data_source_hive.dart │ │ │ ├── sembast │ │ │ └── tasks_local_data_source_sembast.dart │ │ │ └── sqflite │ │ │ └── tasks_local_data_source_sqflite.dart │ │ ├── models │ │ ├── tasks_model.dart │ │ ├── tasks_model.g.dart │ │ └── tasks_model.freezed.dart │ │ └── repositories │ │ └── tasks_repository_impl.dart ├── main.dart └── app │ ├── routes │ ├── screens │ │ └── not_found_screen.dart │ └── app_routes.dart │ └── di │ └── injector.dart ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist └── .gitignore ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ ├── app_icon_64.png │ │ │ ├── app_icon_1024.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Release.entitlements │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner.xcodeproj │ ├── project.xcworkspace │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── Runner.xcscheme ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── mohaned │ │ │ │ │ └── hive │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ ├── win32_window.h │ └── win32_window.cpp ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── .gitignore └── CMakeLists.txt ├── .gitignore ├── pubspec.yaml ├── test └── widget_test.dart ├── analysis_options.yaml ├── .metadata └── README.md /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /lib/core/utils/constants.dart: -------------------------------------------------------------------------------- 1 | class Constants{ 2 | } -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/web/favicon.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /lib/core/error/exceptions.dart: -------------------------------------------------------------------------------- 1 | class NoDataException implements Exception {} 2 | class ConnectionException implements Exception {} -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/core/values/dimens.dart: -------------------------------------------------------------------------------- 1 | const double pad5 = 5; 2 | const double pad8 = 8; 3 | const double pad10 = 10; 4 | const double pad15 = 15; 5 | const double pad18 = 18; 6 | const double pad20 = 20; -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/core/widgets/app_bar_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | AppBar getAppBar(String title) => AppBar( 4 | elevation: 0, 5 | title: Text( 6 | title 7 | ), 8 | ); -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/mohaned/hive/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mohaned.hive 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /lib/tasks/presentation/display/controller/tasks_event.dart: -------------------------------------------------------------------------------- 1 | part of 'tasks_bloc.dart'; 2 | 3 | @freezed 4 | class TasksEvent with _$TasksEvent { 5 | const factory TasksEvent.getAllTasks() = GetAllTasksEvent; 6 | } 7 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohanedZekry/flutter-local-storage-clean-architecture/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/tasks/presentation/add/controller/add_task_event.dart: -------------------------------------------------------------------------------- 1 | part of 'add_task_bloc.dart'; 2 | 3 | @freezed 4 | class AddTaskEvent with _$AddTaskEvent { 5 | const factory AddTaskEvent.addNewTask(TasksModel tasksModel) = AddNewTaskEvent; 6 | } 7 | -------------------------------------------------------------------------------- /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 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /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.5-all.zip 6 | -------------------------------------------------------------------------------- /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 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /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/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.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/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/core/error/failure.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class Failure extends Equatable {} 4 | 5 | class NoDataFailure extends Failure { 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class DatabaseFailure extends Failure { 11 | @override 12 | List get props => []; 13 | } 14 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /lib/tasks/domain/repositories/task_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:flutterhive/core/error/failure.dart'; 3 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 4 | 5 | abstract class TasksRepository { 6 | Future>> getAllTasks(); 7 | Future> addTask(TasksModel task); 8 | } -------------------------------------------------------------------------------- /lib/tasks/presentation/add/controller/add_task_state.dart: -------------------------------------------------------------------------------- 1 | part of 'add_task_bloc.dart'; 2 | 3 | @freezed 4 | class AddTaskState with _$AddTaskState { 5 | const factory AddTaskState.initial() = _Initial; 6 | const factory AddTaskState.loading() = _Loading; 7 | const factory AddTaskState.success() = _Success; 8 | const factory AddTaskState.failed() = _Failed; 9 | } 10 | -------------------------------------------------------------------------------- /lib/tasks/presentation/display/controller/tasks_state.dart: -------------------------------------------------------------------------------- 1 | part of 'tasks_bloc.dart'; 2 | 3 | @freezed 4 | class TasksState with _$TasksState { 5 | const factory TasksState.initial() = _Initial; 6 | const factory TasksState.loading() = _Loading; 7 | const factory TasksState.loaded(List tasks) = _Loaded; 8 | const factory TasksState.error() = _Failed; 9 | } 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/core/use_case/base_use_case.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | import '../error/failure.dart'; 4 | 5 | abstract class BaseUseCase { 6 | Future> call(P param); 7 | } 8 | 9 | class DefaultParams extends Equatable { 10 | const DefaultParams(); 11 | @override 12 | List get props => []; 13 | } -------------------------------------------------------------------------------- /lib/tasks/data/data_sources/local/tasks_local_data_source.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import '../../models/tasks_model.dart'; 3 | 4 | abstract class TasksLocalDataSource { 5 | Future initDb(); 6 | Future> getAllTasks(); 7 | Future addTask(TasksModel task); 8 | Future deleteTask(String title); 9 | Future deleteAllTasks(); 10 | } -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/tasks/data/data_sources/local/hive/tasks.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive/hive.dart'; 2 | part 'tasks.g.dart'; 3 | 4 | @HiveType(typeId: 0) 5 | class Tasks{ 6 | @HiveField(0) 7 | final String title; 8 | @HiveField(1) 9 | final String description; 10 | @HiveField(2) 11 | final bool isDone; 12 | 13 | Tasks({ 14 | required this.title, 15 | required this.description, 16 | required this.isDone 17 | }); 18 | 19 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 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 | -------------------------------------------------------------------------------- /lib/tasks/data/models/tasks_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | part 'tasks_model.freezed.dart'; 3 | part 'tasks_model.g.dart'; 4 | 5 | @freezed 6 | class TasksModel with _$TasksModel { 7 | 8 | factory TasksModel({ 9 | required String title, 10 | required String description, 11 | @Default(false) bool isDone 12 | }) = _TasksModel; 13 | 14 | factory TasksModel.fromJson(Map json) => _$TasksModelFromJson(json); 15 | 16 | } -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | import shared_preferences_foundation 10 | import sqflite 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 14 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 15 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /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/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 = hive 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.mohaned.hive 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.mohaned. All rights reserved. 15 | -------------------------------------------------------------------------------- /lib/tasks/domain/use_cases/add_task_use_case.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:flutterhive/core/error/failure.dart'; 3 | import 'package:flutterhive/core/use_case/base_use_case.dart'; 4 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 5 | import 'package:flutterhive/tasks/domain/repositories/task_repository.dart'; 6 | 7 | class AddTaskUseCase extends BaseUseCase{ 8 | 9 | final TasksRepository taskRepository; 10 | 11 | AddTaskUseCase({required this.taskRepository}); 12 | 13 | @override 14 | Future> call(TasksModel param) async { 15 | return await taskRepository.addTask(param); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /lib/tasks/domain/use_cases/get_all_tasks_use_case.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:flutterhive/core/error/failure.dart'; 3 | import 'package:flutterhive/core/use_case/base_use_case.dart'; 4 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 5 | import '../repositories/task_repository.dart'; 6 | 7 | class GetAllTasksUseCase extends BaseUseCase, DefaultParams>{ 8 | 9 | final TasksRepository taskRepository; 10 | 11 | GetAllTasksUseCase({required this.taskRepository}); 12 | 13 | @override 14 | Future>> call(DefaultParams param) async { 15 | return await taskRepository.getAllTasks(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterhive/app/di/injector.dart'; 3 | import 'package:flutterhive/app/routes/app_routes.dart'; 4 | 5 | void main() async { 6 | WidgetsFlutterBinding.ensureInitialized(); 7 | await initDependencies(); 8 | runApp(const MyApp()); 9 | } 10 | 11 | class MyApp extends StatelessWidget { 12 | const MyApp({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp.router( 17 | debugShowCheckedModeBanner: false, 18 | title: 'Flutter Storage', 19 | routeInformationProvider: AppRouter.router.routeInformationProvider, 20 | routeInformationParser: AppRouter.router.routeInformationParser, 21 | routerDelegate: AppRouter.router.routerDelegate, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/tasks/data/models/tasks_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'tasks_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_TasksModel _$$_TasksModelFromJson(Map json) => 10 | _$_TasksModel( 11 | title: json['title'] as String, 12 | description: json['description'] as String, 13 | isDone: json['isDone'] as bool? ?? false, 14 | ); 15 | 16 | Map _$$_TasksModelToJson(_$_TasksModel instance) => 17 | { 18 | 'title': instance.title, 19 | 'description': instance.description, 20 | 'isDone': instance.isDone, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/tasks/presentation/display/widgets/task_list_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterhive/core/values/dimens.dart'; 3 | import '../../../data/models/tasks_model.dart'; 4 | 5 | 6 | class TaskListWidget extends StatelessWidget { 7 | final List tasks; 8 | const TaskListWidget({Key? key, required this.tasks}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return ListView.builder( 13 | itemBuilder: (context, index) => ListTile( 14 | title: Text( 15 | tasks[index].title 16 | ), 17 | subtitle: Text( 18 | tasks[index].description, 19 | ), 20 | ), 21 | itemCount: tasks.length, 22 | padding: const EdgeInsets.symmetric(vertical: pad10, horizontal: pad18), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutterhive 2 | description: Flutter - Hive 3 | publish_to: 'none' 4 | 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: '>=2.19.0 <3.0.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | cupertino_icons: ^1.0.2 15 | go_router: ^6.0.10 16 | get_it: ^7.2.0 17 | logger: ^1.2.2 18 | flutter_bloc: ^8.1.2 19 | path_provider: ^2.0.13 20 | equatable: ^2.0.5 21 | dartz: ^0.10.1 22 | freezed_annotation: ^2.2.0 23 | 24 | ## Local Storage Packages ## 25 | hive: ^2.2.3 26 | hive_flutter: ^1.1.0 27 | sqflite: ^2.2.4 28 | sembast: ^3.4.0 29 | shared_preferences: ^2.0.18 30 | 31 | 32 | 33 | dev_dependencies: 34 | flutter_test: 35 | sdk: flutter 36 | 37 | flutter_lints: ^2.0.0 38 | hive_generator: ^2.0.0 39 | build_runner: ^2.3.3 40 | freezed: ^2.3.2 41 | json_serializable: ^6.6.1 42 | 43 | flutter: 44 | 45 | uses-material-design: true 46 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib/tasks/presentation/add/controller/add_task_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | import '../../../domain/use_cases/add_task_use_case.dart'; 5 | part 'add_task_event.dart'; 6 | part 'add_task_state.dart'; 7 | part 'add_task_bloc.freezed.dart'; 8 | 9 | class AddTaskBloc extends Bloc { 10 | 11 | final AddTaskUseCase addTaskUseCase; 12 | 13 | AddTaskBloc({required this.addTaskUseCase}) : super(const AddTaskState.initial()) { 14 | on((event, emit) async { 15 | if(event is AddNewTaskEvent){ 16 | emit(const AddTaskState.loading()); 17 | final result = await addTaskUseCase(event.tasksModel); 18 | result.fold( 19 | (l) => emit(const AddTaskState.failed()), 20 | (r) => emit(const AddTaskState.success()) 21 | ); 22 | } 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/tasks/presentation/display/controller/tasks_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | 4 | import '../../../../core/use_case/base_use_case.dart'; 5 | import '../../../data/models/tasks_model.dart'; 6 | import '../../../domain/use_cases/get_all_tasks_use_case.dart'; 7 | part 'tasks_event.dart'; 8 | part 'tasks_state.dart'; 9 | part 'tasks_bloc.freezed.dart'; 10 | 11 | class TasksBloc extends Bloc { 12 | final GetAllTasksUseCase getAllTasksUseCase; 13 | TasksBloc({required this.getAllTasksUseCase}) : super(const TasksState.initial()) { 14 | on((event, emit) async { 15 | if(event is GetAllTasksEvent){ 16 | emit(const TasksState.loading()); 17 | final response = await getAllTasksUseCase(const DefaultParams()); 18 | response.fold( 19 | (l) => emit(const TasksState.error()), 20 | (r) => emit(TasksState.loaded(r))); 21 | } 22 | 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hive", 3 | "short_name": "hive", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "Flutter - Hive", 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/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 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | import 'package:flutterhive/main.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(const MyApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/app/routes/screens/not_found_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterhive/app/routes/app_routes.dart'; 3 | import 'package:go_router/go_router.dart'; 4 | 5 | class NotFoundScreen extends StatelessWidget { 6 | const NotFoundScreen({ 7 | Key? key, 8 | }) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Material( 13 | child: Column( 14 | mainAxisAlignment: MainAxisAlignment.center, 15 | children: [ 16 | const Text('Sorry no page was found'), 17 | Image.network( 18 | 'https://i.pinimg.com/736x/4e/37/3b/4e373b73dc9535ffc979d975897a0840.jpg', 19 | height: 200, 20 | ), 21 | const SizedBox(height: 30), 22 | const Text( 23 | '404', 24 | style: TextStyle(fontSize: 80, fontWeight: FontWeight.bold)), 25 | const SizedBox(height: 30), 26 | const Text('You want me to take you home?'), 27 | const SizedBox(height: 30), 28 | TextButton.icon( 29 | onPressed: () { 30 | GoRouter.of(context).go(AppRouter.root); 31 | }, 32 | icon: const Icon(Icons.home), 33 | label: const Text('Go Home')), 34 | ], 35 | ), 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /lib/tasks/data/repositories/tasks_repository_impl.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:flutterhive/core/error/exceptions.dart'; 3 | import 'package:flutterhive/core/error/failure.dart'; 4 | import 'package:flutterhive/tasks/data/data_sources/local/tasks_local_data_source.dart'; 5 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 6 | import '../../domain/repositories/task_repository.dart'; 7 | 8 | class TasksRepositoryImpl implements TasksRepository { 9 | 10 | final TasksLocalDataSource tasksLocalDataSource; 11 | 12 | const TasksRepositoryImpl({ 13 | required this.tasksLocalDataSource 14 | }); 15 | 16 | @override 17 | Future> addTask(TasksModel task) async { 18 | try{ 19 | final response = await tasksLocalDataSource.addTask( 20 | TasksModel( 21 | title: task.title, 22 | description: task.description, 23 | isDone: task.isDone) 24 | ); 25 | return Right(response); 26 | } on ConnectionException { 27 | return Left(DatabaseFailure()); 28 | } 29 | } 30 | 31 | @override 32 | Future>> getAllTasks() async { 33 | try{ 34 | final response = await tasksLocalDataSource.getAllTasks(); 35 | return Right(response); 36 | } on NoDataException { 37 | return Left(NoDataFailure()); 38 | } 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /lib/tasks/data/data_sources/local/hive/tasks.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'tasks.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class TasksAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 0; 12 | 13 | @override 14 | Tasks read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return Tasks( 20 | title: fields[0] as String, 21 | description: fields[1] as String, 22 | isDone: fields[2] as bool, 23 | ); 24 | } 25 | 26 | @override 27 | void write(BinaryWriter writer, Tasks obj) { 28 | writer 29 | ..writeByte(3) 30 | ..writeByte(0) 31 | ..write(obj.title) 32 | ..writeByte(1) 33 | ..write(obj.description) 34 | ..writeByte(2) 35 | ..write(obj.isDone); 36 | } 37 | 38 | @override 39 | int get hashCode => typeId.hashCode; 40 | 41 | @override 42 | bool operator ==(Object other) => 43 | identical(this, other) || 44 | other is TasksAdapter && 45 | runtimeType == other.runtimeType && 46 | typeId == other.typeId; 47 | } 48 | -------------------------------------------------------------------------------- /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"hive", 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 | -------------------------------------------------------------------------------- /lib/tasks/presentation/display/screens/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:flutterhive/app/routes/app_routes.dart'; 4 | import 'package:flutterhive/core/widgets/app_bar_widget.dart'; 5 | import 'package:go_router/go_router.dart'; 6 | import '../controller/tasks_bloc.dart'; 7 | import '../widgets/task_list_widget.dart'; 8 | 9 | 10 | class HomeScreen extends StatelessWidget { 11 | const HomeScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | late Widget finalView; 16 | return Scaffold( 17 | appBar: getAppBar('Home Screen'), 18 | floatingActionButton: FloatingActionButton( 19 | onPressed: (){ 20 | GoRouter.of(context).go(AppRouter.addTaskRoute); 21 | }, 22 | child: const Icon(Icons.add), 23 | ), 24 | body: BlocBuilder( 25 | builder: (context, state) { 26 | state.when( 27 | initial: () => finalView = const SizedBox(), 28 | loading: () => finalView = const Center(child: CircularProgressIndicator()), 29 | loaded: (tasks) => finalView = TaskListWidget(tasks: tasks), 30 | error: () => finalView = const Center(child: Text('error')) 31 | ); 32 | return finalView; 33 | }, 34 | ) 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /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 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 17 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 18 | - platform: android 19 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 20 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 21 | - platform: ios 22 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 23 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 24 | - platform: linux 25 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 26 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 27 | - platform: macos 28 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 29 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 30 | - platform: web 31 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 32 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 33 | - platform: windows 34 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 35 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /lib/core/widgets/default_text_field_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DefaultTextFieldWidget extends StatelessWidget { 4 | 5 | final TextEditingController controller; 6 | final String labelTitle; 7 | const DefaultTextFieldWidget({ 8 | Key? key, 9 | required this.controller, 10 | required this.labelTitle 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return TextFormField( 16 | keyboardType: TextInputType.emailAddress, 17 | maxLength: 60, 18 | style: const TextStyle( 19 | fontSize: 18, 20 | fontWeight: FontWeight.w500 21 | ), 22 | controller: controller, 23 | validator: (val) => 24 | val!.isEmpty ? 'Please $labelTitle your email' : null, 25 | decoration: InputDecoration( 26 | border: const OutlineInputBorder( 27 | borderRadius: BorderRadius.all( 28 | Radius.circular(15) 29 | ), 30 | ), 31 | labelText: labelTitle, 32 | counterText: '', 33 | filled: true, 34 | enabledBorder: OutlineInputBorder( 35 | borderSide: BorderSide( 36 | color: Colors.grey.withOpacity(0.7), 37 | width: 0, 38 | ), 39 | borderRadius: const BorderRadius.all( 40 | Radius.circular(15) 41 | ), 42 | ), 43 | focusedBorder: const OutlineInputBorder( 44 | borderSide: BorderSide( 45 | color: Colors.blue, 46 | width: 1, 47 | ), 48 | borderRadius: BorderRadius.all( 49 | Radius.circular(15) 50 | ), 51 | ), 52 | 53 | fillColor: Colors.grey.withOpacity(0.1), 54 | prefixIcon: Icon( 55 | Icons.info_outline_rounded, color: Colors.blue.withOpacity(.8),), 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Hive 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | hive 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 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/app/routes/app_routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:flutterhive/app/di/injector.dart'; 4 | import 'package:flutterhive/app/routes/screens/not_found_screen.dart'; 5 | import 'package:flutterhive/tasks/presentation/add/controller/add_task_bloc.dart'; 6 | import 'package:flutterhive/tasks/presentation/add/screen/add_task_screen.dart'; 7 | import 'package:go_router/go_router.dart'; 8 | 9 | import '../../tasks/presentation/display/controller/tasks_bloc.dart'; 10 | import '../../tasks/presentation/display/screens/home_screen.dart'; 11 | 12 | class AppRouter { 13 | 14 | static const root = '/'; 15 | static const addTaskRoute = '/AddNewTask'; 16 | 17 | static final GoRouter _router = GoRouter( 18 | routes: [ 19 | GoRoute( 20 | path: root, 21 | pageBuilder: (context, state) => 22 | CustomTransitionPage( 23 | child: BlocProvider( 24 | create: (context) => injector()..add(const GetAllTasksEvent()), 25 | child: const HomeScreen(), 26 | ), 27 | transitionsBuilder: (context, animation, secondaryAnimation, 28 | child) => FadeTransition(opacity: animation, child: child), 29 | ), 30 | ), 31 | GoRoute( 32 | path: addTaskRoute, 33 | pageBuilder: (context, state) => 34 | CustomTransitionPage( 35 | child: BlocProvider( 36 | create: (context) => injector(), 37 | child: const AddTaskScreen(), 38 | ), 39 | transitionsBuilder: (context, animation, secondaryAnimation, 40 | child) => FadeTransition(opacity: animation, child: child), 41 | ), 42 | ), 43 | 44 | ], 45 | errorBuilder: (context, state) => const NotFoundScreen(), 46 | ); 47 | 48 | static GoRouter get router => _router; 49 | 50 | } -------------------------------------------------------------------------------- /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 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /lib/app/di/injector.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutterhive/tasks/data/data_sources/local/hive/tasks_local_data_source_hive.dart'; 2 | import 'package:flutterhive/tasks/data/data_sources/local/sembast/tasks_local_data_source_sembast.dart'; 3 | import 'package:flutterhive/tasks/data/data_sources/local/sqflite/tasks_local_data_source_sqflite.dart'; 4 | import 'package:flutterhive/tasks/data/data_sources/local/tasks_local_data_source.dart'; 5 | import 'package:flutterhive/tasks/data/repositories/tasks_repository_impl.dart'; 6 | import 'package:flutterhive/tasks/domain/repositories/task_repository.dart'; 7 | import 'package:flutterhive/tasks/domain/use_cases/add_task_use_case.dart'; 8 | import 'package:flutterhive/tasks/domain/use_cases/get_all_tasks_use_case.dart'; 9 | import 'package:flutterhive/tasks/presentation/add/controller/add_task_bloc.dart'; 10 | import 'package:get_it/get_it.dart'; 11 | import '../../tasks/presentation/display/controller/tasks_bloc.dart'; 12 | 13 | final injector = GetIt.instance; 14 | 15 | Future initDependencies() async { 16 | 17 | /// Data Source /// 18 | injector.registerLazySingleton(() => TasksLocalDataSourceHive()); 19 | //injector.registerLazySingleton(() => TasksLocalDataSourceSembast()); 20 | //injector.registerLazySingleton(() => TasksLocalDataSourceSqflite()); 21 | 22 | /// Repository /// 23 | injector.registerLazySingleton( 24 | () => TasksRepositoryImpl(tasksLocalDataSource: injector())); 25 | 26 | /// UseCase /// 27 | injector.registerLazySingleton(() => GetAllTasksUseCase(taskRepository: injector())); 28 | injector.registerLazySingleton(() => AddTaskUseCase(taskRepository: injector())); 29 | 30 | /// BloC /// 31 | injector.registerFactory(() => TasksBloc(getAllTasksUseCase: injector())); 32 | injector.registerFactory(() => AddTaskBloc(addTaskUseCase: injector())); 33 | 34 | await injector().initDb(); 35 | 36 | } -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | hive 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /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 | return true; 35 | } 36 | 37 | void FlutterWindow::OnDestroy() { 38 | if (flutter_controller_) { 39 | flutter_controller_ = nullptr; 40 | } 41 | 42 | Win32Window::OnDestroy(); 43 | } 44 | 45 | LRESULT 46 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 47 | WPARAM const wparam, 48 | LPARAM const lparam) noexcept { 49 | // Give Flutter, including plugins, an opportunity to handle window messages. 50 | if (flutter_controller_) { 51 | std::optional result = 52 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 53 | lparam); 54 | if (result) { 55 | return *result; 56 | } 57 | } 58 | 59 | switch (message) { 60 | case WM_FONTCHANGE: 61 | flutter_controller_->engine()->ReloadSystemFonts(); 62 | break; 63 | } 64 | 65 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 66 | } 67 | -------------------------------------------------------------------------------- /lib/tasks/data/data_sources/local/hive/tasks_local_data_source_hive.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:flutterhive/core/error/exceptions.dart'; 3 | import 'package:flutterhive/tasks/data/data_sources/local/tasks_local_data_source.dart'; 4 | import 'package:hive/hive.dart'; 5 | import '../../../models/tasks_model.dart'; 6 | import 'tasks.dart'; 7 | import 'package:flutter/foundation.dart' as foundation; 8 | import 'package:path_provider/path_provider.dart'; 9 | 10 | class TasksLocalDataSourceHive implements TasksLocalDataSource { 11 | 12 | final _kTaskBox = 'tasks_box'; 13 | 14 | @override 15 | Future initDb() async { 16 | try { 17 | if (!foundation.kIsWeb) { 18 | final appDocumentDir = await getApplicationDocumentsDirectory(); 19 | Hive.init(appDocumentDir.path); 20 | } 21 | Hive.registerAdapter(TasksAdapter()); 22 | await Hive.openBox(_kTaskBox); 23 | return true; 24 | } catch (_) { 25 | throw ConnectionException(); 26 | } 27 | } 28 | 29 | @override 30 | Future addTask(TasksModel task) async { 31 | try{ 32 | final tasksBox = Hive.box(_kTaskBox); 33 | final convertedTask = Tasks(title: task.title, description: task.description, isDone: task.isDone); 34 | await tasksBox.add(convertedTask); 35 | return Future.value(unit); 36 | } catch (_) { 37 | throw ConnectionException(); 38 | } 39 | 40 | } 41 | 42 | @override 43 | Future> getAllTasks() async { 44 | try { 45 | final tasksBox = Hive.box(_kTaskBox); 46 | final result = tasksBox.values.map((e) => 47 | TasksModel( 48 | title: e.title, description: e.description, isDone: e.isDone)) 49 | .toList(); 50 | return result; 51 | } catch (_) { 52 | throw NoDataException(); 53 | } 54 | } 55 | 56 | @override 57 | Future deleteTask(String title) async { 58 | final tasksBox = Hive.box(_kTaskBox); 59 | await tasksBox.delete(title); 60 | return Future.value(unit); 61 | } 62 | 63 | @override 64 | Future deleteAllTasks() async { 65 | final tasksBox = Hive.box(_kTaskBox); 66 | await tasksBox.clear(); 67 | return Future.value(unit); 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.mohaned.hive" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /lib/tasks/data/data_sources/local/sembast/tasks_local_data_source_sembast.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:flutterhive/core/error/exceptions.dart'; 3 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 4 | import 'package:path_provider/path_provider.dart'; 5 | import 'package:sembast/sembast.dart'; 6 | import 'package:sembast/sembast_io.dart'; 7 | import '../tasks_local_data_source.dart'; 8 | import 'package:path/path.dart'; 9 | 10 | class TasksLocalDataSourceSembast implements TasksLocalDataSource { 11 | 12 | final _kDbFileName = 'sembast_tasks.db'; 13 | final _kTasksStore = 'tasks_store'; 14 | 15 | late Database _database; 16 | 17 | late StoreRef> _tasksStore; 18 | 19 | @override 20 | Future initDb() async { 21 | try { 22 | final appDocumentDir = await getApplicationDocumentsDirectory(); 23 | final dbPath = join(appDocumentDir.path, _kDbFileName); 24 | _database = await databaseFactoryIo.openDatabase(dbPath); 25 | _tasksStore = intMapStoreFactory.store(_kTasksStore); 26 | return true; 27 | } catch (_) { 28 | throw ConnectionException(); 29 | } 30 | } 31 | 32 | @override 33 | Future addTask(TasksModel task) async { 34 | try { 35 | await _tasksStore.add(_database, task.toJson()); 36 | return Future.value(unit); 37 | } catch (_) { 38 | throw ConnectionException(); 39 | } 40 | } 41 | 42 | @override 43 | Future deleteAllTasks() async { 44 | try { 45 | final appDocumentDir = await getApplicationDocumentsDirectory(); 46 | final dbPath = join(appDocumentDir.path, _kDbFileName); 47 | await databaseFactoryIo.deleteDatabase(dbPath); 48 | return Future.value(unit); 49 | } catch (_) { 50 | throw ConnectionException(); 51 | } 52 | } 53 | 54 | @override 55 | Future deleteTask(String title) async { 56 | try { 57 | await _tasksStore.delete(_database); 58 | return Future.value(unit); 59 | } catch (_) { 60 | throw ConnectionException(); 61 | } 62 | } 63 | 64 | @override 65 | Future> getAllTasks() async { 66 | try { 67 | final recordSnapshots = await _tasksStore.find(_database); 68 | final response = recordSnapshots.map( 69 | (e) => TasksModel.fromJson(e.value)).toList(growable: false); 70 | return response; 71 | } catch (_) { 72 | throw NoDataException(); 73 | } 74 | 75 | } 76 | 77 | 78 | } -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/tasks/data/data_sources/local/sqflite/tasks_local_data_source_sqflite.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutterhive/core/error/exceptions.dart'; 3 | import 'package:path/path.dart'; 4 | import 'package:dartz/dartz.dart'; 5 | import 'package:flutterhive/tasks/data/data_sources/local/tasks_local_data_source.dart'; 6 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 7 | import 'package:sqflite/sqflite.dart'; 8 | 9 | class TasksLocalDataSourceSqflite implements TasksLocalDataSource { 10 | 11 | late Database _db; 12 | final _mDbName = 'nsqflite.db'; 13 | final _mTasksTb = 'tasks_tb'; 14 | 15 | @override 16 | Future initDb() async { 17 | try { 18 | final dbFolder = await getDatabasesPath(); 19 | if (!await Directory(dbFolder).exists()) { 20 | await Directory(dbFolder).create(recursive: true); 21 | } 22 | final dbPath = join(dbFolder, _mDbName); 23 | _db = await openDatabase( 24 | dbPath, 25 | version: 1, 26 | onCreate: (db, version) async { 27 | await _initTasksTable(db); 28 | }, 29 | ); 30 | return true; 31 | } catch (_) { 32 | throw ConnectionException(); 33 | } 34 | } 35 | Future _initTasksTable(Database db) async { 36 | await db.execute(''' 37 | CREATE TABLE $_mTasksTb( 38 | title TEXT, 39 | description TEXT 40 | ) 41 | '''); 42 | } 43 | 44 | @override 45 | Future addTask(TasksModel task) async { 46 | try { 47 | await _db.transaction( 48 | (txn) async { 49 | await txn.rawInsert(''' 50 | INSERT INTO $_mTasksTb 51 | ( 52 | title, 53 | description 54 | ) 55 | VALUES 56 | ( 57 | "${task.title}", 58 | "${task.description}" 59 | )'''); 60 | }, 61 | ); 62 | // success inserted data 63 | return Future.value(unit); 64 | } catch (e) { 65 | throw ConnectionException(); 66 | } 67 | } 68 | 69 | @override 70 | Future deleteAllTasks() async { 71 | try { 72 | await _db.rawDelete(''' 73 | DELETE FROM $_mTasksTb 74 | '''); 75 | return Future.value(unit); 76 | } catch (e) { 77 | throw ConnectionException(); 78 | } 79 | } 80 | 81 | @override 82 | Future deleteTask(String title) async { 83 | try { 84 | await _db.rawDelete(''' 85 | DELETE FROM $_mTasksTb 86 | WHERE title = $title 87 | '''); 88 | return Future.value(unit); 89 | } catch (e) { 90 | throw ConnectionException(); 91 | } 92 | } 93 | 94 | @override 95 | Future> getAllTasks() async { 96 | final json = await _db.rawQuery('SELECT * FROM $_mTasksTb'); 97 | return json.map((e) => TasksModel.fromJson(e)).toList(); 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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.mohaned" "\0" 93 | VALUE "FileDescription", "hive" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "hive" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.mohaned. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "hive.exe" "\0" 98 | VALUE "ProductName", "hive" "\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/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 | // responsponds 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 | -------------------------------------------------------------------------------- /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 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /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, "hive"); 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, "hive"); 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 GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(hive 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 "hive") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 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 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Local Storage Clean Architecture 2 | 3 | In this project we will use trending local storage packages we will determine how long it takes each option below to perform the operations, so we can have a clear understanding of which is the best choice for us. 4 | The project is implementing a clean architecture & bloc for state management so that it’s easy to understand and easy to change as the project grows in the future and implement new technologies or packages. 5 | 6 | - [hive](https://pub.dev/packages/hive) 7 | - [sembast](https://pub.dev/packages/sembast) 8 | - [sqflite](https://pub.dev/packages/sqflite) 9 | - [shared_preferences](https://pub.dev/packages/shared_preferences) 10 | - [isar](https://pub.dev/packages/isar) 11 | 12 | ## Table of Contents 13 | - [Setup](#intro) 14 | - [Modules](#modules) 15 | - [Implementation](#implementation) 16 | - [Hive](#hive) 17 | - [Sembast](#sembast) 18 | 19 | ## Setup 20 | - State Management: [bloc](https://pub.dev/packages/flutter_bloc) 21 | - Navigation: [go_router](https://pub.dev/packages/go_router) 22 | - Service Locator: [get_it](https://pub.dev/packages/get_it) 23 | - Data Classes: [freezed](https://pub.dev/packages/freezed) 24 | - *Packages* 25 | - [dartz](https://pub.dev/packages/freezed) 26 | - [logger](https://pub.dev/packages/logger) 27 | 28 | ## Modules 29 | | Modules | Progress | 30 | | :---------- | :-------: | 31 | | Data | ✅ | 32 | | Domain | ✅ | 33 | | Presentation | ✅ | 34 | 35 | ## Implementation 36 | ### Hive 37 | is a lightweight and blazing fast key-value database written in pure Dart. 38 | Hive having the idea of `boxes` (which store data). 39 | 40 | Hive stores its data in boxes containing key-value sets `Hive.box` 41 | You can call 42 | ```dart 43 | Hive.openBox(‘name’) 44 | ``` 45 | regardless of whether you as of now have the box opened elsewhere. 46 | 47 | Let’s implement the model class 48 | ```dart 49 | import 'package:hive/hive.dart'; 50 | part 'tasks.g.dart'; 51 | 52 | @HiveType(typeId: 0) 53 | class Tasks{ 54 | @HiveField(0) 55 | final String name; 56 | @HiveField(1) 57 | final String content; 58 | @HiveField(2) 59 | final bool isDone; 60 | 61 | Tasks({ 62 | required this.name, 63 | required this.content, 64 | required this.isDone 65 | }); 66 | } 67 | ``` 68 | Then run a code generator by typing the following command in the terminal which will automatically generate database and Adapters for us. 69 | ```js 70 | $ flutter packages pub run build_runner build 71 | ``` 72 | 73 | **Note:** Dart File name is `tasks.dart` so i will add part `tasks.g.dart`. g stands for generated. Thus new generated file would be `tasks.g.dart` 74 | ```dart 75 | // GENERATED CODE - DO NOT MODIFY BY HAND 76 | 77 | part of 'tasks.dart'; 78 | 79 | // ************************************************************************** 80 | // TypeAdapterGenerator 81 | // ************************************************************************** 82 | 83 | class TasksAdapter extends TypeAdapter { 84 | @override 85 | final int typeId = 0; 86 | 87 | @override 88 | Tasks read(BinaryReader reader) { 89 | final numOfFields = reader.readByte(); 90 | final fields = { 91 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 92 | }; 93 | return Tasks( 94 | name: fields[0] as String, 95 | content: fields[1] as String, 96 | isDone: fields[2] as bool, 97 | ); 98 | } 99 | 100 | @override 101 | void write(BinaryWriter writer, Tasks obj) { 102 | writer 103 | ..writeByte(3) 104 | ..writeByte(0) 105 | ..write(obj.name) 106 | ..writeByte(1) 107 | ..write(obj.content) 108 | ..writeByte(2) 109 | ..write(obj.isDone); 110 | } 111 | 112 | @override 113 | int get hashCode => typeId.hashCode; 114 | 115 | @override 116 | bool operator ==(Object other) => 117 | identical(this, other) || 118 | other is TasksAdapter && 119 | runtimeType == other.runtimeType && 120 | typeId == other.typeId; 121 | } 122 | ``` 123 | ### Sembast 124 | is database stands for Simple Embedded Application Store database 125 | NoSQL persistent store database solution for single process io applications. 126 | 127 | ```dart 128 | final _kDbFileName = 'sembast_tasks.db'; 129 | final _kTasksStore = 'tasks_store'; 130 | 131 | late Database _database; 132 | 133 | StoreRef> _tasksStore; 134 | 135 | appDocumentDir = await getApplicationDocumentsDirectory(); 136 | 137 | dbPath = join(appDocumentDir.path, _kDbFileName); 138 | 139 | _database = await databaseFactoryIo.openDatabase(dbPath); 140 | 141 | _tasksStore = intMapStoreFactory.store(_kTasksStore); 142 | ``` 143 | -------------------------------------------------------------------------------- /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 "hive") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.mohaned.hive") 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 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /lib/tasks/data/models/tasks_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 'tasks_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#custom-getters-and-methods'); 16 | 17 | TasksModel _$TasksModelFromJson(Map json) { 18 | return _TasksModel.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$TasksModel { 23 | String get title => throw _privateConstructorUsedError; 24 | String get description => throw _privateConstructorUsedError; 25 | bool get isDone => throw _privateConstructorUsedError; 26 | 27 | Map toJson() => throw _privateConstructorUsedError; 28 | @JsonKey(ignore: true) 29 | $TasksModelCopyWith get copyWith => 30 | throw _privateConstructorUsedError; 31 | } 32 | 33 | /// @nodoc 34 | abstract class $TasksModelCopyWith<$Res> { 35 | factory $TasksModelCopyWith( 36 | TasksModel value, $Res Function(TasksModel) then) = 37 | _$TasksModelCopyWithImpl<$Res, TasksModel>; 38 | @useResult 39 | $Res call({String title, String description, bool isDone}); 40 | } 41 | 42 | /// @nodoc 43 | class _$TasksModelCopyWithImpl<$Res, $Val extends TasksModel> 44 | implements $TasksModelCopyWith<$Res> { 45 | _$TasksModelCopyWithImpl(this._value, this._then); 46 | 47 | // ignore: unused_field 48 | final $Val _value; 49 | // ignore: unused_field 50 | final $Res Function($Val) _then; 51 | 52 | @pragma('vm:prefer-inline') 53 | @override 54 | $Res call({ 55 | Object? title = null, 56 | Object? description = null, 57 | Object? isDone = null, 58 | }) { 59 | return _then(_value.copyWith( 60 | title: null == title 61 | ? _value.title 62 | : title // ignore: cast_nullable_to_non_nullable 63 | as String, 64 | description: null == description 65 | ? _value.description 66 | : description // ignore: cast_nullable_to_non_nullable 67 | as String, 68 | isDone: null == isDone 69 | ? _value.isDone 70 | : isDone // ignore: cast_nullable_to_non_nullable 71 | as bool, 72 | ) as $Val); 73 | } 74 | } 75 | 76 | /// @nodoc 77 | abstract class _$$_TasksModelCopyWith<$Res> 78 | implements $TasksModelCopyWith<$Res> { 79 | factory _$$_TasksModelCopyWith( 80 | _$_TasksModel value, $Res Function(_$_TasksModel) then) = 81 | __$$_TasksModelCopyWithImpl<$Res>; 82 | @override 83 | @useResult 84 | $Res call({String title, String description, bool isDone}); 85 | } 86 | 87 | /// @nodoc 88 | class __$$_TasksModelCopyWithImpl<$Res> 89 | extends _$TasksModelCopyWithImpl<$Res, _$_TasksModel> 90 | implements _$$_TasksModelCopyWith<$Res> { 91 | __$$_TasksModelCopyWithImpl( 92 | _$_TasksModel _value, $Res Function(_$_TasksModel) _then) 93 | : super(_value, _then); 94 | 95 | @pragma('vm:prefer-inline') 96 | @override 97 | $Res call({ 98 | Object? title = null, 99 | Object? description = null, 100 | Object? isDone = null, 101 | }) { 102 | return _then(_$_TasksModel( 103 | title: null == title 104 | ? _value.title 105 | : title // ignore: cast_nullable_to_non_nullable 106 | as String, 107 | description: null == description 108 | ? _value.description 109 | : description // ignore: cast_nullable_to_non_nullable 110 | as String, 111 | isDone: null == isDone 112 | ? _value.isDone 113 | : isDone // ignore: cast_nullable_to_non_nullable 114 | as bool, 115 | )); 116 | } 117 | } 118 | 119 | /// @nodoc 120 | @JsonSerializable() 121 | class _$_TasksModel implements _TasksModel { 122 | _$_TasksModel( 123 | {required this.title, required this.description, this.isDone = false}); 124 | 125 | factory _$_TasksModel.fromJson(Map json) => 126 | _$$_TasksModelFromJson(json); 127 | 128 | @override 129 | final String title; 130 | @override 131 | final String description; 132 | @override 133 | @JsonKey() 134 | final bool isDone; 135 | 136 | @override 137 | String toString() { 138 | return 'TasksModel(title: $title, description: $description, isDone: $isDone)'; 139 | } 140 | 141 | @override 142 | bool operator ==(dynamic other) { 143 | return identical(this, other) || 144 | (other.runtimeType == runtimeType && 145 | other is _$_TasksModel && 146 | (identical(other.title, title) || other.title == title) && 147 | (identical(other.description, description) || 148 | other.description == description) && 149 | (identical(other.isDone, isDone) || other.isDone == isDone)); 150 | } 151 | 152 | @JsonKey(ignore: true) 153 | @override 154 | int get hashCode => Object.hash(runtimeType, title, description, isDone); 155 | 156 | @JsonKey(ignore: true) 157 | @override 158 | @pragma('vm:prefer-inline') 159 | _$$_TasksModelCopyWith<_$_TasksModel> get copyWith => 160 | __$$_TasksModelCopyWithImpl<_$_TasksModel>(this, _$identity); 161 | 162 | @override 163 | Map toJson() { 164 | return _$$_TasksModelToJson( 165 | this, 166 | ); 167 | } 168 | } 169 | 170 | abstract class _TasksModel implements TasksModel { 171 | factory _TasksModel( 172 | {required final String title, 173 | required final String description, 174 | final bool isDone}) = _$_TasksModel; 175 | 176 | factory _TasksModel.fromJson(Map json) = 177 | _$_TasksModel.fromJson; 178 | 179 | @override 180 | String get title; 181 | @override 182 | String get description; 183 | @override 184 | bool get isDone; 185 | @override 186 | @JsonKey(ignore: true) 187 | _$$_TasksModelCopyWith<_$_TasksModel> get copyWith => 188 | throw _privateConstructorUsedError; 189 | } 190 | -------------------------------------------------------------------------------- /lib/tasks/presentation/add/screen/add_task_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:flutterhive/core/widgets/app_bar_widget.dart'; 4 | import 'package:flutterhive/tasks/data/models/tasks_model.dart'; 5 | import 'package:flutterhive/tasks/presentation/add/controller/add_task_bloc.dart'; 6 | import 'package:go_router/go_router.dart'; 7 | import '../../../../app/routes/app_routes.dart'; 8 | import '../../../../core/values/dimens.dart'; 9 | 10 | class AddTaskScreen extends StatefulWidget { 11 | const AddTaskScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | State createState() => _AddTaskScreenState(); 15 | } 16 | 17 | class _AddTaskScreenState extends State { 18 | 19 | final _formKey = GlobalKey(); 20 | final TextEditingController _nameController = TextEditingController(); 21 | final TextEditingController _detailsController = TextEditingController(); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | appBar: getAppBar('Add New Task'), 27 | body: BlocConsumer( 28 | listener: (context, state) { 29 | state.when(initial: () => null, 30 | loading: () => null, 31 | success: () { 32 | ScaffoldMessenger.of(context).showSnackBar(const SnackBar( 33 | content: Text("Added Successfully"), 34 | )); 35 | GoRouter.of(context).go(AppRouter.root); 36 | }, 37 | failed: () => ScaffoldMessenger.of(context).showSnackBar(const SnackBar( 38 | content: Text("Error Occurred"), 39 | )) 40 | ); 41 | }, 42 | builder: (context, state) { 43 | return SingleChildScrollView( 44 | child: Padding( 45 | padding: const EdgeInsets.symmetric(vertical: pad18, horizontal: pad15), 46 | child: Form( 47 | key: _formKey, 48 | child: Column( 49 | children: [ 50 | TextFormField( 51 | keyboardType: TextInputType.emailAddress, 52 | maxLength: 60, 53 | style: const TextStyle( 54 | fontSize: 18, 55 | fontWeight: FontWeight.w500 56 | ), 57 | controller: _nameController, 58 | validator: (val) => 59 | val!.isEmpty ? 'Please enter task name' : null, 60 | decoration: InputDecoration( 61 | border: const OutlineInputBorder( 62 | borderRadius: BorderRadius.all( 63 | Radius.circular(15) 64 | ), 65 | ), 66 | labelText: 'New Task', 67 | counterText: '', 68 | filled: true, 69 | enabledBorder: OutlineInputBorder( 70 | borderSide: BorderSide( 71 | color: Colors.grey.withOpacity(0.7), 72 | width: 0, 73 | ), 74 | borderRadius: const BorderRadius.all( 75 | Radius.circular(15) 76 | ), 77 | ), 78 | focusedBorder: const OutlineInputBorder( 79 | borderSide: BorderSide( 80 | color: Colors.blue, 81 | width: 1, 82 | ), 83 | borderRadius: BorderRadius.all( 84 | Radius.circular(15) 85 | ), 86 | ), 87 | 88 | fillColor: Colors.grey.withOpacity(0.1), 89 | prefixIcon: Icon( 90 | Icons.info_outline_rounded, color: Colors.blue.withOpacity(.8),), 91 | ), 92 | ), 93 | Container( 94 | margin: const EdgeInsets.only(top: pad15), 95 | child: TextFormField( 96 | keyboardType: TextInputType.emailAddress, 97 | maxLength: 60, 98 | style: const TextStyle( 99 | fontSize: 18, 100 | fontWeight: FontWeight.w500 101 | ), 102 | controller: _detailsController, 103 | validator: (val) => 104 | val!.isEmpty ? 'Please enter task details' : null, 105 | decoration: InputDecoration( 106 | border: const OutlineInputBorder( 107 | borderRadius: BorderRadius.all( 108 | Radius.circular(15) 109 | ), 110 | ), 111 | labelText: 'Details', 112 | counterText: '', 113 | filled: true, 114 | enabledBorder: OutlineInputBorder( 115 | borderSide: BorderSide( 116 | color: Colors.grey.withOpacity(0.7), 117 | width: 0, 118 | ), 119 | borderRadius: const BorderRadius.all( 120 | Radius.circular(15) 121 | ), 122 | ), 123 | focusedBorder: const OutlineInputBorder( 124 | borderSide: BorderSide( 125 | color: Colors.blue, 126 | width: 1, 127 | ), 128 | borderRadius: BorderRadius.all( 129 | Radius.circular(15) 130 | ), 131 | ), 132 | 133 | fillColor: Colors.grey.withOpacity(0.1), 134 | prefixIcon: Icon( 135 | Icons.info_outline_rounded, color: Colors.blue.withOpacity(.8),), 136 | ), 137 | ) 138 | ), 139 | Container( 140 | margin: const EdgeInsets.only(top: pad18), 141 | height: 50.0, 142 | width: MediaQuery.of(context).size.width, 143 | child: ElevatedButton( 144 | style: ElevatedButton.styleFrom( 145 | padding: const EdgeInsets.all(pad10), 146 | textStyle: const TextStyle( 147 | color: Color.fromRGBO(0, 160, 227, 1), 148 | ), 149 | shape: RoundedRectangleBorder( 150 | borderRadius: BorderRadius.circular(pad8), 151 | side: const BorderSide( 152 | color: Color.fromRGBO(0, 160, 227, 1) 153 | ), 154 | ), 155 | ), 156 | onPressed: () { 157 | if(_formKey.currentState!.validate()){ 158 | context.read().add( 159 | AddNewTaskEvent( 160 | TasksModel( 161 | title: _nameController.text, 162 | description: _detailsController.text 163 | ) 164 | ) 165 | ); 166 | } 167 | }, 168 | child: const Text("Add Task", 169 | style: TextStyle(fontSize: 15)), 170 | ), 171 | ), 172 | ], 173 | ), 174 | ), 175 | ), 176 | ); 177 | }, 178 | ), 179 | ); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | alwaysOutOfDate = 1; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | ); 178 | inputPaths = ( 179 | ); 180 | name = "Thin Binary"; 181 | outputPaths = ( 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | shellPath = /bin/sh; 185 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 186 | }; 187 | 9740EEB61CF901F6004384FC /* Run Script */ = { 188 | isa = PBXShellScriptBuildPhase; 189 | alwaysOutOfDate = 1; 190 | buildActionMask = 2147483647; 191 | files = ( 192 | ); 193 | inputPaths = ( 194 | ); 195 | name = "Run Script"; 196 | outputPaths = ( 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | shellPath = /bin/sh; 200 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 201 | }; 202 | /* End PBXShellScriptBuildPhase section */ 203 | 204 | /* Begin PBXSourcesBuildPhase section */ 205 | 97C146EA1CF9000F007C117D /* Sources */ = { 206 | isa = PBXSourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 210 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXSourcesBuildPhase section */ 215 | 216 | /* Begin PBXVariantGroup section */ 217 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 218 | isa = PBXVariantGroup; 219 | children = ( 220 | 97C146FB1CF9000F007C117D /* Base */, 221 | ); 222 | name = Main.storyboard; 223 | sourceTree = ""; 224 | }; 225 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | 97C147001CF9000F007C117D /* Base */, 229 | ); 230 | name = LaunchScreen.storyboard; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXVariantGroup section */ 234 | 235 | /* Begin XCBuildConfiguration section */ 236 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_ANALYZER_NONNULL = YES; 241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 242 | CLANG_CXX_LIBRARY = "libc++"; 243 | CLANG_ENABLE_MODULES = YES; 244 | CLANG_ENABLE_OBJC_ARC = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNREACHABLE_CODE = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | SDKROOT = iphoneos; 280 | SUPPORTED_PLATFORMS = iphoneos; 281 | TARGETED_DEVICE_FAMILY = "1,2"; 282 | VALIDATE_PRODUCT = YES; 283 | }; 284 | name = Profile; 285 | }; 286 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 287 | isa = XCBuildConfiguration; 288 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CLANG_ENABLE_MODULES = YES; 292 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 293 | ENABLE_BITCODE = NO; 294 | INFOPLIST_FILE = Runner/Info.plist; 295 | LD_RUNPATH_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "@executable_path/Frameworks", 298 | ); 299 | PRODUCT_BUNDLE_IDENTIFIER = com.mohaned.hive; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 302 | SWIFT_VERSION = 5.0; 303 | VERSIONING_SYSTEM = "apple-generic"; 304 | }; 305 | name = Profile; 306 | }; 307 | 97C147031CF9000F007C117D /* Debug */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_ANALYZER_NONNULL = YES; 312 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 313 | CLANG_CXX_LIBRARY = "libc++"; 314 | CLANG_ENABLE_MODULES = YES; 315 | CLANG_ENABLE_OBJC_ARC = YES; 316 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 317 | CLANG_WARN_BOOL_CONVERSION = YES; 318 | CLANG_WARN_COMMA = YES; 319 | CLANG_WARN_CONSTANT_CONVERSION = YES; 320 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 321 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 322 | CLANG_WARN_EMPTY_BODY = YES; 323 | CLANG_WARN_ENUM_CONVERSION = YES; 324 | CLANG_WARN_INFINITE_RECURSION = YES; 325 | CLANG_WARN_INT_CONVERSION = YES; 326 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 328 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 331 | CLANG_WARN_STRICT_PROTOTYPES = YES; 332 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 333 | CLANG_WARN_UNREACHABLE_CODE = YES; 334 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 335 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 336 | COPY_PHASE_STRIP = NO; 337 | DEBUG_INFORMATION_FORMAT = dwarf; 338 | ENABLE_STRICT_OBJC_MSGSEND = YES; 339 | ENABLE_TESTABILITY = YES; 340 | GCC_C_LANGUAGE_STANDARD = gnu99; 341 | GCC_DYNAMIC_NO_PIC = NO; 342 | GCC_NO_COMMON_BLOCKS = YES; 343 | GCC_OPTIMIZATION_LEVEL = 0; 344 | GCC_PREPROCESSOR_DEFINITIONS = ( 345 | "DEBUG=1", 346 | "$(inherited)", 347 | ); 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 355 | MTL_ENABLE_DEBUG_INFO = YES; 356 | ONLY_ACTIVE_ARCH = YES; 357 | SDKROOT = iphoneos; 358 | TARGETED_DEVICE_FAMILY = "1,2"; 359 | }; 360 | name = Debug; 361 | }; 362 | 97C147041CF9000F007C117D /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ALWAYS_SEARCH_USER_PATHS = NO; 366 | CLANG_ANALYZER_NONNULL = YES; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 372 | CLANG_WARN_BOOL_CONVERSION = YES; 373 | CLANG_WARN_COMMA = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 386 | CLANG_WARN_STRICT_PROTOTYPES = YES; 387 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 388 | CLANG_WARN_UNREACHABLE_CODE = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 391 | COPY_PHASE_STRIP = NO; 392 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 393 | ENABLE_NS_ASSERTIONS = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_NO_COMMON_BLOCKS = YES; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 404 | MTL_ENABLE_DEBUG_INFO = NO; 405 | SDKROOT = iphoneos; 406 | SUPPORTED_PLATFORMS = iphoneos; 407 | SWIFT_COMPILATION_MODE = wholemodule; 408 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 409 | TARGETED_DEVICE_FAMILY = "1,2"; 410 | VALIDATE_PRODUCT = YES; 411 | }; 412 | name = Release; 413 | }; 414 | 97C147061CF9000F007C117D /* Debug */ = { 415 | isa = XCBuildConfiguration; 416 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 417 | buildSettings = { 418 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 419 | CLANG_ENABLE_MODULES = YES; 420 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 421 | ENABLE_BITCODE = NO; 422 | INFOPLIST_FILE = Runner/Info.plist; 423 | LD_RUNPATH_SEARCH_PATHS = ( 424 | "$(inherited)", 425 | "@executable_path/Frameworks", 426 | ); 427 | PRODUCT_BUNDLE_IDENTIFIER = com.mohaned.hive; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 431 | SWIFT_VERSION = 5.0; 432 | VERSIONING_SYSTEM = "apple-generic"; 433 | }; 434 | name = Debug; 435 | }; 436 | 97C147071CF9000F007C117D /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CLANG_ENABLE_MODULES = YES; 442 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 443 | ENABLE_BITCODE = NO; 444 | INFOPLIST_FILE = Runner/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "@executable_path/Frameworks", 448 | ); 449 | PRODUCT_BUNDLE_IDENTIFIER = com.mohaned.hive; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 452 | SWIFT_VERSION = 5.0; 453 | VERSIONING_SYSTEM = "apple-generic"; 454 | }; 455 | name = Release; 456 | }; 457 | /* End XCBuildConfiguration section */ 458 | 459 | /* Begin XCConfigurationList section */ 460 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | 97C147031CF9000F007C117D /* Debug */, 464 | 97C147041CF9000F007C117D /* Release */, 465 | 249021D3217E4FDB00AE95B9 /* Profile */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | 97C147061CF9000F007C117D /* Debug */, 474 | 97C147071CF9000F007C117D /* Release */, 475 | 249021D4217E4FDB00AE95B9 /* Profile */, 476 | ); 477 | defaultConfigurationIsVisible = 0; 478 | defaultConfigurationName = Release; 479 | }; 480 | /* End XCConfigurationList section */ 481 | }; 482 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 483 | } 484 | -------------------------------------------------------------------------------- /lib/tasks/presentation/display/controller/tasks_bloc.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 'tasks_bloc.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#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$TasksEvent { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function() getAllTasks, 22 | }) => 23 | throw _privateConstructorUsedError; 24 | @optionalTypeArgs 25 | TResult? whenOrNull({ 26 | TResult? Function()? getAllTasks, 27 | }) => 28 | throw _privateConstructorUsedError; 29 | @optionalTypeArgs 30 | TResult maybeWhen({ 31 | TResult Function()? getAllTasks, 32 | required TResult orElse(), 33 | }) => 34 | throw _privateConstructorUsedError; 35 | @optionalTypeArgs 36 | TResult map({ 37 | required TResult Function(GetAllTasksEvent value) getAllTasks, 38 | }) => 39 | throw _privateConstructorUsedError; 40 | @optionalTypeArgs 41 | TResult? mapOrNull({ 42 | TResult? Function(GetAllTasksEvent value)? getAllTasks, 43 | }) => 44 | throw _privateConstructorUsedError; 45 | @optionalTypeArgs 46 | TResult maybeMap({ 47 | TResult Function(GetAllTasksEvent value)? getAllTasks, 48 | required TResult orElse(), 49 | }) => 50 | throw _privateConstructorUsedError; 51 | } 52 | 53 | /// @nodoc 54 | abstract class $TasksEventCopyWith<$Res> { 55 | factory $TasksEventCopyWith( 56 | TasksEvent value, $Res Function(TasksEvent) then) = 57 | _$TasksEventCopyWithImpl<$Res, TasksEvent>; 58 | } 59 | 60 | /// @nodoc 61 | class _$TasksEventCopyWithImpl<$Res, $Val extends TasksEvent> 62 | implements $TasksEventCopyWith<$Res> { 63 | _$TasksEventCopyWithImpl(this._value, this._then); 64 | 65 | // ignore: unused_field 66 | final $Val _value; 67 | // ignore: unused_field 68 | final $Res Function($Val) _then; 69 | } 70 | 71 | /// @nodoc 72 | abstract class _$$GetAllTasksEventCopyWith<$Res> { 73 | factory _$$GetAllTasksEventCopyWith( 74 | _$GetAllTasksEvent value, $Res Function(_$GetAllTasksEvent) then) = 75 | __$$GetAllTasksEventCopyWithImpl<$Res>; 76 | } 77 | 78 | /// @nodoc 79 | class __$$GetAllTasksEventCopyWithImpl<$Res> 80 | extends _$TasksEventCopyWithImpl<$Res, _$GetAllTasksEvent> 81 | implements _$$GetAllTasksEventCopyWith<$Res> { 82 | __$$GetAllTasksEventCopyWithImpl( 83 | _$GetAllTasksEvent _value, $Res Function(_$GetAllTasksEvent) _then) 84 | : super(_value, _then); 85 | } 86 | 87 | /// @nodoc 88 | 89 | class _$GetAllTasksEvent implements GetAllTasksEvent { 90 | const _$GetAllTasksEvent(); 91 | 92 | @override 93 | String toString() { 94 | return 'TasksEvent.getAllTasks()'; 95 | } 96 | 97 | @override 98 | bool operator ==(dynamic other) { 99 | return identical(this, other) || 100 | (other.runtimeType == runtimeType && other is _$GetAllTasksEvent); 101 | } 102 | 103 | @override 104 | int get hashCode => runtimeType.hashCode; 105 | 106 | @override 107 | @optionalTypeArgs 108 | TResult when({ 109 | required TResult Function() getAllTasks, 110 | }) { 111 | return getAllTasks(); 112 | } 113 | 114 | @override 115 | @optionalTypeArgs 116 | TResult? whenOrNull({ 117 | TResult? Function()? getAllTasks, 118 | }) { 119 | return getAllTasks?.call(); 120 | } 121 | 122 | @override 123 | @optionalTypeArgs 124 | TResult maybeWhen({ 125 | TResult Function()? getAllTasks, 126 | required TResult orElse(), 127 | }) { 128 | if (getAllTasks != null) { 129 | return getAllTasks(); 130 | } 131 | return orElse(); 132 | } 133 | 134 | @override 135 | @optionalTypeArgs 136 | TResult map({ 137 | required TResult Function(GetAllTasksEvent value) getAllTasks, 138 | }) { 139 | return getAllTasks(this); 140 | } 141 | 142 | @override 143 | @optionalTypeArgs 144 | TResult? mapOrNull({ 145 | TResult? Function(GetAllTasksEvent value)? getAllTasks, 146 | }) { 147 | return getAllTasks?.call(this); 148 | } 149 | 150 | @override 151 | @optionalTypeArgs 152 | TResult maybeMap({ 153 | TResult Function(GetAllTasksEvent value)? getAllTasks, 154 | required TResult orElse(), 155 | }) { 156 | if (getAllTasks != null) { 157 | return getAllTasks(this); 158 | } 159 | return orElse(); 160 | } 161 | } 162 | 163 | abstract class GetAllTasksEvent implements TasksEvent { 164 | const factory GetAllTasksEvent() = _$GetAllTasksEvent; 165 | } 166 | 167 | /// @nodoc 168 | mixin _$TasksState { 169 | @optionalTypeArgs 170 | TResult when({ 171 | required TResult Function() initial, 172 | required TResult Function() loading, 173 | required TResult Function(List tasks) loaded, 174 | required TResult Function() error, 175 | }) => 176 | throw _privateConstructorUsedError; 177 | @optionalTypeArgs 178 | TResult? whenOrNull({ 179 | TResult? Function()? initial, 180 | TResult? Function()? loading, 181 | TResult? Function(List tasks)? loaded, 182 | TResult? Function()? error, 183 | }) => 184 | throw _privateConstructorUsedError; 185 | @optionalTypeArgs 186 | TResult maybeWhen({ 187 | TResult Function()? initial, 188 | TResult Function()? loading, 189 | TResult Function(List tasks)? loaded, 190 | TResult Function()? error, 191 | required TResult orElse(), 192 | }) => 193 | throw _privateConstructorUsedError; 194 | @optionalTypeArgs 195 | TResult map({ 196 | required TResult Function(_Initial value) initial, 197 | required TResult Function(_Loading value) loading, 198 | required TResult Function(_Loaded value) loaded, 199 | required TResult Function(_Failed value) error, 200 | }) => 201 | throw _privateConstructorUsedError; 202 | @optionalTypeArgs 203 | TResult? mapOrNull({ 204 | TResult? Function(_Initial value)? initial, 205 | TResult? Function(_Loading value)? loading, 206 | TResult? Function(_Loaded value)? loaded, 207 | TResult? Function(_Failed value)? error, 208 | }) => 209 | throw _privateConstructorUsedError; 210 | @optionalTypeArgs 211 | TResult maybeMap({ 212 | TResult Function(_Initial value)? initial, 213 | TResult Function(_Loading value)? loading, 214 | TResult Function(_Loaded value)? loaded, 215 | TResult Function(_Failed value)? error, 216 | required TResult orElse(), 217 | }) => 218 | throw _privateConstructorUsedError; 219 | } 220 | 221 | /// @nodoc 222 | abstract class $TasksStateCopyWith<$Res> { 223 | factory $TasksStateCopyWith( 224 | TasksState value, $Res Function(TasksState) then) = 225 | _$TasksStateCopyWithImpl<$Res, TasksState>; 226 | } 227 | 228 | /// @nodoc 229 | class _$TasksStateCopyWithImpl<$Res, $Val extends TasksState> 230 | implements $TasksStateCopyWith<$Res> { 231 | _$TasksStateCopyWithImpl(this._value, this._then); 232 | 233 | // ignore: unused_field 234 | final $Val _value; 235 | // ignore: unused_field 236 | final $Res Function($Val) _then; 237 | } 238 | 239 | /// @nodoc 240 | abstract class _$$_InitialCopyWith<$Res> { 241 | factory _$$_InitialCopyWith( 242 | _$_Initial value, $Res Function(_$_Initial) then) = 243 | __$$_InitialCopyWithImpl<$Res>; 244 | } 245 | 246 | /// @nodoc 247 | class __$$_InitialCopyWithImpl<$Res> 248 | extends _$TasksStateCopyWithImpl<$Res, _$_Initial> 249 | implements _$$_InitialCopyWith<$Res> { 250 | __$$_InitialCopyWithImpl(_$_Initial _value, $Res Function(_$_Initial) _then) 251 | : super(_value, _then); 252 | } 253 | 254 | /// @nodoc 255 | 256 | class _$_Initial implements _Initial { 257 | const _$_Initial(); 258 | 259 | @override 260 | String toString() { 261 | return 'TasksState.initial()'; 262 | } 263 | 264 | @override 265 | bool operator ==(dynamic other) { 266 | return identical(this, other) || 267 | (other.runtimeType == runtimeType && other is _$_Initial); 268 | } 269 | 270 | @override 271 | int get hashCode => runtimeType.hashCode; 272 | 273 | @override 274 | @optionalTypeArgs 275 | TResult when({ 276 | required TResult Function() initial, 277 | required TResult Function() loading, 278 | required TResult Function(List tasks) loaded, 279 | required TResult Function() error, 280 | }) { 281 | return initial(); 282 | } 283 | 284 | @override 285 | @optionalTypeArgs 286 | TResult? whenOrNull({ 287 | TResult? Function()? initial, 288 | TResult? Function()? loading, 289 | TResult? Function(List tasks)? loaded, 290 | TResult? Function()? error, 291 | }) { 292 | return initial?.call(); 293 | } 294 | 295 | @override 296 | @optionalTypeArgs 297 | TResult maybeWhen({ 298 | TResult Function()? initial, 299 | TResult Function()? loading, 300 | TResult Function(List tasks)? loaded, 301 | TResult Function()? error, 302 | required TResult orElse(), 303 | }) { 304 | if (initial != null) { 305 | return initial(); 306 | } 307 | return orElse(); 308 | } 309 | 310 | @override 311 | @optionalTypeArgs 312 | TResult map({ 313 | required TResult Function(_Initial value) initial, 314 | required TResult Function(_Loading value) loading, 315 | required TResult Function(_Loaded value) loaded, 316 | required TResult Function(_Failed value) error, 317 | }) { 318 | return initial(this); 319 | } 320 | 321 | @override 322 | @optionalTypeArgs 323 | TResult? mapOrNull({ 324 | TResult? Function(_Initial value)? initial, 325 | TResult? Function(_Loading value)? loading, 326 | TResult? Function(_Loaded value)? loaded, 327 | TResult? Function(_Failed value)? error, 328 | }) { 329 | return initial?.call(this); 330 | } 331 | 332 | @override 333 | @optionalTypeArgs 334 | TResult maybeMap({ 335 | TResult Function(_Initial value)? initial, 336 | TResult Function(_Loading value)? loading, 337 | TResult Function(_Loaded value)? loaded, 338 | TResult Function(_Failed value)? error, 339 | required TResult orElse(), 340 | }) { 341 | if (initial != null) { 342 | return initial(this); 343 | } 344 | return orElse(); 345 | } 346 | } 347 | 348 | abstract class _Initial implements TasksState { 349 | const factory _Initial() = _$_Initial; 350 | } 351 | 352 | /// @nodoc 353 | abstract class _$$_LoadingCopyWith<$Res> { 354 | factory _$$_LoadingCopyWith( 355 | _$_Loading value, $Res Function(_$_Loading) then) = 356 | __$$_LoadingCopyWithImpl<$Res>; 357 | } 358 | 359 | /// @nodoc 360 | class __$$_LoadingCopyWithImpl<$Res> 361 | extends _$TasksStateCopyWithImpl<$Res, _$_Loading> 362 | implements _$$_LoadingCopyWith<$Res> { 363 | __$$_LoadingCopyWithImpl(_$_Loading _value, $Res Function(_$_Loading) _then) 364 | : super(_value, _then); 365 | } 366 | 367 | /// @nodoc 368 | 369 | class _$_Loading implements _Loading { 370 | const _$_Loading(); 371 | 372 | @override 373 | String toString() { 374 | return 'TasksState.loading()'; 375 | } 376 | 377 | @override 378 | bool operator ==(dynamic other) { 379 | return identical(this, other) || 380 | (other.runtimeType == runtimeType && other is _$_Loading); 381 | } 382 | 383 | @override 384 | int get hashCode => runtimeType.hashCode; 385 | 386 | @override 387 | @optionalTypeArgs 388 | TResult when({ 389 | required TResult Function() initial, 390 | required TResult Function() loading, 391 | required TResult Function(List tasks) loaded, 392 | required TResult Function() error, 393 | }) { 394 | return loading(); 395 | } 396 | 397 | @override 398 | @optionalTypeArgs 399 | TResult? whenOrNull({ 400 | TResult? Function()? initial, 401 | TResult? Function()? loading, 402 | TResult? Function(List tasks)? loaded, 403 | TResult? Function()? error, 404 | }) { 405 | return loading?.call(); 406 | } 407 | 408 | @override 409 | @optionalTypeArgs 410 | TResult maybeWhen({ 411 | TResult Function()? initial, 412 | TResult Function()? loading, 413 | TResult Function(List tasks)? loaded, 414 | TResult Function()? error, 415 | required TResult orElse(), 416 | }) { 417 | if (loading != null) { 418 | return loading(); 419 | } 420 | return orElse(); 421 | } 422 | 423 | @override 424 | @optionalTypeArgs 425 | TResult map({ 426 | required TResult Function(_Initial value) initial, 427 | required TResult Function(_Loading value) loading, 428 | required TResult Function(_Loaded value) loaded, 429 | required TResult Function(_Failed value) error, 430 | }) { 431 | return loading(this); 432 | } 433 | 434 | @override 435 | @optionalTypeArgs 436 | TResult? mapOrNull({ 437 | TResult? Function(_Initial value)? initial, 438 | TResult? Function(_Loading value)? loading, 439 | TResult? Function(_Loaded value)? loaded, 440 | TResult? Function(_Failed value)? error, 441 | }) { 442 | return loading?.call(this); 443 | } 444 | 445 | @override 446 | @optionalTypeArgs 447 | TResult maybeMap({ 448 | TResult Function(_Initial value)? initial, 449 | TResult Function(_Loading value)? loading, 450 | TResult Function(_Loaded value)? loaded, 451 | TResult Function(_Failed value)? error, 452 | required TResult orElse(), 453 | }) { 454 | if (loading != null) { 455 | return loading(this); 456 | } 457 | return orElse(); 458 | } 459 | } 460 | 461 | abstract class _Loading implements TasksState { 462 | const factory _Loading() = _$_Loading; 463 | } 464 | 465 | /// @nodoc 466 | abstract class _$$_LoadedCopyWith<$Res> { 467 | factory _$$_LoadedCopyWith(_$_Loaded value, $Res Function(_$_Loaded) then) = 468 | __$$_LoadedCopyWithImpl<$Res>; 469 | @useResult 470 | $Res call({List tasks}); 471 | } 472 | 473 | /// @nodoc 474 | class __$$_LoadedCopyWithImpl<$Res> 475 | extends _$TasksStateCopyWithImpl<$Res, _$_Loaded> 476 | implements _$$_LoadedCopyWith<$Res> { 477 | __$$_LoadedCopyWithImpl(_$_Loaded _value, $Res Function(_$_Loaded) _then) 478 | : super(_value, _then); 479 | 480 | @pragma('vm:prefer-inline') 481 | @override 482 | $Res call({ 483 | Object? tasks = null, 484 | }) { 485 | return _then(_$_Loaded( 486 | null == tasks 487 | ? _value._tasks 488 | : tasks // ignore: cast_nullable_to_non_nullable 489 | as List, 490 | )); 491 | } 492 | } 493 | 494 | /// @nodoc 495 | 496 | class _$_Loaded implements _Loaded { 497 | const _$_Loaded(final List tasks) : _tasks = tasks; 498 | 499 | final List _tasks; 500 | @override 501 | List get tasks { 502 | if (_tasks is EqualUnmodifiableListView) return _tasks; 503 | // ignore: implicit_dynamic_type 504 | return EqualUnmodifiableListView(_tasks); 505 | } 506 | 507 | @override 508 | String toString() { 509 | return 'TasksState.loaded(tasks: $tasks)'; 510 | } 511 | 512 | @override 513 | bool operator ==(dynamic other) { 514 | return identical(this, other) || 515 | (other.runtimeType == runtimeType && 516 | other is _$_Loaded && 517 | const DeepCollectionEquality().equals(other._tasks, _tasks)); 518 | } 519 | 520 | @override 521 | int get hashCode => 522 | Object.hash(runtimeType, const DeepCollectionEquality().hash(_tasks)); 523 | 524 | @JsonKey(ignore: true) 525 | @override 526 | @pragma('vm:prefer-inline') 527 | _$$_LoadedCopyWith<_$_Loaded> get copyWith => 528 | __$$_LoadedCopyWithImpl<_$_Loaded>(this, _$identity); 529 | 530 | @override 531 | @optionalTypeArgs 532 | TResult when({ 533 | required TResult Function() initial, 534 | required TResult Function() loading, 535 | required TResult Function(List tasks) loaded, 536 | required TResult Function() error, 537 | }) { 538 | return loaded(tasks); 539 | } 540 | 541 | @override 542 | @optionalTypeArgs 543 | TResult? whenOrNull({ 544 | TResult? Function()? initial, 545 | TResult? Function()? loading, 546 | TResult? Function(List tasks)? loaded, 547 | TResult? Function()? error, 548 | }) { 549 | return loaded?.call(tasks); 550 | } 551 | 552 | @override 553 | @optionalTypeArgs 554 | TResult maybeWhen({ 555 | TResult Function()? initial, 556 | TResult Function()? loading, 557 | TResult Function(List tasks)? loaded, 558 | TResult Function()? error, 559 | required TResult orElse(), 560 | }) { 561 | if (loaded != null) { 562 | return loaded(tasks); 563 | } 564 | return orElse(); 565 | } 566 | 567 | @override 568 | @optionalTypeArgs 569 | TResult map({ 570 | required TResult Function(_Initial value) initial, 571 | required TResult Function(_Loading value) loading, 572 | required TResult Function(_Loaded value) loaded, 573 | required TResult Function(_Failed value) error, 574 | }) { 575 | return loaded(this); 576 | } 577 | 578 | @override 579 | @optionalTypeArgs 580 | TResult? mapOrNull({ 581 | TResult? Function(_Initial value)? initial, 582 | TResult? Function(_Loading value)? loading, 583 | TResult? Function(_Loaded value)? loaded, 584 | TResult? Function(_Failed value)? error, 585 | }) { 586 | return loaded?.call(this); 587 | } 588 | 589 | @override 590 | @optionalTypeArgs 591 | TResult maybeMap({ 592 | TResult Function(_Initial value)? initial, 593 | TResult Function(_Loading value)? loading, 594 | TResult Function(_Loaded value)? loaded, 595 | TResult Function(_Failed value)? error, 596 | required TResult orElse(), 597 | }) { 598 | if (loaded != null) { 599 | return loaded(this); 600 | } 601 | return orElse(); 602 | } 603 | } 604 | 605 | abstract class _Loaded implements TasksState { 606 | const factory _Loaded(final List tasks) = _$_Loaded; 607 | 608 | List get tasks; 609 | @JsonKey(ignore: true) 610 | _$$_LoadedCopyWith<_$_Loaded> get copyWith => 611 | throw _privateConstructorUsedError; 612 | } 613 | 614 | /// @nodoc 615 | abstract class _$$_FailedCopyWith<$Res> { 616 | factory _$$_FailedCopyWith(_$_Failed value, $Res Function(_$_Failed) then) = 617 | __$$_FailedCopyWithImpl<$Res>; 618 | } 619 | 620 | /// @nodoc 621 | class __$$_FailedCopyWithImpl<$Res> 622 | extends _$TasksStateCopyWithImpl<$Res, _$_Failed> 623 | implements _$$_FailedCopyWith<$Res> { 624 | __$$_FailedCopyWithImpl(_$_Failed _value, $Res Function(_$_Failed) _then) 625 | : super(_value, _then); 626 | } 627 | 628 | /// @nodoc 629 | 630 | class _$_Failed implements _Failed { 631 | const _$_Failed(); 632 | 633 | @override 634 | String toString() { 635 | return 'TasksState.error()'; 636 | } 637 | 638 | @override 639 | bool operator ==(dynamic other) { 640 | return identical(this, other) || 641 | (other.runtimeType == runtimeType && other is _$_Failed); 642 | } 643 | 644 | @override 645 | int get hashCode => runtimeType.hashCode; 646 | 647 | @override 648 | @optionalTypeArgs 649 | TResult when({ 650 | required TResult Function() initial, 651 | required TResult Function() loading, 652 | required TResult Function(List tasks) loaded, 653 | required TResult Function() error, 654 | }) { 655 | return error(); 656 | } 657 | 658 | @override 659 | @optionalTypeArgs 660 | TResult? whenOrNull({ 661 | TResult? Function()? initial, 662 | TResult? Function()? loading, 663 | TResult? Function(List tasks)? loaded, 664 | TResult? Function()? error, 665 | }) { 666 | return error?.call(); 667 | } 668 | 669 | @override 670 | @optionalTypeArgs 671 | TResult maybeWhen({ 672 | TResult Function()? initial, 673 | TResult Function()? loading, 674 | TResult Function(List tasks)? loaded, 675 | TResult Function()? error, 676 | required TResult orElse(), 677 | }) { 678 | if (error != null) { 679 | return error(); 680 | } 681 | return orElse(); 682 | } 683 | 684 | @override 685 | @optionalTypeArgs 686 | TResult map({ 687 | required TResult Function(_Initial value) initial, 688 | required TResult Function(_Loading value) loading, 689 | required TResult Function(_Loaded value) loaded, 690 | required TResult Function(_Failed value) error, 691 | }) { 692 | return error(this); 693 | } 694 | 695 | @override 696 | @optionalTypeArgs 697 | TResult? mapOrNull({ 698 | TResult? Function(_Initial value)? initial, 699 | TResult? Function(_Loading value)? loading, 700 | TResult? Function(_Loaded value)? loaded, 701 | TResult? Function(_Failed value)? error, 702 | }) { 703 | return error?.call(this); 704 | } 705 | 706 | @override 707 | @optionalTypeArgs 708 | TResult maybeMap({ 709 | TResult Function(_Initial value)? initial, 710 | TResult Function(_Loading value)? loading, 711 | TResult Function(_Loaded value)? loaded, 712 | TResult Function(_Failed value)? error, 713 | required TResult orElse(), 714 | }) { 715 | if (error != null) { 716 | return error(this); 717 | } 718 | return orElse(); 719 | } 720 | } 721 | 722 | abstract class _Failed implements TasksState { 723 | const factory _Failed() = _$_Failed; 724 | } 725 | --------------------------------------------------------------------------------