From 64fa30173f08fb91591fcd44aa22667f0780aa6e Mon Sep 17 00:00:00 2001 From: mohsen zamani Date: Sun, 12 Mar 2023 22:31:56 +0330 Subject: [PATCH] finish work --- assets/images/svg/next_level.svg | 3 + assets/images/svg/sad.svg | 3 + .../local_db/local_db_core/.gitignore | 30 ++ .../local_db/local_db_core/.metadata | 10 + .../local_db/local_db_core/CHANGELOG.md | 3 + data/data_core/local_db/local_db_core/LICENSE | 1 + .../local_db/local_db_core/README.md | 39 +++ .../local_db_core/analysis_options.yaml | 4 + .../plugins/GeneratedPluginRegistrant.java | 25 ++ .../local_db_core/android/local.properties | 2 + .../ios/Flutter/Generated.xcconfig | 14 + .../ios/Flutter/flutter_export_environment.sh | 13 + .../ios/Runner/GeneratedPluginRegistrant.h | 19 ++ .../ios/Runner/GeneratedPluginRegistrant.m | 21 ++ .../boxes/box_list/level_box/level_box.dart | 75 +++++ .../box_list/level_box/level_box_keys.dart | 8 + .../boxes/interfaces/base_box_interface.dart | 7 + .../.plugin_symlinks/path_provider_linux | 1 + .../flutter/generated_plugin_registrant.cc | 11 + .../flutter/generated_plugin_registrant.h | 15 + .../linux/flutter/generated_plugins.cmake | 23 ++ .../Flutter/GeneratedPluginRegistrant.swift | 12 + .../ephemeral/Flutter-Generated.xcconfig | 11 + .../ephemeral/flutter_export_environment.sh | 12 + .../local_db/local_db_core/pubspec.yaml | 23 ++ .../flutter/generated_plugin_registrant.cc | 11 + .../flutter/generated_plugin_registrant.h | 15 + .../windows/flutter/generated_plugins.cmake | 23 ++ data/data_types/types/.gitignore | 30 ++ data/data_types/types/.metadata | 10 + data/data_types/types/CHANGELOG.md | 3 + data/data_types/types/LICENSE | 1 + data/data_types/types/README.md | 39 +++ data/data_types/types/analysis_options.yaml | 4 + .../plugins/GeneratedPluginRegistrant.java | 25 ++ .../data_types/types/android/local.properties | 2 + .../types/ios/Flutter/Generated.xcconfig | 14 + .../ios/Flutter/flutter_export_environment.sh | 13 + .../ios/Runner/GeneratedPluginRegistrant.h | 19 ++ .../ios/Runner/GeneratedPluginRegistrant.m | 21 ++ .../interface/level_box_repository_impl.dart | 83 ++++++ .../.plugin_symlinks/path_provider_linux | 1 + .../flutter/generated_plugin_registrant.cc | 11 + .../flutter/generated_plugin_registrant.h | 15 + .../linux/flutter/generated_plugins.cmake | 23 ++ .../Flutter/GeneratedPluginRegistrant.swift | 12 + .../ephemeral/Flutter-Generated.xcconfig | 11 + .../ephemeral/flutter_export_environment.sh | 12 + data/data_types/types/pubspec.yaml | 22 ++ .../flutter/generated_plugin_registrant.cc | 11 + .../flutter/generated_plugin_registrant.h | 15 + .../windows/flutter/generated_plugins.cmake | 23 ++ domain/repositories/.gitignore | 30 ++ domain/repositories/.metadata | 10 + domain/repositories/CHANGELOG.md | 3 + domain/repositories/LICENSE | 1 + domain/repositories/README.md | 39 +++ domain/repositories/analysis_options.yaml | 4 + .../plugins/GeneratedPluginRegistrant.java | 25 ++ .../ios/Runner/GeneratedPluginRegistrant.h | 19 ++ .../ios/Runner/GeneratedPluginRegistrant.m | 21 ++ .../adapter/level_model_adapter.dart | 49 +++ .../level_box_domain/model/level_model.dart | 37 +++ .../repository/level_box_repository.dart | 11 + .../flutter/generated_plugin_registrant.cc | 11 + .../flutter/generated_plugin_registrant.h | 15 + .../linux/flutter/generated_plugins.cmake | 23 ++ .../Flutter/GeneratedPluginRegistrant.swift | 12 + .../ephemeral/Flutter-Generated.xcconfig | 11 + .../ephemeral/flutter_export_environment.sh | 12 + domain/repositories/pubspec.yaml | 18 ++ .../flutter/generated_plugin_registrant.cc | 11 + .../flutter/generated_plugin_registrant.h | 15 + .../windows/flutter/generated_plugins.cmake | 23 ++ lib/initializer.dart | 25 ++ lib/main.dart | 22 +- .../level_list/cubit/level_list_cubit.dart | 31 ++ .../level_list/screen/level_list_screen.dart | 176 ++++------- .../level_list/widgets/level_widget.dart | 4 +- .../level_list/widgets/lock_level_widget.dart | 4 +- .../widgets/payed_level_widget.dart | 11 +- lib/screens/lose/lose_screen.dart | 221 ++++++++++++++ lib/screens/photo/photo_screen_large.dart | 278 ++++++++++-------- lib/screens/splash/screen/splash_screen.dart | 7 +- lib/screens/win/win_screen.dart | 235 +++++++++++++++ lib/utils/toast.dart | 2 +- .../solo_screen/moves_tiles_widget.dart | 60 ++-- .../moves_tiles_widget/moves_tiles_text.dart | 6 +- pubspec.lock | 39 ++- pubspec.yaml | 6 + 90 files changed, 2080 insertions(+), 301 deletions(-) create mode 100644 assets/images/svg/next_level.svg create mode 100644 assets/images/svg/sad.svg create mode 100644 data/data_core/local_db/local_db_core/.gitignore create mode 100644 data/data_core/local_db/local_db_core/.metadata create mode 100644 data/data_core/local_db/local_db_core/CHANGELOG.md create mode 100644 data/data_core/local_db/local_db_core/LICENSE create mode 100644 data/data_core/local_db/local_db_core/README.md create mode 100644 data/data_core/local_db/local_db_core/analysis_options.yaml create mode 100644 data/data_core/local_db/local_db_core/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java create mode 100644 data/data_core/local_db/local_db_core/android/local.properties create mode 100644 data/data_core/local_db/local_db_core/ios/Flutter/Generated.xcconfig create mode 100644 data/data_core/local_db/local_db_core/ios/Flutter/flutter_export_environment.sh create mode 100644 data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.h create mode 100644 data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.m create mode 100644 data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box.dart create mode 100644 data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box_keys.dart create mode 100644 data/data_core/local_db/local_db_core/lib/boxes/interfaces/base_box_interface.dart create mode 120000 data/data_core/local_db/local_db_core/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux create mode 100644 data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.cc create mode 100644 data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.h create mode 100644 data/data_core/local_db/local_db_core/linux/flutter/generated_plugins.cmake create mode 100644 data/data_core/local_db/local_db_core/macos/Flutter/GeneratedPluginRegistrant.swift create mode 100644 data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/Flutter-Generated.xcconfig create mode 100644 data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/flutter_export_environment.sh create mode 100644 data/data_core/local_db/local_db_core/pubspec.yaml create mode 100644 data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.cc create mode 100644 data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.h create mode 100644 data/data_core/local_db/local_db_core/windows/flutter/generated_plugins.cmake create mode 100644 data/data_types/types/.gitignore create mode 100644 data/data_types/types/.metadata create mode 100644 data/data_types/types/CHANGELOG.md create mode 100644 data/data_types/types/LICENSE create mode 100644 data/data_types/types/README.md create mode 100644 data/data_types/types/analysis_options.yaml create mode 100644 data/data_types/types/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java create mode 100644 data/data_types/types/android/local.properties create mode 100644 data/data_types/types/ios/Flutter/Generated.xcconfig create mode 100644 data/data_types/types/ios/Flutter/flutter_export_environment.sh create mode 100644 data/data_types/types/ios/Runner/GeneratedPluginRegistrant.h create mode 100644 data/data_types/types/ios/Runner/GeneratedPluginRegistrant.m create mode 100644 data/data_types/types/lib/level_data/interface/level_box_repository_impl.dart create mode 120000 data/data_types/types/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux create mode 100644 data/data_types/types/linux/flutter/generated_plugin_registrant.cc create mode 100644 data/data_types/types/linux/flutter/generated_plugin_registrant.h create mode 100644 data/data_types/types/linux/flutter/generated_plugins.cmake create mode 100644 data/data_types/types/macos/Flutter/GeneratedPluginRegistrant.swift create mode 100644 data/data_types/types/macos/Flutter/ephemeral/Flutter-Generated.xcconfig create mode 100644 data/data_types/types/macos/Flutter/ephemeral/flutter_export_environment.sh create mode 100644 data/data_types/types/pubspec.yaml create mode 100644 data/data_types/types/windows/flutter/generated_plugin_registrant.cc create mode 100644 data/data_types/types/windows/flutter/generated_plugin_registrant.h create mode 100644 data/data_types/types/windows/flutter/generated_plugins.cmake create mode 100644 domain/repositories/.gitignore create mode 100644 domain/repositories/.metadata create mode 100644 domain/repositories/CHANGELOG.md create mode 100644 domain/repositories/LICENSE create mode 100644 domain/repositories/README.md create mode 100644 domain/repositories/analysis_options.yaml create mode 100644 domain/repositories/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java create mode 100644 domain/repositories/ios/Runner/GeneratedPluginRegistrant.h create mode 100644 domain/repositories/ios/Runner/GeneratedPluginRegistrant.m create mode 100644 domain/repositories/lib/level_box_domain/adapter/level_model_adapter.dart create mode 100644 domain/repositories/lib/level_box_domain/model/level_model.dart create mode 100644 domain/repositories/lib/level_box_domain/repository/level_box_repository.dart create mode 100644 domain/repositories/linux/flutter/generated_plugin_registrant.cc create mode 100644 domain/repositories/linux/flutter/generated_plugin_registrant.h create mode 100644 domain/repositories/linux/flutter/generated_plugins.cmake create mode 100644 domain/repositories/macos/Flutter/GeneratedPluginRegistrant.swift create mode 100644 domain/repositories/macos/Flutter/ephemeral/Flutter-Generated.xcconfig create mode 100644 domain/repositories/macos/Flutter/ephemeral/flutter_export_environment.sh create mode 100644 domain/repositories/pubspec.yaml create mode 100644 domain/repositories/windows/flutter/generated_plugin_registrant.cc create mode 100644 domain/repositories/windows/flutter/generated_plugin_registrant.h create mode 100644 domain/repositories/windows/flutter/generated_plugins.cmake create mode 100644 lib/initializer.dart create mode 100644 lib/screens/level_list/cubit/level_list_cubit.dart create mode 100644 lib/screens/lose/lose_screen.dart create mode 100644 lib/screens/win/win_screen.dart diff --git a/assets/images/svg/next_level.svg b/assets/images/svg/next_level.svg new file mode 100644 index 0000000..b2fea83 --- /dev/null +++ b/assets/images/svg/next_level.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/sad.svg b/assets/images/svg/sad.svg new file mode 100644 index 0000000..44e0e99 --- /dev/null +++ b/assets/images/svg/sad.svg @@ -0,0 +1,3 @@ + + + diff --git a/data/data_core/local_db/local_db_core/.gitignore b/data/data_core/local_db/local_db_core/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/data/data_core/local_db/local_db_core/.gitignore @@ -0,0 +1,30 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/data/data_core/local_db/local_db_core/.metadata b/data/data_core/local_db/local_db_core/.metadata new file mode 100644 index 0000000..ddc4d4c --- /dev/null +++ b/data/data_core/local_db/local_db_core/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: b4bce91dd0f168179d46a7ae5eceb3572ba9637a + channel: stable + +project_type: package diff --git a/data/data_core/local_db/local_db_core/CHANGELOG.md b/data/data_core/local_db/local_db_core/CHANGELOG.md new file mode 100644 index 0000000..41cc7d8 --- /dev/null +++ b/data/data_core/local_db/local_db_core/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/data/data_core/local_db/local_db_core/LICENSE b/data/data_core/local_db/local_db_core/LICENSE new file mode 100644 index 0000000..ba75c69 --- /dev/null +++ b/data/data_core/local_db/local_db_core/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/data/data_core/local_db/local_db_core/README.md b/data/data_core/local_db/local_db_core/README.md new file mode 100644 index 0000000..02fe8ec --- /dev/null +++ b/data/data_core/local_db/local_db_core/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/data/data_core/local_db/local_db_core/analysis_options.yaml b/data/data_core/local_db/local_db_core/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/data/data_core/local_db/local_db_core/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/data/data_core/local_db/local_db_core/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/data/data_core/local_db/local_db_core/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..7eb0d9f --- /dev/null +++ b/data/data_core/local_db/local_db_core/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,25 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; +import io.flutter.plugins.pathprovider.PathProviderPlugin; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + if (alreadyRegisteredWith(registry)) { + return; + } + PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); + } + + private static boolean alreadyRegisteredWith(PluginRegistry registry) { + final String key = GeneratedPluginRegistrant.class.getCanonicalName(); + if (registry.hasPlugin(key)) { + return true; + } + registry.registrarFor(key); + return false; + } +} diff --git a/data/data_core/local_db/local_db_core/android/local.properties b/data/data_core/local_db/local_db_core/android/local.properties new file mode 100644 index 0000000..be2bbdc --- /dev/null +++ b/data/data_core/local_db/local_db_core/android/local.properties @@ -0,0 +1,2 @@ +sdk.dir=C:\\Work\\Tools\\Sdk +flutter.sdk=C:\\Work\\Tools\\flutter \ No newline at end of file diff --git a/data/data_core/local_db/local_db_core/ios/Flutter/Generated.xcconfig b/data/data_core/local_db/local_db_core/ios/Flutter/Generated.xcconfig new file mode 100644 index 0000000..2f12501 --- /dev/null +++ b/data/data_core/local_db/local_db_core/ios/Flutter/Generated.xcconfig @@ -0,0 +1,14 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=C:\Work\Tools\flutter +FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_core\local_db\local_db_core +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=lib\main.dart +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 +EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/data/data_core/local_db/local_db_core/ios/Flutter/flutter_export_environment.sh b/data/data_core/local_db/local_db_core/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 0000000..ae16307 --- /dev/null +++ b/data/data_core/local_db/local_db_core/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\Work\Tools\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_core\local_db\local_db_core" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.h b/data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000..7a89092 --- /dev/null +++ b/data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,19 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +NS_ASSUME_NONNULL_END +#endif /* GeneratedPluginRegistrant_h */ diff --git a/data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.m b/data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000..c0d0cba --- /dev/null +++ b/data/data_core/local_db/local_db_core/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,21 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#import "GeneratedPluginRegistrant.h" + +#if __has_include() +#import +#else +@import path_provider_foundation; +#endif + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; +} + +@end diff --git a/data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box.dart b/data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box.dart new file mode 100644 index 0000000..13aba59 --- /dev/null +++ b/data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box.dart @@ -0,0 +1,75 @@ +import 'package:hive/hive.dart'; +import 'package:local_db_core/boxes/box_list/level_box/level_box_keys.dart'; +import 'package:local_db_core/boxes/interfaces/base_box_interface.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; + +class LevelBox implements BaseBoxInterface { + Box? _box; + + LevelBox.privateConstructor(); + + static final LevelBox instance = LevelBox.privateConstructor(); + + factory LevelBox() { + return instance; + } + + @override + String getBoxName() { + return "level"; + } + + @override + String getKeyName(LevelBoxKeys key) { + return key.value; + } + + @override + Future openBox() async { + _box = await Hive.openBox(getBoxName()); + } + + void updateData({required Level level}) async { + if (!Hive.isBoxOpen(getBoxName())) { + await openBox(); + } + List list = await getData(); + int index = list.indexWhere((element) => element.level == level.level); + if (index != -1) { + list[index] = level; + await saveData(list); + } + } + + Future setCurrentLevel(int level) async { + if (!Hive.isBoxOpen(getBoxName())) { + await openBox(); + } + _box?.put(getKeyName(LevelBoxKeys.currentLevel), level); + } + + Future getLevel() async { + if (!Hive.isBoxOpen(getBoxName())) { + await openBox(); + } + int level = _box?.get(getKeyName(LevelBoxKeys.currentLevel), defaultValue: 1) ?? 1; + return level; + } + + Future> getData() async { + if (!Hive.isBoxOpen(getBoxName())) { + await openBox(); + } + return _box?.values.cast().toList() ?? []; + } + + Future saveData(List data) async { + if (!Hive.isBoxOpen(getBoxName())) { + await openBox(); + } + _box?.addAll(data); + for (var value in data) { + await value.save(); + } + } +} diff --git a/data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box_keys.dart b/data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box_keys.dart new file mode 100644 index 0000000..d645287 --- /dev/null +++ b/data/data_core/local_db/local_db_core/lib/boxes/box_list/level_box/level_box_keys.dart @@ -0,0 +1,8 @@ +enum LevelBoxKeys { + levelList('levelList'), + currentLevel('currentLevel'); + + final String value; + + const LevelBoxKeys(this.value); +} diff --git a/data/data_core/local_db/local_db_core/lib/boxes/interfaces/base_box_interface.dart b/data/data_core/local_db/local_db_core/lib/boxes/interfaces/base_box_interface.dart new file mode 100644 index 0000000..48e33f4 --- /dev/null +++ b/data/data_core/local_db/local_db_core/lib/boxes/interfaces/base_box_interface.dart @@ -0,0 +1,7 @@ +abstract class BaseBoxInterface { + String getBoxName(); + + String getKeyName(T key); + + Future openBox(); +} diff --git a/data/data_core/local_db/local_db_core/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux b/data/data_core/local_db/local_db_core/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux new file mode 120000 index 0000000..724a887 --- /dev/null +++ b/data/data_core/local_db/local_db_core/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux @@ -0,0 +1 @@ +C:/Users/user1/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.1.10/ \ No newline at end of file diff --git a/data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.cc b/data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.h b/data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/data/data_core/local_db/local_db_core/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/data/data_core/local_db/local_db_core/linux/flutter/generated_plugins.cmake b/data/data_core/local_db/local_db_core/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/data/data_core/local_db/local_db_core/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/data/data_core/local_db/local_db_core/macos/Flutter/GeneratedPluginRegistrant.swift b/data/data_core/local_db/local_db_core/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..e777c67 --- /dev/null +++ b/data/data_core/local_db/local_db_core/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import path_provider_foundation + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) +} diff --git a/data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 0000000..ecca203 --- /dev/null +++ b/data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=C:\Work\Tools\flutter +FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_core\local_db\local_db_core +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=0.0.1 +FLUTTER_BUILD_NUMBER=0.0.1 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/flutter_export_environment.sh b/data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/flutter_export_environment.sh new file mode 100644 index 0000000..b2c5178 --- /dev/null +++ b/data/data_core/local_db/local_db_core/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\Work\Tools\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_core\local_db\local_db_core" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=0.0.1" +export "FLUTTER_BUILD_NUMBER=0.0.1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/data/data_core/local_db/local_db_core/pubspec.yaml b/data/data_core/local_db/local_db_core/pubspec.yaml new file mode 100644 index 0000000..85a04cf --- /dev/null +++ b/data/data_core/local_db/local_db_core/pubspec.yaml @@ -0,0 +1,23 @@ +name: local_db_core +description: A new Flutter project. +version: 1.0.0+1 +publish_to: 'none' + +environment: + sdk: ">=2.17.6 <3.0.0" +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^1.0.2 + hive: ^2.0.5 + hive_flutter: ^1.1.0 + path_provider: ^2.0.11 + repositories: + path : ../../../../domain/repositories + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 +flutter: + uses-material-design: true \ No newline at end of file diff --git a/data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.cc b/data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.h b/data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/data/data_core/local_db/local_db_core/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/data/data_core/local_db/local_db_core/windows/flutter/generated_plugins.cmake b/data/data_core/local_db/local_db_core/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..b93c4c3 --- /dev/null +++ b/data/data_core/local_db/local_db_core/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/data/data_types/types/.gitignore b/data/data_types/types/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/data/data_types/types/.gitignore @@ -0,0 +1,30 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/data/data_types/types/.metadata b/data/data_types/types/.metadata new file mode 100644 index 0000000..ddc4d4c --- /dev/null +++ b/data/data_types/types/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: b4bce91dd0f168179d46a7ae5eceb3572ba9637a + channel: stable + +project_type: package diff --git a/data/data_types/types/CHANGELOG.md b/data/data_types/types/CHANGELOG.md new file mode 100644 index 0000000..41cc7d8 --- /dev/null +++ b/data/data_types/types/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/data/data_types/types/LICENSE b/data/data_types/types/LICENSE new file mode 100644 index 0000000..ba75c69 --- /dev/null +++ b/data/data_types/types/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/data/data_types/types/README.md b/data/data_types/types/README.md new file mode 100644 index 0000000..02fe8ec --- /dev/null +++ b/data/data_types/types/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/data/data_types/types/analysis_options.yaml b/data/data_types/types/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/data/data_types/types/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/data/data_types/types/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/data/data_types/types/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..7eb0d9f --- /dev/null +++ b/data/data_types/types/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,25 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; +import io.flutter.plugins.pathprovider.PathProviderPlugin; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + if (alreadyRegisteredWith(registry)) { + return; + } + PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); + } + + private static boolean alreadyRegisteredWith(PluginRegistry registry) { + final String key = GeneratedPluginRegistrant.class.getCanonicalName(); + if (registry.hasPlugin(key)) { + return true; + } + registry.registrarFor(key); + return false; + } +} diff --git a/data/data_types/types/android/local.properties b/data/data_types/types/android/local.properties new file mode 100644 index 0000000..be2bbdc --- /dev/null +++ b/data/data_types/types/android/local.properties @@ -0,0 +1,2 @@ +sdk.dir=C:\\Work\\Tools\\Sdk +flutter.sdk=C:\\Work\\Tools\\flutter \ No newline at end of file diff --git a/data/data_types/types/ios/Flutter/Generated.xcconfig b/data/data_types/types/ios/Flutter/Generated.xcconfig new file mode 100644 index 0000000..b363612 --- /dev/null +++ b/data/data_types/types/ios/Flutter/Generated.xcconfig @@ -0,0 +1,14 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=C:\Work\Tools\flutter +FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_types\types +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=lib\main.dart +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=0.0.1 +FLUTTER_BUILD_NUMBER=0.0.1 +EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 +EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/data/data_types/types/ios/Flutter/flutter_export_environment.sh b/data/data_types/types/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 0000000..6142726 --- /dev/null +++ b/data/data_types/types/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\Work\Tools\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_types\types" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=0.0.1" +export "FLUTTER_BUILD_NUMBER=0.0.1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/data/data_types/types/ios/Runner/GeneratedPluginRegistrant.h b/data/data_types/types/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000..7a89092 --- /dev/null +++ b/data/data_types/types/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,19 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +NS_ASSUME_NONNULL_END +#endif /* GeneratedPluginRegistrant_h */ diff --git a/data/data_types/types/ios/Runner/GeneratedPluginRegistrant.m b/data/data_types/types/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000..c0d0cba --- /dev/null +++ b/data/data_types/types/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,21 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#import "GeneratedPluginRegistrant.h" + +#if __has_include() +#import +#else +@import path_provider_foundation; +#endif + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; +} + +@end diff --git a/data/data_types/types/lib/level_data/interface/level_box_repository_impl.dart b/data/data_types/types/lib/level_data/interface/level_box_repository_impl.dart new file mode 100644 index 0000000..e584091 --- /dev/null +++ b/data/data_types/types/lib/level_data/interface/level_box_repository_impl.dart @@ -0,0 +1,83 @@ +import 'package:local_db_core/boxes/box_list/level_box/level_box.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; +import 'package:repositories/level_box_domain/repository/level_box_repository.dart'; + +class LevelBoxRepositoryImpl extends LevelBoxRepository { + final LevelBox _levelBox; + + LevelBoxRepositoryImpl({required LevelBox levelBox}) : _levelBox = levelBox; + + @override + Future getLevel({required void Function(List data) result}) async { + final List levelList = []; + levelList.add(Level( + image: 'assets/images/jpg/level-1.jpg', + duration: 4, + puzzleSize: 3, + level: 1, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-2.jpg', + duration: 4, + puzzleSize: 3, + level: 2, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-3.jpg', + duration: 4, + puzzleSize: 3, + level: 3, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-4.jpg', + duration: 4, + puzzleSize: 3, + level: 4, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-5.jpg', + duration: 4, + puzzleSize: 3, + level: 5, + payable: true, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-6.jpg', + duration: 4, + puzzleSize: 3, + level: 6, + payable: true, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-7.jpg', + duration: 6, + puzzleSize: 4, + level: 7, + payable: true, + )); + levelList.add(Level( + image: 'assets/images/jpg/level-8.jpg', + duration: 6, + puzzleSize: 4, + level: 8, + payable: true, + )); + _levelBox.saveData(levelList); + result.call(levelList); + } + + @override + Future openBox() async { + await _levelBox.openBox(); + } + + @override + Future getCurrentLevel() async { + return await _levelBox.getLevel(); + } + + @override + Future setCurrentLevel(int level) async { + await _levelBox.setCurrentLevel(level); + } +} diff --git a/data/data_types/types/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux b/data/data_types/types/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux new file mode 120000 index 0000000..724a887 --- /dev/null +++ b/data/data_types/types/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux @@ -0,0 +1 @@ +C:/Users/user1/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.1.10/ \ No newline at end of file diff --git a/data/data_types/types/linux/flutter/generated_plugin_registrant.cc b/data/data_types/types/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/data/data_types/types/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/data/data_types/types/linux/flutter/generated_plugin_registrant.h b/data/data_types/types/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/data/data_types/types/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/data/data_types/types/linux/flutter/generated_plugins.cmake b/data/data_types/types/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/data/data_types/types/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/data/data_types/types/macos/Flutter/GeneratedPluginRegistrant.swift b/data/data_types/types/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..e777c67 --- /dev/null +++ b/data/data_types/types/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import path_provider_foundation + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) +} diff --git a/data/data_types/types/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/data/data_types/types/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 0000000..9b9dbd3 --- /dev/null +++ b/data/data_types/types/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=C:\Work\Tools\flutter +FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_types\types +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=0.0.1 +FLUTTER_BUILD_NUMBER=0.0.1 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/data/data_types/types/macos/Flutter/ephemeral/flutter_export_environment.sh b/data/data_types/types/macos/Flutter/ephemeral/flutter_export_environment.sh new file mode 100644 index 0000000..6cd3b89 --- /dev/null +++ b/data/data_types/types/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\Work\Tools\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\data\data_types\types" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=0.0.1" +export "FLUTTER_BUILD_NUMBER=0.0.1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/data/data_types/types/pubspec.yaml b/data/data_types/types/pubspec.yaml new file mode 100644 index 0000000..2c82f7f --- /dev/null +++ b/data/data_types/types/pubspec.yaml @@ -0,0 +1,22 @@ +name: types +description: A new Flutter project. +version: 0.0.1 +publish_to: 'none' + +environment: + sdk: ">=2.17.6 <3.0.0" + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + repositories: + path: ../../../domain/repositories + local_db_core: + path: ../../../data/data_core/local_db/local_db_core + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 +flutter: \ No newline at end of file diff --git a/data/data_types/types/windows/flutter/generated_plugin_registrant.cc b/data/data_types/types/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/data/data_types/types/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/data/data_types/types/windows/flutter/generated_plugin_registrant.h b/data/data_types/types/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/data/data_types/types/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/data/data_types/types/windows/flutter/generated_plugins.cmake b/data/data_types/types/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..b93c4c3 --- /dev/null +++ b/data/data_types/types/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/domain/repositories/.gitignore b/domain/repositories/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/domain/repositories/.gitignore @@ -0,0 +1,30 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/domain/repositories/.metadata b/domain/repositories/.metadata new file mode 100644 index 0000000..ddc4d4c --- /dev/null +++ b/domain/repositories/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: b4bce91dd0f168179d46a7ae5eceb3572ba9637a + channel: stable + +project_type: package diff --git a/domain/repositories/CHANGELOG.md b/domain/repositories/CHANGELOG.md new file mode 100644 index 0000000..41cc7d8 --- /dev/null +++ b/domain/repositories/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/domain/repositories/LICENSE b/domain/repositories/LICENSE new file mode 100644 index 0000000..ba75c69 --- /dev/null +++ b/domain/repositories/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/domain/repositories/README.md b/domain/repositories/README.md new file mode 100644 index 0000000..02fe8ec --- /dev/null +++ b/domain/repositories/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/domain/repositories/analysis_options.yaml b/domain/repositories/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/domain/repositories/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/domain/repositories/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/domain/repositories/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..7eb0d9f --- /dev/null +++ b/domain/repositories/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,25 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; +import io.flutter.plugins.pathprovider.PathProviderPlugin; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + if (alreadyRegisteredWith(registry)) { + return; + } + PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); + } + + private static boolean alreadyRegisteredWith(PluginRegistry registry) { + final String key = GeneratedPluginRegistrant.class.getCanonicalName(); + if (registry.hasPlugin(key)) { + return true; + } + registry.registrarFor(key); + return false; + } +} diff --git a/domain/repositories/ios/Runner/GeneratedPluginRegistrant.h b/domain/repositories/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000..7a89092 --- /dev/null +++ b/domain/repositories/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,19 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +NS_ASSUME_NONNULL_END +#endif /* GeneratedPluginRegistrant_h */ diff --git a/domain/repositories/ios/Runner/GeneratedPluginRegistrant.m b/domain/repositories/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000..c0d0cba --- /dev/null +++ b/domain/repositories/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,21 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#import "GeneratedPluginRegistrant.h" + +#if __has_include() +#import +#else +@import path_provider_foundation; +#endif + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; +} + +@end diff --git a/domain/repositories/lib/level_box_domain/adapter/level_model_adapter.dart b/domain/repositories/lib/level_box_domain/adapter/level_model_adapter.dart new file mode 100644 index 0000000..8cff757 --- /dev/null +++ b/domain/repositories/lib/level_box_domain/adapter/level_model_adapter.dart @@ -0,0 +1,49 @@ +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; + +class LevelModelAdapter extends TypeAdapter { + @override + final int typeId = 0; + + @override + Level read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Level( + image: fields[0] as String, + puzzleSize: fields[1] as int, + duration: fields[2] as int, + level: fields[3] as int, + recordDuration: fields[4] as int, + payable: fields[5] as bool, + ); + } + + @override + void write(BinaryWriter writer, Level obj) { + writer + ..writeByte(6) + ..writeByte(0) + ..write(obj.image) + ..writeByte(1) + ..write(obj.puzzleSize) + ..writeByte(2) + ..write(obj.duration) + ..writeByte(3) + ..write(obj.level) + ..writeByte(4) + ..write(obj.recordDuration) + ..writeByte(5) + ..write(obj.payable); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LevelModelAdapter && runtimeType == other.runtimeType && typeId == other.typeId; +} diff --git a/domain/repositories/lib/level_box_domain/model/level_model.dart b/domain/repositories/lib/level_box_domain/model/level_model.dart new file mode 100644 index 0000000..d6de13c --- /dev/null +++ b/domain/repositories/lib/level_box_domain/model/level_model.dart @@ -0,0 +1,37 @@ +import 'package:hive_flutter/adapters.dart'; + +@HiveType(typeId: 0) +class Level extends HiveObject { + @HiveField(0) + final String image; + @HiveField(1) + final int puzzleSize; + @HiveField(2) + final int duration; + @HiveField(3) + final int level; + @HiveField(4) + final int recordDuration; + @HiveField(5) + final bool payable; + + Level({ + required this.image, + required this.duration, + required this.puzzleSize, + required this.level, + this.recordDuration = 0, + this.payable = false, + }); + + Map toJson() { + return { + 'image': image, + 'duration': duration, + 'puzzleSize': puzzleSize, + 'level': level, + 'recordDuration': recordDuration, + 'payable': payable, + }; + } +} diff --git a/domain/repositories/lib/level_box_domain/repository/level_box_repository.dart b/domain/repositories/lib/level_box_domain/repository/level_box_repository.dart new file mode 100644 index 0000000..cc67b8c --- /dev/null +++ b/domain/repositories/lib/level_box_domain/repository/level_box_repository.dart @@ -0,0 +1,11 @@ +import 'package:repositories/level_box_domain/model/level_model.dart'; + +abstract class LevelBoxRepository { + Future getLevel({required void Function(List data) result}); + + Future openBox(); + + Future getCurrentLevel(); + + Future setCurrentLevel(int level); +} diff --git a/domain/repositories/linux/flutter/generated_plugin_registrant.cc b/domain/repositories/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/domain/repositories/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/domain/repositories/linux/flutter/generated_plugin_registrant.h b/domain/repositories/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/domain/repositories/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/domain/repositories/linux/flutter/generated_plugins.cmake b/domain/repositories/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/domain/repositories/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/domain/repositories/macos/Flutter/GeneratedPluginRegistrant.swift b/domain/repositories/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..e777c67 --- /dev/null +++ b/domain/repositories/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import path_provider_foundation + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) +} diff --git a/domain/repositories/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/domain/repositories/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 0000000..e5156f8 --- /dev/null +++ b/domain/repositories/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=C:\Work\Tools\flutter +FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\domain\repositories +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=0.0.1 +FLUTTER_BUILD_NUMBER=0.0.1 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/domain/repositories/macos/Flutter/ephemeral/flutter_export_environment.sh b/domain/repositories/macos/Flutter/ephemeral/flutter_export_environment.sh new file mode 100644 index 0000000..de48e7d --- /dev/null +++ b/domain/repositories/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\Work\Tools\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\user1\StudioProjects\habib_kids\domain\repositories" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=0.0.1" +export "FLUTTER_BUILD_NUMBER=0.0.1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/domain/repositories/pubspec.yaml b/domain/repositories/pubspec.yaml new file mode 100644 index 0000000..d4a0c3f --- /dev/null +++ b/domain/repositories/pubspec.yaml @@ -0,0 +1,18 @@ +name: repositories +description: A new Flutter project. +version: 0.0.1 + +environment: + sdk: ">=2.17.6 <3.0.0" + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + hive_flutter: ^1.1.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 +flutter: \ No newline at end of file diff --git a/domain/repositories/windows/flutter/generated_plugin_registrant.cc b/domain/repositories/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/domain/repositories/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/domain/repositories/windows/flutter/generated_plugin_registrant.h b/domain/repositories/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/domain/repositories/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/domain/repositories/windows/flutter/generated_plugins.cmake b/domain/repositories/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..b93c4c3 --- /dev/null +++ b/domain/repositories/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/lib/initializer.dart b/lib/initializer.dart new file mode 100644 index 0000000..a05ee7e --- /dev/null +++ b/lib/initializer.dart @@ -0,0 +1,25 @@ +import 'package:local_db_core/boxes/box_list/level_box/level_box.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:repositories/level_box_domain/adapter/level_model_adapter.dart'; +import 'package:repositories/level_box_domain/repository/level_box_repository.dart'; +import 'package:types/level_data/interface/level_box_repository_impl.dart'; +import 'package:hive_flutter/hive_flutter.dart'; + +class Initializer { + Initializer.privateConstructor(); + + final LevelBoxRepository _repository = LevelBoxRepositoryImpl(levelBox: LevelBox()); + static final Initializer instance = Initializer.privateConstructor(); + + factory Initializer() { + return instance; + } + + Future initialHive() async { + final dir = await getApplicationDocumentsDirectory(); + Hive.init(dir.path); + Hive.registerAdapter(LevelModelAdapter()); + await _repository.openBox(); + await _repository.setCurrentLevel(1); + } +} diff --git a/lib/main.dart b/lib/main.dart index a55fa24..5b0e227 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,19 +3,14 @@ import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:my_flutter_puzzle/cubits/count_down_timer_cubit.dart'; +import 'package:my_flutter_puzzle/initializer.dart'; import 'package:my_flutter_puzzle/res/palette.dart'; -import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart'; -import 'package:my_flutter_puzzle/screens/puzzle/puzzle_starter_screen.dart'; import 'package:my_flutter_puzzle/screens/splash/screen/splash_screen.dart'; import 'package:my_flutter_puzzle/utils/color_brightness.dart'; -import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; -import 'package:url_strategy/url_strategy.dart'; void main() async { - setPathUrlStrategy(); - WidgetsFlutterBinding.ensureInitialized(); - + await Initializer.instance.initialHive(); runApp(const ProviderScope(child: MyApp())); } @@ -28,12 +23,6 @@ class MyApp extends StatelessWidget { DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); - Level level = Level( - image: 'level-1'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 1, - ); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); return BlocProvider( create: (context) => CountDownTimerCubit(), @@ -58,12 +47,7 @@ class MyApp extends StatelessWidget { onSurface: Colors.white38, ), ), - home: PuzzleStarterScreen( - duration: level.duration, - puzzleSize: level.puzzleSize, - image: level.image, - level: level.level, - ), + home: const SplashScreen(), ), ); } diff --git a/lib/screens/level_list/cubit/level_list_cubit.dart b/lib/screens/level_list/cubit/level_list_cubit.dart new file mode 100644 index 0000000..a7e87e5 --- /dev/null +++ b/lib/screens/level_list/cubit/level_list_cubit.dart @@ -0,0 +1,31 @@ +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:local_db_core/boxes/box_list/level_box/level_box.dart'; +import 'package:my_flutter_puzzle/cubits/base_cubit_type.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; +import 'package:repositories/level_box_domain/repository/level_box_repository.dart'; +import 'package:types/level_data/interface/level_box_repository_impl.dart'; + +class LevelListCubit extends Cubit> { + List levelList = []; + late int currentLevel; + final LevelBoxRepository _repository = LevelBoxRepositoryImpl(levelBox: LevelBox()); + + LevelListCubit() : super(BaseCubitType(eventName: LevelListCubitState.empty)); + + void empty() => emit(BaseCubitType(eventName: LevelListCubitState.empty)); + + void getData() async { + currentLevel = await _repository.getCurrentLevel(); + await _repository.getLevel( + result: (data) { + levelList = data; + emit(BaseCubitType(eventName: LevelListCubitState.list)); + }, + ); + } +} + +enum LevelListCubitState { + empty, + list, +} diff --git a/lib/screens/level_list/screen/level_list_screen.dart b/lib/screens/level_list/screen/level_list_screen.dart index e43193f..73f9fc3 100644 --- a/lib/screens/level_list/screen/level_list_screen.dart +++ b/lib/screens/level_list/screen/level_list_screen.dart @@ -1,10 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:my_flutter_puzzle/cubits/base_cubit_type.dart'; +import 'package:my_flutter_puzzle/screens/level_list/cubit/level_list_cubit.dart'; import 'package:my_flutter_puzzle/screens/level_list/widgets/level_widget.dart'; import 'package:my_flutter_puzzle/screens/level_list/widgets/lock_level_widget.dart'; import 'package:my_flutter_puzzle/screens/level_list/widgets/payed_level_widget.dart'; +import 'package:my_flutter_puzzle/screens/lose/lose_screen.dart'; import 'package:my_flutter_puzzle/screens/puzzle/puzzle_starter_screen.dart'; +import 'package:my_flutter_puzzle/screens/win/win_screen.dart'; import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; class LevelListScreen extends StatefulWidget { const LevelListScreen({Key? key}) : super(key: key); @@ -14,58 +20,12 @@ class LevelListScreen extends StatefulWidget { } class _LevelListScreenState extends State { - final List _levelList = []; + late final LevelListCubit _cubit; @override void initState() { - _levelList.add(Level( - image: 'level-1'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 1, - )); - _levelList.add(Level( - image: 'level-2'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 2, - )); - _levelList.add(Level( - image: 'level-3'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 3, - )); - _levelList.add(Level( - image: 'level-4'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 4, - )); - _levelList.add(Level( - image: 'level-5'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 5, - )); - _levelList.add(Level( - image: 'level-6'.jpgPath, - duration: 4, - puzzleSize: 3, - level: 6, - )); - _levelList.add(Level( - image: 'level-7'.jpgPath, - duration: 6, - puzzleSize: 4, - level: 7, - )); - _levelList.add(Level( - image: 'level-8'.jpgPath, - duration: 6, - puzzleSize: 4, - level: 8, - )); + _cubit = BlocProvider.of(context); + _cubit.getData(); super.initState(); } @@ -73,64 +33,66 @@ class _LevelListScreenState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xff6236FF), - body: Padding( - padding: const EdgeInsets.symmetric(horizontal: 55), - child: Row( - children: [ - Container( - width: context.width * 213 / 812, - height: context.height * 293 / 540, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('level_screen_image'.pngPath), - ), - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, + body: BlocBuilder>( + builder: (context, state) { + switch (state.eventName!) { + case LevelListCubitState.empty: + break; + case LevelListCubitState.list: + break; + } + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 55), + child: Row( children: [ - Padding( - padding: EdgeInsets.only( - top: context.height * 33 / 540, - bottom: context.height * 12 / 540), - child: const Text( - 'Levels', - style: TextStyle( - color: Colors.white, - fontSize: 24, - fontWeight: FontWeight.bold, + Container( + width: context.width * 213 / 812, + height: context.height * 293 / 540, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('level_screen_image'.pngPath), ), ), ), - SizedBox( - width: context.width * 436 / 820, - height: context.height * 397 / 540, - child: ListView.builder( - itemBuilder: (context, index) { - if (index == 0 || index == 1) { - return GestureDetector( - onTap: () => _startLevel(_levelList[index]), - child: LevelWidget(level: _levelList[index]), - ); - } - if (index == 2) { - return GestureDetector( - child: LockLevelWidget(level: _levelList[index]), - onTap: () => _startLevel(_levelList[index]), - ); - } - return GestureDetector( - child: PayedLevelWidget(level: _levelList[index]), - onTap: () => _startLevel(_levelList[index]), - ); - }, - itemCount: _levelList.length, - ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: context.height * 33 / 540, bottom: context.height * 12 / 540), + child: const Text( + 'Levels', + style: TextStyle( + color: Colors.white, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ), + SizedBox( + width: context.width * 436 / 820, + height: context.height * 397 / 540, + child: ListView.builder( + itemBuilder: (context, index) { + if (_cubit.levelList[index].level == _cubit.currentLevel) { + return GestureDetector( + onTap: () => _startLevel(_cubit.levelList[index]), + child: LevelWidget(level: _cubit.levelList[index]), + ); + } + if (_cubit.levelList[index].payable) { + return PayedLevelWidget(level: _cubit.levelList[index]); + } + return LockLevelWidget(level: _cubit.levelList[index]); + }, + itemCount: _cubit.levelList.length, + ), + ), + ], ), ], ), - ], - ), + ); + }, ), ); } @@ -151,17 +113,3 @@ class _LevelListScreenState extends State { ); } } - -class Level { - final String image; - final int puzzleSize; - final int duration; - final int level; - - Level({ - required this.image, - required this.duration, - required this.puzzleSize, - required this.level, - }); -} diff --git a/lib/screens/level_list/widgets/level_widget.dart b/lib/screens/level_list/widgets/level_widget.dart index a1b9f5c..6baea2f 100644 --- a/lib/screens/level_list/widgets/level_widget.dart +++ b/lib/screens/level_list/widgets/level_widget.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart'; import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; class LevelWidget extends StatelessWidget { final Level level; @@ -92,7 +92,7 @@ class LevelWidget extends StatelessWidget { ), const SizedBox(width: 12), Text( - '${level.puzzleSize}*${level.puzzleSize} | 00:56', + '${level.puzzleSize}*${level.puzzleSize} | ${level.recordDuration}', style: const TextStyle( color: Color(0xffBCACF4), fontSize: 16, diff --git a/lib/screens/level_list/widgets/lock_level_widget.dart b/lib/screens/level_list/widgets/lock_level_widget.dart index 369af87..5dc3571 100644 --- a/lib/screens/level_list/widgets/lock_level_widget.dart +++ b/lib/screens/level_list/widgets/lock_level_widget.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart'; import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; class LockLevelWidget extends StatelessWidget { final Level level; @@ -59,7 +59,7 @@ class LockLevelWidget extends StatelessWidget { ), const SizedBox(width: 12), Text( - '${level.puzzleSize}*${level.puzzleSize} | 00:56', + '${level.puzzleSize}*${level.puzzleSize} | ${level.recordDuration}', style: TextStyle( color: const Color(0xffBCACF4).withOpacity(0.5), fontSize: 16, diff --git a/lib/screens/level_list/widgets/payed_level_widget.dart b/lib/screens/level_list/widgets/payed_level_widget.dart index bf1e81f..ef3a8d4 100644 --- a/lib/screens/level_list/widgets/payed_level_widget.dart +++ b/lib/screens/level_list/widgets/payed_level_widget.dart @@ -1,16 +1,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart'; import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; +import 'package:repositories/level_box_domain/model/level_model.dart'; class PayedLevelWidget extends StatelessWidget { final Level level; - const PayedLevelWidget({ - Key? key, - required this.level, - }) : super(key: key); + const PayedLevelWidget({Key? key, required this.level}) : super(key: key); @override Widget build(BuildContext context) { @@ -62,7 +59,7 @@ class PayedLevelWidget extends StatelessWidget { ), const SizedBox(width: 12), Text( - '${level.puzzleSize}*${level.puzzleSize} | 00:56', + '${level.puzzleSize}*${level.puzzleSize} | ${level.recordDuration}', style: TextStyle( color: const Color(0xffBCACF4).withOpacity(0.5), fontSize: 16, @@ -115,7 +112,7 @@ class PayedLevelWidget extends StatelessWidget { padding: const EdgeInsets.all(10), margin: const EdgeInsets.symmetric(vertical: 3), decoration: const BoxDecoration( - color: Colors.white , + color: Colors.white, shape: BoxShape.circle, ), child: SvgPicture.asset('lock'.svgPath), diff --git a/lib/screens/lose/lose_screen.dart b/lib/screens/lose/lose_screen.dart new file mode 100644 index 0000000..088367a --- /dev/null +++ b/lib/screens/lose/lose_screen.dart @@ -0,0 +1,221 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; +import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; + +class LoseScreen extends StatefulWidget { + final int move; + final int tiles; + + const LoseScreen({ + Key? key, + required this.tiles, + required this.move, + }) : super(key: key); + + @override + State createState() => _LoseScreenState(); +} + +class _LoseScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xffA7A7A7), + body: SizedBox( + width: context.width, + height: context.height, + child: Stack( + alignment: AlignmentDirectional.centerEnd, + children: [ + Center( + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + Container( + width: context.width * 267 / 812, + height: context.height * 284 / 375, + decoration: BoxDecoration( + gradient: const LinearGradient( + colors: [ + Color(0xffB9B9B9), + Color(0xffD1D1D1), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + borderRadius: BorderRadius.circular(36), + ), + child: Column( + children: [ + const SizedBox(height: 31), + const Text( + 'Opsssss !', + style: TextStyle( + color: Colors.white, + fontSize: 25, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 24), + Container( + width: context.width * 114 / 812, + height: context.width * 114 / 812, + decoration: BoxDecoration( + color: const Color(0xffC0C0C0), + shape: BoxShape.circle, + border: Border.all( + color: const Color(0xff7a7a7a), + width: 1, + ), + ), + child: Container( + margin: EdgeInsets.all(context.width * 20 / 812), + padding: EdgeInsets.all(context.width * 20 / 812), + decoration: const BoxDecoration( + color: Color(0xffE02020), + shape: BoxShape.circle, + ), + child: SvgPicture.asset( + 'sad'.svgPath, + colorFilter: const ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), + ), + ), + ), + const SizedBox(height: 19), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + const Text( + 'Tiles', + style: TextStyle( + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(width: 9), + Text( + '${widget.tiles}', + style: const TextStyle( + decoration: TextDecoration.underline, + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + const SizedBox(width: 42), + Row( + children: [ + const Text( + 'Move', + style: TextStyle( + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(width: 9), + Text( + '${widget.move}', + style: const TextStyle( + decoration: TextDecoration.underline, + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ], + ), + ], + ), + ), + Transform.translate( + offset: const Offset(0, 20), + child: Container( + width: context.width * 147 / 812, + height: context.height * 51 / 375, + padding: const EdgeInsets.all(3), + decoration: BoxDecoration( + color: const Color(0xff979797).withOpacity(0.12), + borderRadius: BorderRadius.circular(36), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(31), + gradient: const LinearGradient( + colors: [ + Color(0xffFFC600), + Color(0xffFF5A00), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const SizedBox(width: 6), + Container( + width: context.width * 26 / 540, + height: context.width * 26 / 540, + padding: const EdgeInsets.all(9), + margin: const EdgeInsets.symmetric(vertical: 3), + decoration: BoxDecoration( + border: Border.all( + color: Colors.white, + width: 1, + ), + gradient: const LinearGradient( + colors: [ + Colors.white, + Color(0xffD5D5D5), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + shape: BoxShape.circle, + ), + child: SvgPicture.asset('refresh'.svgPath), + ), + const SizedBox(width: 8), + const Text( + 'Restart', + style: TextStyle( + color: Colors.white, + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(width: 14), + ], + ), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsetsDirectional.only(end: context.width * 68 / 812), + width: context.width * 142 / 812, + height: context.height * 280 / 375, + child: Image( + image: AssetImage('avatar'.pngPath), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/photo/photo_screen_large.dart b/lib/screens/photo/photo_screen_large.dart index 7e2d870..2f83eaf 100644 --- a/lib/screens/photo/photo_screen_large.dart +++ b/lib/screens/photo/photo_screen_large.dart @@ -8,12 +8,13 @@ import 'package:my_flutter_puzzle/cubits/count_down_timer_cubit.dart'; import 'package:my_flutter_puzzle/models/puzzle_data.dart'; import 'package:my_flutter_puzzle/providers.dart'; import 'package:my_flutter_puzzle/res/puzzle_constants.dart'; +import 'package:my_flutter_puzzle/screens/lose/lose_screen.dart'; +import 'package:my_flutter_puzzle/screens/win/win_screen.dart'; import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; import 'package:my_flutter_puzzle/utils/puzzle_solver.dart'; import 'package:my_flutter_puzzle/utils/utils.dart'; import 'package:my_flutter_puzzle/widgets/photo_screen/image_viewer.dart'; -import 'package:my_flutter_puzzle/widgets/solo_screen/animated_dash.dart'; import 'package:my_flutter_puzzle/widgets/solo_screen/count_down_timer_widget.dart'; import 'package:my_flutter_puzzle/widgets/solo_screen/countdown_widget.dart'; import 'package:my_flutter_puzzle/widgets/solo_screen/moves_tiles_widget.dart'; @@ -40,8 +41,7 @@ class PhotoScreenLarge extends ConsumerStatefulWidget { final RiveAnimationController riveController; @override - ConsumerState createState() => - _SoloScreenLargeState(); + ConsumerState createState() => _SoloScreenLargeState(); } class _SoloScreenLargeState extends ConsumerState { @@ -58,6 +58,8 @@ class _SoloScreenLargeState extends ConsumerState { List? _previousImages; Image? _previousImage; PaletteGenerator? _previousPalette; + int _moves = 0; + int _tiles = 0; @override void initState() { @@ -71,8 +73,7 @@ class _SoloScreenLargeState extends ConsumerState { @override Widget build(BuildContext context) { - ref.listen(puzzleNotifierProvider(_solverClient), - (previous, PuzzleState next) { + ref.listen(puzzleNotifierProvider(_solverClient), (previous, PuzzleState next) { if (next is PuzzleInitializing) { setState(() { _isStartPressed = true; @@ -80,6 +81,17 @@ class _SoloScreenLargeState extends ConsumerState { } if (next is PuzzleSolved) { _puzzleSolved = true; + Future.delayed(const Duration(milliseconds: 500), () { + Navigator.push(context, MaterialPageRoute( + builder: (context) { + return WinScreen( + tiles: _tiles, + move: _moves, + level: widget.level, + ); + }, + )); + }); } }); @@ -90,9 +102,7 @@ class _SoloScreenLargeState extends ConsumerState { _previousImage = next.image; _previousPalette = next.palette; }); - ref - .read(puzzleNotifierProvider(_solverClient).notifier) - .initializePuzzle( + ref.read(puzzleNotifierProvider(_solverClient).notifier).initializePuzzle( initialPuzzleData: _initialPuzzleData, ); } @@ -108,139 +118,148 @@ class _SoloScreenLargeState extends ConsumerState { body: SafeArea( child: Padding( padding: EdgeInsets.symmetric( - horizontal: context.width * 30 / 812, - vertical: context.height * 20 / 375, + horizontal: context.width * 26 / 812, ), - child: Row( + child: Column( children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - SvgPicture.asset('flash'.svgPath), - const SizedBox(width: 8), - Text( - 'Level ${widget.level}', - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(width: 18), - GestureDetector( - onTap: _resetTimer, - child: Container( - width: context.width * 22 / 540, - height: context.width * 22 / 540, - padding: const EdgeInsets.all(5), - margin: const EdgeInsets.symmetric(vertical: 3), - decoration: const BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - ), - child: SvgPicture.asset('refresh'.svgPath), - ), - ), - ], - ), - const SizedBox(height: 21), - ImageViewer( - puzzleSize: _puzzleSize, - previousImage: _previousImage, - previousPalette: _previousPalette, - imageSize: 200, - ), - const SizedBox(height: 12), - MovesTilesWidget( - solverClient: _solverClient, - fontSize: 16, - ), - ], - ), - SizedBox(width: context.width * 60 / 812), - SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + SizedBox(height: context.height * 20 / 375), + SizedBox( + width: context.width, + child: Row( children: [ + SvgPicture.asset('flash'.svgPath), + const SizedBox(width: 8), + Text( + 'Level ${widget.level}', + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + const Spacer(), CountDownTimerWidget( duration: widget.duration, finishCallback: _finishTime, ), - const SizedBox(height: 23), - Consumer( - builder: (context, ref, child) { - final state = ref.watch( - imageSplitterNotifierProvider, - ); - return state.maybeWhen( - () => PuzzleWidget( - solverClient: _solverClient, - boardSize: _boardSize, - eachBoxSize: _eachBoxSize, - initialPuzzleData: _initialPuzzleData, - fontSize: _fontSize, - images: _previousImages, - kInitialSpeed: kInitialSpeed, - ), - complete: (image, images, palette) { - _previousImages = images; - _previousImage = image; - _previousPalette = palette; - - return PuzzleWidget( - solverClient: _solverClient, - boardSize: _boardSize, - eachBoxSize: _eachBoxSize, - initialPuzzleData: _initialPuzzleData, - fontSize: _fontSize, - images: images, - kInitialSpeed: kInitialSpeed, - ); - }, - orElse: () => PuzzleWidget( - solverClient: _solverClient, - boardSize: _boardSize, - eachBoxSize: _eachBoxSize, - initialPuzzleData: _initialPuzzleData, - fontSize: _fontSize, - images: _previousImages, - kInitialSpeed: kInitialSpeed, - ), - ); - }, + const Spacer(), + GestureDetector( + onTap: _resetTimer, + child: Container( + width: context.width * 22 / 540, + height: context.width * 22 / 540, + padding: const EdgeInsets.all(5), + margin: const EdgeInsets.symmetric(vertical: 3), + decoration: const BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + ), + child: SvgPicture.asset('refresh'.svgPath), + ), ), ], ), ), - SizedBox(width: context.width * 38 / 812), - Stack( - alignment: Alignment.center, + SizedBox(height: context.height * 22 / 375), + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - width: context.width * 126 / 812, - height: context.height * 251 / 375, - child: Image( - image: AssetImage('avatar'.pngPath), - ), - ), Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.center, children: [ - CountdownWidget( - isStartPressed: _isStartPressed, - onFinish: () { - BlocProvider.of(context) - .start(); - setState(() { - _isStartPressed = false; - }); + ImageViewer( + puzzleSize: _puzzleSize, + previousImage: _previousImage, + previousPalette: _previousPalette, + imageSize: 200, + ), + SizedBox(height: context.height * 30 / 375), + MovesTilesWidget( + solverClient: _solverClient, + fontSize: 16, + callback: (move, tiles) { + _moves = move; + _tiles = tiles; }, - initialSpeed: kInitialSpeed, + ), + ], + ), + SizedBox(width: context.width * 34 / 812), + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Consumer( + builder: (context, ref, child) { + final state = ref.watch( + imageSplitterNotifierProvider, + ); + return state.maybeWhen( + () => PuzzleWidget( + solverClient: _solverClient, + boardSize: _boardSize, + eachBoxSize: _eachBoxSize, + initialPuzzleData: _initialPuzzleData, + fontSize: _fontSize, + images: _previousImages, + kInitialSpeed: kInitialSpeed, + ), + complete: (image, images, palette) { + _previousImages = images; + _previousImage = image; + _previousPalette = palette; + + return PuzzleWidget( + solverClient: _solverClient, + boardSize: _boardSize, + eachBoxSize: _eachBoxSize, + initialPuzzleData: _initialPuzzleData, + fontSize: _fontSize, + images: images, + kInitialSpeed: kInitialSpeed, + ); + }, + orElse: () => PuzzleWidget( + solverClient: _solverClient, + boardSize: _boardSize, + eachBoxSize: _eachBoxSize, + initialPuzzleData: _initialPuzzleData, + fontSize: _fontSize, + images: _previousImages, + kInitialSpeed: kInitialSpeed, + ), + ); + }, + ), + ], + ), + ), + SizedBox(width: context.width * 32 / 812), + Stack( + alignment: Alignment.center, + children: [ + SizedBox( + width: context.width * 126 / 812, + height: context.height * 280 / 375, + child: Image( + image: AssetImage('avatar'.pngPath), + ), + ), + Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CountdownWidget( + isStartPressed: _isStartPressed, + onFinish: () { + BlocProvider.of(context).start(); + setState(() { + _isStartPressed = false; + }); + }, + initialSpeed: kInitialSpeed, + ), + ], ), ], ), @@ -256,9 +275,12 @@ class _SoloScreenLargeState extends ConsumerState { void _finishTime() { if (!_puzzleSolved) { - Utils.instance.showToast(context, 'TimeOut'); Future.delayed(const Duration(milliseconds: 1500), () { - Navigator.pop(context); + Navigator.push(context, MaterialPageRoute( + builder: (context) { + return LoseScreen(tiles: _tiles, move: _moves); + }, + )); }); } } diff --git a/lib/screens/splash/screen/splash_screen.dart b/lib/screens/splash/screen/splash_screen.dart index 577f031..4dae903 100644 --- a/lib/screens/splash/screen/splash_screen.dart +++ b/lib/screens/splash/screen/splash_screen.dart @@ -1,6 +1,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:my_flutter_puzzle/screens/level_list/cubit/level_list_cubit.dart'; import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; @@ -17,7 +19,10 @@ class _SplashScreenState extends State { Timer(const Duration(milliseconds: 2000), () { Navigator.push(context, MaterialPageRoute( builder: (context) { - return const LevelListScreen(); + return BlocProvider( + child: const LevelListScreen(), + create: (context) => LevelListCubit(), + ); }, )); }); diff --git a/lib/screens/win/win_screen.dart b/lib/screens/win/win_screen.dart new file mode 100644 index 0000000..ced1641 --- /dev/null +++ b/lib/screens/win/win_screen.dart @@ -0,0 +1,235 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart'; +import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; + +class WinScreen extends StatefulWidget { + final int move; + final int tiles; + final int level; + + const WinScreen({ + Key? key, + required this.tiles, + required this.move, + required this.level, + }) : super(key: key); + + @override + State createState() => _WinScreenState(); +} + +class _WinScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xff4400CE), + body: SizedBox( + width: context.width, + height: context.height, + child: Stack( + alignment: AlignmentDirectional.centerEnd, + children: [ + Center( + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + Container( + width: context.width * 267 / 812, + height: context.height * 284 / 375, + decoration: BoxDecoration( + gradient: const LinearGradient( + colors: [ + Color(0xff6236FF), + Color(0xff4706CC), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + borderRadius: BorderRadius.circular(36), + ), + child: Column( + children: [ + const SizedBox(height: 31), + const Text( + 'Well done !', + style: TextStyle( + color: Colors.white, + fontSize: 25, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 24), + Container( + width: context.width * 114 / 812, + height: context.width * 114 / 812, + decoration: BoxDecoration( + gradient: const LinearGradient( + colors: [ + Color(0xff6236FF), + Color(0xff4824CB), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + shape: BoxShape.circle, + border: Border.all( + color: const Color(0xff6136FE), + width: 1, + ), + ), + child: Container( + margin: EdgeInsets.all(context.width * 20 / 812), + padding: EdgeInsets.all(context.width * 20 / 812), + decoration: const BoxDecoration( + color: Color(0xff6DD400), + shape: BoxShape.circle, + ), + child: SvgPicture.asset( + 'check'.svgPath, + colorFilter: const ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), + ), + ), + ), + const SizedBox(height: 19), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + const Text( + 'Tiles', + style: TextStyle( + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(width: 9), + Text( + '${widget.tiles}', + style: const TextStyle( + decoration: TextDecoration.underline, + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + const SizedBox(width: 42), + Row( + children: [ + const Text( + 'Move', + style: TextStyle( + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(width: 9), + Text( + '${widget.move}', + style: const TextStyle( + decoration: TextDecoration.underline, + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ], + ), + ], + ), + ), + Transform.translate( + offset: const Offset(0, 20), + child: GestureDetector( + onTap: () { + + }, + child: Container( + width: context.width * 160 / 812, + height: context.height * 51 / 375, + padding: const EdgeInsets.all(3), + decoration: BoxDecoration( + color: const Color(0xff979797).withOpacity(0.12), + borderRadius: BorderRadius.circular(36), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(31), + gradient: const LinearGradient( + colors: [ + Color(0xffFFC600), + Color(0xffFF5A00), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const SizedBox(width: 6), + Container( + width: context.width * 31 / 540, + height: context.width * 31 / 540, + padding: const EdgeInsets.all(9), + margin: const EdgeInsets.symmetric(vertical: 3), + decoration: BoxDecoration( + border: Border.all( + color: Colors.white, + width: 1, + ), + gradient: const LinearGradient( + colors: [ + Colors.white, + Color(0xffD5D5D5), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + shape: BoxShape.circle, + ), + child: SvgPicture.asset('next_level'.svgPath), + ), + const SizedBox(width: 8), + const Text( + 'Next level', + style: TextStyle( + color: Colors.white, + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(width: 14), + ], + ), + ), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsetsDirectional.only(end: context.width * 68 / 812), + width: context.width * 142 / 812, + height: context.height * 280 / 375, + child: Image( + image: AssetImage('avatar'.pngPath), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/utils/toast.dart b/lib/utils/toast.dart index 9b2fb11..60f9425 100644 --- a/lib/utils/toast.dart +++ b/lib/utils/toast.dart @@ -49,7 +49,7 @@ class FToast { } _ToastEntry toastEntry = _overlayQueue.removeAt(0); _entry = toastEntry.entry; - Overlay.of(context)?.insert(_entry!); + Overlay.of(context).insert(_entry!); _timer = Timer(toastEntry.duration, () { Future.delayed(const Duration(milliseconds: 360), () { diff --git a/lib/widgets/solo_screen/moves_tiles_widget.dart b/lib/widgets/solo_screen/moves_tiles_widget.dart index 150b752..f105506 100644 --- a/lib/widgets/solo_screen/moves_tiles_widget.dart +++ b/lib/widgets/solo_screen/moves_tiles_widget.dart @@ -5,16 +5,18 @@ import 'package:my_flutter_puzzle/utils/puzzle_solver.dart'; import 'package:my_flutter_puzzle/widgets/solo_screen/moves_tiles_widget/moves_tiles_text.dart'; class MovesTilesWidget extends StatelessWidget { + final PuzzleSolverClient _solverClient; + final double fontSize; + final Function(int move, int tiles) callback; + const MovesTilesWidget({ Key? key, + required this.callback, required PuzzleSolverClient solverClient, this.fontSize = 24, }) : _solverClient = solverClient, super(key: key); - final PuzzleSolverClient _solverClient; - final double fontSize; - @override Widget build(BuildContext context) { return Consumer( @@ -36,26 +38,38 @@ class MovesTilesWidget extends StatelessWidget { tiles: 0, fontSize: fontSize, ), - current: (puzzleData) => MovesTilesText( - moves: puzzleData.moves, - tiles: puzzleData.tiles, - fontSize: fontSize, - ), - computingSolution: (puzzleData) => MovesTilesText( - moves: puzzleData.moves, - tiles: puzzleData.tiles, - fontSize: fontSize, - ), - autoSolving: (puzzleData) => MovesTilesText( - moves: puzzleData.moves, - tiles: puzzleData.tiles, - fontSize: fontSize, - ), - solved: (puzzleData) => MovesTilesText( - moves: puzzleData.moves, - tiles: puzzleData.tiles, - fontSize: fontSize, - ), + current: (puzzleData) { + callback.call(puzzleData.moves, puzzleData.tiles); + return MovesTilesText( + moves: puzzleData.moves, + tiles: puzzleData.tiles, + fontSize: fontSize, + ); + }, + computingSolution: (puzzleData) { + callback.call(puzzleData.moves, puzzleData.tiles); + return MovesTilesText( + moves: puzzleData.moves, + tiles: puzzleData.tiles, + fontSize: fontSize, + ); + }, + autoSolving: (puzzleData) { + callback.call(puzzleData.moves, puzzleData.tiles); + return MovesTilesText( + moves: puzzleData.moves, + tiles: puzzleData.tiles, + fontSize: fontSize, + ); + }, + solved: (puzzleData) { + callback.call(puzzleData.moves, puzzleData.tiles); + return MovesTilesText( + moves: puzzleData.moves, + tiles: puzzleData.tiles, + fontSize: fontSize, + ); + }, error: (_) => MovesTilesText( moves: 0, tiles: 0, diff --git a/lib/widgets/solo_screen/moves_tiles_widget/moves_tiles_text.dart b/lib/widgets/solo_screen/moves_tiles_widget/moves_tiles_text.dart index 9650642..706bb8f 100644 --- a/lib/widgets/solo_screen/moves_tiles_widget/moves_tiles_text.dart +++ b/lib/widgets/solo_screen/moves_tiles_widget/moves_tiles_text.dart @@ -19,7 +19,7 @@ class MovesTilesText extends StatelessWidget { children: [ Container( height: context.height * 32 / 375, - width: context.width * 94 / 812, + width: context.width * 90 / 812, padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), decoration: BoxDecoration( border: Border.all(color: const Color(0xff6236FF), width: 1), @@ -55,10 +55,10 @@ class MovesTilesText extends StatelessWidget { ], ), ), - const SizedBox(width: 12), + SizedBox(width: context.width * 6 / 812), Container( height: context.height * 32 / 375, - width: context.width * 94 / 812, + width: context.width * 90 / 812, padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), decoration: BoxDecoration( border: Border.all(color: const Color(0xff6236FF), width: 1), diff --git a/pubspec.lock b/pubspec.lock index 2460255..5e789ec 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -344,6 +344,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.0" + hive: + dependency: transitive + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + hive_flutter: + dependency: transitive + description: + name: hive_flutter + sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc + url: "https://pub.dev" + source: hosted + version: "1.1.0" http: dependency: transitive description: @@ -416,6 +432,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + local_db_core: + dependency: "direct main" + description: + path: "data/data_core/local_db/local_db_core" + relative: true + source: path + version: "1.0.0+1" logging: dependency: transitive description: @@ -616,6 +639,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + repositories: + dependency: "direct main" + description: + path: "domain/repositories" + relative: true + source: path + version: "0.0.1" rive: dependency: "direct main" description: @@ -749,6 +779,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + types: + dependency: "direct main" + description: + path: "data/data_types/types" + relative: true + source: path + version: "0.0.1" url_strategy: dependency: "direct main" description: @@ -838,5 +875,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.19.0 <3.0.0" + dart: ">=2.19.2 <3.0.0" flutter: ">=3.7.0-0" diff --git a/pubspec.yaml b/pubspec.yaml index 58e72a0..757699b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,6 +24,12 @@ dependencies: flutter_bloc: ^8.1.1 font_awesome_flutter: ^9.2.0 crop: ^0.5.2 + local_db_core: + path: data/data_core/local_db/local_db_core + types: + path: data/data_types/types + repositories: + path: domain/repositories dev_dependencies: flutter_test: