Compare commits

..

24 Commits

Author SHA1 Message Date
2050fc3135 Merge 3f7f7ce49f into 9098276223 2025-02-16 20:55:37 +04:00
3f7f7ce49f updated project hardcoded values 2025-02-16 20:55:13 +04:00
67209961b4 added project model 2025-02-15 11:54:02 +04:00
9098276223 Merge pull request #71 from SyncrowIOT/fixes_bugs_sprint15
fixes bugs and add project id staging
2025-02-12 12:47:09 +03:00
36dfe2c85e change the key 2025-02-12 12:06:00 +03:00
efed5f55a7 add project id to env file and hide about 2025-02-11 11:05:13 +03:00
9897c19dad fixes bugs and add project id staging 2025-02-10 10:26:02 +03:00
48733fd65e Merge pull request #70 from SyncrowIOT/sprint_14_changes
Sprint 14 changes
2025-02-02 22:33:28 +03:00
4ca4086bd3 Merged with dev 2025-02-02 22:32:15 +03:00
4da1b16b18 Merge pull request #69 from SyncrowIOT/role_permission_restrict_user
restrict_spaceMemberUser_and_change_SignUpModel
2025-02-02 14:27:31 +03:00
1189b52c57 remove comment DevicesViewBody and fix home page 2025-02-02 13:17:25 +03:00
c578d63134 all_devices and Restrict_user 2025-01-29 14:10:38 +03:00
457b7c2c51 Updated gradle and kotlin 2025-01-26 20:38:37 +03:00
4ae04cf2af Merged with Dev 2025-01-26 13:08:40 +03:00
d72253e3de hide SceneSettings 2025-01-23 18:41:50 +03:00
790479effb restrict_spaceMemberUser_and_change_SignUpModel 2025-01-23 18:35:01 +03:00
827585815b Merge pull request #68 from SyncrowIOT/user_agreement_policy
User agreement and policy
2025-01-21 12:05:25 +03:00
de024994c9 showSpaceBottomSheet in a DefaultAppBar and Routine trigger from the device screen
and fixes github comments
and i used this package flutter_html: ^3.0.0-beta.2
2025-01-20 15:50:36 +03:00
bcc4ba98ff size changes 2025-01-19 16:56:42 +03:00
df0f1c6c94 user_agreement and privacy_policy sign up and menu 2025-01-19 16:49:54 +03:00
1f62cadcec Merge pull request #66 from SyncrowIOT/Implement_Change_Password_Flow
change_password
2025-01-16 18:02:33 +03:00
f960a553ca Updated the pacakages 2025-01-13 13:02:51 +03:00
90812f78e8 Completed wall sensor implementation 2025-01-12 00:12:08 +03:00
b1368bf4d7 update ios packages 2025-01-12 00:10:02 +03:00
93 changed files with 3562 additions and 1363 deletions

View File

@ -1,2 +1,3 @@
ENV_NAME=development
BASE_URL=https://syncrow-dev.azurewebsites.net
BASE_URL=https://syncrow-dev.azurewebsites.net
PROJECT_ID=0e62577c-06fa-41b9-8a92-99a21fbaf51c

View File

@ -1,2 +1,3 @@
ENV_NAME=production
BASE_URL=https://syncrow-staging.azurewebsites.net
BASE_URL=https://syncrow-staging.azurewebsites.net
PROJECT_ID=bcda711e-9fc2-4168-a05e-171b4026d1ff

View File

@ -1,2 +1,3 @@
ENV_NAME=staging
BASE_URL=https://syncrow-staging.azurewebsites.net
BASE_URL=https://syncrow-staging.azurewebsites.net
PROJECT_ID=bcda711e-9fc2-4168-a05e-171b4026d1ff

2
.gitignore vendored
View File

@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related

View File

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()

View File

@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

View File

@ -1,6 +1,6 @@
#Wed Apr 03 23:37:40 EET 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -23,7 +23,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.android.application" version '8.3.0' apply false
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
id "com.google.firebase.crashlytics" version "2.8.1" apply false

View File

@ -0,0 +1,18 @@
<svg width="47" height="37" viewBox="0 0 47 37" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="6" y="1" width="41" height="25" rx="12.5" fill="#E9E9E9"/>
<g filter="url(#filter0_d_6419_4507)">
<circle cx="18.5" cy="13.5" r="10.5" fill="white"/>
</g>
<defs>
<filter id="filter0_d_6419_4507" x="0" y="0" width="37" height="37" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="5"/>
<feGaussianBlur stdDeviation="4"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6419_4507"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_6419_4507" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 965 B

View File

@ -0,0 +1,18 @@
<svg width="47" height="37" viewBox="0 0 47 37" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect y="1" width="41" height="25" rx="12.5" fill="#023DFE" fill-opacity="0.7"/>
<g filter="url(#filter0_d_6689_981)">
<circle cx="28.5" cy="13.5" r="10.5" fill="white"/>
</g>
<defs>
<filter id="filter0_d_6689_981" x="10" y="0" width="37" height="37" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="5"/>
<feGaussianBlur stdDeviation="4"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6689_981"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_6689_981" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 975 B

View File

