From abe7072f2d022ebb95aff8dfdbabedaee9bbfc28 Mon Sep 17 00:00:00 2001 From: Mohammad Salameh Date: Mon, 26 Feb 2024 15:55:22 +0300 Subject: [PATCH] AC devices page implemented AC Cubit Add New Devices Cubit Arch will be used Devices Cubit (for devices categories, and devices page) { AC cubit, Lights cubit. ... } Replaced AssetsManager with Assets Class (auto generated) --- assets/icons/coldMode.svg | 3 + assets/icons/{Door Lock.svg => doorLock.svg} | 0 assets/icons/fan-0.svg | 3 + assets/icons/fan-1.svg | 12 + assets/icons/fan-2.svg | 12 + assets/icons/fan-3.svg | 12 + assets/icons/{Hot 1.jpg => hot1.jpg} | Bin assets/icons/minus.svg | 3 + assets/icons/plus.svg | 3 + assets/icons/sunnyMode.svg | 16 ++ assets/icons/windyMode.svg | 67 ++++++ assets/icons/{Winter 1.jpg => winter1.jpg} | Bin ios/Flutter/Debug.xcconfig | 1 + ios/Flutter/Release.xcconfig | 1 + ios/Podfile | 44 ++++ ios/Podfile.lock | 217 ++++++++++++++++++ ios/Runner.xcodeproj/project.pbxproj | 140 +++++++++-- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../contents.xcworkspacedata | 3 + ios/Runner/Base.lproj/Main.storyboard | 13 +- lib/features/app_layout/bloc/nav_cubit.dart | 16 +- .../view/widgets/app_bar_home_dropdown.dart | 4 +- .../app_layout/view/widgets/app_body.dart | 5 +- .../view/widgets/default_nav_bar.dart | 4 - .../view/widgets/carbon_emission.dart | 6 +- .../dashboard/view/widgets/consumption.dart | 5 +- .../dashboard/view/widgets/energy_usage.dart | 4 +- .../view/widgets/live_monitor_tab.dart | 9 +- lib/features/devices/bloc/ac_cubit.dart | 57 +++++ lib/features/devices/bloc/ac_state.dart | 16 ++ lib/features/devices/bloc/devices_cubit.dart | 189 ++++++++------- lib/features/devices/bloc/devices_state.dart | 10 + lib/features/devices/model/ac_model.dart | 19 ++ .../devices/model/device_category_model.dart | 15 +- lib/features/devices/model/device_model.dart | 14 -- .../view/widgets/a_c_control_unit.dart | 75 ++++++ .../devices/view/widgets/ac_view.dart | 72 ++++++ .../devices/view/widgets/curtain_view.dart | 10 + .../view/widgets/devices_mode_tab.dart | 6 +- .../view/widgets/devices_temp_widget.dart | 74 ++++++ .../view/widgets/devices_view_body.dart | 23 +- .../devices/view/widgets/door_view.dart | 10 + .../devices/view/widgets/gateway_view.dart | 10 + .../devices/view/widgets/lights_view.dart | 10 + .../devices/view/widgets/no_devices_view.dart | 4 +- .../devices/view/widgets/screens_view.dart | 10 + .../devices/view/widgets/switches.dart | 98 ++++---- .../view/widgets/universal_a_c_switch.dart | 70 ++++++ .../view/widgets/universal_a_c_temp.dart | 59 +++++ lib/features/layout/view/layout_view.dart | 17 +- lib/features/menu/view/menu_view.dart | 11 +- lib/features/menu/view/widgets/menu_list.dart | 1 + .../menu/view/widgets/profile_tab.dart | 55 +++++ lib/features/scene/bloc/scene_cubit.dart | 1 + lib/features/scene/view/scene_view.dart | 7 +- .../view/widgets/scene_view_no_scenes.dart | 4 +- .../shared_widgets/custom_switch.dart | 42 ++-- .../shared_widgets/default_container.dart | 6 + .../devices_default_switch.dart | 83 +++++++ lib/features/shared_widgets/syncrow_logo.dart | 4 +- .../text_widgets/body_large.dart | 11 +- .../text_widgets/custom_text_widget.dart | 6 +- lib/features/splash/view/splash_view.dart | 4 +- lib/generated/assets.dart | 37 ++- lib/utils/bloc_observer.dart | 6 +- lib/utils/helpers/cache_helper.dart | 31 --- lib/utils/helpers/file_helper.dart | 125 ---------- .../helpers/sharedPreferences_helper.dart | 90 -------- lib/utils/helpers/url_launcher.dart | 76 ------ .../resource_manager/assets_manager.dart | 47 ---- pubspec.lock | 48 +++- pubspec.yaml | 1 + 72 files changed, 1535 insertions(+), 634 deletions(-) create mode 100644 assets/icons/coldMode.svg rename assets/icons/{Door Lock.svg => doorLock.svg} (100%) create mode 100644 assets/icons/fan-0.svg create mode 100644 assets/icons/fan-1.svg create mode 100644 assets/icons/fan-2.svg create mode 100644 assets/icons/fan-3.svg rename assets/icons/{Hot 1.jpg => hot1.jpg} (100%) create mode 100644 assets/icons/minus.svg create mode 100644 assets/icons/plus.svg create mode 100644 assets/icons/sunnyMode.svg create mode 100644 assets/icons/windyMode.svg rename assets/icons/{Winter 1.jpg => winter1.jpg} (100%) create mode 100644 ios/Podfile create mode 100644 ios/Podfile.lock create mode 100644 lib/features/devices/bloc/ac_cubit.dart create mode 100644 lib/features/devices/bloc/ac_state.dart create mode 100644 lib/features/devices/model/ac_model.dart delete mode 100644 lib/features/devices/model/device_model.dart create mode 100644 lib/features/devices/view/widgets/a_c_control_unit.dart create mode 100644 lib/features/devices/view/widgets/ac_view.dart create mode 100644 lib/features/devices/view/widgets/curtain_view.dart create mode 100644 lib/features/devices/view/widgets/devices_temp_widget.dart create mode 100644 lib/features/devices/view/widgets/door_view.dart create mode 100644 lib/features/devices/view/widgets/gateway_view.dart create mode 100644 lib/features/devices/view/widgets/lights_view.dart create mode 100644 lib/features/devices/view/widgets/screens_view.dart create mode 100644 lib/features/devices/view/widgets/universal_a_c_switch.dart create mode 100644 lib/features/devices/view/widgets/universal_a_c_temp.dart create mode 100644 lib/features/menu/view/widgets/profile_tab.dart create mode 100644 lib/features/shared_widgets/devices_default_switch.dart delete mode 100644 lib/utils/helpers/cache_helper.dart delete mode 100644 lib/utils/helpers/file_helper.dart delete mode 100644 lib/utils/helpers/sharedPreferences_helper.dart delete mode 100644 lib/utils/helpers/url_launcher.dart delete mode 100644 lib/utils/resource_manager/assets_manager.dart diff --git a/assets/icons/coldMode.svg b/assets/icons/coldMode.svg new file mode 100644 index 0000000..ab17a65 --- /dev/null +++ b/assets/icons/coldMode.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/Door Lock.svg b/assets/icons/doorLock.svg similarity index 100% rename from assets/icons/Door Lock.svg rename to assets/icons/doorLock.svg diff --git a/assets/icons/fan-0.svg b/assets/icons/fan-0.svg new file mode 100644 index 0000000..82841be --- /dev/null +++ b/assets/icons/fan-0.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/fan-1.svg b/assets/icons/fan-1.svg new file mode 100644 index 0000000..3a4dbf2 --- /dev/null +++ b/assets/icons/fan-1.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/icons/fan-2.svg b/assets/icons/fan-2.svg new file mode 100644 index 0000000..9e54725 --- /dev/null +++ b/assets/icons/fan-2.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/icons/fan-3.svg b/assets/icons/fan-3.svg new file mode 100644 index 0000000..2650a57 --- /dev/null +++ b/assets/icons/fan-3.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/icons/Hot 1.jpg b/assets/icons/hot1.jpg similarity index 100% rename from assets/icons/Hot 1.jpg rename to assets/icons/hot1.jpg diff --git a/assets/icons/minus.svg b/assets/icons/minus.svg new file mode 100644 index 0000000..c6d62f4 --- /dev/null +++ b/assets/icons/minus.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/plus.svg b/assets/icons/plus.svg new file mode 100644 index 0000000..0a6cfb1 --- /dev/null +++ b/assets/icons/plus.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/sunnyMode.svg b/assets/icons/sunnyMode.svg new file mode 100644 index 0000000..bb350d3 --- /dev/null +++ b/assets/icons/sunnyMode.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/icons/windyMode.svg b/assets/icons/windyMode.svg new file mode 100644 index 0000000..a7e6284 --- /dev/null +++ b/assets/icons/windyMode.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/Winter 1.jpg b/assets/icons/winter1.jpg similarity index 100% rename from assets/icons/Winter 1.jpg rename to assets/icons/winter1.jpg diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..d97f17e --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '12.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..b19c726 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,217 @@ +PODS: + - Firebase/Analytics (10.20.0): + - Firebase/Core + - Firebase/Core (10.20.0): + - Firebase/CoreOnly + - FirebaseAnalytics (~> 10.20.0) + - Firebase/CoreOnly (10.20.0): + - FirebaseCore (= 10.20.0) + - Firebase/Crashlytics (10.20.0): + - Firebase/CoreOnly + - FirebaseCrashlytics (~> 10.20.0) + - firebase_analytics (10.8.6): + - Firebase/Analytics (= 10.20.0) + - firebase_core + - Flutter + - firebase_core (2.25.4): + - Firebase/CoreOnly (= 10.20.0) + - Flutter + - firebase_crashlytics (3.4.15): + - Firebase/Crashlytics (= 10.20.0) + - firebase_core + - Flutter + - FirebaseAnalytics (10.20.0): + - FirebaseAnalytics/AdIdSupport (= 10.20.0) + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseAnalytics/AdIdSupport (10.20.0): + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleAppMeasurement (= 10.20.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseCore (10.20.0): + - FirebaseCoreInternal (~> 10.0) + - GoogleUtilities/Environment (~> 7.12) + - GoogleUtilities/Logger (~> 7.12) + - FirebaseCoreExtension (10.21.0): + - FirebaseCore (~> 10.0) + - FirebaseCoreInternal (10.21.0): + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - FirebaseCrashlytics (10.20.0): + - FirebaseCore (~> 10.5) + - FirebaseInstallations (~> 10.0) + - FirebaseSessions (~> 10.5) + - GoogleDataTransport (~> 9.2) + - GoogleUtilities/Environment (~> 7.8) + - nanopb (< 2.30910.0, >= 2.30908.0) + - PromisesObjC (~> 2.1) + - FirebaseInstallations (10.21.0): + - FirebaseCore (~> 10.0) + - GoogleUtilities/Environment (~> 7.8) + - GoogleUtilities/UserDefaults (~> 7.8) + - PromisesObjC (~> 2.1) + - FirebaseSessions (10.21.0): + - FirebaseCore (~> 10.5) + - FirebaseCoreExtension (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleDataTransport (~> 9.2) + - GoogleUtilities/Environment (~> 7.10) + - nanopb (< 2.30910.0, >= 2.30908.0) + - PromisesSwift (~> 2.1) + - Flutter (1.0.0) + - flutter_localization (0.0.1): + - Flutter + - flutter_secure_storage (6.0.0): + - Flutter + - GoogleAppMeasurement (10.20.0): + - GoogleAppMeasurement/AdIdSupport (= 10.20.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (10.20.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.20.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (10.20.0): + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleDataTransport (9.3.0): + - GoogleUtilities/Environment (~> 7.7) + - nanopb (< 2.30910.0, >= 2.30908.0) + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/AppDelegateSwizzler (7.12.0): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (7.12.0): + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.12.0): + - GoogleUtilities/Environment + - GoogleUtilities/MethodSwizzler (7.12.0): + - GoogleUtilities/Logger + - GoogleUtilities/Network (7.12.0): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (7.12.0)" + - GoogleUtilities/Reachability (7.12.0): + - GoogleUtilities/Logger + - GoogleUtilities/UserDefaults (7.12.0): + - GoogleUtilities/Logger + - nanopb (2.30909.1): + - nanopb/decode (= 2.30909.1) + - nanopb/encode (= 2.30909.1) + - nanopb/decode (2.30909.1) + - nanopb/encode (2.30909.1) + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - PromisesObjC (2.3.1) + - PromisesSwift (2.3.1): + - PromisesObjC (= 2.3.1) + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - sqflite (0.0.3): + - Flutter + - FlutterMacOS + - url_launcher_ios (0.0.1): + - Flutter + +DEPENDENCIES: + - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) + - Flutter (from `Flutter`) + - flutter_localization (from `.symlinks/plugins/flutter_localization/ios`) + - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + +SPEC REPOS: + trunk: + - Firebase + - FirebaseAnalytics + - FirebaseCore + - FirebaseCoreExtension + - FirebaseCoreInternal + - FirebaseCrashlytics + - FirebaseInstallations + - FirebaseSessions + - GoogleAppMeasurement + - GoogleDataTransport + - GoogleUtilities + - nanopb + - PromisesObjC + - PromisesSwift + +EXTERNAL SOURCES: + firebase_analytics: + :path: ".symlinks/plugins/firebase_analytics/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_crashlytics: + :path: ".symlinks/plugins/firebase_crashlytics/ios" + Flutter: + :path: Flutter + flutter_localization: + :path: ".symlinks/plugins/flutter_localization/ios" + flutter_secure_storage: + :path: ".symlinks/plugins/flutter_secure_storage/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqflite: + :path: ".symlinks/plugins/sqflite/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + +SPEC CHECKSUMS: + Firebase: 10c8cb12fb7ad2ae0c09ffc86cd9c1ab392a0031 + firebase_analytics: 9c600045bfb4d16dd78593d18f32c99bb77e5001 + firebase_core: a46c312d8bae4defa3d009b2aa7b5b413aeb394e + firebase_crashlytics: 3054fbdd2b4a4a91f25a15e57c9f1bd2a9ed81ae + FirebaseAnalytics: a2731bf3670747ce8f65368b118d18aa8e368246 + FirebaseCore: 28045c1560a2600d284b9c45a904fe322dc890b6 + FirebaseCoreExtension: 1c044fd46e95036cccb29134757c499613f3f564 + FirebaseCoreInternal: 43c1788eaeee9d1b97caaa751af567ce11010d00 + FirebaseCrashlytics: 81530595edb6d99f1918f723a6c33766a24a4c86 + FirebaseInstallations: 390ea1d10a4d02b20c965cbfd527ee9b3b412acb + FirebaseSessions: 80c2bbdd28166267b3d132debe5f7531efdb00bc + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_localization: f43b18844a2b3d2c71fd64f04ffd6b1e64dd54d4 + flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be + GoogleAppMeasurement: bb3c564c3efb933136af0e94899e0a46167466a8 + GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe + GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 + nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5 + path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 + PromisesSwift: 28dca69a9c40779916ac2d6985a0192a5cb4a265 + shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 + +PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 + +COCOAPODS: 1.15.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9baf73c..0bddadd 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,12 +8,14 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 611C662010675536F855E5CA /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 490AAF90B8FBFCC5BA996845 /* Pods_RunnerTests.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + D31283674D2826D7EF8E56BC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25B37F5982CD6994FABA2CC1 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,10 +44,16 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 25B37F5982CD6994FABA2CC1 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 444D77D28A8CDF32047CD0AF /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 490AAF90B8FBFCC5BA996845 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 949637473C534E1F68B19CC0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -53,8 +61,10 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + AAC9129FD50E64509AD1B9AF /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + BFD4DDED98208034B60B5311 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + DFB6BB492A265F2BF6FDC8C0 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + F323D632CA976B68DDB0E669 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -62,12 +72,52 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D31283674D2826D7EF8E56BC /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C2B33A7265AF659D80692473 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 611C662010675536F855E5CA /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2F70EB4341A83C900EB253DC /* Pods */ = { + isa = PBXGroup; + children = ( + BFD4DDED98208034B60B5311 /* Pods-Runner.debug.xcconfig */, + 949637473C534E1F68B19CC0 /* Pods-Runner.release.xcconfig */, + 444D77D28A8CDF32047CD0AF /* Pods-Runner.profile.xcconfig */, + DFB6BB492A265F2BF6FDC8C0 /* Pods-RunnerTests.debug.xcconfig */, + F323D632CA976B68DDB0E669 /* Pods-RunnerTests.release.xcconfig */, + AAC9129FD50E64509AD1B9AF /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 876D3217A8BBDAF41961161F /* Frameworks */ = { + isa = PBXGroup; + children = ( + 25B37F5982CD6994FABA2CC1 /* Pods_Runner.framework */, + 490AAF90B8FBFCC5BA996845 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -79,14 +129,6 @@ name = Flutter; sourceTree = ""; }; - 331C8082294A63A400263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( @@ -94,6 +136,8 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, + 2F70EB4341A83C900EB253DC /* Pods */, + 876D3217A8BBDAF41961161F /* Frameworks */, ); sourceTree = ""; }; @@ -128,9 +172,10 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 3B971DE531245D7FD2921C30 /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, - 331C807E294A63A400263BE5 /* Frameworks */, 331C807F294A63A400263BE5 /* Resources */, + C2B33A7265AF659D80692473 /* Frameworks */, ); buildRules = ( ); @@ -146,12 +191,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 3DC878D0674AA34AEC9695FB /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 315A05630CF83C532DBBCBF2 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -169,7 +216,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C8080294A63A400263BE5 = { @@ -223,6 +270,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 315A05630CF83C532DBBCBF2 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -239,6 +303,50 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 3B971DE531245D7FD2921C30 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3DC878D0674AA34AEC9695FB /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -377,7 +485,7 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */; + baseConfigurationReference = DFB6BB492A265F2BF6FDC8C0 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -395,7 +503,7 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */; + baseConfigurationReference = F323D632CA976B68DDB0E669 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -411,7 +519,7 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */; + baseConfigurationReference = AAC9129FD50E64509AD1B9AF /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 87131a0..8e3ca5d 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index f3c2851..f80b97a 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,13 +16,14 @@ - + - + + diff --git a/lib/features/app_layout/bloc/nav_cubit.dart b/lib/features/app_layout/bloc/nav_cubit.dart index 0fe89a4..cdca620 100644 --- a/lib/features/app_layout/bloc/nav_cubit.dart +++ b/lib/features/app_layout/bloc/nav_cubit.dart @@ -3,12 +3,12 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart'; import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart'; -import 'package:syncrow_app/features/layout/view/layout_view.dart'; import 'package:syncrow_app/features/menu/view/menu_view.dart'; import 'package:syncrow_app/features/scene/view/scene_view.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; +import '../../../generated/assets.dart'; + part 'nav_state.dart'; class NavCubit extends Cubit { @@ -27,16 +27,16 @@ class NavCubit extends Cubit { }; var bottomNavItems = [ - defaultBottomNavBarItem(icon: IconsManager.dashboard, label: 'Dashboard'), - defaultBottomNavBarItem(icon: IconsManager.layout, label: 'Layout'), - defaultBottomNavBarItem(icon: IconsManager.devices, label: 'Devices'), - defaultBottomNavBarItem(icon: IconsManager.routine, label: 'Routine'), - defaultBottomNavBarItem(icon: IconsManager.menu, label: 'Menu'), + defaultBottomNavBarItem(icon: Assets.iconsDashboard, label: 'Dashboard'), + // defaultBottomNavBarItem(icon: Assets.iconslayout, label: 'Layout'), + defaultBottomNavBarItem(icon: Assets.iconsDevices, label: 'Devices'), + defaultBottomNavBarItem(icon: Assets.iconsRoutines, label: 'Routine'), + defaultBottomNavBarItem(icon: Assets.iconsMenu, label: 'Menu'), ]; final List pages = [ const DashboardView(), - const LayoutPage(), + // const LayoutPage(), const DevicesViewBody(), const SceneView(), const MenuView(), diff --git a/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart b/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart index 5f60533..e12a0aa 100644 --- a/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart +++ b/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:gap/gap.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; +import '../../../../generated/assets.dart'; import '../../../shared_widgets/text_widgets/body_large.dart'; class AppBarHomeDropdown extends StatelessWidget { @@ -22,7 +22,7 @@ class AppBarHomeDropdown extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ SvgPicture.asset( - IconsManager.home, + Assets.iconsHome, width: 25, height: 25, colorFilter: const ColorFilter.mode( diff --git a/lib/features/app_layout/view/widgets/app_body.dart b/lib/features/app_layout/view/widgets/app_body.dart index 60e1652..d8bcfe4 100644 --- a/lib/features/app_layout/view/widgets/app_body.dart +++ b/lib/features/app_layout/view/widgets/app_body.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; + +import '../../../../generated/assets.dart'; class AppBody extends StatelessWidget { const AppBody({ @@ -18,7 +19,7 @@ class AppBody extends StatelessWidget { decoration: const BoxDecoration( image: DecorationImage( image: AssetImage( - ImageManager.background, + Assets.imagesBackground, ), fit: BoxFit.cover, opacity: 0.4, diff --git a/lib/features/app_layout/view/widgets/default_nav_bar.dart b/lib/features/app_layout/view/widgets/default_nav_bar.dart index 150227a..86ff70a 100644 --- a/lib/features/app_layout/view/widgets/default_nav_bar.dart +++ b/lib/features/app_layout/view/widgets/default_nav_bar.dart @@ -35,7 +35,3 @@ class DefaultNavBar extends StatelessWidget { ); } } - -class DefaultBottomNavBarItem extends BottomNavigationBarItem { - DefaultBottomNavBarItem({required super.icon}); -} diff --git a/lib/features/dashboard/view/widgets/carbon_emission.dart b/lib/features/dashboard/view/widgets/carbon_emission.dart index 82db69a..fe49034 100644 --- a/lib/features/dashboard/view/widgets/carbon_emission.dart +++ b/lib/features/dashboard/view/widgets/carbon_emission.dart @@ -4,7 +4,7 @@ import 'package:gap/gap.dart'; import 'package:syncrow_app/features/dashboard/view/widgets/card_title.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/features/shared_widgets/united_text.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; class CarbonEmission extends StatelessWidget { @@ -38,7 +38,7 @@ class CarbonEmission extends StatelessWidget { SizedBox.square( dimension: 30, child: SvgPicture.asset( - IconsManager.CO2, + Assets.iconsCO2, fit: BoxFit.contain, ), ), @@ -68,7 +68,7 @@ class CarbonEmission extends StatelessWidget { SizedBox.square( dimension: 30, child: SvgPicture.asset( - IconsManager.sustainability, + Assets.iconsSustainability, fit: BoxFit.contain, ), ), diff --git a/lib/features/dashboard/view/widgets/consumption.dart b/lib/features/dashboard/view/widgets/consumption.dart index ceaa330..4dfebd8 100644 --- a/lib/features/dashboard/view/widgets/consumption.dart +++ b/lib/features/dashboard/view/widgets/consumption.dart @@ -2,9 +2,10 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:syncrow_app/features/dashboard/view/widgets/card_title.dart'; import 'package:syncrow_app/features/shared_widgets/united_text.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; +import '../../../../generated/assets.dart'; + class Consumption extends StatelessWidget { const Consumption({ super.key, @@ -54,7 +55,7 @@ class Consumption extends StatelessWidget { SizedBox.square( dimension: 60, child: Image.asset( - ImageManager.testDash2, + Assets.imagesTestDash2, fit: BoxFit.contain, ), ) diff --git a/lib/features/dashboard/view/widgets/energy_usage.dart b/lib/features/dashboard/view/widgets/energy_usage.dart index c05cadb..1781f0b 100644 --- a/lib/features/dashboard/view/widgets/energy_usage.dart +++ b/lib/features/dashboard/view/widgets/energy_usage.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:syncrow_app/features/dashboard/view/widgets/energy_usage_header.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; class EnergyUsage extends StatelessWidget { const EnergyUsage({ @@ -23,7 +23,7 @@ class EnergyUsage extends StatelessWidget { children: [ const EnergyUsageHeader(), Expanded( - child: Image.asset(ImageManager.testDash), + child: Image.asset(Assets.imagesTestDash), ) ], ), diff --git a/lib/features/dashboard/view/widgets/live_monitor_tab.dart b/lib/features/dashboard/view/widgets/live_monitor_tab.dart index 8b343aa..1763089 100644 --- a/lib/features/dashboard/view/widgets/live_monitor_tab.dart +++ b/lib/features/dashboard/view/widgets/live_monitor_tab.dart @@ -1,8 +1,9 @@ import 'package:flutter/material.dart'; import 'package:syncrow_app/features/dashboard/view/widgets/live_monitor_widget.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; +import '../../../../generated/assets.dart'; + class LiveMonitorTab extends StatelessWidget { const LiveMonitorTab({ super.key, @@ -14,21 +15,21 @@ class LiveMonitorTab extends StatelessWidget { children: [ Expanded( child: LiveMonitorWidget( - image: IconsManager.active, + image: Assets.iconsActive, title: StringsManager.active, value: '10.00w', ), ), Expanded( child: LiveMonitorWidget( - image: IconsManager.voltMeter, + image: Assets.iconsVoltMeter, title: StringsManager.current, value: '12.1 A', ), ), Expanded( child: LiveMonitorWidget( - image: IconsManager.frequency, + image: Assets.iconsFrequency, title: StringsManager.frequency, value: '50 Hz', ), diff --git a/lib/features/devices/bloc/ac_cubit.dart b/lib/features/devices/bloc/ac_cubit.dart new file mode 100644 index 0000000..09220a3 --- /dev/null +++ b/lib/features/devices/bloc/ac_cubit.dart @@ -0,0 +1,57 @@ +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:meta/meta.dart'; +import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; + +part 'ac_state.dart'; + +class AcCubit extends Cubit { + AcCubit() : super(AcInitial()); + + static AcCubit get(context) => BlocProvider.of(context); + + bool areAllACsOff() { + for (var ac in DevicesCubit.categories[0].devices) { + if (ac.status) { + return false; + } + } + return true; + } + + void turnAllACsOff() { + for (var ac in DevicesCubit.categories[0].devices) { + ac.status = false; + } + emit(SwitchACsOff()); + } + + void turnAllACsOn() { + for (var ac in DevicesCubit.categories[0].devices) { + ac.status = true; + } + emit(SwitchACsOn()); + } + + void setTempToAll(double temperature) { + for (var ac in DevicesCubit.categories[0].devices) { + ac.temperature = temperature; + } + emit(ACsTempChanged()); + } + + double averageTempForAll() { + double allTemp = 0; + for (var ac in DevicesCubit.categories[0].devices) { + allTemp += ac.temperature; + } + emit(ACsTempChanged()); + + double averageTemp = allTemp / DevicesCubit.categories[0].devices.length; + + averageTemp = (averageTemp * 2).round() / 2; + + return averageTemp; + } + + /// implement the fan speed and temp mode change +} diff --git a/lib/features/devices/bloc/ac_state.dart b/lib/features/devices/bloc/ac_state.dart new file mode 100644 index 0000000..d46b3cf --- /dev/null +++ b/lib/features/devices/bloc/ac_state.dart @@ -0,0 +1,16 @@ +part of 'ac_cubit.dart'; + +@immutable +abstract class AcState {} + +class AcInitial extends AcState {} + +class SwitchACsOff extends AcState {} + +class SwitchACsOn extends AcState {} + +class ACsTempChanged extends AcState {} + +class ACsFanSpeedChanged extends AcState {} + +class ACsTempModeChanged extends AcState {} diff --git a/lib/features/devices/bloc/devices_cubit.dart b/lib/features/devices/bloc/devices_cubit.dart index abc23cb..a197242 100644 --- a/lib/features/devices/bloc/devices_cubit.dart +++ b/lib/features/devices/bloc/devices_cubit.dart @@ -1,99 +1,130 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/features/devices/model/ac_model.dart'; +import 'package:syncrow_app/features/devices/view/widgets/curtain_view.dart'; +import 'package:syncrow_app/features/devices/view/widgets/door_view.dart'; +import 'package:syncrow_app/features/devices/view/widgets/gateway_view.dart'; +import 'package:syncrow_app/features/devices/view/widgets/screens_view.dart'; +import 'package:syncrow_app/generated/assets.dart'; import '../model/device_category_model.dart'; +import '../view/widgets/ac_view.dart'; +import '../view/widgets/lights_view.dart'; part 'devices_state.dart'; class DevicesCubit extends Cubit { DevicesCubit() : super(DevicesInitial()) { - getCategories(); + // getCategories(); } - bool ACSwitchValue = false; - bool lightsSwitchValue = false; - bool doorSwitchValue = false; - bool curtainSwitchValue = false; - bool screensSwitchValue = false; - bool gatewaySwitchValue = false; + /// separate the cubit into different cubits based on devices type + static bool ACSwitchValue = false; + static bool lightsSwitchValue = false; + static bool doorSwitchValue = false; + static bool curtainSwitchValue = false; + static bool screensSwitchValue = false; + static bool gatewaySwitchValue = false; - void changeSwitchValue(DeviceType device) { - switch (device) { - case DeviceType.AC: - ACSwitchValue = !ACSwitchValue; - break; - case DeviceType.Lights: - lightsSwitchValue = !lightsSwitchValue; - break; - case DeviceType.Door: - doorSwitchValue = !doorSwitchValue; - break; - case DeviceType.Curtain: - curtainSwitchValue = !curtainSwitchValue; - break; - case DeviceType.Screens: - screensSwitchValue = !screensSwitchValue; - break; - case DeviceType.Gateway: - gatewaySwitchValue = !gatewaySwitchValue; - break; - } - emit(DevicesSuccess()); + void changeCategorySwitchValue(DevicesCategoryModel category) { + category.switchValue = !category.switchValue; + emit(CategorySwitchChanged()); + print('${category.name} switch value: ${category.switchValue} '); } static DevicesCubit get(context) => BlocProvider.of(context); - var categories = []; + static var categories = [ + DevicesCategoryModel( + devices: [ + ACModel( + name: "Living Room AC", + id: '0', + status: false, + temperature: 20, + fanSpeed: 0, + tempMode: 0, + ), + ACModel( + name: "Master Bedroom AC", + id: '1', + status: false, + temperature: 20, + fanSpeed: 0, + tempMode: 0, + ), + ], + icon: Assets.iconsAC, + name: 'ACs', + switchValue: ACSwitchValue, + type: DeviceType.AC, + page: const ACView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsLight, + name: 'Lights', + switchValue: lightsSwitchValue, + type: DeviceType.Lights, + page: const LightsView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsDoorLock, + name: 'Doors', + switchValue: doorSwitchValue, + type: DeviceType.Door, + page: const DoorView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsCurtain, + name: 'Curtains', + switchValue: curtainSwitchValue, + type: DeviceType.Curtain, + page: const CurtainView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsScreen, + name: 'Screens', + switchValue: screensSwitchValue, + type: DeviceType.Screens, + page: const ScreensView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsGateway, + name: 'Gateway', + switchValue: gatewaySwitchValue, + type: DeviceType.Gateway, + page: const GateWayView(), + ), + ]; - Future> getCategories() async { - emit(DevicesLoading()); - await Future.delayed(const Duration(seconds: 2)); - emit(DevicesSuccess()); + Widget? get chosenCategory { + for (var category in categories) { + if (category.isSelected) { + return category.page; + } + } + return null; + } - return categories = [ - DevicesCategoryModel( - devices: [], - icon: IconsManager.ac, - name: 'ACs', - switchValue: false, - type: DeviceType.AC, - ), - DevicesCategoryModel( - devices: [], - icon: IconsManager.light, - name: 'Lights', - switchValue: false, - type: DeviceType.Lights, - ), - DevicesCategoryModel( - devices: [], - icon: IconsManager.doorLock, - name: 'Doors', - switchValue: false, - type: DeviceType.Door, - ), - DevicesCategoryModel( - devices: [], - icon: IconsManager.curtain, - name: 'Curtains', - switchValue: false, - type: DeviceType.Curtain, - ), - DevicesCategoryModel( - devices: [], - icon: IconsManager.screen, - name: 'Screens', - switchValue: false, - type: DeviceType.Screens, - ), - DevicesCategoryModel( - devices: [], - icon: IconsManager.gateway, - name: 'Gateway', - switchValue: false, - type: DeviceType.Gateway, - ), - ]; + void updateCategory(int index) { + for (var i = 0; i < categories.length; i++) { + if (i == index) { + categories[i].isSelected = true; + } else { + categories[i].isSelected = false; + } + } + emit(DevicesCategoryChanged()); + } + + static void clearCategoriesSelection() { + for (var category in categories) { + category.isSelected = false; + } } } diff --git a/lib/features/devices/bloc/devices_state.dart b/lib/features/devices/bloc/devices_state.dart index 25bb4f3..f68db64 100644 --- a/lib/features/devices/bloc/devices_state.dart +++ b/lib/features/devices/bloc/devices_state.dart @@ -12,3 +12,13 @@ class DevicesSuccess extends DevicesState {} class DevicesFailure extends DevicesState {} class ChangeIndex extends DevicesState {} + +class DevicesCategoryChanged extends DevicesState {} + +class CategorySwitchChanged extends DevicesState {} + +class SwitchACsOff extends DevicesState {} + +class SwitchACsOn extends DevicesState {} + +class SetACsTemp extends DevicesState {} diff --git a/lib/features/devices/model/ac_model.dart b/lib/features/devices/model/ac_model.dart new file mode 100644 index 0000000..2f95f39 --- /dev/null +++ b/lib/features/devices/model/ac_model.dart @@ -0,0 +1,19 @@ +class ACModel { + final String name; + final String id; + late bool status; + late double temperature; + + late int fanSpeed; + + late int tempMode; + + ACModel({ + required this.name, + required this.id, + required this.status, + required this.temperature, + required this.fanSpeed, + required this.tempMode, + }); +} diff --git a/lib/features/devices/model/device_category_model.dart b/lib/features/devices/model/device_category_model.dart index 6197f26..b2743cb 100644 --- a/lib/features/devices/model/device_category_model.dart +++ b/lib/features/devices/model/device_category_model.dart @@ -1,16 +1,23 @@ -import 'device_model.dart'; +import 'package:flutter/cupertino.dart'; + +import 'ac_model.dart'; class DevicesCategoryModel { final String name; final String icon; - final bool switchValue; - final List devices; + final Widget page; + + bool switchValue; + final List devices; final DeviceType type; + bool isSelected; DevicesCategoryModel( - {required this.type, + {this.isSelected = false, + required this.page, + required this.type, required this.name, required this.icon, required this.switchValue, diff --git a/lib/features/devices/model/device_model.dart b/lib/features/devices/model/device_model.dart deleted file mode 100644 index 37ee98e..0000000 --- a/lib/features/devices/model/device_model.dart +++ /dev/null @@ -1,14 +0,0 @@ -class DeviceModel { - final String name; - final String imageUrl; - final String description; - final String category; - final String id; - - DeviceModel( - {required this.name, - required this.imageUrl, - required this.description, - required this.category, - required this.id}); -} diff --git a/lib/features/devices/view/widgets/a_c_control_unit.dart b/lib/features/devices/view/widgets/a_c_control_unit.dart new file mode 100644 index 0000000..6289775 --- /dev/null +++ b/lib/features/devices/view/widgets/a_c_control_unit.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:gap/gap.dart'; +import 'package:syncrow_app/features/devices/model/ac_model.dart'; +import 'package:syncrow_app/features/shared_widgets/default_container.dart'; + +import '../../../../generated/assets.dart'; + +class ACControlUnit extends StatefulWidget { + const ACControlUnit({ + super.key, + required this.model, + }); + + final ACModel model; + + @override + State createState() => _ACControlUnitState(); +} + +class _ACControlUnitState extends State { + var fanSpeeds = [ + Assets.iconsFan0, + Assets.iconsFan1, + Assets.iconsFan2, + Assets.iconsFan3, + ]; + + var tempModes = [ + Assets.iconsSunnyMode, + Assets.iconsColdMode, + Assets.iconsWindyMode, + ]; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + widget.model.fanSpeed = + widget.model.fanSpeed == 3 ? 0 : widget.model.fanSpeed + 1; + }); + }, + child: DefaultContainer( + height: 55, + child: Center( + child: SvgPicture.asset(fanSpeeds[widget.model.fanSpeed]), + ), + ), + ), + ), + const Gap(10), + Expanded( + child: InkWell( + onTap: () { + setState(() { + widget.model.tempMode = + widget.model.tempMode == 2 ? 0 : widget.model.tempMode + 1; + }); + }, + child: DefaultContainer( + height: 55, + child: Center( + child: SvgPicture.asset(tempModes[widget.model.tempMode]), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/features/devices/view/widgets/ac_view.dart b/lib/features/devices/view/widgets/ac_view.dart new file mode 100644 index 0000000..b19baed --- /dev/null +++ b/lib/features/devices/view/widgets/ac_view.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:gap/gap.dart'; +import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart'; +import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; +import 'package:syncrow_app/features/devices/view/widgets/a_c_control_unit.dart'; +import 'package:syncrow_app/features/devices/view/widgets/devices_temp_widget.dart'; +import 'package:syncrow_app/features/devices/view/widgets/universal_a_c_switch.dart'; +import 'package:syncrow_app/features/devices/view/widgets/universal_a_c_temp.dart'; +import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; + +class ACView extends StatelessWidget { + const ACView({super.key}); + + @override + Widget build(BuildContext context) { + return BlocProvider( + create: (context) => AcCubit(), + child: BlocBuilder( + builder: (context, state) { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + // universal AC controller + const Gap(10), + const BodySmall(text: "All ACs"), + const Gap(5), + const UniversalACSwitch(), + const Gap(10), + const UniversalACTemp(), + const Gap(10), + + // other ACs controller + ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + padding: const EdgeInsets.all(0), + itemCount: DevicesCubit.categories[0].devices.length, + itemBuilder: (context, index) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BodySmall( + text: + DevicesCubit.categories[0].devices[index].name), + const Gap(5), + DevicesDefaultSwitch( + model: DevicesCubit.categories[0].devices[index], + ), + const Gap(10), + DevicesTempWidget( + model: DevicesCubit.categories[0].devices[index], + ), + const Gap(10), + ACControlUnit( + model: DevicesCubit.categories[0].devices[index], + ), + const Gap(10), + ], + ); + }, + ), + ], + ), + ); + }, + ), + ); + } +} diff --git a/lib/features/devices/view/widgets/curtain_view.dart b/lib/features/devices/view/widgets/curtain_view.dart new file mode 100644 index 0000000..e85496f --- /dev/null +++ b/lib/features/devices/view/widgets/curtain_view.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class CurtainView extends StatelessWidget { + const CurtainView({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/features/devices/view/widgets/devices_mode_tab.dart b/lib/features/devices/view/widgets/devices_mode_tab.dart index 77c1145..3c071c5 100644 --- a/lib/features/devices/view/widgets/devices_mode_tab.dart +++ b/lib/features/devices/view/widgets/devices_mode_tab.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:gap/gap.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; class DevicesModeTab extends StatelessWidget { @@ -30,7 +30,7 @@ class DevicesModeTab extends StatelessWidget { height: 30, width: 25, child: SvgPicture.asset( - IconsManager.winter, + Assets.iconsWinter, fit: BoxFit.contain, ), ), @@ -58,7 +58,7 @@ class DevicesModeTab extends StatelessWidget { height: 30, width: 25, child: SvgPicture.asset( - IconsManager.summer, + Assets.iconsSummer, fit: BoxFit.contain, ), ), diff --git a/lib/features/devices/view/widgets/devices_temp_widget.dart b/lib/features/devices/view/widgets/devices_temp_widget.dart new file mode 100644 index 0000000..327b5f1 --- /dev/null +++ b/lib/features/devices/view/widgets/devices_temp_widget.dart @@ -0,0 +1,74 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:syncrow_app/features/devices/model/ac_model.dart'; +import 'package:syncrow_app/features/shared_widgets/default_container.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; +import 'package:syncrow_app/utils/context_extension.dart'; +import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; + +import '../../../../generated/assets.dart'; + +class DevicesTempWidget extends StatefulWidget { + const DevicesTempWidget({ + super.key, + required this.model, + }); + + final ACModel model; + + @override + State createState() => _DevicesTempWidgetState(); +} + +class _DevicesTempWidgetState extends State { + // double temp = widget.model.temperature; + + @override + Widget build(BuildContext context) { + return DefaultContainer( + height: 60, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox.square( + dimension: 24, + child: InkWell( + onTap: () { + setState(() { + // temp = temp - .5; + widget.model.temperature = widget.model.temperature - .5; + }); + }, + child: SvgPicture.asset( + Assets.iconsMinus, + ), + ), + ), + BodyLarge( + text: "${widget.model.temperature}° C", + style: context.bodyLarge.copyWith( + color: ColorsManager.primaryColor.withOpacity(0.6), + fontSize: 23, + ), + ), + SizedBox.square( + dimension: 24, + child: InkWell( + onTap: () { + setState(() { + // temp = temp + .5 + widget.model.temperature = widget.model.temperature + .5; + }); + }, + child: SvgPicture.asset( + Assets.iconsPlus, + height: 24, + width: 24, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/features/devices/view/widgets/devices_view_body.dart b/lib/features/devices/view/widgets/devices_view_body.dart index 7f41859..9bba301 100644 --- a/lib/features/devices/view/widgets/devices_view_body.dart +++ b/lib/features/devices/view/widgets/devices_view_body.dart @@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/devices/view/widgets/categories_view.dart'; import '../../bloc/devices_cubit.dart'; -import 'no_devices_view.dart'; class DevicesViewBody extends StatelessWidget { const DevicesViewBody({ @@ -13,17 +12,15 @@ class DevicesViewBody extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => DevicesCubit(), - child: BlocBuilder( - builder: (context, state) { - return state is DevicesLoading - ? const Center(child: CircularProgressIndicator()) - : state is DevicesSuccess - ? DevicesCubit.get(context).categories.isEmpty - ? const NoDevicesView() - : const CategoriesView() - : const Center(child: Text('Error')); - }, - )); + create: (context) => DevicesCubit(), + child: BlocBuilder( + builder: (context, state) { + return state is DevicesLoading + ? const Center(child: CircularProgressIndicator()) + : DevicesCubit.get(context).chosenCategory ?? + const CategoriesView(); + }, + ), + ); } } diff --git a/lib/features/devices/view/widgets/door_view.dart b/lib/features/devices/view/widgets/door_view.dart new file mode 100644 index 0000000..4cb3b29 --- /dev/null +++ b/lib/features/devices/view/widgets/door_view.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class DoorView extends StatelessWidget { + const DoorView({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/features/devices/view/widgets/gateway_view.dart b/lib/features/devices/view/widgets/gateway_view.dart new file mode 100644 index 0000000..71065e3 --- /dev/null +++ b/lib/features/devices/view/widgets/gateway_view.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class GateWayView extends StatelessWidget { + const GateWayView({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/features/devices/view/widgets/lights_view.dart b/lib/features/devices/view/widgets/lights_view.dart new file mode 100644 index 0000000..6ddbae5 --- /dev/null +++ b/lib/features/devices/view/widgets/lights_view.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class LightsView extends StatelessWidget { + const LightsView({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/features/devices/view/widgets/no_devices_view.dart b/lib/features/devices/view/widgets/no_devices_view.dart index 0646bf2..e718b72 100644 --- a/lib/features/devices/view/widgets/no_devices_view.dart +++ b/lib/features/devices/view/widgets/no_devices_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:syncrow_app/features/shared_widgets/default_text_button.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; class NoDevicesView extends StatelessWidget { const NoDevicesView({ @@ -15,7 +15,7 @@ class NoDevicesView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( - ImageManager.boxEmpty, + Assets.imagesBoxEmpty, opacity: const AlwaysStoppedAnimation(0.5), scale: 1, width: 140, diff --git a/lib/features/devices/view/widgets/screens_view.dart b/lib/features/devices/view/widgets/screens_view.dart new file mode 100644 index 0000000..fe19fc8 --- /dev/null +++ b/lib/features/devices/view/widgets/screens_view.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class ScreensView extends StatelessWidget { + const ScreensView({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/features/devices/view/widgets/switches.dart b/lib/features/devices/view/widgets/switches.dart index 08bb3df..68284f8 100644 --- a/lib/features/devices/view/widgets/switches.dart +++ b/lib/features/devices/view/widgets/switches.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncrow_app/features/shared_widgets/custom_switch.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart'; @@ -13,51 +14,60 @@ class Switches extends StatelessWidget { @override Widget build(BuildContext context) { - return GridView.builder( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - childAspectRatio: 1.5, - ), - padding: const EdgeInsets.only(top: 10), - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: DevicesCubit.get(context).categories.length, - itemBuilder: (context, index) { - return DefaultContainer( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SvgPicture.asset( - DevicesCubit.get(context).categories[index].icon, - fit: BoxFit.contain, - ), - SizedBox( - width: 30, - height: 20, - child: CustomSwitch( - value: DevicesCubit.get(context) - .categories[index] - .switchValue, - onChanged: (value) => DevicesCubit.get(context) - .changeSwitchValue( - DevicesCubit.get(context).categories[index].type), - ), - ), - ], - ), - BodyLarge( - text: DevicesCubit.get(context).categories[index].name, - fontWeight: FontWeight.bold, - ) - ], + return BlocBuilder( + builder: (context, state) { + return GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + childAspectRatio: 1.5, ), + padding: const EdgeInsets.only(top: 10), + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: DevicesCubit.categories.length, + itemBuilder: (_, index) { + return InkWell( + onTap: () => DevicesCubit.get(context).updateCategory(index), + child: DefaultContainer( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + DevicesCubit.categories[index].icon, + fit: BoxFit.contain, + ), + const SizedBox( + width: 30, + height: 20, + child: CustomSwitch( + // value: DevicesCubit + // .categories[index] + // .switchValue, + // + // onChanged: (value) => DevicesCubit.get(context) + // .changeSwitchValue( DevicesCubit + // .categories[index] + // .switchValue), + ), + ), + ], + ), + BodyLarge( + text: DevicesCubit.categories[index].name, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + ); + }, ); }, ); diff --git a/lib/features/devices/view/widgets/universal_a_c_switch.dart b/lib/features/devices/view/widgets/universal_a_c_switch.dart new file mode 100644 index 0000000..557eb85 --- /dev/null +++ b/lib/features/devices/view/widgets/universal_a_c_switch.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; + +import '../../../../utils/resource_manager/color_manager.dart'; +import '../../../shared_widgets/text_widgets/body_medium.dart'; +import '../../bloc/ac_cubit.dart'; + +class UniversalACSwitch extends StatelessWidget { + const UniversalACSwitch({ + super.key, + }); + + @override + Widget build(BuildContext context) { + bool acsStatus = AcCubit.get(context).areAllACsOff(); + + //TODO: Move these to String Manager "ON" and "OFF" + return Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + AcCubit.get(context).turnAllACsOn(); + }, + child: Container( + height: 60, + decoration: BoxDecoration( + color: acsStatus ? ColorsManager.primaryColor : Colors.white, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(15), + bottomLeft: Radius.circular(15), + ), + ), + child: Center( + child: BodyMedium( + text: "ON", + fontColor: acsStatus ? Colors.white : null, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + AcCubit.get(context).turnAllACsOff(); + }, + child: Container( + height: 60, + decoration: BoxDecoration( + color: acsStatus ? Colors.white : ColorsManager.primaryColor, + borderRadius: const BorderRadius.only( + topRight: Radius.circular(15), + bottomRight: Radius.circular(15), + ), + ), + child: Center( + child: BodyMedium( + text: "OFF", + fontColor: acsStatus ? null : Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/features/devices/view/widgets/universal_a_c_temp.dart b/lib/features/devices/view/widgets/universal_a_c_temp.dart new file mode 100644 index 0000000..6eeb368 --- /dev/null +++ b/lib/features/devices/view/widgets/universal_a_c_temp.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart'; +import 'package:syncrow_app/utils/context_extension.dart'; + +import '../../../../generated/assets.dart'; +import '../../../../utils/resource_manager/color_manager.dart'; +import '../../../shared_widgets/default_container.dart'; +import '../../../shared_widgets/text_widgets/body_large.dart'; + +class UniversalACTemp extends StatelessWidget { + const UniversalACTemp({ + super.key, + }); + + @override + Widget build(BuildContext context) { + double averageTemp = AcCubit.get(context).averageTempForAll(); + return DefaultContainer( + height: 60, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox.square( + dimension: 24, + child: InkWell( + onTap: () { + AcCubit.get(context).setTempToAll(averageTemp + .5); + }, + child: SvgPicture.asset( + Assets.iconsMinus, + ), + ), + ), + BodyLarge( + text: "${AcCubit.get(context).averageTempForAll()}° C", + style: context.bodyLarge.copyWith( + color: ColorsManager.primaryColor.withOpacity(0.6), + fontSize: 23, + ), + ), + SizedBox.square( + dimension: 24, + child: InkWell( + onTap: () { + AcCubit.get(context).setTempToAll(averageTemp + .5); + }, + child: SvgPicture.asset( + Assets.iconsPlus, + height: 24, + width: 24, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/features/layout/view/layout_view.dart b/lib/features/layout/view/layout_view.dart index eac9dd1..ce265e5 100644 --- a/lib/features/layout/view/layout_view.dart +++ b/lib/features/layout/view/layout_view.dart @@ -8,13 +8,14 @@ class LayoutPage extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => LayoutCubit(), - child: BlocBuilder( - builder: (context, state) { - return const Center( - child: Text('Layout Page'), - ); - }, - )); + create: (context) => LayoutCubit(), + child: BlocBuilder( + builder: (context, state) { + return const Center( + child: Text('Layout Page'), + ); + }, + ), + ); } } diff --git a/lib/features/menu/view/menu_view.dart b/lib/features/menu/view/menu_view.dart index fe57bf7..754be11 100644 --- a/lib/features/menu/view/menu_view.dart +++ b/lib/features/menu/view/menu_view.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart'; import 'package:syncrow_app/features/menu/view/widgets/menu_list.dart'; +import 'package:syncrow_app/features/menu/view/widgets/profile_tab.dart'; class MenuView extends StatelessWidget { const MenuView({super.key}); @@ -15,10 +16,12 @@ class MenuView extends StatelessWidget { return SingleChildScrollView( physics: const BouncingScrollPhysics(), child: Column( - children: MenuCubit.of(context) - .menuLists - .map((list) => MenuList(listModel: list)) - .toList(), + children: [ + const ProfileTab(), + ...MenuCubit.of(context) + .menuLists + .map((list) => MenuList(listModel: list)) + ], ), ); }, diff --git a/lib/features/menu/view/widgets/menu_list.dart b/lib/features/menu/view/widgets/menu_list.dart index 6e4758b..8cb2064 100644 --- a/lib/features/menu/view/widgets/menu_list.dart +++ b/lib/features/menu/view/widgets/menu_list.dart @@ -19,6 +19,7 @@ class MenuList extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ + const Gap(5), BodySmall( text: listModel.label!, ), diff --git a/lib/features/menu/view/widgets/profile_tab.dart b/lib/features/menu/view/widgets/profile_tab.dart new file mode 100644 index 0000000..cf030e5 --- /dev/null +++ b/lib/features/menu/view/widgets/profile_tab.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; +import 'package:syncrow_app/features/shared_widgets/default_container.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; + +import '../../../shared_widgets/syncrow_logo.dart'; + +class ProfileTab extends StatelessWidget { + const ProfileTab({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return const Padding( + padding: EdgeInsets.symmetric(vertical: 10), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Gap(20), + DefaultContainer( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BodyMedium( + text: "Karim", + fontWeight: FontWeight.bold, + ), + BodySmall(text: "Syncrow Account") + ], + ), + ), + ], + ), + Positioned( + right: 20, + top: 0, + child: CircleAvatar( + radius: 38, + backgroundColor: Colors.white, + child: CircleAvatar( + radius: 37, + backgroundColor: Colors.grey, + child: SyncrowLogo(), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/features/scene/bloc/scene_cubit.dart b/lib/features/scene/bloc/scene_cubit.dart index 74bc3bb..0bc5167 100644 --- a/lib/features/scene/bloc/scene_cubit.dart +++ b/lib/features/scene/bloc/scene_cubit.dart @@ -13,6 +13,7 @@ class SceneCubit extends Cubit { void getScenes() { emit(SceneLoading()); + //TODO: remove this it's causing the Bad State because its being after the cubit is closed Future.delayed(const Duration(seconds: 5), () { emit(SceneSuccess()); }); diff --git a/lib/features/scene/view/scene_view.dart b/lib/features/scene/view/scene_view.dart index b6c0f00..26e51c6 100644 --- a/lib/features/scene/view/scene_view.dart +++ b/lib/features/scene/view/scene_view.dart @@ -6,7 +6,7 @@ import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; class SceneView extends StatelessWidget { @@ -51,7 +51,7 @@ class SceneView extends StatelessWidget { Image.asset( height: 50, width: 50, - IconsManager.summerMode, + Assets.iconsHot1, fit: BoxFit.contain, ), const Icon( @@ -79,6 +79,7 @@ class SceneView extends StatelessWidget { ), child: DefaultContainer( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -87,7 +88,7 @@ class SceneView extends StatelessWidget { Image.asset( height: 50, width: 50, - IconsManager.winterMode, + Assets.iconsWinter1, fit: BoxFit.contain, ), const Icon( diff --git a/lib/features/scene/view/widgets/scene_view_no_scenes.dart b/lib/features/scene/view/widgets/scene_view_no_scenes.dart index 5b8c90b..cd9e8c8 100644 --- a/lib/features/scene/view/widgets/scene_view_no_scenes.dart +++ b/lib/features/scene/view/widgets/scene_view_no_scenes.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:syncrow_app/features/shared_widgets/default_text_button.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; class SceneViewNoScenes extends StatelessWidget { const SceneViewNoScenes({ @@ -17,7 +17,7 @@ class SceneViewNoScenes extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( - ImageManager.automation, + Assets.imagesAutomation, scale: 1, opacity: const AlwaysStoppedAnimation(.5), width: 140, diff --git a/lib/features/shared_widgets/custom_switch.dart b/lib/features/shared_widgets/custom_switch.dart index d7bba55..a29381c 100644 --- a/lib/features/shared_widgets/custom_switch.dart +++ b/lib/features/shared_widgets/custom_switch.dart @@ -2,10 +2,14 @@ import 'package:flutter/material.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; class CustomSwitch extends StatefulWidget { - final bool value; - final ValueChanged onChanged; + // final bool value; + // final ValueChanged onChanged; - const CustomSwitch({super.key, required this.value, required this.onChanged}); + const CustomSwitch({ + super.key, + // required this.value, + // required this.onChanged, + }); @override _CustomSwitchState createState() => _CustomSwitchState(); @@ -16,14 +20,20 @@ class _CustomSwitchState extends State Animation? _circleAnimation; AnimationController? _animationController; + bool value = false; + + void onChange(bool customValue){ + value = customValue ; + } + @override void initState() { super.initState(); _animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 100)); _circleAnimation = AlignmentTween( - begin: widget.value ? Alignment.centerRight : Alignment.centerLeft, - end: widget.value ? Alignment.centerLeft : Alignment.centerRight) + begin: value ? Alignment.centerRight : Alignment.centerLeft, + end: value ? Alignment.centerLeft : Alignment.centerRight) .animate(CurvedAnimation( parent: _animationController!, curve: Curves.linear)); } @@ -35,12 +45,14 @@ class _CustomSwitchState extends State builder: (context, child) { return GestureDetector( onTap: () { - _animationController!.isCompleted - ? _animationController!.reverse() - : _animationController!.forward(); - widget.value == false - ? widget.onChanged(true) - : widget.onChanged(false); + setState(() { + _animationController!.isCompleted + ? _animationController!.reverse() + : _animationController!.forward(); + value == false + ? onChange(true) + : onChange(false); + }); }, child: Container( width: 45.0, @@ -54,13 +66,9 @@ class _CustomSwitchState extends State child: Padding( padding: const EdgeInsets.all(2.0), child: Container( - alignment: widget.value - ? ((Directionality.of(context) == TextDirection.rtl) + alignment: value ? Alignment.centerRight - : Alignment.centerLeft) - : ((Directionality.of(context) == TextDirection.rtl) - ? Alignment.centerLeft - : Alignment.centerRight), + : Alignment.centerLeft, child: Container( width: 20.0, height: 20.0, diff --git a/lib/features/shared_widgets/default_container.dart b/lib/features/shared_widgets/default_container.dart index 53b3ee0..a4f0047 100644 --- a/lib/features/shared_widgets/default_container.dart +++ b/lib/features/shared_widgets/default_container.dart @@ -4,13 +4,19 @@ class DefaultContainer extends StatelessWidget { const DefaultContainer({ super.key, required this.child, + this.height, + this.width, }); + final double? height; + final double? width; final Widget child; @override Widget build(BuildContext context) { return Container( + height: height, + width: width, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), diff --git a/lib/features/shared_widgets/devices_default_switch.dart b/lib/features/shared_widgets/devices_default_switch.dart new file mode 100644 index 0000000..5b007ee --- /dev/null +++ b/lib/features/shared_widgets/devices_default_switch.dart @@ -0,0 +1,83 @@ +import 'package:flutter/material.dart'; +import 'package:syncrow_app/features/devices/model/ac_model.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; +import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; + +class DevicesDefaultSwitch extends StatefulWidget { + const DevicesDefaultSwitch({ + super.key, + required this.model, + }); + + final ACModel model; + + @override + State createState() => _DevicesDefaultSwitchState(); +} + +class _DevicesDefaultSwitchState extends State { + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + // isOn = !isOn; + widget.model.status = !widget.model.status; + }); + }, + child: Container( + height: 60, + decoration: BoxDecoration( + color: widget.model.status + ? ColorsManager.primaryColor + : Colors.white, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(15), + bottomLeft: Radius.circular(15), + ), + ), + child: Center( + child: BodyMedium( + text: "ON", + fontColor: widget.model.status ? Colors.white : null, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + widget.model.status = !widget.model.status; + }); + }, + child: Container( + height: 60, + decoration: BoxDecoration( + color: widget.model.status + ? Colors.white + : ColorsManager.primaryColor, + borderRadius: const BorderRadius.only( + topRight: Radius.circular(15), + bottomRight: Radius.circular(15), + ), + ), + child: Center( + child: BodyMedium( + text: "OFF", + fontColor: widget.model.status ? null : Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/features/shared_widgets/syncrow_logo.dart b/lib/features/shared_widgets/syncrow_logo.dart index 61fcc04..739227a 100644 --- a/lib/features/shared_widgets/syncrow_logo.dart +++ b/lib/features/shared_widgets/syncrow_logo.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; +import 'package:syncrow_app/generated/assets.dart'; class SyncrowLogo extends StatelessWidget { const SyncrowLogo({ @@ -14,7 +14,7 @@ class SyncrowLogo extends StatelessWidget { @override Widget build(BuildContext context) { - return Image.asset(isDark ? ImageManager.blackLogo : ImageManager.whiteLogo, + return Image.asset(isDark ? Assets.imagesBlackLogo : Assets.imagesWhiteLogo, scale: 1, width: width); } } diff --git a/lib/features/shared_widgets/text_widgets/body_large.dart b/lib/features/shared_widgets/text_widgets/body_large.dart index 18a1447..fa87d19 100644 --- a/lib/features/shared_widgets/text_widgets/body_large.dart +++ b/lib/features/shared_widgets/text_widgets/body_large.dart @@ -11,6 +11,7 @@ class BodyLarge extends StatelessWidget { this.style, this.height, this.fontWeight, + this.fontColor, }); final String text; @@ -22,11 +23,17 @@ class BodyLarge extends StatelessWidget { final FontWeight? fontWeight; + final Color? fontColor; + @override Widget build(BuildContext context) => CustomText( text, - style: style ?? context.bodyLarge.copyWith(height: height ?? 1.5), textAlign: textAlign, - fontWeight: fontWeight, + style: style ?? + context.bodyLarge.copyWith( + height: height ?? 1.5, + fontWeight: fontWeight, + color: fontColor, + ), ); } diff --git a/lib/features/shared_widgets/text_widgets/custom_text_widget.dart b/lib/features/shared_widgets/text_widgets/custom_text_widget.dart index c0b7c5b..3871cbd 100644 --- a/lib/features/shared_widgets/text_widgets/custom_text_widget.dart +++ b/lib/features/shared_widgets/text_widgets/custom_text_widget.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; class CustomText extends StatelessWidget { const CustomText(this.text, @@ -31,10 +30,7 @@ class CustomText extends StatelessWidget { Widget build(BuildContext context) { return SelectableText( text, - style: style!.copyWith( - fontSize: fontSize, - color: fontColor ?? ColorsManager.textPrimaryColor, - fontWeight: fontWeight), + style: style, textAlign: textAlign, onTap: onTap, minLines: minLines, diff --git a/lib/features/splash/view/splash_view.dart b/lib/features/splash/view/splash_view.dart index d3e1dab..b6b3233 100644 --- a/lib/features/splash/view/splash_view.dart +++ b/lib/features/splash/view/splash_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:syncrow_app/features/splash/view/widgets/user_agreement_dialog.dart'; +import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/navigation/routing_constants.dart'; -import 'package:syncrow_app/utils/resource_manager/assets_manager.dart'; class SplashView extends StatelessWidget { const SplashView({super.key}); @@ -28,7 +28,7 @@ class SplashView extends StatelessWidget { builder: (context) => const UserAgreementDialog(), ); }, - child: Image.asset(ImageManager.blackLogo)), + child: Image.asset(Assets.imagesBlackLogo)), ), ); } diff --git a/lib/generated/assets.dart b/lib/generated/assets.dart index affb124..98fa1fe 100644 --- a/lib/generated/assets.dart +++ b/lib/generated/assets.dart @@ -2,20 +2,51 @@ class Assets { Assets._(); + static const String assetsIconsHome = 'assets/icons/home.svg'; static const String fontsAftikaRegular = 'assets/fonts/AftikaRegular.ttf'; - static const String iconsDashboard = 'assets/icons/dashboard-fill.svg'; - static const String iconsDashboardFill = 'assets/icons/dashboard.svg'; + static const String iconsAC = 'assets/icons/AC.svg'; + static const String iconsActive = 'assets/icons/active.svg'; + static const String iconsCO2 = 'assets/icons/CO2.svg'; + static const String iconsColdMode = 'assets/icons/coldMode.svg'; + static const String iconsCurtain = 'assets/icons/Curtain.svg'; + static const String iconsDashboard = 'assets/icons/dashboard.svg'; + static const String iconsDashboardFill = 'assets/icons/dashboard-fill.svg'; static const String iconsDevices = 'assets/icons/Devices.svg'; static const String iconsDevicesFill = 'assets/icons/Devices-fill.svg'; - static const String iconsHome = 'assets/icons/home.svg'; + static const String iconsDoorLock = 'assets/icons/doorLock.svg'; + static const String iconsFan0 = 'assets/icons/fan-0.svg'; + static const String iconsFan1 = 'assets/icons/fan-1.svg'; + static const String iconsFan2 = 'assets/icons/fan-2.svg'; + static const String iconsFan3 = 'assets/icons/fan-3.svg'; + static const String iconsFrequency = 'assets/icons/frequency.svg'; + static const String iconsGateway = 'assets/icons/Gateway.svg'; + static const String iconsHome = 'assets/icons/home.jpg'; + static const String iconsHome2 = 'assets/icons/home-2.svg'; + static const String iconsHot1 = 'assets/icons/hot1.jpg'; static const String iconsLayout = 'assets/icons/Layout.svg'; static const String iconsLayoutFill = 'assets/icons/Layout-fill.svg'; + static const String iconsLight = 'assets/icons/Light.svg'; static const String iconsMenu = 'assets/icons/Menu.svg'; static const String iconsMenuFill = 'assets/icons/Menu-fill.svg'; + static const String iconsMinus = 'assets/icons/minus.svg'; + static const String iconsPlus = 'assets/icons/plus.svg'; static const String iconsRoutineFill = 'assets/icons/Routine-fill.svg'; static const String iconsRoutines = 'assets/icons/Routines.svg'; + static const String iconsScreen = 'assets/icons/Screen.svg'; + static const String iconsSummer = 'assets/icons/Summer.svg'; + static const String iconsSummerMode = 'assets/icons/summer_mode.svg'; + static const String iconsSunnyMode = 'assets/icons/sunnyMode.svg'; + static const String iconsSustainability = 'assets/icons/sustainability.svg'; + static const String iconsVoltMeter = 'assets/icons/volt-meter.svg'; + static const String iconsWindyMode = 'assets/icons/windyMode.svg'; + static const String iconsWinter = 'assets/icons/Winter.svg'; + static const String iconsWinter1 = 'assets/icons/winter1.jpg'; + static const String iconsWinterMode = 'assets/icons/Winter_mode.svg'; static const String imagesAutomation = 'assets/images/automation.jpg'; + static const String imagesBackground = 'assets/images/Background.png'; static const String imagesBlackLogo = 'assets/images/black-logo.png'; static const String imagesBoxEmpty = 'assets/images/box-empty.jpg'; + static const String imagesTestDash = 'assets/images/test_dash.png'; + static const String imagesTestDash2 = 'assets/images/test_dash2.png'; static const String imagesWhiteLogo = 'assets/images/white-logo.png'; } diff --git a/lib/utils/bloc_observer.dart b/lib/utils/bloc_observer.dart index 06ca2b0..f179654 100644 --- a/lib/utils/bloc_observer.dart +++ b/lib/utils/bloc_observer.dart @@ -1,6 +1,7 @@ // ignore_for_file: avoid_print import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; class MyBlocObserver extends BlocObserver { @override @@ -24,6 +25,9 @@ class MyBlocObserver extends BlocObserver { @override void onClose(BlocBase bloc) { super.onClose(bloc); + if (bloc is DevicesCubit) { + DevicesCubit.clearCategoriesSelection(); + } print('onClose -- ${bloc.runtimeType}'); } -} \ No newline at end of file +} diff --git a/lib/utils/helpers/cache_helper.dart b/lib/utils/helpers/cache_helper.dart deleted file mode 100644 index 7b31128..0000000 --- a/lib/utils/helpers/cache_helper.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:shared_preferences/shared_preferences.dart'; - -class CacheHelper { - static late SharedPreferences sharedPreferences; - - static init() async { - sharedPreferences = await SharedPreferences.getInstance(); - } - - static Object? getData({ - required String key, - }) async { - return sharedPreferences.get(key); - } - - static Future setData({ - required String key, - required value, - }) async { - if (value is String) return await sharedPreferences.setString(key, value); - if (value is int) return await sharedPreferences.setInt(key, value); - if (value is bool) return await sharedPreferences.setBool(key, value); - return await sharedPreferences.setDouble(key, value); - } - - static dynamic removeData({ - required String key, - }) async { - return sharedPreferences.remove(key); - } -} diff --git a/lib/utils/helpers/file_helper.dart b/lib/utils/helpers/file_helper.dart deleted file mode 100644 index 3679c85..0000000 --- a/lib/utils/helpers/file_helper.dart +++ /dev/null @@ -1,125 +0,0 @@ -// import 'dart:io'; -// import 'dart:math'; -// import 'package:dio/dio.dart'; -// import 'package:file_picker/file_picker.dart'; -// import 'package:flutter/material.dart'; -// import 'package:flutter/services.dart'; -// -// import 'package:path_provider/path_provider.dart'; -// -// class FileHelper { -// static Future> takePicture() async { -// try { -// XFile? pickedImage = await ImagePicker().pickImage(source: ImageSource.camera); -// if (pickedImage != null) { -// final fileTemp = File(pickedImage.path); -// final bytes = fileTemp.readAsBytesSync(); -// return {pickedImage.path: bytes}; -// } else { -// return {}; -// } -// } on PlatformException catch (_) { -// return {}; -// } -// } -// -// static Future> pickFile({bool gallery = false}) async { -// try { -// FilePickerResult? pickedFile; -// XFile? pickedFromGallery; -// if (gallery) { -// final picker = ImagePicker(); -// pickedFromGallery = -// await picker.pickImage(source: ImageSource.gallery, requestFullMetadata: false); -// } else { -// pickedFile = await FilePicker.platform.pickFiles( -// allowedExtensions: ['png', 'jpg', 'jpeg', 'pdf'], -// type: FileType.custom, -// withReadStream: true, -// ); -// } -// if (pickedFile != null) { -// String path = pickedFile.files.single.path ?? ''; -// final fileTemp = File(path); -// final bytes = fileTemp.readAsBytesSync(); -// if (path.isEmpty) { -// return {}; -// } -// return {path: bytes}; -// } else if (pickedFromGallery != null) { -// String path = pickedFromGallery.path; -// final fileTemp = File(path); -// final bytes = fileTemp.readAsBytesSync(); -// if (path.isEmpty) { -// return {}; -// } -// return {path: bytes}; -// } else { -// return {}; -// } -// } on PlatformException catch (_) { -// return {}; -// } -// } -// -// Future downloadFile(String url) async { -// String filePath; -// try { -// filePath = await _prepareSaveDir(url); -// await HTTPService() -// .downloadRequest(path: url, savePath: filePath, expectedResponseModel: (json) {}); -// } catch (err) { -// CustomSnackBar.displaySnackBar('Something went wrong please try again!'); -// return ''; -// } -// return filePath; -// } -// -// String getRandomString(int length) { -// const chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890'; -// Random rnd = Random(); -// -// return String.fromCharCodes( -// Iterable.generate(length, (_) => chars.codeUnitAt(rnd.nextInt(chars.length)))); -// } -// -// Future _prepareSaveDir(String url) async { -// try { -// final localPath = (await _findLocalPath(url))!; -// -// final savedDir = Directory(localPath); -// bool hasExisted = await savedDir.exists(); -// if (!hasExisted) { -// await File(savedDir.path).create(); -// } -// return savedDir.path; -// } catch (err) { -// return ''; -// } -// } -// -// Future _findLocalPath(String url) async { -// String fileName = getRandomString(10); -// String fileNameWithExtension = url.contains('pdf') ? '$fileName.pdf' : '$fileName.jpeg'; -// -// if (Platform.isAndroid) { -// return "/sdcard/download/$fileNameWithExtension"; -// } else { -// var directory = await getApplicationDocumentsDirectory(); -// return '${directory.path}${Platform.pathSeparator}$fileNameWithExtension'; -// } -// } -// -// static Future fetchPdfContent(final String url) async { -// try { -// final Response> response = await Dio().get>( -// url, -// options: Options(responseType: ResponseType.bytes), -// ); -// return Uint8List.fromList(response.data ?? []); -// } catch (e) { -// debugPrint(e.toString()); -// return null; -// } -// } -// } diff --git a/lib/utils/helpers/sharedPreferences_helper.dart b/lib/utils/helpers/sharedPreferences_helper.dart deleted file mode 100644 index f7400ea..0000000 --- a/lib/utils/helpers/sharedPreferences_helper.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'package:shared_preferences/shared_preferences.dart'; - -class SharedPreferencesHelper { - // isRegistered flag to know if the user has entered his fullname and email or not (is he registered or not) - static bool? isRegistered; - - // flags to detect the mode {regular, onboarding, demo} - static bool? isDemo; - static bool? isOnBoarding; - - // isDemoAndUseToken flag to use the user token in the header of the request in the demo experience, instead of "Demo" header in situations (1. openning the profile request 2. updating th user data -registeration- request) - static bool? isDemoAndUseToken; - - // addedFirstProperty flag to detect if the user has added his first property or not - static bool? addedFirstProperty; - - // stores the user id value - static String? userIdValue; - - // stores the phone number value - static String? phoneNumber; - - //stores the country code of the user phone - static String? countryCode; - - // static Future getIsDemoValue() async { - // isDemo = await readBoolFromSP(KeyConstants.isDemoFlag) ?? false; - // return isDemo; - // } - // - // static Future getIsOnboardingValue() async { - // isOnBoarding = await readBoolFromSP(KeyConstants.isOnboardingFlag); - // return isOnBoarding; - // } - - static saveStringToSP(String key, String value) async { - final prefs = await SharedPreferences.getInstance(); - await prefs.setString(key, value); - } - - static saveBoolToSP(String key, bool value) async { - final prefs = await SharedPreferences.getInstance(); - await prefs.setBool(key, value); - } - - static saveIntToSP(String key, int value) async { - final prefs = await SharedPreferences.getInstance(); - await prefs.setInt(key, value); - } - - static saveDoubleToSP(String key, double value) async { - final prefs = await SharedPreferences.getInstance(); - await prefs.setDouble(key, value); - } - - static saveStringListToSP(String key, List value) async { - final prefs = await SharedPreferences.getInstance(); - await prefs.setStringList(key, value); - } - - static Future readStringFromSP(String key) async { - final prefs = await SharedPreferences.getInstance(); - String value = prefs.getString(key) ?? ''; - return value; - } - - static Future readBoolFromSP(String key) async { - final prefs = await SharedPreferences.getInstance(); - bool? value = prefs.getBool(key); - return value; - } - - static Future readIntFromSP(String key) async { - final prefs = await SharedPreferences.getInstance(); - int value = prefs.getInt(key) ?? 0; - return value; - } - - static Future> readStringListFromSP(String key) async { - final prefs = await SharedPreferences.getInstance(); - List? value = prefs.getStringList(key) ?? []; - return value; - } - - static Future removeValueFromSP(String key) async { - final prefs = await SharedPreferences.getInstance(); - await prefs.remove(key); - return true; - } -} diff --git a/lib/utils/helpers/url_launcher.dart b/lib/utils/helpers/url_launcher.dart deleted file mode 100644 index b4b6c56..0000000 --- a/lib/utils/helpers/url_launcher.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'dart:io'; - -import 'package:url_launcher/url_launcher.dart'; - -class URLLauncher { - static Future sendWhatsapp( - {String phoneNumber = '971581497062', - String text = 'Hi%2C%20I%20would%20like%20to', - String from = ''}) async { - Uri launchUri; - launchUri = Uri.parse("whatsapp://send?phone=%2B$phoneNumber&text=$text"); - // Launch the App - try { - // SegmentEvents.sendTrackEvent(SegmentEventModel( - // eventName: 'Whatsapp opened', properties: {'From': from})); - // - // if (await canLaunchUrl(launchUri) == false) { - // CustomSnackBar.displaySnackBar('Could not open whatsapp'); - // return; - // } - if (Platform.isAndroid) { - await launch( - launchUri.toString(), - ); - } else { - await launchUrl( - launchUri, - ); - } - } catch (error) { - // CustomSnackBar.displaySnackBar('Could not open whatsapp'); - throw 'Could not launch $phoneNumber'; - } - } - - static Future sendEmail( - {required String email, String subject = '', body = ''}) async { - String? encodeQueryParameters(Map params) { - return params.entries - .map((MapEntry e) => - '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') - .join('&'); - } - - final emailLaunchUri = Uri( - scheme: 'mailto', - path: email, - query: encodeQueryParameters({ - subject: body, - }), - ); - try { - bool canLaunch = await canLaunchUrl(emailLaunchUri); - if (canLaunch) { - await launchUrl(emailLaunchUri); - } - } catch (err) { - throw 'Could not launch $emailLaunchUri'; - } - } - - static Future launch(String url) async { - Uri parsedUrl = Uri.parse(url); - try { - bool canLaunch = await canLaunchUrl(parsedUrl); - if (canLaunch) { - await launchUrl( - parsedUrl, - // mode: LaunchMode.externalApplication, - ); - } - } catch (err) { - throw 'Url launcher error: ${err.toString()}'; - } - } -} diff --git a/lib/utils/resource_manager/assets_manager.dart b/lib/utils/resource_manager/assets_manager.dart deleted file mode 100644 index e49d235..0000000 --- a/lib/utils/resource_manager/assets_manager.dart +++ /dev/null @@ -1,47 +0,0 @@ -abstract class ImageManager { - static const String base = 'assets/images'; - - static const String whiteLogo = '$base/white-logo.png'; - static const String blackLogo = '$base/black-logo.png'; - static const String boxEmpty = '$base/box-empty.jpg'; - static const String automation = '$base/automation.jpg'; - static const String background = '$base/Background.png'; - static const String testDash = '$base/test_dash.png'; - static const String testDash2 = '$base/test_dash2.png'; -} - -abstract class IconsManager { - static const String base = 'assets/icons'; - - static const String home = '$base/home-2.svg'; - - static const String dashboardFill = '$base/dashboard-fill.svg'; - static const String dashboard = '$base/dashboard.svg'; - - static const String devices = '$base/Devices.svg'; - static const String devicesFill = '$base/Devices-fill.svg'; - - static const String routine = '$base/Routines.svg'; - static const String routineFill = '$base/Routine-fill.svg'; - - static const String menu = '$base/Menu.svg'; - static const String menuFill = '$base/Menu-fill.svg'; - - static const String layout = '$base/Layout.svg'; - static const String layoutFill = '$base/Layout-fill.svg'; - static const String frequency = '$base/frequency.svg'; - static const String winter = '$base/Winter.svg'; - static const String active = '$base/active.svg'; - static const String voltMeter = '$base/volt-meter.svg'; - static const String summer = '$base/Summer.svg'; - static const String CO2 = '$base/CO2.svg'; - static const String sustainability = '$base/sustainability.svg'; - static const String ac = '$base/AC.svg'; - static const String curtain = '$base/Curtain.svg'; - static const String doorLock = '$base/Door Lock.svg'; - static const String gateway = '$base/Gateway.svg'; - static const String light = '$base/Light.svg'; - static const String summerMode = '$base/Hot 1.jpg'; - static const String winterMode = '$base/Winter 1.jpg'; - static const String screen = '$base/Screen.svg'; -} diff --git a/pubspec.lock b/pubspec.lock index 5d7bf13..8236457 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -381,6 +381,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: transitive description: @@ -393,26 +417,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" nested: dependency: transitive description: @@ -433,10 +457,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_parsing: dependency: transitive description: @@ -786,6 +810,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" web: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 58f1382..d830539 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,6 +46,7 @@ flutter: - assets/images/ - assets/icons/ - assets/fonts/ + - assets/ fonts: - family: Aftika fonts: