diff --git a/assets/images/completed_done.svg b/assets/images/completed_done.svg new file mode 100644 index 00000000..759f0cba --- /dev/null +++ b/assets/images/completed_done.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/pages/analytics/models/analytics_device.dart b/lib/pages/analytics/models/analytics_device.dart index 869de23f..6571eae4 100644 --- a/lib/pages/analytics/models/analytics_device.dart +++ b/lib/pages/analytics/models/analytics_device.dart @@ -39,8 +39,12 @@ class AnalyticsDevice { ? ProductDevice.fromJson(json['productDevice'] as Map) : null, spaceUuid: json['spaceUuid'] as String?, - latitude: json['lat'] != null ? double.parse(json['lat'] as String? ?? '0.0') : null, - longitude: json['lon'] != null ? double.parse(json['lon'] as String? ?? '0.0') : null, + latitude: json['lat'] != null && json['lat'] != '' + ? double.tryParse(json['lat']?.toString() ?? '0.0') + : null, + longitude: json['lon'] != null && json['lon'] != '' + ? double.tryParse(json['lon']?.toString() ?? '0.0') + : null, ); } } diff --git a/lib/pages/device_managment/all_devices/models/device_status.dart b/lib/pages/device_managment/all_devices/models/device_status.dart index b78f2a30..f4efe36b 100644 --- a/lib/pages/device_managment/all_devices/models/device_status.dart +++ b/lib/pages/device_managment/all_devices/models/device_status.dart @@ -57,6 +57,16 @@ class Status { }; } + Status copyWith({ + String? code, + dynamic value, + }) { + return Status( + code: code ?? this.code, + value: value ?? this.value, + ); + } + factory Status.fromJson(String source) => Status.fromMap(json.decode(source)); String toJson() => json.encode(toMap()); diff --git a/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart index 64044b94..0d3a1a92 100644 --- a/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart @@ -4,6 +4,7 @@ import 'package:syncrow_web/pages/device_managment/curtain_module/bloc/curtain_m import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/calibrate_completed_dialog.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; class AccurteCalibratingDialog extends StatelessWidget { final String deviceId; @@ -17,6 +18,7 @@ class AccurteCalibratingDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( + backgroundColor: ColorsManager.whiteColors, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Calibrating', diff --git a/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart index 997e70cf..7124639d 100644 --- a/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; class AccurateCalibrationDialog extends StatelessWidget { final String deviceId; @@ -15,6 +16,7 @@ class AccurateCalibrationDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( + backgroundColor: ColorsManager.whiteColors, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Accurate Calibration', diff --git a/lib/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart b/lib/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart index 433608ac..0d6ea90c 100644 --- a/lib/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart +++ b/lib/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart @@ -22,6 +22,7 @@ class AccurateDialogWidget extends StatelessWidget { child: Column( children: [ Expanded( + flex: 3, child: Column( children: [ Padding( @@ -43,17 +44,22 @@ class AccurateDialogWidget extends StatelessWidget { ), ), Expanded( + flex: 5, child: body, ), Expanded( + flex: 2, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - const Divider(), + const Expanded(child: Divider()), Row( children: [ Expanded( child: InkWell( + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(26), + ), onTap: leftOnTap, child: Container( height: 40, @@ -64,6 +70,9 @@ class AccurateDialogWidget extends StatelessWidget { color: ColorsManager.grayBorder, ), ), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(26), + ), ), child: const Text( 'Cancel', @@ -74,6 +83,9 @@ class AccurateDialogWidget extends StatelessWidget { ), Expanded( child: InkWell( + borderRadius: const BorderRadius.only( + bottomRight: Radius.circular(26), + ), onTap: rightOnTap, child: Container( height: 40, @@ -84,6 +96,9 @@ class AccurateDialogWidget extends StatelessWidget { color: ColorsManager.grayBorder, ), ), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(26), + ), ), child: const Text( 'Next', diff --git a/lib/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart index c322fe9d..fa293ec6 100644 --- a/lib/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart @@ -28,7 +28,7 @@ class NormalTextBodyForDialog extends StatelessWidget { title, style: const TextStyle( color: ColorsManager.grayColor, - fontSize: 17, + fontSize: 15, ), ), ), @@ -42,7 +42,7 @@ class NormalTextBodyForDialog extends StatelessWidget { const Text('1. ', style: TextStyle( color: ColorsManager.grayColor, - fontSize: 17, + fontSize: 15, )), SizedBox( width: 450, @@ -50,7 +50,7 @@ class NormalTextBodyForDialog extends StatelessWidget { step1, style: const TextStyle( color: ColorsManager.grayColor, - fontSize: 17, + fontSize: 15, ), ), ), @@ -67,13 +67,13 @@ class NormalTextBodyForDialog extends StatelessWidget { const Text('2. ', style: TextStyle( color: ColorsManager.grayColor, - fontSize: 17, + fontSize: 15, )), Text( step2, style: const TextStyle( color: ColorsManager.grayColor, - fontSize: 17, + fontSize: 15, ), ), ], diff --git a/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart index 8514d432..6fc9adf2 100644 --- a/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart @@ -63,6 +63,7 @@ class _QuickCalibratingDialogState extends State { @override Widget build(_) { return AlertDialog( + backgroundColor: ColorsManager.whiteColors, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Calibrating', @@ -71,7 +72,7 @@ class _QuickCalibratingDialogState extends State { children: [ const Expanded( child: Align( - alignment: Alignment.center, + alignment: Alignment.topCenter, child: Padding( padding: EdgeInsets.only(right: 75), child: Text( @@ -85,17 +86,21 @@ class _QuickCalibratingDialogState extends State { child: Align( alignment: Alignment.center, child: Container( - width: 110, + width: 130, padding: const EdgeInsets.all(5), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.neutralGray.withValues( + alpha: 0.5, + ), borderRadius: BorderRadius.circular(12), ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - child: NumberInputField(controller: _controller), + child: Padding( + padding: const EdgeInsetsGeometry.only(left: 5), + child: NumberInputField(controller: _controller)), ), Expanded( child: Text( @@ -127,7 +132,7 @@ class _QuickCalibratingDialogState extends State { ), const Expanded( child: Align( - alignment: Alignment.center, + alignment: Alignment.bottomCenter, child: Text( '2.click Next to Complete the calibration', style: TextStyle(color: ColorsManager.lightGrayColor), diff --git a/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart index 6c776293..06b386c8 100644 --- a/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/accurate_dialog_widget.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/normal_text_body_for_dialog.dart'; import 'package:syncrow_web/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; class QuickCalibrationDialog extends StatelessWidget { final int timControl; @@ -17,6 +18,7 @@ class QuickCalibrationDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( + backgroundColor: ColorsManager.whiteColors, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Quick Calibration', diff --git a/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart b/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart index 0ec55e39..0db1445f 100644 --- a/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart +++ b/lib/pages/device_managment/schedule_device/bloc/schedule_bloc.dart @@ -286,11 +286,20 @@ class ScheduleBloc extends Bloc { try { if (state is ScheduleLoaded) { final dateTime = DateTime.parse(event.time); + Status status = Status(code: '', value: ''); + if (event.category == 'CUR_2') { + status = status.copyWith( + code: 'control', + value: event.functionOn == true ? 'open' : 'close'); + } else { + status = + status.copyWith(code: event.category, value: event.functionOn); + } final updatedSchedule = ScheduleEntry( scheduleId: event.scheduleId, category: event.category, time: getTimeStampWithoutSeconds(dateTime).toString(), - function: Status(code: event.category, value: event.functionOn), + function: status, days: event.selectedDays, ); final success = await DevicesManagementApi().editScheduleRecord( diff --git a/lib/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart b/lib/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart index c511b8bd..52a5c56f 100644 --- a/lib/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart +++ b/lib/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart @@ -52,9 +52,12 @@ class BuildScheduleView extends StatelessWidget { children: [ const ScheduleHeader(), const SizedBox(height: 20), - ScheduleModeSelector( - currentMode: state.scheduleMode, - ), + if (category == 'CUR_2') + const SizedBox() + else + ScheduleModeSelector( + currentMode: state.scheduleMode, + ), const SizedBox(height: 20), if (state.scheduleMode == ScheduleModes.schedule) ScheduleManagementUI( diff --git a/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_table.dart b/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_table.dart index 21f404ff..84d8e1f5 100644 --- a/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_table.dart +++ b/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_table.dart @@ -212,12 +212,20 @@ class _ScheduleTableView extends StatelessWidget { isEdit: true, ).then((updatedSchedule) { if (updatedSchedule != null) { + bool temp; + if (schedule.category == 'CUR_2') { + updatedSchedule.function.value == 'open' + ? temp = true + : temp = false; + } else { + temp = updatedSchedule.function.value; + } context.read().add( ScheduleEditEvent( scheduleId: schedule.scheduleId, category: schedule.category, time: updatedSchedule.time, - functionOn: updatedSchedule.function.value, + functionOn: temp, selectedDays: updatedSchedule.days), ); } diff --git a/lib/pages/spaces_management/all_spaces/model/product_model.dart b/lib/pages/spaces_management/all_spaces/model/product_model.dart index 8f905032..a7b23d0f 100644 --- a/lib/pages/spaces_management/all_spaces/model/product_model.dart +++ b/lib/pages/spaces_management/all_spaces/model/product_model.dart @@ -58,11 +58,14 @@ class ProductModel { '3G': Assets.Gang3SwitchIcon, '3GT': Assets.threeTouchSwitch, 'CUR': Assets.curtain, + 'CUR_2': Assets.curtain, 'GD': Assets.garageDoor, 'GW': Assets.SmartGatewayIcon, 'DL': Assets.DoorLockIcon, 'WL': Assets.waterLeakSensor, 'WH': Assets.waterHeater, + 'WM': Assets.waterLeakSensor, + 'SOS': Assets.sos, 'AC': Assets.ac, 'CPS': Assets.presenceSensor, 'PC': Assets.powerClamp,