@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
platform :ios, '15.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@ -1,155 +1,153 @@
PODS:
- device_info_plus (0.0.1):
- Flutter
- Firebase/Analytics (10.25.0):
- Firebase/Analytics (11.6.0):
- Firebase/Core
- Firebase/Core (10.25.0):
- Firebase/Core (11.6.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 10.25.0)
- Firebase/CoreOnly (10.25.0):
- FirebaseCore (= 10.25.0)
- Firebase/Crashlytics (10.25.0):
- FirebaseAnalytics (~> 11.6.0)
- Firebase/CoreOnly (11.6.0):
- FirebaseCore (~> 11.6.0)
- Firebase/Crashlytics (11.6.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 10.25.0)
- Firebase/Database (10.25.0):
- FirebaseCrashlytics (~> 11.6.0)
- Firebase/Database (11.6.0):
- Firebase/CoreOnly
- FirebaseDatabase (~> 10.25.0)
- firebase_analytics (10.8.7):
- Firebase/Analytics (= 10.25.0)
- FirebaseDatabase (~> 11.6.0)
- firebase_analytics (11.4.0):
- Firebase/Analytics (= 11.6.0)
- firebase_core
- Flutter
- firebase_core (2.32.0):
- Firebase/CoreOnly (= 10.25.0)
- firebase_core (3.10.0):
- Firebase/CoreOnly (= 11.6.0)
- Flutter
- firebase_crashlytics (3.4.16):
- Firebase/Crashlytics (= 10.25.0)
- firebase_crashlytics (4.3.0):
- Firebase/Crashlytics (= 11.6.0)
- firebase_core
- Flutter
- firebase_database (10.5.7):
- Firebase/Database (= 10.25.0)
- firebase_database (11.3.0):
- Firebase/Database (= 11.6.0)
- firebase_core
- Flutter
- FirebaseAnalytics (10.25.0):
- FirebaseAnalytics/AdIdSupport (= 10.25.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.30911.0, >= 2.30908.0)
- FirebaseAnalytics/AdIdSupport (10.25.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleAppMeasurement (= 10.25.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseAppCheckInterop (10.29.0)
- FirebaseCore (10.25.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreExtension (10.29.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.29.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.25.0):
- FirebaseCore (~> 10.5)
- FirebaseInstallations (~> 10.0)
- FirebaseRemoteConfigInterop (~> 10.23)
- FirebaseSessions (~> 10.5)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseDatabase (10.25.0):
- FirebaseAppCheckInterop (~> 10.17)
- FirebaseCore (~> 10.0)
- FirebaseSharedSwift (~> 10.0)
- GoogleUtilities/UserDefaults (~> 7.13)
- FirebaseAnalytics (11.6.0):
- FirebaseAnalytics/AdIdSupport (= 11.6.0)
- FirebaseCore (~> 11.6.0)
- FirebaseInstallations (~> 11.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- FirebaseAnalytics/AdIdSupport (11.6.0):
- FirebaseCore (~> 11.6.0)
- FirebaseInstallations (~> 11.0)
- GoogleAppMeasurement (= 11.6.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- FirebaseAppCheckInterop (11.6.0)
- FirebaseCore (11.6.0):
- FirebaseCoreInternal (~> 11.6.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/Logger (~> 8.0)
- FirebaseCoreExtension (11.6.0):
- FirebaseCore (~> 11.6.0)
- FirebaseCoreInternal (11.6.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseCrashlytics (11.6.0):
- FirebaseCore (~> 11.6.0)
- FirebaseInstallations (~> 11.0)
- FirebaseRemoteConfigInterop (~> 11.0)
- FirebaseSessions (~> 11.0)
- GoogleDataTransport (~> 10.0)
- GoogleUtilities/Environment (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- FirebaseDatabase (11.6.0):
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseCore (~> 11.6.0)
- FirebaseSharedSwift (~> 11.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- leveldb-library (~> 1.22)
- FirebaseInstallations (10.29.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseRemoteConfigInterop (10.29.0)
- FirebaseSessions (10.29.0):
- FirebaseCore (~> 10.5)
- FirebaseCoreExtension (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.13)
- GoogleUtilities/UserDefaults (~> 7.13)
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseInstallations (11.6.0):
- FirebaseCore (~> 11.6.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4)
- FirebaseRemoteConfigInterop (11.6.0)
- FirebaseSessions (11.6.0):
- FirebaseCore (~> 11.6.0)
- FirebaseCoreExtension (~> 11.6.0)
- FirebaseInstallations (~> 11.0)
- GoogleDataTransport (~> 10.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (10.29.0)
- FirebaseSharedSwift (11.6.0)
- Flutter (1.0.0)
- flutter_secure_storage (6.0.0):
- Flutter
- GoogleAppMeasurement (10.25.0):
- GoogleAppMeasurement/AdIdSupport (= 10.25.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.25.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.25.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.25.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleDataTransport (9.4.1):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.13.3):
- GoogleAppMeasurement (11.6.0):
- GoogleAppMeasurement/AdIdSupport (= 11.6.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/AdIdSupport (11.6.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 11.6.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/WithoutAdIdSupport (11.6.0):
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- GoogleDataTransport (10.1.0):
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- GoogleUtilities/AppDelegateSwizzler (8.0.2):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (7.13.3):
- GoogleUtilities/Environment (8.0.2):
- GoogleUtilities/Privacy
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.13.3):
- GoogleUtilities/Logger (8.0.2):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/MethodSwizzler (7.13.3):
- GoogleUtilities/MethodSwizzler (8.0.2):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/Network (7.13.3):
- GoogleUtilities/Network (8.0.2):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.13.3)":
- "GoogleUtilities/NSData+zlib (8.0.2)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (7.13.3)
- GoogleUtilities/Reachability (7.13.3):
- GoogleUtilities/Privacy (8.0.2)
- GoogleUtilities/Reachability (8.0.2):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (7.13.3):
- GoogleUtilities/UserDefaults (8.0.2):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- image_picker_ios (0.0.1):
- Flutter
- leveldb-library (1.22.5)
- nanopb (2.30910.0):
- nanopb/decode (= 2.30910.0)
- nanopb/encode (= 2.30910.0)
- nanopb/decode (2.30910.0)
- nanopb/encode (2.30910.0)
- leveldb-library (1.22.6)
- nanopb (3.30910.0):
- nanopb/decode (= 3.30910.0)
- nanopb/encode (= 3.30910.0)
- nanopb/decode (3.30910.0)
- nanopb/encode (3.30910.0)
- onesignal_flutter (5.2.0):
- Flutter
- OneSignalXCFramework (= 5.2.0)
@ -291,42 +289,42 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
firebase_analytics: 3a9263fedec72970e6bd30a7132bbdd386de2c14
firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197
firebase_crashlytics: 0b7cb41f5fb3b6889d0fb408cfce3cc7a4247061
firebase_database: 2713033e426b176d4fe5e7195f3d19aa1b549a91
FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248
FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
FirebaseCrashlytics: 4b96efb0ce73b38b2a85e8b8bd1bd8f63f09d015
FirebaseDatabase: faa489a42f5f868d23a55dd442d6e2099348458e
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
Firebase: 374a441a91ead896215703a674d58cdb3e9d772b
firebase_analytics: 07bd7cfbac54bfcdccf2bb2530f9a65486f7ef3f
firebase_core: feb37e79f775c2bd08dd35e02d83678291317e10
firebase_crashlytics: 609a5f6f4a2f5af9e40a68182e0c1be3ca2a02f6
firebase_database: adc9efd0b70cdc8d1e6f3c9f6bb054a625c4f45d
FirebaseAnalytics: 7114c698cac995602e3b1b96663473e50d54d6e7
FirebaseAppCheckInterop: 347aa09a805219a31249b58fc956888e9fcb314b
FirebaseCore: 48b0dd707581cf9c1a1220da68223fb0a562afaa
FirebaseCoreExtension: 2d77d6430c16cf43ca2b04608302ed02b3598361
FirebaseCoreInternal: d98ab91e2d80a56d7b246856a8885443b302c0c2
FirebaseCrashlytics: b21c665fb50138766480bce73ebdb1aa30f7f300
FirebaseDatabase: ce3a83a39ab50559a85c5add54f6f285544433b8
FirebaseInstallations: efc0946fc756e4d22d8113f7c761948120322e8c
FirebaseRemoteConfigInterop: e75e348953352a000331eb77caf01e424248e176
FirebaseSessions: 9529d14180868e29a8da164b3a729c036204918b
FirebaseSharedSwift: a4e5dfca3e210633bb3a3dfb94176c019211948b
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
GoogleAppMeasurement: 6a9e6317b6a6d810ad03d4a66564ca6c4c5818a3
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28
nanopb: 438bc412db1928dac798aa6fd75726007be04262
leveldb-library: cc8b8f8e013647a295ad3f8cd2ddf49a6f19be19
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
onesignal_flutter: 5ce68a29861960168e81101cb1bd685d264361de
OneSignalXCFramework: bdf74fdc06888f9466dc21e826fe1549ed143095
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
PODFILE CHECKSUM: 4243bd7f9184f79552dd731a7c9d5cad03bd2706
PODFILE CHECKSUM: deba6d843ff3cf709e6e9051ce6601a587b24105
COCOAPODS: 1.15.2
COCOAPODS: 1.16.2

View File

@ -547,6 +547,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Syncrow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -739,6 +740,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Syncrow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -769,6 +771,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Syncrow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -856,6 +859,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Syncrow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -959,6 +963,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Syncrow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -1057,6 +1062,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Syncrow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@ -1,7 +1,7 @@
import UIKit
import Flutter
@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,

View File

@ -38,5 +38,10 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>sms</string>
<string>tel</string>
</array>
</dict>
</plist>

View File

@ -7,10 +7,11 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:onesignal_flutter/onesignal_flutter.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:share_plus/share_plus.dart';
import 'package:syncrow_app/features/app_layout/model/permission_model.dart';
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/auth/model/user_model.dart';
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/model/subspace_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
@ -28,25 +29,33 @@ import 'package:syncrow_app/navigation/routing_constants.dart';
import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/profile_api.dart';
import 'package:syncrow_app/services/api/spaces_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
part 'home_state.dart';
class HomeCubit extends Cubit<HomeState> {
HomeCubit._() : super(HomeInitial()) {
// checkIfNotificationPermissionGranted();
fetchUserInfo();
if (selectedSpace == null) {
fetchUnitsByUserId();
// .then((value) {
// if (selectedSpace != null) {
// fetchRoomsByUnitId(selectedSpace!);
// }
// });
}
fetchUserInfo().then(
(value) {
if (selectedSpace == null) {
fetchUnitsByUserId();
fetchPermissions();
// .then((value) {
// if (selectedSpace != null) {
// fetchRoomsByUnitId(selectedSpace!);
// }
// });
}
},
);
}
static UserModel? user;
List<PermissionModel>? permissionModel = [];
static HomeCubit? _instance;
static HomeCubit getInstance() {
// If an instance already exists, return it
@ -56,15 +65,90 @@ class HomeCubit extends Cubit<HomeState> {
Future fetchUserInfo() async {
try {
emit(HomeLoading());
var uuid =
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
user = await ProfileApi().fetchUserInfo(uuid);
emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info
project = user?.project;
emit(HomeUserInfoLoaded(user!));
} catch (e) {
return;
}
}
static bool manageSupSpace = false;
static bool manageScene = false;
static bool manageDeviceLocation = false;
static bool visitorPasswordManagement = false;
String errorMsg = '';
Future<void> fetchPermissions() async {
try {
emit(HomeLoading());
final response = await ProfileApi().fetchPermissions(user!.role!.uuid);
permissionModel = PermissionModel.fromJsonList(response);
hasViewPermission();
emit(PermissionsRoleLoaded(permissionModel!));
} catch (e) {
emit(HomeError(e.toString()));
}
}
void hasViewPermission() {
emit(HomeLoading());
manageSupSpace = hasPermission(
permissionModel!,
'SPACE_MANAGEMENT',
'MANAGE_SPACE',
'ASSIGN_USER_TO_SPACE',
);
manageScene = hasPermission(
permissionModel!,
'AUTOMATION_MANAGEMENT',
'MANAGE_SCENES',
'UPDATE',
);
manageDeviceLocation = hasPermission(
permissionModel!,
'DEVICE_MANAGEMENT',
'MANAGE_DEVICE',
'LOCATION_UPDATE',
);
visitorPasswordManagement = hasPermission(
permissionModel!,
'VISITOR_PASSWORD_MANAGEMENT',
'MANAGE_VISITOR_PASSWORD',
'VIEW',
);
emit(HomePermissionUpdated());
}
bool hasPermission(List<PermissionModel> permissions, String mainTitle,
String subTitle, String finalTitle) {
try {
final mainOption = permissions.firstWhere(
(perm) => perm.title == mainTitle,
);
final subOption = mainOption.subOptions.firstWhere(
(sub) => sub.title == subTitle,
);
if (subOption.subOptions == null) {
return false;
}
final finalOption = subOption.subOptions!.firstWhere(
(finalSub) => finalSub.title == finalTitle,
);
return finalOption.isChecked == true;
} catch (e) {
return false;
}
}
void emitSafe(HomeState newState) {
final cubit = this;
if (!cubit.isClosed) {
@ -89,12 +173,14 @@ class HomeCubit extends Cubit<HomeState> {
static HomeCubit get(context) => BlocProvider.of(context);
List<SpaceModel>? spaces;
List<SpaceModel> spaces = [];
SpaceModel? selectedSpace;
SubSpaceModel? selectedRoom;
Project? project;
PageController devicesPageController = PageController();
PageController roomsPageController = PageController();
@ -182,8 +268,10 @@ class HomeCubit extends Cubit<HomeState> {
if (index == 0) {
unselectRoom();
} else if (index == 1) {
unselectRoom1();
} else {
selectedRoom = selectedSpace!.subspaces[index - 1];
selectedRoom = selectedSpace!.subspaces[index - 2];
emitSafe(RoomSelected(selectedRoom!));
}
}
@ -197,8 +285,10 @@ class HomeCubit extends Cubit<HomeState> {
if (index <= 0) {
unselectRoom();
} else if (index == 1) {
unselectRoom1();
} else {
selectedRoom = selectedSpace!.subspaces[index - 1];
selectedRoom = selectedSpace!.subspaces[index - 2];
emitSafe(RoomSelected(selectedRoom!));
}
}
@ -220,11 +310,28 @@ class HomeCubit extends Cubit<HomeState> {
emitSafe(RoomUnSelected());
}
unselectRoom1() {
// selectedRoom = null;
devicesPageController.animateToPage(
1,
duration: duration,
curve: Curves.linear,
);
roomsPageController.animateToPage(
1,
duration: duration,
curve: Curves.linear,
);
emitSafe(RoomUnSelected());
}
//////////////////////////////////////// API ////////////////////////////////////////
generateInvitation(SpaceModel unit) async {
try {
final invitationCode =
await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
final invitationCode = await SpacesAPI.generateInvitationCode(unit.id,
unit.community.uuid, project?.uuid ?? TempConst.projectIdDev);
if (invitationCode.isNotEmpty) {
Share.share('The invitation code is $invitationCode');
CustomSnackBar.displaySnackBar(
@ -261,15 +368,16 @@ class HomeCubit extends Cubit<HomeState> {
emitSafe(GetSpacesLoading());
try {
spaces = await SpacesAPI.getSpacesByUserId();
emitSafe(GetSpacesSuccess(spaces));
} catch (failure) {
emitSafe(GetSpacesError("No units found"));
return;
}
if (spaces != null && spaces!.isNotEmpty) {
selectedSpace = spaces!.first;
if (spaces.isNotEmpty) {
selectedSpace = spaces.first;
await fetchRoomsByUnitId(selectedSpace!);
emitSafe(GetSpacesSuccess(spaces!));
emitSafe(GetSpacesSuccess(spaces));
} else {
emitSafe(GetSpacesError("No spaces found"));
}
@ -278,8 +386,10 @@ class HomeCubit extends Cubit<HomeState> {
fetchRoomsByUnitId(SpaceModel space) async {
emitSafe(GetSpaceRoomsLoading());
try {
space.subspaces =
await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(
space.community.uuid,
space.id,
project?.uuid ?? TempConst.projectIdDev);
} catch (failure) {
emitSafe(GetSpaceRoomsError(failure.toString()));
return;
@ -298,18 +408,18 @@ class HomeCubit extends Cubit<HomeState> {
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
var res = await SpacesAPI.activationCodeSpace(
activationCode: activationCode, userUuid: uuid);
if (res['success'] == true) {
fetchUserInfo();
fetchUnitsByUserId();
}
emitSafe(GetSpacesSuccess(spaces!));
return res['success'];
} on DioException catch (e) {
final errorMessage = e.response?.data['error']['message'];
emitSafe(ActivationError(errMessage: errorMessage));
return false;
} catch (e) {
emitSafe(ActivationError(errMessage: e.toString()));
errorMsg = e.response?.data['error']['message'];
emitSafe(ActivationError(errMessage: errorMsg));
return false;
}
}
@ -378,42 +488,44 @@ class HomeCubit extends Cubit<HomeState> {
// ),
// onPressed: () {},
// ),
IconButton(
icon: const Icon(
Icons.add,
size: 32,
),
style: ButtonStyle(
foregroundColor:
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {
Navigator.pushNamed(
NavigationService.navigatorKey.currentContext!,
Routes.sceneTasksRoute,
arguments: SceneSettingsRouteArguments(
sceneType: '',
sceneId: '',
sceneName: '',
),
);
NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>()
.add(const ClearTaskListEvent());
NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>()
.add(const SceneTypeEvent(CreateSceneEnum.none));
NavigationService.navigatorKey.currentContext!
.read<SmartSceneSelectBloc>()
.add(const SmartSceneClearEvent());
BlocProvider.of<EffectPeriodBloc>(
NavigationService.navigatorKey.currentState!.context)
.add(ResetEffectivePeriod());
NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>()
.add(const ClearTabToRunSetting());
},
),
manageScene
? IconButton(
icon: const Icon(
Icons.add,
size: 32,
),
style: ButtonStyle(
foregroundColor:
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {
Navigator.pushNamed(
NavigationService.navigatorKey.currentContext!,
Routes.sceneTasksRoute,
arguments: SceneSettingsRouteArguments(
sceneType: '',
sceneId: '',
sceneName: '',
),
);
NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>()
.add(const ClearTaskListEvent());
NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>()
.add(const SceneTypeEvent(CreateSceneEnum.none));
NavigationService.navigatorKey.currentContext!
.read<SmartSceneSelectBloc>()
.add(const SmartSceneClearEvent());
BlocProvider.of<EffectPeriodBloc>(
NavigationService.navigatorKey.currentState!.context)
.add(ResetEffectivePeriod());
NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>()
.add(const ClearTabToRunSetting());
},
)
: const SizedBox(),
// IconButton(
// icon: const Icon(
// Icons.more_vert,
@ -503,3 +615,28 @@ BottomNavigationBarItem defaultBottomNavBarItem(
label: label,
);
}
// class PermissionUtils {
// // Check if the "VIEW" permission exists in "MANAGE_SUBSPACE"
// static bool hasViewPermission(List<dynamic> permissions) {
// return _hasPermission(permissions, 'MANAGE_SUBSPACE', 'VIEW');
// }
// // Generalized permission checker
// static bool _hasPermission(
// List<dynamic> permissions, String mainTitle, String subTitle) {
// final mainOption = permissions.firstWhere(
// (perm) => perm['title'] == mainTitle,
// orElse: () => null,
// );
// if (mainOption != null) {
// final subOption = mainOption['subOptions'].firstWhere(
// (sub) => sub['title'] == subTitle,
// orElse: () => null,
// );
// return subOption != null && subOption['isChecked'] == true;
// }
// return false;
// }
// }

View File

@ -15,8 +15,8 @@ class HomeError extends HomeState {
class HomeSuccess extends HomeState {}
///specific states
//get spaces
class ActivationSuccess extends HomeState {}
class GetSpacesLoading extends HomeLoading {}
class GetSpacesSuccess extends HomeSuccess {
@ -65,9 +65,15 @@ class RoomUnSelected extends HomeState {}
class NavChangePage extends HomeState {}
// Define new state classes
class HomePermissionUpdated extends HomeState {}
class HomeUserInfoLoaded extends HomeState {
final UserModel user;
HomeUserInfoLoaded(this.user);
}
class PermissionsRoleLoaded extends HomeState {
final List<PermissionModel> permissionModel;
PermissionsRoleLoaded(this.permissionModel);
}

View File

@ -0,0 +1,39 @@
class PermissionModel {
final String title;
final List<PermissionAttributes> subOptions;
PermissionModel({required this.title, required this.subOptions});
factory PermissionModel.fromJson(Map<String, dynamic> json) {
return PermissionModel(
title: json['title'],
subOptions: (json['subOptions'] as List)
.map((e) => PermissionAttributes.fromJson(e))
.toList(),
);
}
static List<PermissionModel> fromJsonList(List<dynamic> jsonList) {
return jsonList.map((json) => PermissionModel.fromJson(json)).toList();
}
}
class PermissionAttributes {
final String title;
final List<PermissionAttributes>? subOptions;
final bool? isChecked;
PermissionAttributes({required this.title, this.subOptions, this.isChecked});
factory PermissionAttributes.fromJson(Map<String, dynamic> json) {
return PermissionAttributes(
title: json['title'],
isChecked: json['isChecked'],
subOptions: json['subOptions'] != null
? (json['subOptions'] as List)
.map((e) => PermissionAttributes.fromJson(e))
.toList()
: null,
);
}
}

View File

@ -17,7 +17,10 @@ class AppLayout extends StatelessWidget {
child: BlocBuilder<HomeCubit, HomeState>(
builder: (context, state) {
return DefaultScaffold(
appBar: HomeCubit.getInstance().spaces != null ? const DefaultAppBar() : null,
appBar: HomeCubit.getInstance().spaces != null &&
HomeCubit.getInstance().spaces!.isNotEmpty
? const DefaultAppBar()
: null,
bottomNavBar: const DefaultNavBar(),
child: const AppBody(),
);

View File

@ -1,7 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
@ -19,10 +22,23 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
backgroundColor: Colors.transparent,
leadingWidth: 200,
toolbarHeight: Constants.appBarHeight,
leading: HomeCubit.getInstance().spaces!.isNotEmpty
? HomeCubit.appBarLeading[HomeCubit.bottomNavItems[HomeCubit.pageIndex].label]!
leading: InkWell(
onTap: () {
final spaces = HomeCubit.getInstance().spaces!;
showSpaceBottomSheet(context, spaces);
},
child: HomeCubit.getInstance().spaces!.isNotEmpty
? AbsorbPointer(
absorbing: true,
child: HomeCubit.appBarLeading[HomeCubit
.bottomNavItems[HomeCubit.pageIndex].label]!,
)
: null,
),
actions: HomeCubit.manageScene
? HomeCubit.appBarActions[
HomeCubit.bottomNavItems[HomeCubit.pageIndex].label]
: null,
actions: HomeCubit.appBarActions[HomeCubit.bottomNavItems[HomeCubit.pageIndex].label],
));
},
);
@ -31,3 +47,83 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Size get preferredSize => Size.fromHeight(Constants.appBarHeight);
}
void showSpaceBottomSheet(BuildContext context, List<SpaceModel> spaces) {
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setModalState) {
String? selectedSpaceId = HomeCubit.getInstance().selectedSpace?.id;
final bool shouldLimitHeight = spaces.length > 5;
return Container(
constraints: shouldLimitHeight
? BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.5,
)
: const BoxConstraints(),
child: SingleChildScrollView(
child: Column(
children: [
const SizedBox(height: 10),
Container(
decoration: const BoxDecoration(color: Colors.black12),
height: 5,
width: 50,
),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: spaces.length,
itemBuilder: (BuildContext context, int index) {
final space = spaces[index];
return Padding(
padding: const EdgeInsets.only(left: 30, right: 30),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(space.name),
],
),
Radio<String>(
value: space.id,
groupValue: selectedSpaceId,
onChanged: (String? newValue) {
if (newValue != null) {
setModalState(() {
selectedSpaceId = newValue;
});
HomeCubit.getInstance().changeSelectedSpace(
spaces.firstWhere((s) => s.id == newValue),
);
Navigator.of(context).pop();
}
},
),
],
),
);
},
separatorBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: const Divider(
color: Colors.grey,
thickness: 0.5,
),
);
},
),
],
),
),
);
},
);
},
);
}

View File

@ -221,6 +221,7 @@ class AuthCubit extends Cubit<AuthState> {
List<String> userFullName = fullName.split(' ');
response = await AuthenticationAPI.signUp(
model: SignUpModel(
hasAcceptedAppAgreement: true,
email: email.toLowerCase(),
password: signUpPassword,
firstName: userFullName[0],

View File

@ -0,0 +1,27 @@
class Project {
final String uuid;
final String name;
final String description;
const Project({
required this.uuid,
required this.name,
required this.description,
});
factory Project.fromJson(Map<String, dynamic> json) {
return Project(
uuid: json['uuid'] as String,
name: json['name'] as String,
description: json['description'] as String,
);
}
Map<String, dynamic> toJson() {
return {
'uuid': uuid,
'name': name,
'description': description,
};
}
}

View File

@ -3,10 +3,12 @@ class SignUpModel {
final String password;
final String firstName;
final String lastName;
final bool hasAcceptedAppAgreement;
SignUpModel(
{required this.email,
required this.password,
required this.hasAcceptedAppAgreement,
required this.firstName,
required this.lastName});
@ -15,7 +17,8 @@ class SignUpModel {
email: json['email'],
password: json['password'],
firstName: json['firstName'],
lastName: json['lastName']);
lastName: json['lastName'],
hasAcceptedAppAgreement: true);
}
Map<String, dynamic> toJson() {
@ -24,6 +27,7 @@ class SignUpModel {
'password': password,
'firstName': firstName,
'lastName': lastName,
"hasAcceptedAppAgreement": hasAcceptedAppAgreement
};
}
}

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/auth/model/token.dart';
class UserModel {
@ -15,6 +16,12 @@ class UserModel {
final String? timeZone;
final String? regionUuid;
final bool? isAgreementAccepted;
final bool? hasAcceptedWebAgreement;
final DateTime? webAgreementAcceptedAt;
final bool? hasAcceptedAppAgreement;
final DateTime? appAgreementAcceptedAt;
final Role? role;
final Project? project;
UserModel({
required this.uuid,
@ -28,7 +35,12 @@ class UserModel {
required this.isAgreementAccepted,
required this.regionName,
required this.timeZone,
// required this.role,
required this.hasAcceptedWebAgreement,
required this.webAgreementAcceptedAt,
required this.hasAcceptedAppAgreement,
required this.appAgreementAcceptedAt,
required this.role,
required this.project,
});
factory UserModel.fromJson(Map<String, dynamic> json) {
@ -44,24 +56,44 @@ class UserModel {
regionName: json['region']?['regionName'],
timeZone: json['timeZone']?['timeZoneOffset'],
regionUuid: json['region']?['uuid'],
hasAcceptedWebAgreement: json['hasAcceptedWebAgreement'],
webAgreementAcceptedAt: json['webAgreementAcceptedAt'] != null
? DateTime.parse(json['webAgreementAcceptedAt'])
: null,
hasAcceptedAppAgreement: json['hasAcceptedAppAgreement'],
appAgreementAcceptedAt: json['appAgreementAcceptedAt'] != null
? DateTime.parse(json['appAgreementAcceptedAt'])
: null,
role: json['role'] != null ? Role.fromJson(json['role']) : null,
project:
json['project'] != null ? Project.fromJson(json['project']) : null,
);
}
factory UserModel.fromToken(Token token) {
Map<String, dynamic> tempJson = Token.decodeToken(token.accessToken);
return UserModel(
uuid: tempJson['uuid'].toString(),
email: tempJson['email'],
lastName: tempJson['lastName'],
firstName: tempJson['firstName'],
profilePicture: UserModel.decodeBase64Image(tempJson['profilePicture']),
phoneNumber: null,
isEmailVerified: null,
isAgreementAccepted: null,
regionUuid: null,
regionName: tempJson['region']?['regionName'],
timeZone: tempJson['timezone']?['timeZoneOffset'],
);
uuid: tempJson['uuid'].toString(),
email: tempJson['email'],
lastName: tempJson['lastName'],
firstName: tempJson['firstName'],
profilePicture: UserModel.decodeBase64Image(tempJson['profilePicture']),
phoneNumber: null,
isEmailVerified: null,
isAgreementAccepted: null,
regionUuid: null,
regionName: tempJson['region']?['regionName'],
timeZone: tempJson['timezone']?['timeZoneOffset'],
hasAcceptedWebAgreement: tempJson['hasAcceptedWebAgreement'],
webAgreementAcceptedAt: tempJson['webAgreementAcceptedAt'] != null
? DateTime.parse(tempJson['webAgreementAcceptedAt'])
: null,
hasAcceptedAppAgreement: tempJson['hasAcceptedAppAgreement'],
appAgreementAcceptedAt: tempJson['appAgreementAcceptedAt'] != null
? DateTime.parse(tempJson['appAgreementAcceptedAt'])
: null,
role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null,
project: null);
}
static Uint8List? decodeBase64Image(String? base64String) {
@ -85,6 +117,45 @@ class UserModel {
'isAgreementAccepted': isAgreementAccepted,
'regionName': regionName,
'timeZone': timeZone,
'hasAcceptedWebAgreement': hasAcceptedWebAgreement,
'webAgreementAcceptedAt': webAgreementAcceptedAt?.toIso8601String(),
'hasAcceptedAppAgreement': hasAcceptedAppAgreement,
'appAgreementAcceptedAt': appAgreementAcceptedAt?.toIso8601String(),
'role': role?.toJson(),
};
}
}
class Role {
final String? uuid;
final DateTime? createdAt;
final DateTime? updatedAt;
final String? type;
Role({
required this.uuid,
required this.createdAt,
required this.updatedAt,
required this.type,
});
factory Role.fromJson(Map<String, dynamic> json) {
return Role(
uuid: json['uuid'],
createdAt:
json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null,
updatedAt:
json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null,
type: json['type'],
);
}
Map<String, dynamic> toJson() {
return {
'uuid': uuid,
'createdAt': createdAt?.toIso8601String(),
'updatedAt': updatedAt?.toIso8601String(),
'type': type,
};
}
}

View File

@ -3,12 +3,15 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/privacy_policy.dart';
import 'package:syncrow_app/features/menu/bloc/user_agreement.dart';
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/navigation/routing_constants.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
@ -202,6 +205,93 @@ class SignUpView extends StatelessWidget {
hint: "At least 8 characters"),
),
const SizedBox(height: 40),
Center(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0),
child: Text.rich(
TextSpan(
text:
'By signing up you agree to our ',
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(
fontSize: 16,
color: ColorsManager
.onPrimaryColor,
),
children: [
WidgetSpan(
child: GestureDetector(
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(
builder: (context) =>
const UserAgreement(),
));
},
child: BodyMedium(
text: 'Terms & Conditions',
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(
decoration:
TextDecoration
.underline,
decorationColor:
ColorsManager
.onPrimaryColor,
color: ColorsManager
.onPrimaryColor,
fontSize: 16),
),
),
),
TextSpan(
text: ' and ',
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(
fontSize: 16,
color: ColorsManager
.onPrimaryColor,
)),
WidgetSpan(
child: GestureDetector(
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(
builder: (context) =>
const PrivacyPolicy(),
));
},
child: BodyMedium(
text: 'Privacy Policy',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(
decoration:
TextDecoration
.underline,
decorationColor:
Colors.white,
color: ColorsManager
.onPrimaryColor,
fontSize: 16),
),
),
),
],
),
textAlign: TextAlign.center,
),
),
),
const SizedBox(height: 40),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [

View File

@ -0,0 +1,19 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class ProjectCubit extends Cubit<String?> {
final FlutterSecureStorage storage;
static const String projectKey = "selected_project_uuid";
ProjectCubit(this.storage) : super(null);
Future<void> setProjectUUID(String newUUID) async {
await storage.write(key: projectKey, value: newUUID);
emit(newUUID);
}
Future<void> clearProjectUUID() async {
await storage.delete(key: projectKey);
emit(null);
}
}

View File

@ -7,7 +7,7 @@ import 'package:syncrow_app/features/shared_widgets/create_unit.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
import 'widgets/energy_usage.dart';
// import 'widgets/energy_usage.dart';
class DashboardView extends StatelessWidget {
const DashboardView({super.key});
@ -29,7 +29,7 @@ class DashboardView extends StatelessWidget {
),
const LiveMonitorTab(),
const SizedBox(height: 10),
const EnergyUsage(),
// const EnergyUsage(),
Container(
padding: const EdgeInsets.only(top: 20),
constraints: const BoxConstraints(

View File

@ -1,178 +1,178 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/dashboard/view/widgets/energy_usage_header.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
// import 'package:fl_chart/fl_chart.dart';
// import 'package:flutter/material.dart';
// import 'package:syncrow_app/features/dashboard/view/widgets/energy_usage_header.dart';
// import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
// import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class EnergyUsage extends StatelessWidget {
const EnergyUsage({
super.key,
});
// class EnergyUsage extends StatelessWidget {
// const EnergyUsage({
// super.key,
// });
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const EnergyUsageHeader(),
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 150,
minHeight: 150,
),
child: LineChart(
LineChartData(
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
horizontalInterval: 2,
drawVerticalLine: false,
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(.5),
strokeWidth: 1,
);
},
),
titlesData: FlTitlesData(
show: true,
rightTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
interval: 1,
getTitlesWidget: leftTitleWidgets,
reservedSize: 25,
),
),
topTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 30,
interval: 12,
getTitlesWidget: (value, meta) {
switch (value.toInt()) {
case 0:
return SideTitleWidget(
axisSide: meta.axisSide,
child: const BodySmall(text: '1'),
);
// @override
// Widget build(BuildContext context) {
// return DecoratedBox(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(15),
// ),
// child: Padding(
// padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// const EnergyUsageHeader(),
// ConstrainedBox(
// constraints: const BoxConstraints(
// maxHeight: 150,
// minHeight: 150,
// ),
// child: LineChart(
// LineChartData(
// gridData: FlGridData(
// show: true,
// drawHorizontalLine: true,
// horizontalInterval: 2,
// drawVerticalLine: false,
// getDrawingHorizontalLine: (value) {
// return FlLine(
// color: Colors.grey.withOpacity(.5),
// strokeWidth: 1,
// );
// },
// ),
// titlesData: FlTitlesData(
// show: true,
// rightTitles: AxisTitles(
// sideTitles: SideTitles(
// showTitles: true,
// interval: 1,
// getTitlesWidget: leftTitleWidgets,
// reservedSize: 25,
// ),
// ),
// topTitles: const AxisTitles(
// sideTitles: SideTitles(showTitles: false),
// ),
// bottomTitles: AxisTitles(
// sideTitles: SideTitles(
// showTitles: true,
// reservedSize: 30,
// interval: 12,
// getTitlesWidget: (value, meta) {
// switch (value.toInt()) {
// case 0:
// return SideTitleWidget(
// axisSide: meta.axisSide,
// child: const BodySmall(text: '1'),
// );
case 11:
return SideTitleWidget(
axisSide: meta.axisSide,
child: const BodySmall(text: '28'),
);
default:
return Container();
}
},
),
),
leftTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
minX: 0,
maxX: 11,
minY: 0,
maxY: 6,
lineBarsData: [
LineChartBarData(
spots: const [
FlSpot(0, 3),
FlSpot(2.6, 2),
FlSpot(4.9, 5),
FlSpot(6.8, 3.1),
FlSpot(8, 4),
FlSpot(9.5, 3),
FlSpot(11, 4),
],
isCurved: true,
gradient: LinearGradient(
colors: [
ColorsManager.primaryColor,
ColorsManager.primaryColor.withOpacity(0.3),
],
),
barWidth: 5,
isStrokeCapRound: true,
dotData: const FlDotData(
show: false,
),
belowBarData: BarAreaData(
show: true,
gradient: LinearGradient(
colors: [
ColorsManager.primaryColor.withOpacity(0.5),
ColorsManager.primaryColor.withOpacity(0.1),
],
),
),
),
],
),
),
)
],
),
),
);
}
// case 11:
// return SideTitleWidget(
// axisSide: meta.axisSide,
// child: const BodySmall(text: '28'),
// );
// default:
// return Container();
// }
// },
// ),
// ),
// leftTitles: const AxisTitles(
// sideTitles: SideTitles(showTitles: false),
// ),
// ),
// minX: 0,
// maxX: 11,
// minY: 0,
// maxY: 6,
// lineBarsData: [
// LineChartBarData(
// spots: const [
// FlSpot(0, 3),
// FlSpot(2.6, 2),
// FlSpot(4.9, 5),
// FlSpot(6.8, 3.1),
// FlSpot(8, 4),
// FlSpot(9.5, 3),
// FlSpot(11, 4),
// ],
// isCurved: true,
// gradient: LinearGradient(
// colors: [
// ColorsManager.primaryColor,
// ColorsManager.primaryColor.withOpacity(0.3),
// ],
// ),
// barWidth: 5,
// isStrokeCapRound: true,
// dotData: const FlDotData(
// show: false,
// ),
// belowBarData: BarAreaData(
// show: true,
// gradient: LinearGradient(
// colors: [
// ColorsManager.primaryColor.withOpacity(0.5),
// ColorsManager.primaryColor.withOpacity(0.1),
// ],
// ),
// ),
// ),
// ],
// ),
// ),
// )
// ],
// ),
// ),
// );
// }
Widget leftTitleWidgets(double value, TitleMeta meta) {
String text;
switch (value.toInt()) {
case 1:
text = '1K';
break;
case 3:
text = '3k';
break;
case 5:
text = '5k';
break;
default:
return Container();
}
// Widget leftTitleWidgets(double value, TitleMeta meta) {
// String text;
// switch (value.toInt()) {
// case 1:
// text = '1K';
// break;
// case 3:
// text = '3k';
// break;
// case 5:
// text = '5k';
// break;
// default:
// return Container();
// }
return Center(child: BodySmall(text: text));
}
// return Center(child: BodySmall(text: text));
// }
Widget bottomTitleWidgets(double value, TitleMeta meta) {
// const style = TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 16,
// );
// Widget text;
// switch (value.toInt()) {
// case 2:
// text = const Text('MAR', style: style);
// break;
// case 5:
// text = const Text('JUN', style: style);
// break;
// case 8:
// text = const Text('SEP', style: style);
// break;
// default:
// text = const Text('', style: style);
// break;
// }
// Widget bottomTitleWidgets(double value, TitleMeta meta) {
// // const style = TextStyle(
// // fontWeight: FontWeight.bold,
// // fontSize: 16,
// // );
// // Widget text;
// // switch (value.toInt()) {
// // case 2:
// // text = const Text('MAR', style: style);
// // break;
// // case 5:
// // text = const Text('JUN', style: style);
// // break;
// // case 8:
// // text = const Text('SEP', style: style);
// // break;
// // default:
// // text = const Text('', style: style);
// // break;
// // }
return SideTitleWidget(
axisSide: meta.axisSide,
child: const BodySmall(text: 'Feb'),
);
}
}
// return SideTitleWidget(
// axisSide: meta.axisSide,
// child: const BodySmall(text: 'Feb'),
// );
// }
// }

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_event.dart';
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_state.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
@ -16,6 +17,7 @@ import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/home_management_api.dart';
import 'package:syncrow_app/services/api/scene_api.dart';
import 'package:syncrow_app/services/api/spaces_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
@ -112,8 +114,9 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
FetchRoomsEvent event, Emitter<SixSceneState> emit) async {
try {
emit(SixSceneLoadingState());
Project? project = HomeCubit.getInstance().project;
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
event.unit.community.uuid, event.unit.id);
event.unit.community.uuid, event.unit.id, project?.uuid ?? TempConst.projectIdDev);
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
} catch (e) {
emit(SixSceneFailedState(errorMessage: e.toString()));
@ -125,12 +128,14 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
try {
emit(SixSceneLoadingState());
if (_hasSelectionChanged) {
Project? project = HomeCubit.getInstance().project;
await HomeManagementAPI.assignDeviceToRoom(
event.unit.community.uuid, event.unit.id, event.roomId, sixSceneId);
event.unit.community.uuid, event.unit.id, event.roomId, sixSceneId, project?.uuid ?? TempConst.projectIdDev);
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
List<String> allDevicesIds = [];
allDevices.forEach((element) {
allDevicesIds.add(element.uuid!);
@ -341,8 +346,10 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
emit(SixSceneLoadingState());
try {
Project? project = HomeCubit.getInstance().project;
allScenes = await SceneApi.getScenesByUnitId(
event.unitId, event.unit.community.uuid,
event.unitId, event.unit.community.uuid, project?.uuid ?? TempConst.projectIdDev,
showInDevice: event.showInDevice);
filteredScenes = allScenes;

View File

@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/model/ac_model.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
@ -135,6 +136,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
ac.acSwitch = acSwitchValue;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
} else {
@ -455,24 +457,27 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
}
void _getCounterValue(GetCounterEvent event, Emitter<AcsState> emit) async {
try {
emit(AcsLoadingState());
var response = await DevicesAPI.getDeviceStatus(acId);
List<StatusModel> statusModelList = [];
for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status));
}
deviceStatus =
AcStatusModel.fromJson(response['productUuid'], statusModelList);
if (event.deviceCode == 'countdown_time') {
deviceStatus.countdown1 > 0
? _onStartTimer(deviceStatus.countdown1)
: emit(UpdateTimerState(seconds: deviceStatus.countdown1));
}
} catch (e) {
emit(AcsFailedState(errorMessage: e.toString()));
return;
emit(AcsLoadingState());
var response = await DevicesAPI.getDeviceStatus(acId);
List<StatusModel> statusModelList = [];
for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status));
}
deviceStatus =
AcStatusModel.fromJson(response['productUuid'], statusModelList);
deviceStatus.countdown1;
var duration;
if (deviceStatus.countdown1 == 5) {
duration = const Duration(minutes: 30);
var countNum = duration.inSeconds;
_onStartTimer(countNum);
} else if (deviceStatus.countdown1 > 5) {
duration = Duration(minutes: deviceStatus.countdown1 * 6);
var countNum = duration.inSeconds;
_onStartTimer(countNum);
} else {
_timer?.cancel();
emit(TimerRunComplete());
}
}

View File

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -112,7 +114,7 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
code: 'presence_state',
);
recordGroups = response;
// print('---${recordGroups.data!.first.eventTime}');
// print('---${jsonEncode(recordGroups.data.first.)}');
emit(FitchData());
} on DioException catch (e) {
final errorData = e.response!.data;

View File

@ -2,6 +2,8 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_event.dart';
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_state.dart';
@ -10,6 +12,7 @@ import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/home_management_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
@ -27,11 +30,16 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
static List<DevicesCategoryModel>? allCategories;
Future<void> _onFetchAllDevices(FetchAllDevices event, Emitter<DeviceManagerState> emit) async {
Future<void> _onFetchAllDevices(
FetchAllDevices event, Emitter<DeviceManagerState> emit) async {
emit(state.copyWith(loading: true));
try {
final allDevices = await HomeManagementAPI.fetchDevicesByUnitId();
emit(state.copyWith(devices: _getOnlyImplementedDevices(allDevices), loading: false));
Project? project = HomeCubit.getInstance().project;
final allDevices = await HomeManagementAPI.fetchDevicesByUnitId(
project?.uuid ?? TempConst.projectIdDev);
emit(state.copyWith(
devices: _getOnlyImplementedDevices(allDevices), loading: false));
} catch (e) {
emit(state.copyWith(error: e.toString(), loading: false));
}
@ -41,26 +49,31 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
FetchDevicesByRoomId event, Emitter<DeviceManagerState> emit) async {
emit(state.copyWith(loading: true));
try {
final devices = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId,
);
Project? project = HomeCubit.getInstance().project;
emit(state.copyWith(devices: _getOnlyImplementedDevices(devices), loading: false));
final devices = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
emit(state.copyWith(
devices: _getOnlyImplementedDevices(devices), loading: false));
} catch (e) {
emit(state.copyWith(error: e.toString(), loading: false));
}
}
void _onSelectCategory(SelectCategory event, Emitter<DeviceManagerState> emit) {
void _onSelectCategory(
SelectCategory event, Emitter<DeviceManagerState> emit) {
for (var i = 0; i < allCategories!.length; i++) {
allCategories![i].isSelected = i == event.index;
}
emit(state.copyWith(categoryChanged: true));
}
void _onUnselectAllCategories(UnselectAllCategories event, Emitter<DeviceManagerState> emit) {
void _onUnselectAllCategories(
UnselectAllCategories event, Emitter<DeviceManagerState> emit) {
for (var category in allCategories!) {
category.isSelected = false;
}
@ -104,7 +117,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
_updateDevicesStatus(category, emit);
}
void _onTurnOnOffDevice(TurnOnOffDevice event, Emitter<DeviceManagerState> emit) {
void _onTurnOnOffDevice(
TurnOnOffDevice event, Emitter<DeviceManagerState> emit) {
var device = event.device;
device.isOnline = !device.isOnline!;
DevicesCategoryModel category = allCategories!.firstWhere((category) {
@ -127,7 +141,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
emit(state.copyWith(categoryChanged: true)); // Set category changed state
}
void _updateDevicesStatus(DevicesCategoryModel category, Emitter<DeviceManagerState> emit) {
void _updateDevicesStatus(
DevicesCategoryModel category, Emitter<DeviceManagerState> emit) {
if (category.devices != null && category.devices!.isNotEmpty) {
bool? tempStatus = category.devices![0].isOnline;
for (var device in category.devices!) {
@ -147,7 +162,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
try {
final deviceFunctions = await DevicesAPI.deviceFunctions(event.deviceId);
emit(state.copyWith(functionsLoading: false, deviceFunctions: deviceFunctions));
emit(state.copyWith(
functionsLoading: false, deviceFunctions: deviceFunctions));
} catch (e) {
emit(state.copyWith(functionsLoading: false, error: e.toString()));
}

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/bloc/device_settings_bloc/device_scene_event.dart';
import 'package:syncrow_app/features/devices/bloc/device_settings_bloc/device_scene_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
@ -18,6 +19,7 @@ import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/home_management_api.dart';
import 'package:syncrow_app/services/api/spaces_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
@ -349,13 +351,20 @@ class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
AssignRoomEvent event, Emitter<DeviceSettingState> emit) async {
try {
emit(DeviceSettingLoadingState());
Project? project = HomeCubit.getInstance().project;
if (_hasSelectionChanged) {
await HomeManagementAPI.assignDeviceToRoom(
event.unit.community.uuid, event.unit.id, event.roomId, deviceId);
event.unit.community.uuid,
event.unit.id,
event.roomId,
deviceId,
project?.uuid ?? TempConst.projectIdDev);
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
List<String> allDevicesIds = [];
allDevices.forEach((element) {
allDevicesIds.add(element.uuid!);
@ -375,8 +384,12 @@ class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
FetchRoomsEvent event, Emitter<DeviceSettingState> emit) async {
try {
emit(DeviceSettingLoadingState());
Project? project = HomeCubit.getInstance().project;
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
event.unit.community.uuid, event.unit.id);
event.unit.community.uuid,
event.unit.id,
project?.uuid ?? TempConst.projectIdDev);
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
} catch (e) {
emit(

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
@ -19,6 +20,7 @@ import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/home_management_api.dart';
import 'package:syncrow_app/services/api/network_exception.dart';
import 'package:syncrow_app/services/api/spaces_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
part 'devices_state.dart';
@ -31,6 +33,7 @@ class DevicesCubit extends Cubit<DevicesState> {
// Fetch groups based on the selected space ID
await fetchGroups(selectedSpace.id);
await fetchAllDevices(selectedSpace);
}
DevicesCubit._() : super(DevicesInitial()) {
@ -109,17 +112,6 @@ class DevicesCubit extends Cubit<DevicesState> {
}
// Getter to retrieve all devices from HomeCubit
List<DeviceModel> get allDevices {
List<DeviceModel> devices = [];
if (HomeCubit.getInstance().selectedSpace != null) {
for (var room in HomeCubit.getInstance().selectedSpace!.subspaces) {
if (room.devices != null) {
devices.addAll(room.devices!);
}
}
}
return devices;
}
// DevicesCategoryModel? get chosenCategory {
// for (var category in allCategories!) {
@ -267,36 +259,36 @@ class DevicesCubit extends Cubit<DevicesState> {
}
///////////////////////// API CALLS //////////////////////////
deviceControl(DeviceControlModel control, String deviceId) async {
emitSafe(DeviceControlLoading(
code: control.code,
));
try {
var response = await DevicesAPI.controlDevice(control, deviceId);
// deviceControl(DeviceControlModel control, String deviceId) async {
// emitSafe(DeviceControlLoading(
// code: control.code,
// ));
// try {
// var response = await DevicesAPI.controlDevice(control, deviceId);
if (response['success'] ?? false) {
emitSafe(DeviceControlSuccess(code: control.code));
//this delay is to give tuya server time to update the status
// Future.delayed(const Duration(milliseconds: 400), () {
fetchDevicesStatues(
deviceId,
HomeCubit.getInstance()
.selectedSpace!
.subspaces
.indexOf(HomeCubit.getInstance().selectedRoom!),
code: control.code);
// });
} else {
emitSafe(DeviceControlError('Failed to control the device'));
}
} catch (failure) {
emitSafe(DeviceControlError(failure.toString()));
return;
}
}
// if (response['success'] ?? false) {
// emitSafe(DeviceControlSuccess(code: control.code));
// //this delay is to give tuya server time to update the status
// // Future.delayed(const Duration(milliseconds: 400), () {
// fetchDevicesStatues(
// deviceId,
// HomeCubit.getInstance()
// .selectedSpace!
// .subspaces
// .indexOf(HomeCubit.getInstance().selectedRoom!),
// code: control.code);
// // });
// } else {
// emitSafe(DeviceControlError('Failed to control the device'));
// }
// } catch (failure) {
// emitSafe(DeviceControlError(failure.toString()));
// return;
// }
// }
fetchGroups(String spaceId) async {
emitSafe(DevicesCategoriesLoading());
emitSafe(GetDevicesLoading());
try {
allCategories = await DevicesAPI.fetchGroups(spaceId);
} catch (e) {
@ -319,14 +311,20 @@ class DevicesCubit extends Cubit<DevicesState> {
.subspaces
.indexWhere((element) => element.id == roomId);
try {
Project? project = HomeCubit.getInstance().project;
HomeCubit.getInstance().selectedSpace!.subspaces[roomIndex].devices =
await DevicesAPI.getDevicesByRoomId(
communityUuid: unit!.community.uuid, spaceUuid: unit.id, roomId: roomId);
communityUuid: unit!.community.uuid,
spaceUuid: unit.id,
roomId: roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
} catch (e) {
emitSafe(GetDevicesError(e.toString()));
return;
}
final devices = HomeCubit.getInstance().selectedSpace!.subspaces[roomIndex].devices;
final devices =
HomeCubit.getInstance().selectedSpace!.subspaces[roomIndex].devices;
emitSafe(GetDevicesSuccess(devices));
//get status for each device
@ -356,8 +354,11 @@ class DevicesCubit extends Cubit<DevicesState> {
emitSafe(GetDeviceStatusError(e.toString()));
return;
}
HomeCubit.getInstance().selectedSpace!.subspaces[roomIndex].devices![deviceIndex].status =
statuses;
HomeCubit.getInstance()
.selectedSpace!
.subspaces[roomIndex]
.devices![deviceIndex]
.status = statuses;
emitSafe(GetDeviceStatusSuccess(code: code));
}
@ -406,6 +407,343 @@ class DevicesCubit extends Cubit<DevicesState> {
// emitSafe(LightBrightnessChanged(value));
// }
// }
// List<DeviceModel> _fetchedDevices = [];
// List<DeviceModel> get allDevices => _fetchedDevices;
List<DeviceModel> allDevices = [];
Future<void> fetchAllDevices(SpaceModel? unit) async {
emitSafe(GetDevicesLoading());
try {
Project? project = HomeCubit.getInstance().project;
final devices = await DevicesAPI.getAllDevices(
communityUuid: unit!.community.uuid,
spaceUuid: unit.id,
projectId: project?.uuid ?? TempConst.projectIdDev);
allDevices = devices;
emitSafe(GetDevicesSuccess(allDevices));
} catch (e) {
emitSafe(GetDevicesError(e.toString()));
}
}
bool isDeviceOn(DeviceModel device) {
final switchStatuses = device.status.where(
(s) => (s.code?.startsWith('switch') ?? false),
);
final anySwitchFalse = switchStatuses.any((s) => s.value == false);
return !anySwitchFalse;
}
void updateDeviceStatus(String deviceId, bool newToggleStatus) {
emitSafe(GetDevicesLoading());
// Create a fresh copy of the device list.
final updatedDevices = List<DeviceModel>.from(allDevices);
for (int i = 0; i < updatedDevices.length; i++) {
final device = updatedDevices[i];
if (device.uuid == deviceId) {
updatedDevices[i] = DeviceModel(
activeTime: device.activeTime,
localKey: device.localKey,
model: device.model,
name: device.name,
icon: device.icon,
categoryName: device.categoryName,
type: device.type,
isOnline: device.isOnline,
status: device.status, // Make sure to keep the same status list
productName: device.productName,
timeZone: device.timeZone,
updateTime: device.updateTime,
uuid: device.uuid,
productUuid: device.productUuid,
productType: device.productType,
subspace: device.subspace,
toggleStatus: newToggleStatus,
);
break;
}
}
emit(GetDevicesSuccess(updatedDevices));
}
Future<void> threeGangToggle(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final switches = ['switch_1', 'switch_2', 'switch_3'];
for (final switchCode in switches) {
final statusIndex =
device.status.indexWhere((s) => s.code == switchCode);
if (statusIndex != -1) {
final toggledValue = control.value;
final controlRequest = DeviceControlModel(
code: switchCode, value: toggledValue, deviceId: deviceUuid);
final response =
await DevicesAPI.controlDevice(controlRequest, deviceUuid);
if (response['success'] != true) {
throw Exception('Failed to toggle $switchCode');
}
device.status[statusIndex].value = toggledValue;
}
}
final anySwitchOff = device.status.any(
(s) => (s.code?.startsWith('switch_') ?? false) && (s.value == false),
);
device.toggleStatus = !anySwitchOff;
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} catch (failure) {
emit(DeviceControlError(failure.toString()));
}
}
Future<void> towGangToggle(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final switches = [
'switch_1',
'switch_2',
];
for (final switchCode in switches) {
final statusIndex =
device.status.indexWhere((s) => s.code == switchCode);
if (statusIndex != -1) {
final toggledValue = control.value;
final controlRequest = DeviceControlModel(
code: switchCode, value: toggledValue, deviceId: deviceUuid);
final response =
await DevicesAPI.controlDevice(controlRequest, deviceUuid);
device.status[statusIndex].value = response['result'];
}
}
final anySwitchOff = device.status.any(
(s) => (s.code?.startsWith('switch_') ?? false) && (s.value == false),
);
device.toggleStatus = !anySwitchOff;
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} catch (failure) {
emit(DeviceControlError(failure.toString()));
}
}
Future<void> towGTGangToggle(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final switches = [
'switch_1',
'switch_2',
];
for (final switchCode in switches) {
final statusIndex =
device.status.indexWhere((s) => s.code == switchCode);
if (statusIndex != -1) {
final toggledValue = control.value;
final controlRequest = DeviceControlModel(
code: switchCode, value: toggledValue, deviceId: deviceUuid);
final response =
await DevicesAPI.controlDevice(controlRequest, deviceUuid);
device.status[statusIndex].value = response['result'];
}
}
final anySwitchOff = device.status.any(
(s) => (s.code?.startsWith('switch_') ?? false) && (s.value == false),
);
device.toggleStatus = !anySwitchOff;
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} catch (failure) {
emit(DeviceControlError(failure.toString()));
}
}
Future<void> oneGangToggle(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final statusIndex = device.status.indexWhere((s) => s.code == 'switch_1');
if (statusIndex != -1) {
final toggledValue = control.value;
final controlRequest = DeviceControlModel(
code: 'switch_1', value: toggledValue, deviceId: deviceUuid);
final response =
await DevicesAPI.controlDevice(controlRequest, deviceUuid);
print(response);
if (response['result'] != true) {
throw Exception('Failed to toggle switch_1');
}
device.status[statusIndex].value = response['result'];
}
final anySwitchOff = device.status.any(
(s) => (s.code?.startsWith('switch_') ?? false) && (s.value == false),
);
device.toggleStatus = !anySwitchOff;
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} catch (failure) {
emit(DeviceControlError(failure.toString()));
}
}
Future<void> oneGTGangToggle(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final statusIndex = device.status.indexWhere((s) => s.code == 'switch_1');
if (statusIndex != -1) {
final currentValue = device.status[statusIndex].value ?? false;
final toggledValue = !currentValue;
final controlRequest = DeviceControlModel(
code: 'switch_1', value: toggledValue, deviceId: deviceUuid);
final response =
await DevicesAPI.controlDevice(controlRequest, deviceUuid);
if (response['result'] != true) {
throw Exception('Failed to toggle switch_1');
}
device.status[statusIndex].value = response['result'];
}
final anySwitchOff = device.status.any(
(s) => (s.code?.startsWith('switch_') ?? false) && (s.value == false),
);
device.toggleStatus = !anySwitchOff;
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} catch (failure) {
emit(DeviceControlError(failure.toString()));
}
}
Future<void> deviceControl(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final response = await DevicesAPI.controlDevice(control, deviceUuid);
if (response['success'] == true) {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex != -1) {
final device = allDevices[deviceIndex];
final statusIndex =
device.status.indexWhere((s) => s.code == control.code);
if (statusIndex != -1) {
device.status[statusIndex].value = control.value;
}
final anySwitchOff = device.status.any(
(s) =>
(s.code?.startsWith('switch_') ?? false) && (s.value == false),
);
device.toggleStatus = !anySwitchOff;
allDevices[deviceIndex] = device;
}
emit(DeviceControlSuccess(code: control.code));
} else {
emit(DeviceControlError('Failed to control the device'));
}
} catch (failure) {
emit(DeviceControlError(failure.toString()));
}
}
Future<void> changeCurtainSwitch(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final isOpen = control.value == "open";
final newValue = isOpen ? 0 : 100;
final response = await DevicesAPI.deviceBatchController(
code: 'percent_control',
devicesUuid: [deviceUuid],
value: newValue,
);
if (response['success'] == true) {
final statusIndex =
device.status.indexWhere((s) => s.code == 'percent_control');
if (statusIndex != -1) {
device.status[statusIndex].value = newValue;
}
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} else {
emit(DeviceControlError('Failed to toggle curtain.'));
}
} catch (error) {
emit(DeviceControlError(error.toString()));
}
}
Future<void> changeGarageSwitch(
DeviceControlModel control, String deviceUuid) async {
emit(SwitchControlLoading(code: control.code));
try {
final deviceIndex = allDevices.indexWhere((d) => d.uuid == deviceUuid);
if (deviceIndex == -1) {
throw Exception('Device not found');
}
final device = allDevices[deviceIndex];
final isOpen = control.value == "open";
final newValue = isOpen ? 0 : 100;
final response = await DevicesAPI.deviceBatchController(
code: 'percent_control',
devicesUuid: [deviceUuid],
value: newValue,
);
if (response['success'] == true) {
final statusIndex =
device.status.indexWhere((s) => s.code == 'percent_control');
if (statusIndex != -1) {
device.status[statusIndex].value = newValue;
}
allDevices[deviceIndex] = device;
emit(DeviceControlSuccess(code: control.code));
} else {
emit(DeviceControlError('Failed to toggle curtain.'));
}
} catch (error) {
emit(DeviceControlError(error.toString()));
}
}
}
enum LightMode {

View File

@ -34,6 +34,7 @@ class GetDeviceStatusError extends DevicesState {
}
class GetDevicesLoading extends DevicesState {}
class RoomLoading extends DevicesState {}
class GetDevicesSuccess extends DevicesState {
GetDevicesSuccess(this.devices);
@ -55,10 +56,16 @@ class DeviceSwitchChanged extends DevicesState {}
class DeviceSelected extends DevicesState {}
// Device Control
class DeviceControlLoading extends DevicesState {
final String? code;
// class DeviceControlLoading extends DevicesState {
// final String? code;
DeviceControlLoading({this.code});
// DeviceControlLoading({this.code});
// }
class SwitchControlLoading extends DevicesState {
final String? code;
final String? deviceId;
SwitchControlLoading({this.deviceId, this.code});
}
class DeviceControlSuccess extends DevicesState {

View File

@ -1,6 +1,8 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_event.dart';
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_state.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
@ -14,6 +16,7 @@ import 'package:syncrow_app/features/devices/model/subspace_model.dart';
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/scene_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
@ -299,9 +302,11 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
LoadScenes event, Emitter<FourSceneState> emit) async {
emit(FourSceneLoadingState());
try {
Project? project = HomeCubit.getInstance().project;
if (event.unitId.isNotEmpty) {
allScenes = await SceneApi.getScenesByUnitId(
event.unitId, event.unit.community.uuid,
event.unitId, event.unit.community.uuid, project?.uuid ?? TempConst.projectIdDev,
showInDevice: event.showInDevice);
filteredScenes = allScenes;

View File

@ -5,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/app_layout/model/community_model.dart';
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_event.dart';
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
@ -19,6 +20,7 @@ import 'package:syncrow_app/navigation/routing_constants.dart';
import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/home_management_api.dart';
import 'package:syncrow_app/services/api/spaces_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class SosBloc extends Bloc<SosEvent, SosState> {
@ -184,8 +186,12 @@ class SosBloc extends Bloc<SosEvent, SosState> {
FetchRoomsEvent event, Emitter<SosState> emit) async {
try {
emit(SosLoadingState());
Project? project = HomeCubit.getInstance().project;
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
event.unit.community.uuid, event.unit.id);
event.unit.community.uuid,
event.unit.id,
project?.uuid ?? TempConst.projectIdDev);
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
} catch (e) {
emit(const SosFailedState(errorMessage: 'Something went wrong'));
@ -223,13 +229,19 @@ class SosBloc extends Bloc<SosEvent, SosState> {
void _assignDevice(AssignRoomEvent event, Emitter<SosState> emit) async {
try {
emit(SosLoadingState());
Project? project = HomeCubit.getInstance().project;
await HomeManagementAPI.assignDeviceToRoom(
event.unit.community.uuid, event.unit.id, event.roomId, sosId);
event.unit.community.uuid,
event.unit.id,
event.roomId,
sosId,
project?.uuid ?? TempConst.projectIdDev);
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
List<String> allDevicesIds = [];
@ -249,13 +261,16 @@ class SosBloc extends Bloc<SosEvent, SosState> {
void _unassignDevice(UnassignRoomEvent event, Emitter<SosState> emit) async {
try {
Map<String, bool> roomDevicesId = {};
Project? project = HomeCubit.getInstance().project;
emit(SosLoadingState());
await HomeManagementAPI.unAssignDeviceToRoom(
event.unit.community.uuid, event.unit.id, event.roomId, sosId);
event.unit.community.uuid, event.unit.id, event.roomId, sosId, project?.uuid ?? TempConst.projectIdDev);
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
List<String> allDevicesIds = [];

View File

@ -40,7 +40,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
bool createSchedule = false;
List<ScheduleModel> listSchedule = [];
TwoTouchBloc({required this.twoTouchId, required this.switchCode}) : super(InitialState()) {
TwoTouchBloc({required this.twoTouchId, required this.switchCode})
: super(InitialState()) {
on<InitialEvent>(_fetchTwoTouchStatus);
on<TwoTouchUpdated>(_twoTouchUpdated);
on<ChangeFirstSwitchStatusEvent>(_changeFirstSwitch);
@ -71,13 +72,15 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
int selectedTabIndex = 0;
void toggleSelectedIndex(ToggleSelectedEvent event, Emitter<TwoTouchState> emit) {
void toggleSelectedIndex(
ToggleSelectedEvent event, Emitter<TwoTouchState> emit) {
emit(LoadingInitialState());
selectedTabIndex = event.index;
emit(ChangeSlidingSegmentState(value: selectedTabIndex));
}
void toggleCreateSchedule(ToggleCreateScheduleEvent event, Emitter<TwoTouchState> emit) {
void toggleCreateSchedule(
ToggleCreateScheduleEvent event, Emitter<TwoTouchState> emit) {
emit(LoadingInitialState());
createSchedule = !createSchedule;
selectedDays.clear();
@ -85,7 +88,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
emit(UpdateCreateScheduleState(createSchedule));
}
void _fetchTwoTouchStatus(InitialEvent event, Emitter<TwoTouchState> emit) async {
void _fetchTwoTouchStatus(
InitialEvent event, Emitter<TwoTouchState> emit) async {
emit(LoadingInitialState());
try {
var response = await DevicesAPI.getDeviceStatus(twoTouchId);
@ -104,18 +108,21 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
_listenToChanges() {
try {
DatabaseReference ref = FirebaseDatabase.instance.ref('device-status/$twoTouchId');
DatabaseReference ref =
FirebaseDatabase.instance.ref('device-status/$twoTouchId');
Stream<DatabaseEvent> stream = ref.onValue;
stream.listen((DatabaseEvent event) async {
if (_timer != null) {
await Future.delayed(const Duration(seconds: 2));
}
Map<dynamic, dynamic> usersMap = event.snapshot.value as Map<dynamic, dynamic>;
Map<dynamic, dynamic> usersMap =
event.snapshot.value as Map<dynamic, dynamic>;
List<StatusModel> statusList = [];
usersMap['status'].forEach((element) {
statusList.add(StatusModel(code: element['code'], value: element['value']));
statusList
.add(StatusModel(code: element['code'], value: element['value']));
});
deviceStatus = TwoTouchModel.fromJson(statusList);
@ -130,7 +137,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
emit(UpdateState(twoTouchModel: deviceStatus));
}
void _changeFirstSwitch(ChangeFirstSwitchStatusEvent event, Emitter<TwoTouchState> emit) async {
void _changeFirstSwitch(
ChangeFirstSwitchStatusEvent event, Emitter<TwoTouchState> emit) async {
emit(LoadingNewSate(twoTouchModel: deviceStatus));
try {
deviceStatus.firstSwitch = !event.value;
@ -141,7 +149,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
_timer = Timer(const Duration(milliseconds: 100), () async {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: twoTouchId, code: 'switch_1', value: !event.value),
DeviceControlModel(
deviceId: twoTouchId, code: 'switch_1', value: !event.value),
twoTouchId);
if (!response['success']) {
@ -153,7 +162,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
}
void _changeSecondSwitch(ChangeSecondSwitchStatusEvent event, Emitter<TwoTouchState> emit) async {
void _changeSecondSwitch(
ChangeSecondSwitchStatusEvent event, Emitter<TwoTouchState> emit) async {
emit(LoadingNewSate(twoTouchModel: deviceStatus));
try {
deviceStatus.secondSwitch = !event.value;
@ -163,7 +173,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
_timer = Timer(const Duration(milliseconds: 100), () async {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: twoTouchId, code: 'switch_2', value: !event.value),
DeviceControlModel(
deviceId: twoTouchId, code: 'switch_2', value: !event.value),
twoTouchId);
if (!response['success']) {
@ -186,11 +197,15 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
final response = await Future.wait([
DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: twoTouchId, code: 'switch_1', value: deviceStatus.firstSwitch),
deviceId: twoTouchId,
code: 'switch_1',
value: deviceStatus.firstSwitch),
twoTouchId),
DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: twoTouchId, code: 'switch_2', value: deviceStatus.secondSwitch),
deviceId: twoTouchId,
code: 'switch_2',
value: deviceStatus.secondSwitch),
twoTouchId),
]);
@ -213,11 +228,15 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
final response = await Future.wait([
DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: twoTouchId, code: 'switch_1', value: deviceStatus.firstSwitch),
deviceId: twoTouchId,
code: 'switch_1',
value: deviceStatus.firstSwitch),
twoTouchId),
DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: twoTouchId, code: 'switch_2', value: deviceStatus.secondSwitch),
deviceId: twoTouchId,
code: 'switch_2',
value: deviceStatus.secondSwitch),
twoTouchId),
]);
if (response.every((element) => !element['success'])) {
@ -237,8 +256,10 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
groupTwoTouchList[i].firstSwitch = true;
groupTwoTouchList[i].secondSwitch = true;
}
emit(UpdateGroupState(twoTouchList: groupTwoTouchList, allSwitches: true));
List<String> allDeviceIds = groupTwoTouchList.map((device) => device.deviceId).toList();
emit(
UpdateGroupState(twoTouchList: groupTwoTouchList, allSwitches: true));
List<String> allDeviceIds =
groupTwoTouchList.map((device) => device.deviceId).toList();
final response1 = await DevicesAPI.deviceBatchController(
code: 'switch_1',
@ -271,9 +292,11 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
groupTwoTouchList[i].secondSwitch = false;
}
emit(UpdateGroupState(twoTouchList: groupTwoTouchList, allSwitches: false));
emit(UpdateGroupState(
twoTouchList: groupTwoTouchList, allSwitches: false));
List<String> allDeviceIds = groupTwoTouchList.map((device) => device.deviceId).toList();
List<String> allDeviceIds =
groupTwoTouchList.map((device) => device.deviceId).toList();
final response1 = await DevicesAPI.deviceBatchController(
code: 'switch_1',
@ -298,17 +321,20 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
}
void _changeSliding(ChangeSlidingSegment event, Emitter<TwoTouchState> emit) async {
void _changeSliding(
ChangeSlidingSegment event, Emitter<TwoTouchState> emit) async {
emit(ChangeSlidingSegmentState(value: event.value));
}
void _setCounterValue(SetCounterValue event, Emitter<TwoTouchState> emit) async {
void _setCounterValue(
SetCounterValue event, Emitter<TwoTouchState> emit) async {
emit(LoadingNewSate(twoTouchModel: deviceStatus));
int seconds = 0;
try {
seconds = event.duration.inSeconds;
final response = await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: twoTouchId, code: event.deviceCode, value: seconds),
DeviceControlModel(
deviceId: twoTouchId, code: event.deviceCode, value: seconds),
twoTouchId);
if (response['success'] ?? false) {
@ -333,7 +359,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
}
void _getCounterValue(GetCounterEvent event, Emitter<TwoTouchState> emit) async {
void _getCounterValue(
GetCounterEvent event, Emitter<TwoTouchState> emit) async {
emit(LoadingInitialState());
try {
add(GetScheduleEvent());
@ -441,7 +468,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
deviceId: twoTouchId,
);
List<dynamic> jsonData = response;
listSchedule = jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
listSchedule =
jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
emit(InitialState());
} on DioException catch (e) {
final errorData = e.response!.data;
@ -452,12 +480,13 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
int? getTimeStampWithoutSeconds(DateTime? dateTime) {
if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds =
DateTime(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute);
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month,
dateTime.day, dateTime.hour, dateTime.minute);
return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000;
}
Future toggleRepeat(ToggleScheduleEvent event, Emitter<TwoTouchState> emit) async {
Future toggleRepeat(
ToggleScheduleEvent event, Emitter<TwoTouchState> emit) async {
try {
emit(LoadingInitialState());
final response = await DevicesAPI.changeSchedule(
@ -476,7 +505,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
}
Future deleteSchedule(DeleteScheduleEvent event, Emitter<TwoTouchState> emit) async {
Future deleteSchedule(
DeleteScheduleEvent event, Emitter<TwoTouchState> emit) async {
try {
emit(LoadingInitialState());
final response = await DevicesAPI.deleteSchedule(
@ -496,7 +526,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
}
void _fetchTwoTouchWizardStatus(InitialWizardEvent event, Emitter<TwoTouchState> emit) async {
void _fetchTwoTouchWizardStatus(
InitialWizardEvent event, Emitter<TwoTouchState> emit) async {
emit(LoadingInitialState());
try {
devicesList = [];
@ -506,7 +537,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
HomeCubit.getInstance().selectedSpace?.id ?? '', '2GT');
for (int i = 0; i < devicesList.length; i++) {
var response = await DevicesAPI.getDeviceStatus(devicesList[i].uuid ?? '');
var response =
await DevicesAPI.getDeviceStatus(devicesList[i].uuid ?? '');
List<StatusModel> statusModelList = [];
for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status));
@ -529,15 +561,16 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
return true;
});
}
emit(UpdateGroupState(twoTouchList: groupTwoTouchList, allSwitches: allSwitchesOn));
emit(UpdateGroupState(
twoTouchList: groupTwoTouchList, allSwitches: allSwitchesOn));
} catch (e) {
emit(FailedState(error: e.toString()));
return;
}
}
void _changeFirstWizardSwitch(
ChangeFirstWizardSwitchStatusEvent event, Emitter<TwoTouchState> emit) async {
void _changeFirstWizardSwitch(ChangeFirstWizardSwitchStatusEvent event,
Emitter<TwoTouchState> emit) async {
emit(LoadingNewSate(twoTouchModel: deviceStatus));
try {
bool allSwitchesValue = true;
@ -550,7 +583,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
});
emit(UpdateGroupState(twoTouchList: groupTwoTouchList, allSwitches: allSwitchesValue));
emit(UpdateGroupState(
twoTouchList: groupTwoTouchList, allSwitches: allSwitchesValue));
final response = await DevicesAPI.deviceBatchController(
code: 'switch_1',
devicesUuid: [event.deviceId],
@ -565,8 +599,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
}
void _changeSecondWizardSwitch(
ChangeSecondWizardSwitchStatusEvent event, Emitter<TwoTouchState> emit) async {
void _changeSecondWizardSwitch(ChangeSecondWizardSwitchStatusEvent event,
Emitter<TwoTouchState> emit) async {
emit(LoadingNewSate(twoTouchModel: deviceStatus));
try {
bool allSwitchesValue = true;
@ -579,7 +613,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
}
});
emit(UpdateGroupState(twoTouchList: groupTwoTouchList, allSwitches: allSwitchesValue));
emit(UpdateGroupState(
twoTouchList: groupTwoTouchList, allSwitches: allSwitchesValue));
final response = await DevicesAPI.deviceBatchController(
code: 'switch_2',
@ -598,7 +633,8 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
String statusSelected = '';
String optionSelected = '';
Future<void> _changeStatus(ChangeStatusEvent event, Emitter<TwoTouchState> emit) async {
Future<void> _changeStatus(
ChangeStatusEvent event, Emitter<TwoTouchState> emit) async {
try {
emit(LoadingInitialState());
final Map<String, Map<String, String>> controlMap = {
@ -627,11 +663,15 @@ class TwoTouchBloc extends Bloc<TwoTouchEvent, TwoTouchState> {
final selectedControl = controlMap[optionSelected]?[statusSelected];
if (selectedControl != null) {
await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: twoTouchId, code: optionSelected, value: selectedControl),
DeviceControlModel(
deviceId: twoTouchId,
code: optionSelected,
value: selectedControl),
twoTouchId,
);
} else {
emit(const FailedState(error: 'Invalid statusSelected or optionSelected'));
emit(const FailedState(
error: 'Invalid statusSelected or optionSelected'));
}
} on DioException catch (e) {
final errorData = e.response!.data;

View File

@ -18,6 +18,7 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
on<ChangeIndicatorEvent>(_changeIndicator);
on<ChangeValueEvent>(_changeValue);
on<WallSensorUpdatedEvent>(_wallSensorUpdated);
on<GetDeviceReportsEvent>(_getDeviceReports);
}
void _fetchCeilingSensorStatus(InitialEvent event, Emitter<WallSensorState> emit) async {
@ -91,4 +92,17 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
} catch (_) {}
emit(UpdateState(wallSensorModel: deviceStatus));
}
void _getDeviceReports(GetDeviceReportsEvent event, Emitter<WallSensorState> emit) async {
emit(LoadingInitialState());
try {
await DevicesAPI.getDeviceReports(deviceId, event.code).then((value) {
emit(DeviceReportsState(deviceReport: value, code: event.code));
});
} catch (e) {
emit(FailedState(error: e.toString()));
return;
}
}
}

View File

@ -29,3 +29,15 @@ class ChangeValueEvent extends WallSensorEvent {
@override
List<Object> get props => [value, code];
}
class GetDeviceReportsEvent extends WallSensorEvent {
final String deviceUuid;
final String code;
const GetDeviceReportsEvent({
required this.deviceUuid,
required this.code,
});
@override
List<Object> get props => [deviceUuid, code];
}

View File

@ -1,4 +1,5 @@
import 'package:equatable/equatable.dart';
import 'package:syncrow_app/features/devices/model/device_report_model.dart';
import 'package:syncrow_app/features/devices/model/wall_sensor_model.dart';
class WallSensorState extends Equatable {
@ -36,3 +37,9 @@ class FailedState extends WallSensorState {
@override
List<Object> get props => [error];
}
class DeviceReportsState extends WallSensorState {
final DeviceReport deviceReport;
final String code;
const DeviceReportsState({required this.deviceReport, required this.code});
}

View File

@ -10,6 +10,9 @@ class DeviceModel {
String? model;
String? name;
String? icon;
String? categoryName;
bool? toggleStatus = false;
String? type;
bool? isOnline;
List<StatusModel> status = [];
@ -21,6 +24,8 @@ class DeviceModel {
DeviceType? productType;
bool isSelected = false;
late List<FunctionModel> functions;
DeviceSubspace? subspace;
DeviceModel(
{this.activeTime,
this.productUuid,
@ -34,6 +39,9 @@ class DeviceModel {
this.updateTime,
this.uuid,
this.productType,
this.categoryName,
this.subspace,
this.toggleStatus,
this.icon,
this.type}) {
functions = getFunctions(productType!);
@ -87,23 +95,74 @@ class DeviceModel {
} else {
tempIcon = Assets.assetsIconsLogo;
}
// Step 1: Parse `status` as before
final statusList = (json['status'] as List<dynamic>?)
?.map((st) => StatusModel.fromJson(st as Map<String, dynamic>))
.toList();
// Step 2: Check whether ANY status means "off"
final anyOff = statusList?.any((s) {
final code = s.code;
if (code == null) return false;
// 1) Handle "switch" or "switch_x"
if (code == 'switch' || code.startsWith('switch_')) {
// If it's false, we consider that "off"
return s.value == false;
}
// 2) If code == "control" and value == "stop", consider "off"
if (s.value == 'open') {
return true;
}
// 3) If code == "percent_control" and value == 0, maybe "off"
if (code == 'percent_control' && s.value == 0) {
return true;
}
// Add more conditions for other codes as needed
// Default: if none of the above apply, it's not "off"
return false;
});
// Step 3: Decide final toggleStatus (true = fully "on", false = partially/fully "off")
bool computedToggleStatus = !(anyOff ?? false);
return DeviceModel(
icon: tempIcon,
activeTime: json['activeTime'],
// id: json['id'],
localKey: json['localKey'],
model: json['model'],
name: json['name'],
isOnline: json['online'],
productName: json['productName'],
timeZone: json['timeZone'],
updateTime: json['updateTime'],
uuid: json['uuid'],
productType: type,
type: json['productType'],
status: [],
productUuid: json['productUuid']);
icon: tempIcon,
activeTime: json['activeTime'],
categoryName: json['categoryName'],
localKey: json['localKey'],
model: json['model'],
name: json['name'],
isOnline: json['online'],
productName: json['productName'],
timeZone: json['timeZone'],
updateTime: json['updateTime'],
uuid: json['uuid'],
productType: type,
type: json['productType'],
// Use the newly computed toggleStatus:
toggleStatus: computedToggleStatus,
// Or if you prefer to use the value returned by the backend when available:
// toggleStatus: json['toggleStatus'] ?? computedToggleStatus,
status: statusList ?? [],
subspace: json['subspace'] != null
? DeviceSubspace.fromJson(json['subspace'])
: DeviceSubspace(
createdAt: null,
disabled: false,
subspaceName: '',
updatedAt: null,
uuid: '',
),
productUuid: json['productUuid'],
);
}
Map<String, dynamic> toJson() {
@ -118,9 +177,50 @@ class DeviceModel {
'updateTime': updateTime,
'uuid': uuid,
'productType': productType,
'subspace': subspace?.toJson(), // serialize subspace
};
}
List<FunctionModel> getFunctions(DeviceType type) =>
devicesFunctionsMap[productType] ?? [];
}
class DeviceSubspace {
String? uuid;
DateTime? createdAt;
DateTime? updatedAt;
String? subspaceName;
bool? disabled;
DeviceSubspace({
this.uuid,
this.createdAt,
this.updatedAt,
this.subspaceName,
this.disabled,
});
factory DeviceSubspace.fromJson(Map<String, dynamic> json) {
return DeviceSubspace(
uuid: json['uuid'],
createdAt: json['createdAt'] != null
? DateTime.tryParse(json['createdAt'])
: null,
updatedAt: json['updatedAt'] != null
? DateTime.tryParse(json['updatedAt'])
: null,
subspaceName: json['subspaceName'],
disabled: json['disabled'],
);
}
Map<String, dynamic> toJson() {
return {
'uuid': uuid,
'createdAt': createdAt?.toIso8601String(),
'updatedAt': updatedAt?.toIso8601String(),
'subspaceName': subspaceName,
'disabled': disabled,
};
}
}

View File

@ -9,17 +9,18 @@ class WallSensorModel {
int currentDistance;
int illuminance;
bool indicator;
int noOneTime;
WallSensorModel({
required this.presenceState,
required this.farDetection,
required this.presenceTime,
required this.motionSensitivity,
required this.motionlessSensitivity,
required this.currentDistance,
required this.illuminance,
required this.indicator,
});
WallSensorModel(
{required this.presenceState,
required this.farDetection,
required this.presenceTime,
required this.motionSensitivity,
required this.motionlessSensitivity,
required this.currentDistance,
required this.illuminance,
required this.indicator,
required this.noOneTime});
factory WallSensorModel.fromJson(List<StatusModel> jsonList) {
late String _presenceState;
@ -30,6 +31,7 @@ class WallSensorModel {
late int _currentDistance;
late int _illuminance;
late bool _indicator;
late int _noOneTime;
for (int i = 0; i < jsonList.length; i++) {
if (jsonList[i].code == 'presence_state') {
@ -48,6 +50,8 @@ class WallSensorModel {
_illuminance = jsonList[i].value ?? 0;
} else if (jsonList[i].code == 'indicator') {
_indicator = jsonList[i].value ?? false;
} else if (jsonList[i].code == 'no_one_time') {
_noOneTime = jsonList[i].value ?? 0;
}
}
return WallSensorModel(
@ -58,6 +62,7 @@ class WallSensorModel {
motionlessSensitivity: _motionlessSensitivity,
currentDistance: _currentDistance,
illuminance: _illuminance,
indicator: _indicator);
indicator: _indicator,
noOneTime: _noOneTime);
}
}

View File

@ -38,8 +38,10 @@ class SettingProfilePage extends StatelessWidget {
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
return state is DeviceSettingLoadingState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: RefreshIndicator(
onRefresh: () async {
@ -55,15 +57,18 @@ class SettingProfilePage extends StatelessWidget {
child: SvgPicture.asset(
Assets.sosHomeIcon,
fit: BoxFit.fitHeight,
height: MediaQuery.of(context).size.height * 0.13,
height:
MediaQuery.of(context).size.height * 0.13,
))
: CircleAvatar(
radius: 55,
backgroundColor: ColorsManager.graysColor,
child: ClipOval(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Center(
child: SvgPicture.asset(
@ -71,7 +76,10 @@ class SettingProfilePage extends StatelessWidget {
? Assets.fourSceneIcon
: Assets.sixSceneIcon,
fit: BoxFit.contain,
height: MediaQuery.of(context).size.height * 0.08,
height: MediaQuery.of(context)
.size
.height *
0.08,
),
),
],
@ -89,7 +97,8 @@ class SettingProfilePage extends StatelessWidget {
children: [
IntrinsicWidth(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 200),
constraints:
const BoxConstraints(maxWidth: 200),
child: TextFormField(
maxLength: 30,
style: const TextStyle(
@ -122,7 +131,8 @@ class SettingProfilePage extends StatelessWidget {
Assets.sosEditProfile,
color: Colors.grey,
fit: BoxFit.contain,
height: MediaQuery.of(context).size.height * 0.02,
height: MediaQuery.of(context).size.height *
0.02,
),
),
),
@ -141,15 +151,17 @@ class SettingProfilePage extends StatelessWidget {
padding: const EdgeInsets.all(20),
child: InkWell(
onTap: () async {
bool? val = await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => LocationSettingPage(
space: spaces!.first,
deviceId: device?.uuid ?? '',
)),
);
if (val != null && val == true) {
_bloc.add(const DeviceSettingInitialInfo());
if (HomeCubit.visitorPasswordManagement) {
bool? val = await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => LocationSettingPage(
space: spaces!.first,
deviceId: device?.uuid ?? '',
)),
);
if (val != null && val == true) {
_bloc.add(const DeviceSettingInitialInfo());
}
}
},
child: Row(
@ -162,7 +174,8 @@ class SettingProfilePage extends StatelessWidget {
children: [
SizedBox(
child: BodyMedium(
text: _bloc.deviceInfo.subspace.subspaceName,
text: _bloc
.deviceInfo.subspace.subspaceName,
fontColor: ColorsManager.textGray,
),
),

View File

@ -1,9 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/model/ac_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_controls.dart';
@ -71,6 +73,7 @@ class AcInterface extends StatelessWidget {
onTap: () {
BlocProvider.of<ACsBloc>(context)
.add(AcSwitch(acSwitch: statusModel.acSwitch));
},
child: SvgPicture.asset(Assets.acSwitchIcon))
],

View File

@ -43,6 +43,7 @@ class AcInterfaceControls extends StatelessWidget {
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
AcTimerPage(
deviceStatus: deviceStatus,
device: deviceModel,
deviceCode: deviceModel.type!,
switchCode: '',

View File

@ -7,7 +7,7 @@ import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_st
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
import 'package:syncrow_app/features/devices/model/ac_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/ACs/custom_halfhour_timer_picker.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
@ -20,10 +20,13 @@ class AcTimerPage extends StatelessWidget {
final DeviceModel device;
final String deviceCode;
final String switchCode;
final AcStatusModel deviceStatus;
const AcTimerPage(
{required this.device,
required this.deviceCode,
required this.switchCode,
required this.deviceStatus,
super.key});
@override
@ -37,27 +40,24 @@ class AcTimerPage extends StatelessWidget {
create: (context) => ACsBloc(acId: device.uuid ?? ''),
child: BlocBuilder<ACsBloc, AcsState>(
builder: (context, state) {
final oneGangBloc = BlocProvider.of<ACsBloc>(context);
final acBloc = BlocProvider.of<ACsBloc>(context);
Duration duration = Duration.zero;
int selectedValue = 0;
int countNum = 0;
if (state is UpdateTimerState) {
if (state is AcsInitialState) {
acBloc.add(GetCounterEvent(deviceCode: deviceCode));
} else if (state is UpdateTimerState) {
countNum = state.seconds;
} else if (state is TimerRunInProgress) {
countNum = state.remainingTime;
} else if (state is TimerRunComplete) {
countNum = 0;
}
// else if (state is LoadingNewSate) {
// countNum = 0;
// }
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (!didPop) {
oneGangBloc.add(OnClose());
acBloc.add(OnClose());
Navigator.pop(context);
}
},
@ -90,7 +90,7 @@ class AcTimerPage extends StatelessWidget {
),
),
Center(
child: Container(
child: SizedBox(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
@ -102,7 +102,7 @@ class AcTimerPage extends StatelessWidget {
.slidingBlueColor,
fontSize: 40,
)
: Container(
: SizedBox(
child: CustomHalfHourPicker(
onValueChanged: (value) {
selectedValue =
@ -120,8 +120,6 @@ class AcTimerPage extends StatelessWidget {
countNum =
duration.inSeconds;
}
print(
"Selected Value: $selectedValue, Duration: $duration");
},
),
),
@ -131,12 +129,14 @@ class AcTimerPage extends StatelessWidget {
return;
}
if (countNum > 0) {
oneGangBloc.add(SetCounterValue(
acBloc.add(SetCounterValue(
seconds: countNum,
deviceCode:'countdown_time',
deviceCode:
'countdown_time',
duration: selectedValue));
} else if (duration != Duration.zero) {
oneGangBloc.add(SetCounterValue(
} else if (duration !=
Duration.zero) {
acBloc.add(SetCounterValue(
seconds: 0,
deviceCode:
'countdown_time',

View File

@ -22,8 +22,6 @@ class ACsView extends StatelessWidget {
@override
Widget build(BuildContext context) {
print("ACsView deviceModel UUID: ${deviceModel?.uuid}");
return BlocProvider(
create: (context) => ACsBloc(acId: deviceModel?.uuid ?? '')
..add(AcsInitial(allAcs: deviceModel != null ? false : true)),
@ -40,6 +38,7 @@ class ACsView extends StatelessWidget {
extendBody: true,
appBar: deviceModel != null
? DeviceAppbar(
value: true,
deviceName: deviceModel!.name!,
deviceUuid: deviceModel!.uuid!,
)

View File

@ -0,0 +1,110 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/devices/view/widgets/room_page_switch.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class AllDevices extends StatefulWidget {
const AllDevices({super.key, required this.allDevices});
final List<DeviceModel> allDevices;
@override
_AllDevicesState createState() => _AllDevicesState();
}
class _AllDevicesState extends State<AllDevices> {
final TextEditingController _searchController = TextEditingController();
List<DeviceModel> _filteredDevices = [];
@override
void initState() {
super.initState();
_filteredDevices = widget.allDevices ?? [];
_searchController.addListener(_filterDevices);
}
@override
void dispose() {
_searchController.removeListener(_filterDevices);
_searchController.dispose();
super.dispose();
}
void _filterDevices() {
final query = _searchController.text.toLowerCase();
setState(() {
_filteredDevices = widget.allDevices!
.where((device) => device.name!.toLowerCase().contains(query))
.toList();
});
}
@override
Widget build(BuildContext context) {
return Column(
children: [
if (widget.allDevices.isNotEmpty)
TextFormField(
controller: _searchController,
decoration: InputDecoration(
hintText: 'Search',
hintStyle: const TextStyle(
color: ColorsManager.textGray,
fontSize: 16,
fontWeight: FontWeight.w400),
prefixIcon: Container(
padding: const EdgeInsets.all(5.0),
margin: const EdgeInsets.all(10.0),
child: SvgPicture.asset(
Assets.searchIcon,
fit: BoxFit.contain,
),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
),
_filteredDevices.isNotEmpty
? Expanded(
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 1.5,
),
padding: const EdgeInsets.only(top: 10),
itemCount: _filteredDevices.length,
itemBuilder: (context, index) {
return RoomPageSwitch(
allDevices: _filteredDevices,
isAllDevices: true,
device: _filteredDevices[index]);
},
),
)
: widget.allDevices.isNotEmpty
? const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(
'No Results Found',
style: TextStyle(
color: ColorsManager.grayColor,
fontSize: 14,
fontWeight: FontWeight.w400),
)),
],
),
)
: const SizedBox(),
],
);
}
}

View File

@ -250,7 +250,9 @@ class CeilingSensorInterface extends StatelessWidget {
),
] else if (button['title'] == 'Space Type') ...[
Text(
model.spaceType.name.toString(),
model.spaceType.name.toString() == "none"
? "Office"
: model.spaceType.name.toString(),
style: const TextStyle(color: Colors.black),
),
] else ...[
@ -299,7 +301,13 @@ class CeilingSensorInterface extends StatelessWidget {
);
if (result != null) {
bloc.add(ChangeValueEvent(
type: title.toString(), value: result, code: 'nobody_time'));
type: title.toString(),
value: result
.toString()
.toLowerCase()
.replaceAll('sec', 's')
.replaceAll('1hr', '1hour'),
code: 'nobody_time'));
}
} else if (title == 'Maximum Distance') {
final result = await _showDialog(
@ -336,7 +344,7 @@ class CeilingSensorInterface extends StatelessWidget {
context,
MaterialPageRoute(builder: (context) => const CeilingHelpDescription()),
);
} else if (title == 'Induction History') {
} else if (title == 'Presence Record') {
Navigator.push(
context,
MaterialPageRoute(
@ -385,7 +393,7 @@ class CeilingSensorInterface extends StatelessWidget {
'val': nobodyTimeVal,
},
{
'title': 'Induction History',
'title': 'Presence Record',
'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
'page': null,
'withArrow': false,

View File

@ -31,12 +31,12 @@ class MaxDistanceControl extends StatefulWidget {
}
int _parseValue(String value) {
if (value.endsWith('sec')) {
return int.parse(value.replaceAll('sec', '').trim());
if (value.endsWith('s')) {
return int.parse(value.replaceAll('s', '').trim());
} else if (value.endsWith('min')) {
return int.parse(value.replaceAll('min', '').trim()) * 60;
} else if (value.endsWith('hr')) {
return int.parse(value.replaceAll('hr', '').trim()) * 3600;
} else if (value.endsWith('hour')) {
return int.parse(value.replaceAll('hour', '').trim()) * 3600;
}
return 0; // Default to 0 if the format is unrecognized
}
@ -58,7 +58,7 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
String _formatLabel(double seconds) {
if (seconds == 0) return 'None';
if (seconds < 60) return '${seconds.toInt()}sec';
if (seconds < 60) return '${seconds.toInt()}s';
if (seconds < 3600) {
final minutes = (seconds / 60).round();
return '${minutes}min';
@ -90,7 +90,6 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
@override
Widget build(BuildContext context) {
final double currentSeconds = _stepValues[_currentIndex];
return Dialog(
child: Container(
decoration: BoxDecoration(
@ -128,7 +127,9 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
TitleMedium(
text: _formatLabel(currentSeconds),
text: _formatLabel(currentSeconds)
.replaceAll('1hr', '1hour')
.replaceAllMapped(RegExp(r's$'), (match) => 'sec'),
style: context.titleMedium.copyWith(
color: Colors.black,
fontWeight: FontsManager.bold,

View File

@ -90,9 +90,7 @@ class PresenceRecord extends StatelessWidget {
: Colors.grey,
),
title: Text(
record.value == 'true'
? "Opened"
: "Closed",
record.value.toString(),
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,

View File

@ -106,12 +106,11 @@ class _PresenceSpaceTypeDialogState extends State<PresenceSpaceTypeDialog> {
padding: const EdgeInsets.all(10),
child: SvgPicture.asset(
icon,
),
),
const SizedBox(height: 4),
Text(
title,
title == "None" ? "Office" : title,
style: Theme.of(context)
.textTheme
.bodySmall

View File

@ -6,6 +6,7 @@ import 'package:syncrow_app/features/devices/bloc/curtain_bloc/curtain_event.dar
import 'package:syncrow_app/features/devices/bloc/curtain_bloc/curtain_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_buttons.dart';
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/generated/assets.dart';
@ -33,11 +34,17 @@ class CurtainView extends StatelessWidget {
// blindHeight = state.blindHeight;
}
return DefaultScaffold(
appBar: DeviceAppbar(
deviceName: curtain!.name!,
deviceUuid: curtain!.uuid!,
),
title: curtain.name,
child: state is CurtainLoadingState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: RefreshIndicator(
onRefresh: () async {
@ -62,37 +69,56 @@ class CurtainView extends StatelessWidget {
children: [
SvgPicture.asset(
Assets.assetsIconsCurtainsIconCurtainHolder,
width: MediaQuery.sizeOf(context).width * 0.75,
width:
MediaQuery.sizeOf(context).width * 0.75,
),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.75,
width:
MediaQuery.sizeOf(context).width * 0.75,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.025,
width:
MediaQuery.sizeOf(context).width *
0.025,
),
AnimatedContainer(
duration: const Duration(milliseconds: 200),
duration:
const Duration(milliseconds: 200),
curve: Curves.linear,
height: MediaQuery.sizeOf(context).height * 0.35,
width: MediaQuery.sizeOf(context).width * 0.35,
height: MediaQuery.sizeOf(context)
.height *
0.35,
width:
MediaQuery.sizeOf(context).width *
0.35,
child: Stack(
children: List.generate(
4,
(index) {
double spacing = curtainWidth / 7.5;
double leftMostPosition = index * spacing;
double spacing =
curtainWidth / 7.5;
double leftMostPosition =
index * spacing;
return AnimatedPositioned(
duration: const Duration(milliseconds: 200),
duration: const Duration(
milliseconds: 200),
curve: Curves.linear,
left: leftMostPosition,
child: SizedBox(
height:
MediaQuery.sizeOf(context).height * 0.35,
width: MediaQuery.sizeOf(context).width * 0.08,
height: MediaQuery.sizeOf(
context)
.height *
0.35,
width: MediaQuery.sizeOf(
context)
.width *
0.08,
child: SvgPicture.asset(
Assets.assetsIconsCurtainsIconVerticalBlade,
Assets
.assetsIconsCurtainsIconVerticalBlade,
fit: BoxFit.fill,
),
),
@ -102,23 +128,37 @@ class CurtainView extends StatelessWidget {
),
),
AnimatedContainer(
duration: const Duration(milliseconds: 200),
duration:
const Duration(milliseconds: 200),
curve: Curves.linear,
height: MediaQuery.sizeOf(context).height * 0.35,
width: MediaQuery.sizeOf(context).width * 0.35,
height: MediaQuery.sizeOf(context)
.height *
0.35,
width:
MediaQuery.sizeOf(context).width *
0.35,
child: Stack(
children: List.generate(
4,
(index) {
double spacing = curtainWidth / 7.5;
double rightMostPosition = index * spacing;
double spacing =
curtainWidth / 7.5;
double rightMostPosition =
index * spacing;
return AnimatedPositioned(
duration: const Duration(milliseconds: 200),
duration: const Duration(
milliseconds: 200),
curve: Curves.linear,
right: rightMostPosition,
child: SizedBox(
height: MediaQuery.sizeOf(context).height * 0.35,
width: MediaQuery.sizeOf(context).width * 0.08,
height: MediaQuery.sizeOf(
context)
.height *
0.35,
width: MediaQuery.sizeOf(
context)
.width *
0.08,
child: SvgPicture.asset(
Assets.rightVerticalBlade,
fit: BoxFit.fill,
@ -130,7 +170,9 @@ class CurtainView extends StatelessWidget {
),
),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.025,
width:
MediaQuery.sizeOf(context).width *
0.025,
),
],
),

View File

@ -1,3 +1,4 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
@ -6,14 +7,27 @@ import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
class DeviceAppbar extends StatelessWidget implements PreferredSizeWidget {
final String deviceName;
final String deviceUuid;
final bool? value;
final double appBarHeight = 56.0;
final void Function()? onPressed;
const DeviceAppbar(
{super.key, required this.deviceName, required this.deviceUuid, this.onPressed});
{super.key,
required this.deviceName,
this.value,
required this.deviceUuid,
this.onPressed});
@override
Widget build(BuildContext context) {
return AppBar(
leading: IconButton(
onPressed: () {
Navigator.of(context).pop(value ?? true);
},
icon: Icon(
Platform.isIOS ? Icons.arrow_back_ios : Icons.arrow_back,
)),
backgroundColor: Colors.transparent,
centerTitle: true,
title: BodyLarge(

View File

@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/all_devices.dart';
import 'package:syncrow_app/features/devices/view/widgets/room_page.dart';
import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart';
import 'package:syncrow_app/features/devices/view/widgets/wizard_page.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
import 'package:syncrow_app/features/scene/view/scene_view.dart';
import 'package:syncrow_app/features/shared_widgets/create_unit.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
@ -14,103 +14,123 @@ import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.da
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
class DevicesViewPage extends StatelessWidget {
const DevicesViewPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => SceneBloc(), // Initialize your SceneBloc here
child: DevicesViewBody(),
);
}
}
class DevicesViewBody extends StatelessWidget {
const DevicesViewBody({
super.key,
});
const DevicesViewBody({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocBuilder<DevicesCubit, DevicesState>(
builder: (context, state) {
if (state is DevicesLoading ||
state is GetDevicesLoading ||
state is DevicesCategoriesLoading) {
return const Center(child: CircularProgressIndicator());
} else {
return HomeCubit.getInstance().spaces?.isEmpty ?? true
? const CreateUnitWidget()
: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
TitleMedium(
text: StringsManager.devices,
style: context.titleMedium.copyWith(
fontSize: 25,
),
),
],
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.1,
child: const SceneView(
pageType: true,
)),
const SizedBox(
height: 20,
),
const RoomsSlider(),
const SizedBox(
height: 10,
),
Expanded(
child: PageView(
controller: HomeCubit.getInstance().devicesPageController,
onPageChanged: (index) {
HomeCubit.getInstance().devicesPageChanged(index);
},
children: [
WizardPage(
groupsList: DevicesCubit.getInstance().allCategories ?? [],
),
if (HomeCubit.getInstance().selectedSpace != null)
...HomeCubit.getInstance().selectedSpace!.subspaces.map(
(room) {
return RoomPage(
room: room,
);
},
)
],
),
),
HomeCubit.getInstance().selectedSpace != null
? Padding(
padding: const EdgeInsets.symmetric(
vertical: 7,
),
child: SmoothPageIndicator(
controller: HomeCubit.getInstance().devicesPageController,
count: HomeCubit.getInstance().selectedSpace!.subspaces.length + 1,
effect: const WormEffect(
paintStyle: PaintingStyle.stroke,
dotHeight: 8,
dotWidth: 8,
),
),
)
: const Center(
child: BodyLarge(text: 'No Home Found'),
),
],
);
return BlocBuilder<HomeCubit, HomeState>(
builder: (context, homeState) {
final homeCubit = HomeCubit.getInstance();
// Handle state priority: Errors first
if (homeState is ActivationError) {
return const CreateUnitWidget();
}
// Handle loading states
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
return const Center(child: CircularProgressIndicator());
}
// Handle error states
if (homeState is GetSpacesError) {
return const CreateUnitWidget();
}
// Handle success states
if (homeState is GetSpacesSuccess ||
homeState is RoomUnSelected ||
homeState is RoomSelected ||
homeState is NavChangePage ||
homeState is GetSpaceRoomsSuccess) {
// Show empty state if no spaces
if (homeCubit.spaces.isEmpty) {
return const CreateUnitWidget();
}
return BlocBuilder<DevicesCubit, DevicesState>(
builder: (context, devicesState) {
// Devices loading states
if (devicesState is DevicesLoading ||
devicesState is DevicesCategoriesLoading ||
devicesState is GetDevicesLoading) {
return const Center(child: CircularProgressIndicator());
}
// Devices error state
if (devicesState is GetDevicesError) {
return Center(child: BodyLarge(text: devicesState.errorMsg));
}
// Main content for both GetSpacesSuccess and RoomUnSelected
return _buildMainContent(context, homeCubit);
},
);
}
// Fallback for unknown states
return const Center(child: BodyLarge(text: ''));
},
);
}
Widget _buildMainContent(BuildContext context, HomeCubit homeCubit) {
final devicesCubit = context.read<DevicesCubit>();
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
TitleMedium(
text: StringsManager.devices,
style: context.titleMedium.copyWith(fontSize: 25),
),
],
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.1,
child: const SceneView(pageType: true),
),
const SizedBox(height: 20),
const RoomsSlider(),
const SizedBox(height: 10),
Expanded(
child: PageView(
controller: homeCubit.devicesPageController,
onPageChanged: (index) {
homeCubit.devicesPageChanged(index);
if (index == 0) {
devicesCubit.fetchAllDevices(homeCubit.selectedSpace);
}
},
children: [
AllDevices(
allDevices: devicesCubit.allDevices,
),
WizardPage(
groupsList: devicesCubit.allCategories ?? [],
),
if (homeCubit.selectedSpace != null)
...homeCubit.selectedSpace!.subspaces.map(
(room) => RoomPage(room: room),
),
],
),
),
_buildPageIndicator(homeCubit),
],
);
}
Widget _buildPageIndicator(HomeCubit homeCubit) {
return homeCubit.selectedSpace != null
? Padding(
padding: const EdgeInsets.symmetric(vertical: 7),
child: SmoothPageIndicator(
controller: homeCubit.devicesPageController,
count: homeCubit.selectedSpace!.subspaces.length + 2,
effect: const WormEffect(
paintStyle: PaintingStyle.stroke,
dotHeight: 8,
dotWidth: 8,
),
),
)
: const Center(
child: BodyLarge(text: 'No Home Found'),
);
}
}

View File

@ -5,6 +5,7 @@ import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_b
import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_event.dart';
import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_preferences_settings.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_records_screen.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/schedule_garage_screen.dart';
@ -22,6 +23,10 @@ class GarageDoorScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultScaffold(
appBar: DeviceAppbar(
deviceName: device!.name!,
deviceUuid: device!.uuid!,
),
title: 'Garage Door Opener',
child: BlocProvider(
create: (context) => GarageDoorBloc(GDId: device?.uuid ?? '')

View File

@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/six_scene_screen.dart';
@ -28,23 +29,31 @@ import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_interf
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
import 'package:syncrow_app/features/devices/view/widgets/water_heater/water_heater_page.dart';
import 'package:syncrow_app/features/devices/view/widgets/water_leak/water_leak_screen.dart';
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
class RoomPageSwitch extends StatelessWidget {
const RoomPageSwitch({
super.key,
required this.device,
});
const RoomPageSwitch(
{super.key,
required this.device,
this.isAllDevices = false,
this.allDevices});
final DeviceModel device;
final List<DeviceModel>? allDevices;
final bool isAllDevices;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
showDeviceInterface(device, context);
showDeviceInterface(
device: device,
context: context,
isAllDevices: isAllDevices,
allDevices: allDevices);
},
child: DefaultContainer(
padding: const EdgeInsets.all(15),
@ -60,22 +69,38 @@ class RoomPageSwitch extends StatelessWidget {
device.icon!,
fit: BoxFit.contain,
),
// CustomSwitch(
// device: device,
// ),
isAllDevices
? CustomSwitch(
device: device,
)
: const SizedBox(),
],
),
Flexible(
child: FittedBox(
child: Text(
device.name ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: context.bodyLarge.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.grey,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
device.name ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: context.bodyLarge.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.grey,
),
),
Text(
device.subspace!.subspaceName ?? '',
overflow: TextOverflow.ellipsis,
style: context.bodySmall.copyWith(
fontWeight: FontWeight.w400,
fontSize: 10,
color: Colors.grey,
),
),
],
),
),
),
@ -89,14 +114,23 @@ class RoomPageSwitch extends StatelessWidget {
/// Shows the device interface based on the product type of the device.
///
/// The [device] parameter represents the device model.
void showDeviceInterface(DeviceModel device, BuildContext context) {
Future<void> showDeviceInterface(
{required DeviceModel device,
required BuildContext context,
required isAllDevices,
List<DeviceModel>? allDevices}) async {
final devicesCubit = context.read<DevicesCubit>();
switch (device.productType) {
case DeviceType.AC:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
ACsView(deviceModel: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
// navigateToInterface(ACsView(deviceModel: device), context);
break;
case DeviceType.WallSensor:
@ -116,12 +150,15 @@ void showDeviceInterface(DeviceModel device, BuildContext context) {
// navigateToInterface(CeilingSensorInterface(ceilingSensor: device), context);
break;
case DeviceType.Curtain:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) => CurtainView(
curtain: device,
)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
break;
case DeviceType.Blind:
break;
@ -143,30 +180,43 @@ void showDeviceInterface(DeviceModel device, BuildContext context) {
case DeviceType.LightBulb:
navigateToInterface(LightInterface(light: device), context);
case DeviceType.OneGang:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
OneGangInterface(gangSwitch: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.TwoGang:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
TwoGangInterface(gangSwitch: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.ThreeGang:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
ThreeGangInterface(gangSwitch: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.WH:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
WaterHeaterPage(device: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.DS:
Navigator.push(
context,
@ -182,31 +232,43 @@ void showDeviceInterface(DeviceModel device, BuildContext context) {
PowerClampPage(device: device)));
case DeviceType.OneTouch:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
OneTouchScreen(device: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.TowTouch:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
TwoTouchInterface(touchSwitch: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.ThreeTouch:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
ThreeTouchInterface(touchSwitch: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.GarageDoor:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
GarageDoorScreen(device: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.WaterLeak:
Navigator.push(
@ -216,18 +278,24 @@ void showDeviceInterface(DeviceModel device, BuildContext context) {
WaterLeakScreen(device: device)));
case DeviceType.SixScene:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
SixSceneScreen(device: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.FourScene:
Navigator.push(
var value = await Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
FourSceneScreen(device: device)));
if (value && isAllDevices) {
devicesCubit.fetchAllDevices(HomeCubit.getInstance().selectedSpace);
}
case DeviceType.SOS:
Navigator.push(

View File

@ -23,6 +23,21 @@ class RoomsSlider extends StatelessWidget {
HomeCubit.getInstance().roomSliderPageChanged(index);
},
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: InkWell(
onTap: () {
HomeCubit.getInstance().unselectRoom();
},
child: TitleMedium(
text: 'All Devices',
style: context.titleMedium.copyWith(
fontSize: 25,
color: ColorsManager.textPrimaryColor,
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: InkWell(
@ -43,7 +58,10 @@ class RoomsSlider extends StatelessWidget {
(room) => InkWell(
onTap: () {
HomeCubit.getInstance().roomSliderPageChanged(
HomeCubit.getInstance().selectedSpace!.subspaces.indexOf(room));
HomeCubit.getInstance()
.selectedSpace!
.subspaces
.indexOf(room));
},
child: TitleMedium(
text: room.name!,
@ -51,7 +69,8 @@ class RoomsSlider extends StatelessWidget {
fontSize: 25,
color: HomeCubit.getInstance().selectedRoom == room
? ColorsManager.textPrimaryColor
: ColorsManager.textPrimaryColor.withOpacity(.2),
: ColorsManager.textPrimaryColor
.withOpacity(.2),
),
),
),

View File

@ -1,14 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/smart_scene/smart_scene_select_dart_bloc.dart';
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
import 'package:syncrow_app/features/scene/model/scene_settings_route_arguments.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
import 'package:syncrow_app/features/scene/model/scenes_model.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/generated/assets.dart';
import 'package:syncrow_app/navigation/routing_constants.dart';
class SceneListview extends StatelessWidget {
final List<ScenesModel> scenes;
@ -31,23 +28,28 @@ class SceneListview extends StatelessWidget {
padding: const EdgeInsets.only(right: 10),
child: DefaultContainer(
onTap: () {
Navigator.pushNamed(
context,
Routes.sceneTasksRoute,
arguments: SceneSettingsRouteArguments(
sceneType: CreateSceneEnum.tabToRun.name,
sceneId: scene.id,
sceneName: scene.name,
),
);
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
context
.read<SceneBloc>()
.add(SceneTrigger(scene.id, scene.name));
// Navigator.pushNamed(
// context,
// Routes.sceneTasksRoute,
// arguments: SceneSettingsRouteArguments(
// sceneType: CreateSceneEnum.tabToRun.name,
// sceneId: scene.id,
// sceneName: scene.name,
// ),
// );
// context.read<SmartSceneSelectBloc>()
// .add(const SmartSceneClearEvent());
BlocProvider.of<CreateSceneBloc>(context)
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
// BlocProvider.of<CreateSceneBloc>(context).add(
// FetchSceneTasksEvent(
// sceneId: scene.id, isAutomation: false));
/// the state to set the scene type must be after the fetch
BlocProvider.of<CreateSceneBloc>(context)
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
// /// the state to set the scene type must be after the fetch
// BlocProvider.of<CreateSceneBloc>(context)
// .add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
},
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.4,
@ -62,7 +64,8 @@ class SceneListview extends StatelessWidget {
height: 32,
width: 32,
fit: BoxFit.fill,
errorBuilder: (context, error, stackTrace) => Image.asset(
errorBuilder: (context, error, stackTrace) =>
Image.asset(
Assets.assetsIconsLogo,
height: 32,
width: 32,

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/members_management_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/smart_linkage_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/temporary_password_page.dart';
@ -14,6 +15,8 @@ class DoorLockGrid extends StatelessWidget {
@override
Widget build(BuildContext context) {
final buttons = doorLockButtons(val: uuid);
return GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
@ -23,14 +26,15 @@ class DoorLockGrid extends StatelessWidget {
crossAxisSpacing: 10,
childAspectRatio: 1.75 / 1,
),
itemCount: 4,
itemCount: buttons.length,
itemBuilder: (context, index) => DefaultContainer(
onTap: () {
//TODO: remove checking after adding the pages
doorLockButtons()[index]['page'] != null
? Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => doorLockButtons(val: uuid)[index]['page'] as Widget,
builder: (context) =>
doorLockButtons(val: uuid)[index]['page'] as Widget,
),
)
: null;
@ -75,11 +79,12 @@ List<Map<String, dynamic>> doorLockButtons({val}) => [
'image': Assets.assetsIconsDoorlockAssetsMembersManagement,
'page': const MembersManagementView(),
},
{
'title': 'Temporary Password',
'image': Assets.assetsIconsDoorlockAssetsTemporaryPassword,
'page': TemporaryPasswordPage(deviceId: val),
},
if (HomeCubit.manageDeviceLocation)
{
'title': 'Temporary Password',
'image': Assets.assetsIconsDoorlockAssetsTemporaryPassword,
'page': TemporaryPasswordPage(deviceId: val),
},
{
'title': 'Smart Linkage',
'image': Assets.assetsIconsDoorlockAssetsSmartLinkage,

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/two_touch_bloc/two_touch_bloc.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
import 'package:syncrow_app/features/devices/view/widgets/two_touch/two_touch_screen.dart';
@ -26,6 +28,7 @@ class TwoTouchInterface extends StatelessWidget {
extendBody: true,
appBar: touchSwitch != null
? DeviceAppbar(
value: true,
deviceName: touchSwitch!.name!,
deviceUuid: touchSwitch!.uuid!,
)

View File

@ -215,8 +215,7 @@ class ParametersList extends StatelessWidget {
{
'icon': Assets.assetsIconsPresenceSensorAssetsEmpty,
'title': 'Nobody Time',
'code': null,
//TODO: Implement the nobody time
'code': 'no_one_time',
},
{
'icon': Assets.assetsIconsPresenceSensorAssetsIndicator,
@ -231,7 +230,7 @@ class ParametersList extends StatelessWidget {
{
'icon': Assets.assetsIconsPresenceSensorAssetsIlluminanceRecord,
'title': 'Illuminance Record',
'code': null
'code': 'illuminance_value'
},
];
}
@ -240,6 +239,7 @@ Widget listItem(Map<String, Object?> wallSensorButton, BuildContext context, Dev
WallSensorModel wallSensorStatus) {
String? unit;
dynamic value;
int noBodyTimeValue;
if (wallSensorButton['code'] != null) {
// if (wallSensor.status.any((element) => element.code == wallSensorButton['code'] as String)) {
// unit = unitsMap[wallSensorButton['code'] as String];
@ -256,12 +256,15 @@ Widget listItem(Map<String, Object?> wallSensorButton, BuildContext context, Dev
} else if (wallSensorButton['code'] == 'illuminance_value') {
unit = unitsMap[wallSensorButton['code'] as String];
value = wallSensorStatus.illuminance;
} else if (wallSensorButton['code'] == 'no_one_time') {
unit = unitsMap[wallSensorButton['code'] as String];
value = wallSensorStatus.noOneTime;
}
}
return DefaultContainer(
margin: const EdgeInsets.only(bottom: 5),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 20),
onTap: () {
onTap: () async {
if (wallSensorButton['page'] != null) {
Navigator.push(
context,
@ -270,6 +273,42 @@ Widget listItem(Map<String, Object?> wallSensorButton, BuildContext context, Dev
),
);
}
if (wallSensorButton['title'] == 'Presence Record') {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PresenceRecords(
deviceId: wallSensor.uuid!,
code: 'presence_state',
title: 'Presence Record',
)),
);
}
if (wallSensorButton['title'] == 'Illuminance Record') {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PresenceRecords(
deviceId: wallSensor.uuid!,
code: 'illuminance_value',
title: 'Illuminance Record',
)),
);
}
if (wallSensorButton['title'] == 'Nobody Time') {
int noBodyTimeValue = value as int;
String controlCode = 'no_one_time';
final result = await showDialog(
context: context,
builder: (context) => ParameterControlDialog(
title: 'Nobody Time', sensor: wallSensor, value: noBodyTimeValue, min: 0, max: 10000),
);
if (result != null) {
BlocProvider.of<WallSensorBloc>(context)
.add(ChangeValueEvent(value: result, code: controlCode));
}
}
},
child: Row(
children: [

View File

@ -0,0 +1,120 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_event.dart';
import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_state.dart';
import 'package:syncrow_app/features/devices/model/device_report_model.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class PresenceRecords extends StatelessWidget {
final String deviceId;
final String code;
final String title;
const PresenceRecords(
{super.key, required this.deviceId, required this.code, required this.title});
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: title,
child: BlocProvider(
create: (context) => WallSensorBloc(deviceId: deviceId)
..add(GetDeviceReportsEvent(deviceUuid: deviceId, code: code)),
child: BlocBuilder<WallSensorBloc, WallSensorState>(builder: (context, state) {
final Map<String, List<DeviceEvent>> groupedRecords = {};
if (state is LoadingInitialState) {
return const Center(
child: DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
);
} else if (state is DeviceReportsState) {
for (var record in state.deviceReport.data ?? []) {
final DateTime eventDateTime = DateTime.fromMillisecondsSinceEpoch(record.eventTime!);
final String formattedDate = DateFormat('EEEE, dd/MM/yyyy').format(eventDateTime);
// Group by formatted date
if (groupedRecords.containsKey(formattedDate)) {
groupedRecords[formattedDate]!.add(record);
} else {
groupedRecords[formattedDate] = [record];
}
}
}
return groupedRecords.isEmpty
? const Center(
child: Text('No records found'),
)
: ListView.builder(
itemCount: groupedRecords.length,
itemBuilder: (context, index) {
final String date = groupedRecords.keys.elementAt(index);
final List<DeviceEvent> recordsForDate = groupedRecords[date]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 5, top: 10),
child: Text(
date,
style: const TextStyle(
color: ColorsManager.grayColor,
fontSize: 13,
fontWeight: FontWeight.w700,
),
),
),
DefaultContainer(
child: Column(
children: [
...recordsForDate.asMap().entries.map((entry) {
final int idx = entry.key;
final DeviceEvent record = entry.value;
final DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch(record.eventTime!);
final String formattedTime =
DateFormat('HH:mm:ss').format(eventDateTime);
return Column(
children: [
Container(
child: ListTile(
leading: Icon(
record.value == 'true'
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: record.value == 'true' ? Colors.blue : Colors.grey,
),
title: Text(
record.value == 'true' ? "Opened" : "Closed",
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
subtitle: Text('$formattedTime'),
),
),
if (idx != recordsForDate.length - 1)
const Divider(
color: ColorsManager.graysColor,
),
],
);
}).toList(),
],
),
),
],
);
},
);
}),
),
);
}
}

View File

@ -1,3 +1,5 @@
import 'dart:ffi';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -9,6 +11,8 @@ import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_e
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/wall_sensor_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_records_screen.dart';
import 'package:syncrow_app/features/devices/view/widgets/wall_sensor/persence_records.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/features/shared_widgets/text_widgets/body_medium.dart';
@ -41,7 +45,8 @@ class WallMountedInterface extends StatelessWidget {
motionlessSensitivity: 0,
currentDistance: 0,
illuminance: 0,
indicator: false);
indicator: false,
noOneTime: 0);
if (state is UpdateState) {
wallSensorModel = state.wallSensorModel;

View File

@ -1,10 +1,12 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/auth/model/user_model.dart';
import 'package:syncrow_app/features/menu/bloc/create_unit_bloc/create_unit_event.dart';
import 'package:syncrow_app/features/menu/bloc/create_unit_bloc/create_unit_state.dart';
import 'package:syncrow_app/services/api/home_creation_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class CreateUnitBloc extends Bloc<CreateUnitEvent, CreateUnitState> {
@ -239,8 +241,13 @@ Future<String> _createNewRoom(
required String communityId}) async {
try {
Map<String, String> body = {'subspaceName': roomName};
Project? project = HomeCubit.getInstance().project;
final response = await HomeCreation.createRoom(
communityId: communityId, spaceId: unitId, body: body);
communityId: communityId,
spaceId: unitId,
body: body,
projectId: project?.uuid ?? TempConst.projectIdDev);
// if (response['data']['uuid'] != '') {
// final result = await _assignToRoom(roomId: response['data']['uuid'], userId: userId);

View File

@ -1,5 +1,6 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart';
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart';
@ -7,6 +8,7 @@ import 'package:syncrow_app/services/api/devices_api.dart';
import 'package:syncrow_app/services/api/home_creation_api.dart';
import 'package:syncrow_app/services/api/home_management_api.dart';
import 'package:syncrow_app/services/api/spaces_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
List<DeviceModel> allDevices = [];
@ -24,8 +26,12 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
FetchRoomsEvent event, Emitter<ManageUnitState> emit) async {
try {
emit(LoadingState());
Project? project = HomeCubit.getInstance().project;
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
event.unit.community.uuid, event.unit.id);
event.unit.community.uuid,
event.unit.id,
project?.uuid ?? TempConst.projectIdDev);
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
} catch (e) {
emit(const ErrorState(message: 'Something went wrong'));
@ -37,11 +43,14 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
FetchDevicesByRoomIdEvent event, Emitter<ManageUnitState> emit) async {
try {
Map<String, bool> roomDevicesId = {};
Project? project = HomeCubit.getInstance().project;
emit(LoadingState());
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
List<String> allDevicesIds = [];
@ -72,14 +81,21 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
AssignRoomEvent event, Emitter<ManageUnitState> emit) async {
try {
Map<String, bool> roomDevicesId = {};
Project? project = HomeCubit.getInstance().project;
emit(LoadingState());
await HomeManagementAPI.assignDeviceToRoom(
event.unit.community.uuid, event.unit.id, event.roomId, event.deviceId);
event.unit.community.uuid,
event.unit.id,
event.roomId,
event.deviceId,
project?.uuid ?? TempConst.projectIdDev);
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
List<String> allDevicesIds = [];
@ -105,19 +121,25 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
}
}
void _unassignDevice(
UnassignRoomEvent event, Emitter<ManageUnitState> emit) async {
try {
Map<String, bool> roomDevicesId = {};
Project? project = HomeCubit.getInstance().project;
emit(LoadingState());
await HomeManagementAPI.unAssignDeviceToRoom(
event.unit.community.uuid, event.unit.id, event.roomId, event.deviceId);
event.unit.community.uuid,
event.unit.id,
event.roomId,
event.deviceId,
project?.uuid ?? TempConst.projectIdDev);
final devicesList = await DevicesAPI.getDevicesByRoomId(
communityUuid: event.unit.community.uuid,
spaceUuid: event.unit.id,
roomId: event.roomId);
roomId: event.roomId,
projectId: project?.uuid ?? TempConst.projectIdDev);
List<String> allDevicesIds = [];
@ -143,18 +165,22 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
}
}
_addNewRoom(AddNewRoom event, Emitter<ManageUnitState> emit) async {
Map<String, String> body = {'subspaceName': event.roomName};
try {
emit(LoadingState());
Project? project = HomeCubit.getInstance().project;
final response = await HomeCreation.createRoom(
communityId: event.unit.community.uuid,
spaceId: event.unit.id,
body: body);
body: body,
projectId: project?.uuid ?? TempConst.projectIdDev);
if (response['data']['uuid'] != '') {
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
event.unit.community.uuid, event.unit.id);
event.unit.community.uuid,
event.unit.id,
project?.uuid ?? TempConst.projectIdDev);
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
await HomeCubit.getInstance().fetchUnitsByUserId();

View File

@ -1,12 +1,184 @@
import 'dart:ui';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/privacy_policy.dart';
import 'package:syncrow_app/features/menu/bloc/user_agreement.dart';
import 'package:syncrow_app/features/menu/view/widgets/join_home/join_home_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/manage_home/manage_home_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/securty/view/securty_view.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/services/api/profile_api.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
part 'menu_state.dart';
class MenuCubit extends Cubit<MenuState> {
MenuCubit() : super(MenuInitial());
static MenuCubit of(context) => BlocProvider.of<MenuCubit>(context);
String name = '';
String userAgreementHtml = "";
String privacyPolicyHtml = "";
Future<void> fetchAgreement() async {
try {
emit(MenuLoading());
final response = await ProfileApi().fetchUserAgreement();
userAgreementHtml = response;
emit(MenuLoaded(userAgreementHtml));
} catch (error) {
emit(MenuError(error.toString()));
}
}
Future<void> fetchPrivacyPolicy() async {
try {
emit(MenuLoading());
final response = await ProfileApi().fetchPrivacyPolicy();
privacyPolicyHtml = response;
emit(MenuLoaded(privacyPolicyHtml));
} catch (error) {
emit(MenuError(error.toString()));
}
}
List<Map<String, Object>> menuSections = [
//Home Management
{
'title': 'Home Management',
'color': ColorsManager.primaryColor,
'buttons': [
// {
// 'title': 'Create a Unit',
// 'Icon': Assets.assetsIconsMenuIconsHomeManagementIconsCreateHome,
// 'page': const CreateUnitView()
// },
{
'title': 'Join a Unit',
'Icon': Assets.assetsIconsMenuIconsHomeManagementIconsJoinAHome,
'page': const JoinHomeView()
},
if (HomeCubit.manageSupSpace)
{
'title': 'Manage Your Units',
'Icon':
Assets.assetsIconsMenuIconsHomeManagementIconsManageYourHome,
'page': const ManageHomeView()
},
],
},
//General Settings
// {
// 'title': 'General Settings',
// 'color': const Color(0xFF023DFE),
// 'buttons': [
// {
// 'title': 'Voice Assistant',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsVoiceAssistant,
// 'page': null
// },
// {
// 'title': 'Temperature unit',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTemperatureUnit,
// 'page': null
// },
// {
// 'title': 'Touch tone on panel',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTouchTone,
// 'page': null
// },
// {
// 'title': 'Language',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsLanguage,
// 'page': null
// },
// {
// 'title': 'Network Diagnosis',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsNetworkDiagnosis,
// 'page': null
// },
// {
// 'title': 'Clear Cache',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsClearCach,
// 'page': null
// },
// ],
// },
// //Messages Center
// {
// 'title': 'Messages Center',
// 'color': const Color(0xFF0088FF),
// 'buttons': [
// {
// 'title': 'Alerts',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsAlerts,
// 'page': null
// },
// {
// 'title': 'Messages',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsMessages,
// 'page': null
// },
// {
// 'title': 'FAQs',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsFAQs,
// 'page': null
// },
// {
// 'title': 'Help & Feedback',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsHelpAndFeedback,
// 'page': null
// },
// ],
// },
//Security And Privacy
{
'title': 'Security And Privacy',
'color': const Color(0xFF8AB9FF),
'buttons': [
{
'title': 'Security',
'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsSecurty,
'page': const SecurtyView()
},
// {
// 'title': 'Privacy',
// 'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsPrivacy,
// 'page': const PrivacyView()
// },
],
},
//Legal Information
{
'title': 'Legal Information',
'color': const Color(0xFF001B72),
'buttons': [
// {
// 'title': 'About',
// 'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsAbout,
// 'page': null
// },
{
'title': 'Privacy Policy',
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsPrivacyPolicy,
'page': const PrivacyPolicy()
},
{
'title': 'User Agreement',
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsUserAgreement,
'page': const UserAgreement()
},
],
},
];
Future<void> fetchMenuSections() async {
emit(MenuLoading());
try {
emit(MenuItemsLoaded(menuSections));
} catch (e) {
emit(MenuError(e.toString()));
}
}
}

View File

@ -3,3 +3,27 @@ part of 'menu_cubit.dart';
abstract class MenuState {}
class MenuInitial extends MenuState {}
class MenuLoading extends MenuState {}
class MenuLoaded extends MenuState {
final String userAgreementHtml;
MenuLoaded(this.userAgreementHtml);
}
class MenuItemsLoaded extends MenuState {
final List<Map<String, Object>> menuSections;
MenuItemsLoaded(this.menuSections);
}
class MenuError extends MenuState {
final String message;
MenuError(this.message);
}
class MenuNameUpdated extends MenuState {
final String name;
MenuNameUpdated(this.name);
}

View File

@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:url_launcher/url_launcher.dart';
class PrivacyPolicy extends StatefulWidget {
const PrivacyPolicy({super.key});
@override
_PrivacyPolicyState createState() => _PrivacyPolicyState();
}
class _PrivacyPolicyState extends State<PrivacyPolicy> {
@override
void initState() {
super.initState();
MenuCubit.of(context).fetchPrivacyPolicy();
}
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: 'Privacy Policy',
child: BlocBuilder<MenuCubit, MenuState>(
builder: (context, state) {
if (state is MenuLoading) {
return const Center(child: CircularProgressIndicator());
} else if (state is MenuLoaded) {
return ListView(
children: [
Html(
data: state.userAgreementHtml.isNotEmpty
? state.userAgreementHtml
: '',
onLinkTap: (url, attributes, element) async {
final uri = Uri.parse(url!);
await launchUrl(uri, mode: LaunchMode.externalApplication);
},
),
],
);
} else if (state is MenuError) {
return Center(
child: Text(
'Error: ${state.message}',
style: const TextStyle(color: Colors.red),
),
);
}
return const Center(child: Text('Loading User Agreement...'));
},
),
);
}
}

View File

@ -23,8 +23,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
String timeZoneSelected = '';
String regionSelected = '';
final TextEditingController searchController = TextEditingController();
final TextEditingController nameController =
TextEditingController(text: '${HomeCubit.user!.firstName} ${HomeCubit.user!.lastName}');
final TextEditingController nameController = TextEditingController(
text: '${HomeCubit.user!.firstName} ${HomeCubit.user!.lastName}');
List<RegionModel> allRegions = [];
List<TimeZone> allTimeZone = [];
@ -77,10 +77,13 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
emit(NameEditingState(editName: editName));
}
void _fetchUserInfo(InitialProfileEvent event, Emitter<ProfileState> emit) async {
void _fetchUserInfo(
InitialProfileEvent event, Emitter<ProfileState> emit) async {
try {
emit(LoadingInitialState());
HomeCubit.user = await ProfileApi().fetchUserInfo(HomeCubit.user!.uuid);
HomeCubit.getInstance().project = HomeCubit.user?.project;
emit(SaveState());
} catch (e) {
emit(FailedState(errorMessage: e.toString()));
@ -88,7 +91,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
Future _fetchTimeZone(TimeZoneInitialEvent event, Emitter<ProfileState> emit) async {
Future _fetchTimeZone(
TimeZoneInitialEvent event, Emitter<ProfileState> emit) async {
emit(LoadingInitialState());
try {
allTimeZone = await ProfileApi.fetchTimeZone();
@ -100,7 +104,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
Future selectTimeZone(SelectTimeZoneEvent event, Emitter<ProfileState> emit) async {
Future selectTimeZone(
SelectTimeZoneEvent event, Emitter<ProfileState> emit) async {
try {
emit(LoadingInitialState());
timeZoneSelected = event.val;
@ -112,7 +117,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
Future selectRegion(SelectRegionEvent event, Emitter<ProfileState> emit) async {
Future selectRegion(
SelectRegionEvent event, Emitter<ProfileState> emit) async {
try {
emit(LoadingInitialState());
await ProfileApi.saveRegion(regionUuid: event.val);
@ -124,7 +130,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
Future<void> searchRegion(SearchRegionEvent event, Emitter<ProfileState> emit) async {
Future<void> searchRegion(
SearchRegionEvent event, Emitter<ProfileState> emit) async {
emit(LoadingInitialState());
final query = event.query.toLowerCase();
if (allRegions.isEmpty) {
@ -140,7 +147,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
Future<void> searchTimeZone(SearchTimeZoneEvent event, Emitter<ProfileState> emit) async {
Future<void> searchTimeZone(
SearchTimeZoneEvent event, Emitter<ProfileState> emit) async {
emit(LoadingInitialState());
final query = event.query.toLowerCase();
if (allTimeZone.isEmpty) {
@ -156,7 +164,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
void _fetchRegion(RegionInitialEvent event, Emitter<ProfileState> emit) async {
void _fetchRegion(
RegionInitialEvent event, Emitter<ProfileState> emit) async {
try {
emit(LoadingInitialState());
allRegions = await ProfileApi.fetchRegion();
@ -166,7 +175,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
}
Future<void> _selectImage(SelectImageEvent event, Emitter<ProfileState> emit) async {
Future<void> _selectImage(
SelectImageEvent event, Emitter<ProfileState> emit) async {
try {
if (await _requestPermission()) {
emit(ChangeImageState());
@ -283,7 +293,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
return false;
} else {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
SharedPreferences sharedPreferences =
await SharedPreferences.getInstance();
bool firstClick = sharedPreferences.getBool('firstPermission') ?? true;
await sharedPreferences.setBool('firstPermission', false);
if (firstClick == false) {

View File

@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:url_launcher/url_launcher.dart';
class UserAgreement extends StatefulWidget {
const UserAgreement({super.key});
@override
_UserAgreementState createState() => _UserAgreementState();
}
class _UserAgreementState extends State<UserAgreement> {
@override
void initState() {
super.initState();
MenuCubit.of(context).fetchAgreement();
}
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: 'User Agreement',
child: BlocBuilder<MenuCubit, MenuState>(
builder: (context, state) {
if (state is MenuLoading) {
return const Center(child: CircularProgressIndicator());
} else if (state is MenuLoaded) {
return ListView(
children: [
Html(
data: state.userAgreementHtml.isNotEmpty
? state.userAgreementHtml
: '',
onLinkTap: (url, attributes, element) async {
final uri = Uri.parse(url!);
await launchUrl(uri, mode: LaunchMode.externalApplication);
},
),
],
);
} else if (state is MenuError) {
return Center(
child: Text(
'Error: ${state.message}',
style: const TextStyle(color: Colors.red),
),
);
}
return const Center(child: Text('Loading User Agreement...'));
},
),
);
}
}

View File

@ -1,69 +1,62 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:syncrow_app/features/auth/bloc/auth_cubit.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/profile_tab.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/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
class MenuView extends StatelessWidget {
const MenuView({super.key});
const MenuView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (BuildContext context) => MenuCubit(),
create: (BuildContext context) => MenuCubit()..fetchMenuSections(),
child: BlocBuilder<MenuCubit, MenuState>(
builder: (context, state) {
return BlocBuilder<AuthCubit, AuthState>(
builder: (context, state) {
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
children: [
const ProfileTab(),
for (var section in menuSections)
MenuList(
section: section,
),
const SizedBox(
height: 15,
),
BodyMedium(text: dotenv.env['ENV_NAME'] ?? ''),
const SizedBox(
height: 15,
),
InkWell(
onTap: () {
AuthCubit.get(context).logout();
},
child: Row(
children: [
Expanded(
child: DefaultContainer(
child: Center(
child: BodyLarge(
text: 'Logout',
style: context.bodyLarge.copyWith(
color: Colors.red,
),
builder: (context, menuState) {
if (menuState is MenuLoading) {
return const Center(child: CircularProgressIndicator());
} else if (menuState is MenuError) {
return Center(child: Text(menuState.message));
} else if (menuState is MenuItemsLoaded) {
final sections = menuState.menuSections;
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
children: [
const ProfileTab(),
for (var section in sections) MenuList(section: section),
const SizedBox(height: 15),
InkWell(
onTap: () {
AuthCubit.get(context).logout();
},
child: Row(
children: [
Expanded(
child: DefaultContainer(
child: Center(
child: BodyLarge(
text: 'Logout',
style: context.bodyLarge.copyWith(
color: Colors.red,
),
),
),
),
],
),
)
],
),
);
},
);
),
],
),
),
],
),
);
}
// Fallback in case no states match
return const SizedBox.shrink();
},
),
);

View File

@ -3,10 +3,12 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class JoinHomeView extends StatelessWidget {
const JoinHomeView({super.key});
@ -57,14 +59,93 @@ class JoinHomeView extends StatelessWidget {
'Please enter the invitation code');
return;
}
if (await HomeCubit.getInstance().activationCode(textEditingController.text)) {
if (await HomeCubit.getInstance()
.activationCode(textEditingController.text)) {
await HomeCubit.getInstance().fetchUnitsByUserId();
CustomSnackBar.displaySnackBar('Done successfully');
Navigator.of(context).pop();
} else {
CustomSnackBar.displaySnackBar('Wrong code!');
// CustomSnackBar.displaySnackBar('Wrong code!');
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
contentPadding: EdgeInsets.zero,
content: SizedBox(
height: MediaQuery.of(context).size.height * 0.2,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(
height: 10,
),
const BodyLarge(
text: "Warning",
fontWeight: FontWeight.w700,
fontColor: ColorsManager.red,
fontSize: 16,
),
const Padding(
padding:
EdgeInsets.only(left: 15, right: 15),
child: Divider(
color: ColorsManager.textGray,
),
),
Padding(
padding: const EdgeInsets.only(
left: 15,
right: 20,
top: 15,
bottom: 20),
child: Column(
children: [
Center(
child: Text(
HomeCubit.getInstance().errorMsg,
textAlign: TextAlign.center,
)),
],
),
),
Expanded(
child: Container(
decoration: const BoxDecoration(
border: Border(
top: BorderSide(
color: ColorsManager.textGray,
width: 1.0,
),
)),
child: InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Padding(
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Center(
child: Text(
'Ok',
style: TextStyle(
color: ColorsManager
.switchButton
.withOpacity(0.6),
fontSize: 14,
fontWeight:
FontWeight.w400),
),
),
)),
),
)
],
),
),
);
},
);
}
},
icon: const Icon(

View File

@ -109,22 +109,19 @@ class VerificationCodePage extends StatelessWidget {
children: [
Expanded(
child: InkWell(
onTap: state is TimerState &&
!state.isButtonEnabled &&
state.remainingTime != 1
? null
: () {
_bloc.add(StartTimerEvent());
},
onTap:
state is TimerState && !state.isButtonEnabled && state.remainingTime != 1
? null
: () {
_bloc.add(StartTimerEvent());
},
child: Container(
padding: const EdgeInsets.only(
right: 20, left: 20, top: 15, bottom: 15),
padding: const EdgeInsets.only(right: 20, left: 20, top: 15, bottom: 15),
decoration: BoxDecoration(
color: state is TimerState && !state.isButtonEnabled
? ColorsManager.blueButton
: ColorsManager.blueColor,
borderRadius:
BorderRadius.all(Radius.circular(20))),
borderRadius: BorderRadius.all(Radius.circular(20))),
child: Center(
child: Center(
child: Text(
@ -132,8 +129,7 @@ class VerificationCodePage extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: state is TimerState &&
!state.isButtonEnabled
color: state is TimerState && !state.isButtonEnabled
? Colors.white
: ColorsManager.onPrimaryColor,
),
@ -146,24 +142,18 @@ class VerificationCodePage extends StatelessWidget {
Expanded(
child: InkWell(
onTap: () {
context
.read<SecurityBloc>()
.add(VerifyPassCodeEvent());
context.read<SecurityBloc>().add(VerifyPassCodeEvent());
},
child: Container(
padding: const EdgeInsets.only(
right: 20, left: 20, top: 15, bottom: 15),
padding: const EdgeInsets.only(right: 20, left: 20, top: 15, bottom: 15),
decoration: const BoxDecoration(
color: ColorsManager.blueColor,
borderRadius:
BorderRadius.all(Radius.circular(20))),
borderRadius: BorderRadius.all(Radius.circular(20))),
child: const Center(
child: Text(
"Verify",
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.w700),
fontSize: 16, color: Colors.white, fontWeight: FontWeight.w700),
),
),
),

View File

@ -2,9 +2,12 @@ import 'dart:async';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/project_model.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
import 'package:syncrow_app/services/api/scene_api.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
part 'scene_state.dart';
@ -23,9 +26,11 @@ class SceneBloc extends Bloc<SceneEvent, SceneState> {
emit(SceneLoading());
try {
Project? project = HomeCubit.getInstance().project;
if (event.unitId.isNotEmpty) {
scenes = await SceneApi.getScenesByUnitId(
event.unitId, event.unit.community.uuid,
scenes = await SceneApi.getScenesByUnitId(event.unitId,
event.unit.community.uuid, project?.uuid ?? TempConst.projectIdDev,
showInDevice: event.showInDevice);
emit(SceneLoaded(scenes, automationList));
} else {

View File

@ -16,10 +16,12 @@ class SceneRoomsTabBarDevicesView extends StatefulWidget {
const SceneRoomsTabBarDevicesView({super.key});
@override
State<SceneRoomsTabBarDevicesView> createState() => _SceneRoomsTabBarDevicesViewState();
State<SceneRoomsTabBarDevicesView> createState() =>
_SceneRoomsTabBarDevicesViewState();
}
class _SceneRoomsTabBarDevicesViewState extends State<SceneRoomsTabBarDevicesView>
class _SceneRoomsTabBarDevicesViewState
extends State<SceneRoomsTabBarDevicesView>
with SingleTickerProviderStateMixin {
late final TabController _tabController;
List<SubSpaceModel>? rooms = [];
@ -35,14 +37,15 @@ class _SceneRoomsTabBarDevicesViewState extends State<SceneRoomsTabBarDevicesVie
0,
SubSpaceModel(
name: 'All Devices',
devices: DevicesCubit.getInstance().allDevices,
devices: context.read<DevicesCubit>().allDevices,
id: '-1',
),
);
}
}
_tabController = TabController(length: rooms!.length, vsync: this, initialIndex: 0);
_tabController =
TabController(length: rooms!.length, vsync: this, initialIndex: 0);
_tabController.addListener(_handleTabSwitched);
super.initState();
}
@ -52,8 +55,10 @@ class _SceneRoomsTabBarDevicesViewState extends State<SceneRoomsTabBarDevicesVie
final value = _tabController.index;
/// select tab
context.read<TabBarBloc>().add(
TabChanged(selectedIndex: value, roomId: rooms?[value].id ?? '', unit: selectedSpace));
context.read<TabBarBloc>().add(TabChanged(
selectedIndex: value,
roomId: rooms?[value].id ?? '',
unit: selectedSpace));
return;
}
}

View File

@ -36,34 +36,38 @@ class SceneItem extends StatelessWidget {
Widget build(BuildContext context) {
return DefaultContainer(
onTap: () {
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
if (disablePlayButton == false) {
BlocProvider.of<CreateSceneBloc>(context)
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
if (HomeCubit.manageScene) {
context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneClearEvent());
if (disablePlayButton == false) {
BlocProvider.of<CreateSceneBloc>(context).add(
FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
/// the state to set the scene type must be after the fetch
BlocProvider.of<CreateSceneBloc>(context)
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
} else {
BlocProvider.of<CreateSceneBloc>(context)
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: true));
/// the state to set the scene type must be after the fetch
BlocProvider.of<CreateSceneBloc>(context)
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
} else {
BlocProvider.of<CreateSceneBloc>(context).add(
FetchSceneTasksEvent(sceneId: scene.id, isAutomation: true));
/// the state to set the scene type must be after the fetch
BlocProvider.of<CreateSceneBloc>(context)
.add(const SceneTypeEvent(CreateSceneEnum.deviceStatusChanges));
/// the state to set the scene type must be after the fetch
BlocProvider.of<CreateSceneBloc>(context)
.add(const SceneTypeEvent(CreateSceneEnum.deviceStatusChanges));
}
Navigator.pushNamed(
context,
Routes.sceneTasksRoute,
arguments: SceneSettingsRouteArguments(
sceneType: disablePlayButton == false
? CreateSceneEnum.tabToRun.name
: CreateSceneEnum.deviceStatusChanges.name,
sceneId: scene.id,
sceneName: scene.name,
),
);
}
Navigator.pushNamed(
context,
Routes.sceneTasksRoute,
arguments: SceneSettingsRouteArguments(
sceneType: disablePlayButton == false
? CreateSceneEnum.tabToRun.name
: CreateSceneEnum.deviceStatusChanges.name,
sceneId: scene.id,
sceneName: scene.name,
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -79,8 +83,11 @@ class SceneItem extends StatelessWidget {
height: 32,
width: 32,
fit: BoxFit.fill,
errorBuilder: (context, error, stackTrace) =>
Image.asset(Assets.assetsIconsLogo, height: 32, width: 32, fit: BoxFit.fill),
errorBuilder: (context, error, stackTrace) => Image.asset(
Assets.assetsIconsLogo,
height: 32,
width: 32,
fit: BoxFit.fill),
),
if (disablePlayButton || scene.iconInBytes.isEmpty)
SvgPicture.asset(
@ -93,7 +100,9 @@ class SceneItem extends StatelessWidget {
? IconButton(
padding: EdgeInsets.zero,
onPressed: () {
context.read<SceneBloc>().add(SceneTrigger(scene.id, scene.name));
context
.read<SceneBloc>()
.add(SceneTrigger(scene.id, scene.name));
},
icon: isLoading
? const Center(
@ -115,11 +124,15 @@ class SceneItem extends StatelessWidget {
activeColor: ColorsManager.primaryColor,
value: scene.status == 'enable' ? true : false,
onChanged: (value) {
context.read<SceneBloc>().add(UpdateAutomationStatus(
automationStatusUpdate: AutomationStatusUpdate(
isEnable: value,
spaceUuid: HomeCubit.getInstance().selectedSpace!.id),
automationId: scene.id));
context.read<SceneBloc>().add(
UpdateAutomationStatus(
automationStatusUpdate:
AutomationStatusUpdate(
isEnable: value,
spaceUuid: HomeCubit.getInstance()
.selectedSpace!
.id),
automationId: scene.id));
},
),
],

View File

@ -16,7 +16,8 @@ class CreateUnitWidget extends StatelessWidget {
TextEditingController textEditingController = TextEditingController();
return BlocConsumer<HomeCubit, HomeState>(
listener: (context, state) {
if (state is ActivationError) {}
// if (state is ActivationError) {
// }
},
builder: (context, state) {
return SingleChildScrollView(
@ -96,11 +97,12 @@ class CreateUnitWidget extends StatelessWidget {
textEditingController.text)) {
CustomSnackBar.displaySnackBar(
'Done successfully');
Navigator.of(context).pop();
} else {
CustomSnackBar.displaySnackBar(
'Wrong code!');
}
Future.delayed(
const Duration(milliseconds: 500),
() {
Navigator.of(context).pop();
});
}
},
icon: const Icon(
Icons.arrow_right_alt,
@ -136,42 +138,42 @@ class CreateUnitWidget extends StatelessWidget {
}
}
// return SizedBox(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// SvgPicture.asset(
// Assets.noUnitsIconDashboard,
// width: 100,
// height: 100,
// ),
// const SizedBox(
// height: 50,
// ),
// Flexible(
// child: GestureDetector(
// onTap: () {
// Navigator.pushNamed(context, Routes.createUnit);
// },
// child: Container(
// padding: const EdgeInsets.symmetric(horizontal: 34, vertical: 14),
// decoration: ShapeDecoration(
// color: const Color(0x99023DFE),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(20),
// ),
// ),
// child: const TitleMedium(
// text: 'Create a unit',
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white),
// ),
// ),
// ),
// ),
// ],
// ),
// );
// return SizedBox(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// SvgPicture.asset(
// Assets.noUnitsIconDashboard,
// width: 100,
// height: 100,
// ),
// const SizedBox(
// height: 50,
// ),
// Flexible(
// child: GestureDetector(
// onTap: () {
// Navigator.pushNamed(context, Routes.createUnit);
// },
// child: Container(
// padding: const EdgeInsets.symmetric(horizontal: 34, vertical: 14),
// decoration: ShapeDecoration(
// color: const Color(0x99023DFE),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(20),
// ),
// ),
// child: const TitleMedium(
// text: 'Create a unit',
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white),
// ),
// ),
// ),
// ),
// ],
// ),
// );
// }
// }

View File

@ -1,81 +1,146 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:collection/collection.dart';
class CustomSwitch extends StatelessWidget {
const CustomSwitch({super.key, required this.device});
class CustomSwitch extends StatefulWidget {
const CustomSwitch({Key? key, required this.device}) : super(key: key);
final DeviceModel device;
@override
_CustomSwitchState createState() => _CustomSwitchState();
}
bool isCurtainOpen(DeviceModel device) {
// Find the status with code == 'percent_control'
final curtainStatus = device.status.firstWhere(
(s) => s.code == 'percent_control',
// orElse: () => null,
);
// We consider it "on/open" if percent_control == 100
return curtainStatus.value >= 20;
}
class _CustomSwitchState extends State<CustomSwitch> {
bool _isLoading = false;
bool isDeviceOn(DeviceModel device) {
// If it's a curtain, check percent_control
if (device.type == "CUR") {
return isCurtainOpen(device);
}
// Otherwise, default to your existing switch logic
final switchStatuses = device.status.where(
(s) => (s.code?.startsWith('switch') ?? false),
);
final anySwitchFalse = switchStatuses.any((s) => s.value == false);
return !anySwitchFalse;
}
Widget _buildLoadingIndicator() {
return const SizedBox(
width: 45,
height: 28,
child: Center(
child: SizedBox(
width: 22,
height: 22,
child: CircularProgressIndicator(
strokeWidth: 2,
color: ColorsManager.primaryColor,
),
),
),
);
}
@override
Widget build(BuildContext context) {
return BlocBuilder<DevicesCubit, DevicesState>(
builder: (context, state) {
bool? status;
if (device.status.isNotEmpty) {
status = device.status
.firstWhereOrNull((status) => status.code == "switch")
?.value;
final isSwitch = widget.device.categoryName == 'Switch';
if (!isSwitch &&
widget.device.type != "AC" &&
widget.device.type != "GD" &&
widget.device.type != "CUR") {
return const SizedBox();
}
final isOn = isDeviceOn(widget.device);
return GestureDetector(
onTap: () async {
setState(() {
_isLoading = true;
});
final newValue = !isOn;
String code;
dynamic controlValue;
if (widget.device.type == "AC") {
code = "switch";
controlValue = newValue;
} else if (widget.device.type == "CUR") {
code = "percent_control";
controlValue = newValue ? "close" : "open";
} else {
code = "switch_1";
controlValue = newValue;
}
final control = DeviceControlModel(
code: code,
value: controlValue,
deviceId: widget.device.uuid!,
);
try {
if (widget.device.type == "CUR") {
await context
.read<DevicesCubit>()
.changeCurtainSwitch(control, widget.device.uuid!);
} else if (widget.device.type == "1GT") {
await context
.read<DevicesCubit>()
.oneGTGangToggle(control, widget.device.uuid!);
} else if (widget.device.type == "2GT") {
await context
.read<DevicesCubit>()
.towGTGangToggle(control, widget.device.uuid!);
} else if (widget.device.type == "3G") {
await context
.read<DevicesCubit>()
.threeGangToggle(control, widget.device.uuid!);
} else if (widget.device.type == "2G") {
await context
.read<DevicesCubit>()
.towGangToggle(control, widget.device.uuid!);
} else if (widget.device.type == "1G") {
await context
.read<DevicesCubit>()
.oneGangToggle(control, widget.device.uuid!);
} else {
await context
.read<DevicesCubit>()
.deviceControl(control, widget.device.uuid!);
}
} finally {
setState(() {
_isLoading = false;
});
}
return status == null
? const SizedBox()
: GestureDetector(
onTap: () {
DevicesCubit.getInstance().deviceControl(
DeviceControlModel(
deviceId: device.uuid,
code: device.status
.firstWhere((status) => status.code == "switch")
.code,
value: !device.status
.firstWhere((status) => status.code == "switch")
.value!,
),
device.uuid!,
);
},
child: Container(
width: 45.0,
height: 28.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.0),
color: status
? ColorsManager.primaryColor
: const Color(0xFFD9D9D9)),
child: Center(
child: Container(
width: 40.0,
height: 23.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.0),
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Container(
alignment: status
? Alignment.centerRight
: Alignment.centerLeft,
child: Container(
width: 20.0,
height: 20.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: status
? ColorsManager.primaryColor
: Colors.grey,
),
),
),
),
),
),
),
);
},
child: _isLoading
? _buildLoadingIndicator()
: SizedBox(
child: SvgPicture.asset(
isOn ? Assets.toggleSwitchSmall : Assets.offToggleSwitchSmall,
),
),
);
}
}

View File

@ -1139,4 +1139,8 @@ class Assets {
static const String office = 'assets/icons/office.svg';
static const String parlour = 'assets/icons/parlour.svg';
static const String grid = 'assets/images/grid.svg';
static const String toggleSwitchSmall = 'assets/icons/toggleSwitchSmall.svg';
static const String offToggleSwitchSmall = 'assets/icons/offToggleSwitchSmall.svg';
}

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/effective_period/effect_period_bloc.dart';
@ -26,6 +28,9 @@ class MyApp extends StatelessWidget {
Constants.bottomNavBarHeightPercentage;
return MultiBlocProvider(
providers: [
BlocProvider<DevicesCubit>(
create: (context) => DevicesCubit.getInstance(),
),
BlocProvider(create: (context) => AuthCubit()),
BlocProvider(
create: (context) => EffectPeriodBloc(),
@ -34,6 +39,7 @@ class MyApp extends StatelessWidget {
BlocProvider(create: (context) => CreateSceneBloc()),
BlocProvider(create: (context) => SceneBloc()),
BlocProvider(create: (context) => ProfileBloc()),
BlocProvider(create: (context) => MenuCubit()), //DevicesCubit
],
child: MaterialApp(
navigatorKey: NavigationService.navigatorKey,

View File

@ -53,7 +53,8 @@ abstract class ApiEndpoints {
//POST
static const String addUnit = '/unit';
static const String addUnitToUser = '/unit/user';
static const String verifyInvitationCode = '/user/{userUuid}/spaces/verify-code';
static const String verifyInvitationCode =
'/user/{userUuid}/spaces/verify-code';
//GET
static const String unitByUuid = '/unit/';
@ -63,8 +64,7 @@ abstract class ApiEndpoints {
static const String unitUser = '/unit/user/';
static const String invitationCode =
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{unitUuid}/invitation-code';
static const String activationCode =
'/invite-user/activation';
static const String activationCode = '/invite-user/activation';
//PUT
static const String renameUnit = '/unit/{unitUuid}';
@ -97,7 +97,8 @@ abstract class ApiEndpoints {
static const String controlGroup = '/group/control';
//GET
static const String groupBySpace = '/group/{unitUuid}';
static const String devicesByGroupName = '/group/{unitUuid}/devices/{groupName}';
static const String devicesByGroupName =
'/group/{unitUuid}/devices/{groupName}';
static const String groupByUuid = '/group/{groupUuid}';
//DELETE
@ -109,7 +110,8 @@ abstract class ApiEndpoints {
static const String addDeviceToRoom = '/device/room';
static const String addDeviceToGroup = '/device/group';
static const String controlDevice = '/device/{deviceUuid}/control';
static const String firmwareDevice = '/device/{deviceUuid}/firmware/{firmwareVersion}';
static const String firmwareDevice =
'/device/{deviceUuid}/firmware/{firmwareVersion}';
static const String getDevicesByUserId = '/device/user/{userId}';
static const String getDevicesByUnitId = '/device/unit/{unitUuid}';
static const String openDoorLock = '/door-lock/open/{doorLockUuid}';
@ -120,8 +122,10 @@ abstract class ApiEndpoints {
static const String deviceByUuid = '/device/{deviceUuid}';
static const String deviceFunctions = '/device/{deviceUuid}/functions';
static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices';
static const String deviceFunctionsStatus = '/device/{deviceUuid}/functions/status';
static const String powerClamp = '/device/{powerClampUuid}/power-clamp/status';
static const String deviceFunctionsStatus =
'/device/{deviceUuid}/functions/status';
static const String powerClamp =
'/device/{powerClampUuid}/power-clamp/status';
///Device Permission Module
//POST
@ -149,14 +153,16 @@ abstract class ApiEndpoints {
static const String getUnitAutomation = '/automation/{unitUuid}';
static const String getAutomationDetails = '/automation/details/{automationId}';
static const String getAutomationDetails =
'/automation/details/{automationId}';
/// PUT
static const String updateScene = '/scene/tap-to-run/{sceneId}';
static const String updateAutomation = '/automation/{automationId}';
static const String updateAutomationStatus = '/automation/status/{automationId}';
static const String updateAutomationStatus =
'/automation/status/{automationId}';
/// DELETE
static const String deleteScene = '/scene/tap-to-run/{sceneId}';
@ -165,8 +171,10 @@ abstract class ApiEndpoints {
//////////////////////Door Lock //////////////////////
//online
static const String addTemporaryPassword = '/door-lock/temporary-password/online/{doorLockUuid}';
static const String getTemporaryPassword = '/door-lock/temporary-password/online/{doorLockUuid}';
static const String addTemporaryPassword =
'/door-lock/temporary-password/online/{doorLockUuid}';
static const String getTemporaryPassword =
'/door-lock/temporary-password/online/{doorLockUuid}';
//one-time offline
static const String addOneTimeTemporaryPassword =
@ -198,7 +206,8 @@ abstract class ApiEndpoints {
'/door-lock/temporary-password/online/{doorLockUuid}/{passwordId}';
static const String saveSchedule = '/schedule/{deviceUuid}';
static const String getSchedule = '/schedule/{deviceUuid}?category={category}';
static const String getSchedule =
'/schedule/{deviceUuid}?category={category}';
static const String changeSchedule = '/schedule/enable/{deviceUuid}';
static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}';
static const String reportLogs =
@ -207,8 +216,16 @@ abstract class ApiEndpoints {
static const String statusBatch = '/device/status/batch';
static const String deviceScene = '/device/{deviceUuid}/scenes';
static const String fourSceneByName = '/device/{deviceUuid}/scenes?switchName={switchName}';
static const String fourSceneByName =
'/device/{deviceUuid}/scenes?switchName={switchName}';
static const String resetDevice = '/factory/reset/{deviceUuid}';
static const String unAssignScenesDevice = '/device/{deviceUuid}/scenes?switchName={switchName}';
static const String unAssignScenesDevice =
'/device/{deviceUuid}/scenes?switchName={switchName}';
static const String getDeviceLogs = '/device/report-logs/{uuid}?code={code}';
static const String terms = '/terms';
static const String policy = '/policy';
static const String getPermission = '/permission/{roleUuid}';
static const String getAllDevices =
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
}

View File

@ -188,7 +188,6 @@ class DevicesAPI {
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
print('object-*-*-*${json}');
return json;
});
return response;
@ -220,13 +219,14 @@ class DevicesAPI {
required String communityUuid,
required String spaceUuid,
required String roomId,
required String projectId,
}) async {
try {
final String path = ApiEndpoints.deviceByRoom
.replaceAll('{communityUuid}', communityUuid)
.replaceAll('{spaceUuid}', spaceUuid)
.replaceAll('{subSpaceUuid}', roomId)
.replaceAll('{projectUuid}', TempConst.projectId);
.replaceAll('{projectUuid}', projectId);
final response = await _httpService.get(
path: path,
@ -545,4 +545,57 @@ class DevicesAPI {
);
return response;
}
static Future<DeviceReport> getDeviceReports(
String uuid,
String code,
) async {
final response = await HTTPService().get(
path: ApiEndpoints.getDeviceLogs
.replaceAll('{uuid}', uuid)
.replaceAll('{code}', code),
showServerMessage: false,
expectedResponseModel: (json) {
return DeviceReport.fromJson(json);
},
);
return response;
}
static Future<List<DeviceModel>> getAllDevices({
required String communityUuid,
required String spaceUuid,
required String projectId,
}) async {
try {
final String path = ApiEndpoints.getAllDevices
.replaceAll('{communityUuid}', communityUuid)
.replaceAll('{spaceUuid}', spaceUuid)
.replaceAll('{projectUuid}', projectId);
final response = await _httpService.get(
path: path,
showServerMessage: false,
expectedResponseModel: (json) {
final data = json['data'];
if (data == null || data.isEmpty) {
return <DeviceModel>[];
}
if (json == null || json.isEmpty || json == []) {
return <DeviceModel>[];
}
return data
.map<DeviceModel>((device) => DeviceModel.fromJson(device))
.toList();
},
);
return response;
} catch (e) {
// Log the error if needed
// Return an empty list in case of error
return <DeviceModel>[];
}
}
}

View File

@ -145,12 +145,13 @@ class HomeCreation {
required String communityId,
required String spaceId,
required Map<String, String> body,
required String projectId
}) async {
try {
final fullPath = ApiEndpoints.addSubSpace
.replaceAll('{communityUuid}', communityId)
.replaceAll('{spaceUuid}', spaceId)
.replaceAll('{projectUuid}', TempConst.projectId);
.replaceAll('{projectUuid}', projectId);
final response = await _httpService.post(
path: fullPath,
body: body,

View File

@ -27,7 +27,7 @@ class HomeManagementAPI {
return list;
}
static Future<List<DeviceModel>> fetchDevicesByUnitId() async {
static Future<List<DeviceModel>> fetchDevicesByUnitId(String projectUuid) async {
List<DeviceModel> list = [];
try {
@ -40,7 +40,7 @@ class HomeManagementAPI {
final path = ApiEndpoints.spaceDevices
.replaceAll('{communityUuid}', communityUuid)
.replaceAll('{spaceUuid}', spaceUuid)
.replaceAll('{projectUuid}', TempConst.projectId);
.replaceAll('{projectUuid}', projectUuid);
await _httpService.get(
path: path,
@ -63,10 +63,11 @@ class HomeManagementAPI {
}
static Future<Map<String, dynamic>> assignDeviceToRoom(String communityId,
String spaceId, String subSpaceId, String deviceId) async {
String spaceId, String subSpaceId, String deviceId, String projectId) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.assignDeviceToRoom
.replaceAll('{projectUuid}', projectId)
.replaceAll('{communityUuid}', communityId)
.replaceAll('{spaceUuid}', spaceId)
.replaceAll('{subSpaceUuid}', subSpaceId)
@ -82,7 +83,7 @@ class HomeManagementAPI {
}
static Future<Map<String, dynamic>> unAssignDeviceToRoom(String communityId,
String spaceId, String subSpaceId, String deviceId) async {
String spaceId, String subSpaceId, String deviceId, String projectId) async {
try {
final response = await _httpService.delete(
path: ApiEndpoints.assignDeviceToRoom
@ -90,7 +91,7 @@ class HomeManagementAPI {
.replaceAll('{spaceUuid}', spaceId)
.replaceAll('{subSpaceUuid}', subSpaceId)
.replaceAll('{deviceUuid}', deviceId)
.replaceAll('{projectUuid}', TempConst.projectId),
.replaceAll('{projectUuid}', projectId),
expectedResponseModel: (json) {
return json;
},

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:developer';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/user_model.dart';
import 'package:syncrow_app/features/menu/model/region_model.dart';
@ -95,6 +94,16 @@ class ProfileApi {
return response;
}
Future fetchPermissions(roleId) async {
final response = await _httpService.get(
path: ApiEndpoints.getPermission.replaceAll('{roleUuid}', roleId!),
showServerMessage: true,
expectedResponseModel: (json) {
return json;
});
return response;
}
static Future<List<RegionModel>> fetchRegion() async {
final response = await _httpService.get(
path: ApiEndpoints.getRegion,
@ -116,4 +125,24 @@ class ProfileApi {
});
return response as List<TimeZone>;
}
Future fetchUserAgreement() async {
final response = await _httpService.get(
path: ApiEndpoints.terms,
showServerMessage: true,
expectedResponseModel: (json) {
return json['data'];
});
return response;
}
Future fetchPrivacyPolicy() async {
final response = await _httpService.get(
path: ApiEndpoints.policy,
showServerMessage: true,
expectedResponseModel: (json) {
return json['data'];
});
return response;
}
}

View File

@ -50,14 +50,14 @@ class SceneApi {
//get scene by unit id
static Future<List<ScenesModel>> getScenesByUnitId(
String unitId, String communityId,
String unitId, String communityId, String projectId,
{showInDevice = false}) async {
try {
final response = await _httpService.get(
path: ApiEndpoints.getUnitScenes
.replaceAll('{spaceUuid}', unitId)
.replaceAll('{communityUuid}', communityId)
.replaceAll('{projectUuid}', TempConst.projectId),
.replaceAll('{projectUuid}', projectId),
queryParameters: {'showInHomePage': showInDevice},
showServerMessage: false,
expectedResponseModel: (json) {

View File

@ -32,13 +32,13 @@ class SpacesAPI {
}
static Future<List<SubSpaceModel>> getSubSpaceBySpaceId(
String communityId, String spaceId) async {
String communityId, String spaceId, String projectId) async {
try {
// Construct the API path
final path = ApiEndpoints.listSubspace
.replaceFirst('{communityUuid}', communityId)
.replaceFirst('{spaceUuid}', spaceId)
.replaceAll('{projectUuid}', TempConst.projectId);
.replaceAll('{projectUuid}', projectId);
final response = await _httpService.get(
path: path,
@ -66,12 +66,12 @@ class SpacesAPI {
//factory/reset/{deviceUuid}
static Future<String> generateInvitationCode(
String unitId, String communityId) async {
String unitId, String communityId, String projectId) async {
final response = await _httpService.post(
path: ApiEndpoints.invitationCode
.replaceAll('{unitUuid}', unitId)
.replaceAll('{communityUuid}', communityId)
.replaceAll('{projectUuid}', TempConst.projectId),
.replaceAll('{projectUuid}', projectId),
showServerMessage: false,
expectedResponseModel: (json) {
if (json != null && json['data'] != null) {

View File

@ -1,3 +1,5 @@
import 'package:flutter_dotenv/flutter_dotenv.dart';
class TempConst {
static const projectId = '0e62577c-06fa-41b9-8a92-99a21fbaf51c';
static String projectIdDev = dotenv.env['PROJECT_ID'] ?? '';
}

View File

@ -1,10 +1,12 @@
//ignore_for_file: constant_identifier_names
import 'dart:ui';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/model/function_model.dart';
import 'package:syncrow_app/features/menu/bloc/privacy_policy.dart';
import 'package:syncrow_app/features/menu/bloc/user_agreement.dart';
// import 'package:syncrow_app/features/menu/view/widgets/create_home/create_home_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/join_home/join_home_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/manage_home/manage_home_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/privacy/privacy_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/securty/view/securty_view.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
@ -99,7 +101,9 @@ Map<String, DeviceType> devicesTypesMap = {
Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
DeviceType.AC: [
FunctionModel(
code: 'switch', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'mode',
type: functionTypesMap['Enum'],
@ -122,7 +126,9 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
// "range": ["low", "middle", "high", "auto"]
})),
FunctionModel(
code: 'child_lock', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'child_lock',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
],
DeviceType.Gateway: [
FunctionModel(
@ -136,7 +142,9 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
"range": ["normal", "alarm"]
})),
FunctionModel(
code: 'factory_reset', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'factory_reset',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'alarm_active',
type: functionTypesMap['String'],
@ -146,7 +154,8 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
FunctionModel(
code: 'sensitivity',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "", "min": 1, "max": 10, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "", "min": 1, "max": 10, "scale": 0, "step": 1})),
],
DeviceType.DoorLock: [
FunctionModel(
@ -154,7 +163,9 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'remote_no_dp_key', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
code: 'remote_no_dp_key',
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'normal_open_switch',
type: functionTypesMap['Boolean'],
@ -164,64 +175,87 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
FunctionModel(
code: 'far_detection',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "cm", "min": 75, "max": 600, "scale": 0, "step": 75})),
values: ValueModel.fromJson(
{"unit": "cm", "min": 75, "max": 600, "scale": 0, "step": 75})),
FunctionModel(
code: 'presence_time',
type: functionTypesMap['Integer'],
values:
ValueModel.fromJson({"unit": "Min", "min": 0, "max": 65535, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "Min", "min": 0, "max": 65535, "scale": 0, "step": 1})),
FunctionModel(
code: 'motion_sensitivity_value',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
FunctionModel(
code: 'motionless_sensitivity',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
FunctionModel(
code: 'indicator', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'indicator',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
],
DeviceType.OneGang: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
],
DeviceType.TwoGang: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_2',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_2',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
],
DeviceType.ThreeGang: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_2',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_3', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_3',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_2',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_3',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
],
DeviceType.Curtain: [
FunctionModel(
@ -233,15 +267,19 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
FunctionModel(
code: 'percent_control',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1})),
],
DeviceType.WH: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'relay_status',
type: functionTypesMap['Enum'],
@ -265,7 +303,9 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
],
DeviceType.DS: [
FunctionModel(
code: 'doorcontact_state', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
code: 'doorcontact_state',
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'battery_percentage',
type: functionTypesMap['Integer'],
@ -273,11 +313,14 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
],
DeviceType.OneTouch: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'relay_status',
type: functionTypesMap['Enum'],
@ -299,17 +342,23 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
],
DeviceType.TowTouch: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_2',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_2',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'relay_status',
type: functionTypesMap['Enum'],
@ -337,23 +386,32 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
],
DeviceType.ThreeTouch: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_2',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_3', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_3',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_2',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_3',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel(
code: 'relay_status',
type: functionTypesMap['Enum'],
@ -387,19 +445,24 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
],
DeviceType.GarageDoor: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel(
code: 'tr_timecon',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_alarm',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel(
code: 'door_control_1',
type: functionTypesMap['Enum'],
@ -420,19 +483,24 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
DeviceType.WaterLeak: [],
DeviceType.PC: [
FunctionModel(
code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
code: 'switch_1',
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'countdown_1',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel(
code: 'tr_timecon',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
FunctionModel(
code: 'countdown_alarm',
type: functionTypesMap['Integer'],
values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
values: ValueModel.fromJson(
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel(
code: 'door_control_1',
type: functionTypesMap['Enum'],
@ -476,9 +544,13 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
"range": ["scene"]
})),
FunctionModel(
code: 'scene_id_group_id', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
code: 'scene_id_group_id',
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_backlight', type: functionTypesMap['Enum'], values: ValueModel.fromJson({})),
code: 'switch_backlight',
type: functionTypesMap['Enum'],
values: ValueModel.fromJson({})),
],
DeviceType.SixScene: [
FunctionModel(
@ -518,13 +590,19 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
"range": ["scene"]
})),
FunctionModel(
code: 'scene_id_group_id', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
code: 'scene_id_group_id',
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'switch_backlight', type: functionTypesMap['Enum'], values: ValueModel.fromJson({})),
code: 'switch_backlight',
type: functionTypesMap['Enum'],
values: ValueModel.fromJson({})),
],
DeviceType.SOS: [
FunctionModel(
code: 'contact_state', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
code: 'contact_state',
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel(
code: 'battery_percentage',
type: functionTypesMap['Integer'],
@ -600,130 +678,6 @@ K? getNextItem<K, V>(Map<K, V> map, V value) {
return null;
}
List<Map<String, Object>> menuSections = [
//Home Management
{
'title': 'Home Management',
'color': ColorsManager.primaryColor,
'buttons': [
// {
// 'title': 'Create a Unit',
// 'Icon': Assets.assetsIconsMenuIconsHomeManagementIconsCreateHome,
// 'page': const CreateUnitView()
// },
{
'title': 'Join a Unit',
'Icon': Assets.assetsIconsMenuIconsHomeManagementIconsJoinAHome,
'page': const JoinHomeView()
},
{
'title': 'Manage Your Units',
'Icon': Assets.assetsIconsMenuIconsHomeManagementIconsManageYourHome,
'page': const ManageHomeView()
},
],
},
//General Settings
// {
// 'title': 'General Settings',
// 'color': const Color(0xFF023DFE),
// 'buttons': [
// {
// 'title': 'Voice Assistant',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsVoiceAssistant,
// 'page': null
// },
// {
// 'title': 'Temperature unit',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTemperatureUnit,
// 'page': null
// },
// {
// 'title': 'Touch tone on panel',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTouchTone,
// 'page': null
// },
// {
// 'title': 'Language',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsLanguage,
// 'page': null
// },
// {
// 'title': 'Network Diagnosis',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsNetworkDiagnosis,
// 'page': null
// },
// {
// 'title': 'Clear Cache',
// 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsClearCach,
// 'page': null
// },
// ],
// },
// //Messages Center
// {
// 'title': 'Messages Center',
// 'color': const Color(0xFF0088FF),
// 'buttons': [
// {
// 'title': 'Alerts',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsAlerts,
// 'page': null
// },
// {
// 'title': 'Messages',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsMessages,
// 'page': null
// },
// {
// 'title': 'FAQs',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsFAQs,
// 'page': null
// },
// {
// 'title': 'Help & Feedback',
// 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsHelpAndFeedback,
// 'page': null
// },
// ],
// },
//Security And Privacy
{
'title': 'Security And Privacy',
'color': const Color(0xFF8AB9FF),
'buttons': [
{
'title': 'Security',
'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsSecurty,
'page': const SecurtyView()
},
// {
// 'title': 'Privacy',
// 'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsPrivacy,
// 'page': const PrivacyView()
// },
],
},
//Legal Information
{
'title': 'Legal Information',
'color': const Color(0xFF001B72),
'buttons': [
{'title': 'About', 'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsAbout, 'page': null},
// {
// 'title': 'Privacy Policy',
// 'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsPrivacyPolicy,
// 'page': null
// },
{
'title': 'User Agreement',
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsUserAgreement,
'page': null
},
],
},
];
enum MemberRole {
FamilyMember,
OtherMember,

View File

@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: _flutterfire_internals
sha256: "37a42d06068e2fe3deddb2da079a8c4d105f241225ba27b7122b37e9865fd8f7"
sha256: "27899c95f9e7ec06c8310e6e0eac967707714b9f1450c4a58fa00ca011a4a8ae"
url: "https://pub.dev"
source: hosted
version: "1.3.35"
version: "1.3.49"
args:
dependency: transitive
description:
@ -85,18 +85,18 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
cross_file:
dependency: transitive
description:
name: cross_file
sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32"
sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
url: "https://pub.dev"
source: hosted
version: "0.3.4+1"
version: "0.3.4+2"
crypto:
dependency: transitive
description:
@ -109,10 +109,10 @@ packages:
dependency: transitive
description:
name: csslib
sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb"
sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
version: "0.17.3"
cupertino_icons:
dependency: "direct main"
description:
@ -125,26 +125,26 @@ packages:
dependency: "direct main"
description:
name: day_picker
sha256: a0f73716d688b3643769db39e7626cae54026bec24c33a8ebf5a6f8c618a05f2
sha256: "0f7b7e0078f8c7882d009bebabf3b9825acfe5ac0dbcc6ad0fd520bef3fc1047"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.3.0"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
sha256: eead12d1a1ed83d8283ab4c2f3fca23ac4082f29f25f29dff0f758f57d06ec91
sha256: "4fa68e53e26ab17b70ca39f072c285562cfc1589df5bb1e9295db90f6645f431"
url: "https://pub.dev"
source: hosted
version: "10.1.0"
version: "11.2.0"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "7.0.2"
dio:
dependency: "direct main"
description:
@ -157,10 +157,10 @@ packages:
dependency: "direct main"
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7"
url: "https://pub.dev"
source: hosted
version: "2.0.5"
version: "2.0.7"
fake_async:
dependency: transitive
description:
@ -173,10 +173,10 @@ packages:
dependency: transitive
description:
name: ffi
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.3"
file:
dependency: transitive
description:
@ -221,90 +221,90 @@ packages:
dependency: "direct main"
description:
name: firebase_analytics
sha256: c6220b23397f9302a42617227ee8fb1c5d718097a5351fcce53561d73fc10339
sha256: "498c6cb8468e348a556709c745d92a52173ab3a9b906aa0593393f0787f201ea"
url: "https://pub.dev"
source: hosted
version: "10.8.7"
version: "11.4.0"
firebase_analytics_platform_interface:
dependency: transitive
description:
name: firebase_analytics_platform_interface
sha256: "7f1c02cdd93a5e0a561af2f551465ffb6abdd541dbd0c8a9b8628d9ae0a5d024"
sha256: ccbb350554e98afdb4b59852689292d194d31232a2647b5012a66622b3711df9
url: "https://pub.dev"
source: hosted
version: "3.9.7"
version: "4.3.0"
firebase_analytics_web:
dependency: transitive
description:
name: firebase_analytics_web
sha256: ebb857c23f35fed52220b6c3271c12eeb6137de3930845223e3d0590b6fd0649
sha256: "68e1f18fc16482c211c658e739c25f015b202a260d9ad8249c6d3d7963b8105f"
url: "https://pub.dev"
source: hosted
version: "0.5.5+19"
version: "0.5.10+6"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
sha256: "26de145bb9688a90962faec6f838247377b0b0d32cc0abecd9a4e43525fc856c"
sha256: "0307c1fde82e2b8b97e0be2dab93612aff9a72f31ebe9bfac66ed8b37ef7c568"
url: "https://pub.dev"
source: hosted
version: "2.32.0"
version: "3.10.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63
sha256: d7253d255ff10f85cfd2adaba9ac17bae878fa3ba577462451163bd9f1d1f0bf
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "5.4.0"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
sha256: "22fcb352744908224fc7be3caae254836099786acfe5df6e9fe901e9c2575a41"
sha256: fbc008cf390d909b823763064b63afefe9f02d8afdb13eb3f485b871afee956b
url: "https://pub.dev"
source: hosted
version: "2.17.1"
version: "2.19.0"
firebase_crashlytics:
dependency: "direct main"
description:
name: firebase_crashlytics
sha256: "0126fa101b74fb981796b3e6f47ccf7fc40237ec918327aaec7c0a06fd1bb4c1"
sha256: f6adb65fa3d6391a79f0e60833bb4cdc468ce0c318831c90057ee11e0909cd29
url: "https://pub.dev"
source: hosted
version: "3.4.16"
version: "4.3.0"
firebase_crashlytics_platform_interface:
dependency: transitive
description:
name: firebase_crashlytics_platform_interface
sha256: cdfa0a20d66e1b32de542883c0ddf651ee9b66b12cebf73067e4d2cdc0865d17
sha256: "6635166c22c6f75f634b8e77b70fcc43b24af4cfee28f975249dbdbd9769a702"
url: "https://pub.dev"
source: hosted
version: "3.6.23"
version: "3.8.0"
firebase_database:
dependency: "direct main"
description:
name: firebase_database
sha256: "3b9ca306d26ad243ccbc4c717ff6e8563a080ebe11ee77fa7349b419c894b42d"
sha256: af9e0b2e8a117d2324027a5632d64b003e710283a20c692e12ebcc439d22be5c
url: "https://pub.dev"
source: hosted
version: "10.5.7"
version: "11.3.0"
firebase_database_platform_interface:
dependency: transitive
description:
name: firebase_database_platform_interface
sha256: "5864cc362275465e9bd682b243f19419c9d78b861c2db820241eea596ae3b320"
sha256: "6f92dfdd773c40d7b04113ad9e9de66826cd8a9f6c939a3693943eba4adce234"
url: "https://pub.dev"
source: hosted
version: "0.2.5+35"
version: "0.2.6"
firebase_database_web:
dependency: transitive
description:
name: firebase_database_web
sha256: a6008395dd20e8b8dde0691b441c181a1216c3866f89f48dcb6889d34fd35905
sha256: "6b863cc62cbd5d006d8e36d5407336115d3737cfe1d8574c6d8a3d035d0ed259"
url: "https://pub.dev"
source: hosted
version: "0.2.5+7"
version: "0.2.6+6"
fixnum:
dependency: transitive
description:
@ -317,10 +317,10 @@ packages:
dependency: "direct main"
description:
name: fl_chart
sha256: "94307bef3a324a0d329d3ab77b2f0c6e5ed739185ffc029ed28c0f9b019ea7ef"
sha256: "10ddaf334fe84d59333a12d153043e366f243e0bdfff2df0313e1e249f5bf926"
url: "https://pub.dev"
source: hosted
version: "0.69.0"
version: "0.70.1"
flutter:
dependency: "direct main"
description: flutter
@ -358,14 +358,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.0"
flutter_html:
dependency: "direct main"
description:
name: flutter_html
sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee"
url: "https://pub.dev"
source: hosted
version: "3.0.0-beta.2"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "5.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@ -444,10 +452,10 @@ packages:
dependency: "direct main"
description:
name: get_it
sha256: e6017ce7fdeaf218dc51a100344d8cb70134b80e28b760f8bb23c242437bafd7
sha256: f126a3e286b7f5b578bf436d5592968706c4c1de28a228b870ce375d9f743103
url: "https://pub.dev"
source: hosted
version: "7.6.7"
version: "8.0.3"
html:
dependency: "direct main"
description:
@ -460,10 +468,10 @@ packages:
dependency: transitive
description:
name: http
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.2.2"
http_parser:
dependency: transitive
description:
@ -492,10 +500,10 @@ packages:
dependency: transitive
description:
name: image_picker_for_web
sha256: "5d6eb13048cd47b60dbf1a5495424dea226c5faf3950e20bf8120a58efb5b5f3"
sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83"
url: "https://pub.dev"
source: hosted
version: "3.0.4"
version: "3.0.6"
image_picker_ios:
dependency: transitive
description:
@ -540,10 +548,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
sha256: "00f33b908655e606b86d2ade4710a231b802eec6f11e87e4ea3783fd72077a50"
url: "https://pub.dev"
source: hosted
version: "0.19.0"
version: "0.20.1"
js:
dependency: transitive
description:
@ -556,18 +564,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
@ -580,10 +588,18 @@ packages:
dependency: transitive
description:
name: lints
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "5.1.1"
list_counter:
dependency: transitive
description:
name: list_counter
sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237
url: "https://pub.dev"
source: hosted
version: "1.0.2"
matcher:
dependency: transitive
description:
@ -596,18 +612,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.15.0"
mime:
dependency: transitive
description:
@ -812,18 +828,18 @@ packages:
dependency: "direct main"
description:
name: share_plus
sha256: ef3489a969683c4f3d0239010cc8b7a2a46543a8d139e111c06c558875083544
sha256: "6327c3f233729374d0abaafd61f6846115b2a481b4feddd8534211dc10659400"
url: "https://pub.dev"
source: hosted
version: "9.0.0"
version: "10.1.3"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "0f9e4418835d1b2c3ae78fdb918251959106cefdbc4dd43526e182f80e82f6d4"
sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.2"
shared_preferences:
dependency: "direct main"
description:
@ -868,10 +884,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_web
sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a"
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
url: "https://pub.dev"
source: hosted
version: "2.3.0"
version: "2.2.1"
shared_preferences_windows:
dependency: transitive
description:
@ -884,7 +900,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
sleek_circular_slider:
dependency: "direct main"
description:
@ -937,10 +953,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.12.0"
stream_channel:
dependency: transitive
description:
@ -953,10 +969,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
synchronized:
dependency: transitive
description:
@ -977,10 +993,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.3"
time_picker_spinner:
dependency: "direct main"
description:
@ -1001,26 +1017,26 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e"
sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
url: "https://pub.dev"
source: hosted
version: "6.2.5"
version: "6.3.1"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745
sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.3.14"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03"
sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626"
url: "https://pub.dev"
source: hosted
version: "6.2.4"
version: "6.3.2"
url_launcher_linux:
dependency: transitive
description:
@ -1033,34 +1049,34 @@ packages:
dependency: transitive
description:
name: url_launcher_macos
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.2"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a"
sha256: "3ba963161bd0fe395917ba881d320b9c4f6dd3c4a233da62ab18a5025c85f1e9"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.4.0"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.4"
uuid:
dependency: "direct main"
description:
@ -1105,26 +1121,26 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.dev"
source: hosted
version: "14.2.1"
version: "14.3.0"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "1.1.0"
win32:
dependency: transitive
description:
name: win32
sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
sha256: "154360849a56b7b67331c21f09a386562d88903f90a1099c5987afc1912e1f29"
url: "https://pub.dev"
source: hosted
version: "5.2.0"
version: "5.10.0"
win32_registry:
dependency: transitive
description:
@ -1150,5 +1166,5 @@ packages:
source: hosted
version: "6.5.0"
sdks:
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.22.0"
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.27.0"

View File

@ -5,7 +5,7 @@ description: This is the mobile application project, developed with Flutter for
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.9+45
version: 1.0.18+55
environment:
sdk: ">=3.0.6 <4.0.0"
@ -15,42 +15,43 @@ dependencies:
cupertino_icons: ^1.0.6
dio: ^5.4.1
equatable: ^2.0.5
firebase_analytics: ^10.8.7
firebase_core: ^2.25.5
firebase_crashlytics: ^3.4.16
firebase_analytics: ^11.4.0
firebase_core: ^3.10.0
firebase_crashlytics: ^4.3.0
flutter:
sdk: flutter
flutter_animated_dialog: ^2.0.1
flutter_svg: ^2.0.10+1
sleek_circular_slider: ^2.0.1
day_picker: 2.2.0
day_picker: ^2.3.0
# Utility Packages
flutter_secure_storage: ^9.0.0
flutter_dotenv: ^5.1.0
# noinspection YAMLSchemaValidation
intl: ^0.19.0
get_it: ^7.6.7
url_launcher: ^6.2.5
intl: ^0.20.1
get_it: ^8.0.3
url_launcher: ^6.3.1
# flutter_localization: ^0.2.0
flutter_bloc: ^8.1.4
html: ^0.15.4
onesignal_flutter: ^5.2.0
permission_handler: ^11.3.1
pin_code_fields: ^8.0.1
share_plus: ^9.0.0
share_plus: ^10.1.3
shared_preferences: ^2.2.2
smooth_page_indicator: ^1.1.0
uuid: ^4.4.0
time_picker_spinner: ^1.0.0
image_picker: ^1.1.2
device_info_plus: ^10.1.0
fl_chart: ^0.69.0
firebase_database: ^10.5.7
device_info_plus: ^11.2.0
fl_chart: ^0.70.1
firebase_database: ^11.3.0
percent_indicator: ^4.2.3
flutter_html: ^3.0.0-beta.2
dev_dependencies:
flutter_lints: ^3.0.1
flutter_lints: ^5.0.0
flutter_test:
sdk: flutter