mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 09:45:25 +00:00
push batch door sensor, design bugs
This commit is contained in:
@ -12,6 +12,7 @@ import 'package:syncrow_web/pages/device_managment/door_lock/view/door_lock_cont
|
|||||||
import 'package:syncrow_web/pages/device_managment/gateway/view/gateway_batch_control.dart';
|
import 'package:syncrow_web/pages/device_managment/gateway/view/gateway_batch_control.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/gateway/view/gateway_view.dart';
|
import 'package:syncrow_web/pages/device_managment/gateway/view/gateway_view.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/main_door_sensor/view/main_door_control_view.dart';
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/view/main_door_control_view.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/view/main_door_sensor_batch_view.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/one_gang_switch/view/wall_light_batch_control.dart';
|
import 'package:syncrow_web/pages/device_managment/one_gang_switch/view/wall_light_batch_control.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/one_gang_switch/view/wall_light_device_control.dart';
|
import 'package:syncrow_web/pages/device_managment/one_gang_switch/view/wall_light_device_control.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/view/living_room_batch_controls.dart';
|
import 'package:syncrow_web/pages/device_managment/three_gang_switch/view/living_room_batch_controls.dart';
|
||||||
@ -77,6 +78,8 @@ mixin RouteControlsBasedCode {
|
|||||||
CPS:
|
CPS:
|
||||||
AC:
|
AC:
|
||||||
CUR:
|
CUR:
|
||||||
|
WH:
|
||||||
|
DS:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Widget routeBatchControlsWidgets({required List<AllDevicesModel> devices}) {
|
Widget routeBatchControlsWidgets({required List<AllDevicesModel> devices}) {
|
||||||
@ -148,7 +151,13 @@ mixin RouteControlsBasedCode {
|
|||||||
.map((e) => e.uuid!)
|
.map((e) => e.uuid!)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
case 'DS':
|
||||||
|
return MainDoorSensorBatchView(
|
||||||
|
devicesIds: devices
|
||||||
|
.where((e) => (e.productType == 'DS'))
|
||||||
|
.map((e) => e.uuid!)
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ class AllDevicesModel {
|
|||||||
int? updateTime;
|
int? updateTime;
|
||||||
String? uuid;
|
String? uuid;
|
||||||
int? batteryLevel;
|
int? batteryLevel;
|
||||||
|
String? productName;
|
||||||
|
|
||||||
AllDevicesModel({
|
AllDevicesModel({
|
||||||
this.room,
|
this.room,
|
||||||
@ -90,6 +91,7 @@ class AllDevicesModel {
|
|||||||
this.updateTime,
|
this.updateTime,
|
||||||
this.uuid,
|
this.uuid,
|
||||||
this.batteryLevel,
|
this.batteryLevel,
|
||||||
|
this.productName,
|
||||||
});
|
});
|
||||||
AllDevicesModel.fromJson(Map<String, dynamic> json) {
|
AllDevicesModel.fromJson(Map<String, dynamic> json) {
|
||||||
room = (json['room'] != null && (json['room'] is Map))
|
room = (json['room'] != null && (json['room'] is Map))
|
||||||
@ -121,6 +123,7 @@ class AllDevicesModel {
|
|||||||
updateTime = int.tryParse(json['updateTime']?.toString() ?? '');
|
updateTime = int.tryParse(json['updateTime']?.toString() ?? '');
|
||||||
uuid = json['uuid']?.toString();
|
uuid = json['uuid']?.toString();
|
||||||
batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
|
batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
|
||||||
|
productName = json['productName']?.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getDefaultIcon(String? productType) {
|
String _getDefaultIcon(String? productType) {
|
||||||
@ -182,6 +185,7 @@ class AllDevicesModel {
|
|||||||
data['updateTime'] = updateTime;
|
data['updateTime'] = updateTime;
|
||||||
data['uuid'] = uuid;
|
data['uuid'] = uuid;
|
||||||
data['battery'] = batteryLevel;
|
data['battery'] = batteryLevel;
|
||||||
|
data['productName'] = productName;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +218,7 @@ class AllDevicesModel {
|
|||||||
other.timeZone == timeZone &&
|
other.timeZone == timeZone &&
|
||||||
other.updateTime == updateTime &&
|
other.updateTime == updateTime &&
|
||||||
other.uuid == uuid &&
|
other.uuid == uuid &&
|
||||||
|
other.productName == productName &&
|
||||||
other.batteryLevel == batteryLevel;
|
other.batteryLevel == batteryLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +248,7 @@ class AllDevicesModel {
|
|||||||
timeZone.hashCode ^
|
timeZone.hashCode ^
|
||||||
updateTime.hashCode ^
|
updateTime.hashCode ^
|
||||||
uuid.hashCode ^
|
uuid.hashCode ^
|
||||||
|
productName.hashCode ^
|
||||||
batteryLevel.hashCode;
|
batteryLevel.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
data: devicesToShow.map((device) {
|
data: devicesToShow.map((device) {
|
||||||
return [
|
return [
|
||||||
device.name ?? '',
|
device.name ?? '',
|
||||||
device.categoryName ?? '',
|
device.productName ?? '',
|
||||||
device.uuid ?? '',
|
device.uuid ?? '',
|
||||||
device.unit?.name ?? '',
|
device.unit?.name ?? '',
|
||||||
device.room?.name ?? '',
|
device.room?.name ?? '',
|
||||||
|
@ -73,7 +73,7 @@ class CeilingSensorBatchControlView extends StatelessWidget
|
|||||||
value: model.sensitivity.toDouble(),
|
value: model.sensitivity.toDouble(),
|
||||||
title: 'Sensitivity:',
|
title: 'Sensitivity:',
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 5,
|
maxValue: 10,
|
||||||
steps: 1,
|
steps: 1,
|
||||||
action: (int value) {
|
action: (int value) {
|
||||||
context.read<CeilingSensorBloc>().add(
|
context.read<CeilingSensorBloc>().add(
|
||||||
|
@ -112,7 +112,7 @@ class CeilingSensorControlsView extends StatelessWidget
|
|||||||
value: model.sensitivity.toDouble(),
|
value: model.sensitivity.toDouble(),
|
||||||
title: 'Sensitivity:',
|
title: 'Sensitivity:',
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 5,
|
maxValue: 10,
|
||||||
steps: 1,
|
steps: 1,
|
||||||
action: (int value) {
|
action: (int value) {
|
||||||
context.read<CeilingSensorBloc>().add(
|
context.read<CeilingSensorBloc>().add(
|
||||||
|
@ -15,26 +15,24 @@ class DoorLockBatchControlView extends StatelessWidget
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
return Row(
|
||||||
final isLarge = isLargeScreenSize(context);
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
final isMedium = isMediumScreenSize(context);
|
|
||||||
return SizedBox(
|
|
||||||
child: GridView(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 50, vertical: 20),
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: isLarge || isExtraLarge || isMedium ? 2 : 1,
|
|
||||||
mainAxisExtent: 140,
|
|
||||||
crossAxisSpacing: 12,
|
|
||||||
mainAxisSpacing: 12,
|
|
||||||
),
|
|
||||||
children: [
|
children: [
|
||||||
FirmwareUpdateWidget(
|
SizedBox(
|
||||||
|
width: 170,
|
||||||
|
height: 140,
|
||||||
|
child: FirmwareUpdateWidget(
|
||||||
deviceId: devicesIds.first,
|
deviceId: devicesIds.first,
|
||||||
version: 12,
|
version: 12,
|
||||||
),
|
),
|
||||||
FactoryResetWidget(
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 170,
|
||||||
|
height: 140,
|
||||||
|
child: FactoryResetWidget(
|
||||||
callFactoryReset: () {
|
callFactoryReset: () {
|
||||||
BlocProvider.of<DoorLockBloc>(context).add(
|
BlocProvider.of<DoorLockBloc>(context).add(
|
||||||
DoorLockFactoryReset(
|
DoorLockFactoryReset(
|
||||||
@ -44,8 +42,8 @@ class DoorLockBatchControlView extends StatelessWidget
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,6 @@ class GatewayBatchControlView extends StatelessWidget
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
|
||||||
final isLarge = isLargeScreenSize(context);
|
|
||||||
final isMedium = isMediumScreenSize(context);
|
|
||||||
|
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => GateWayBloc()..add(GatWayById(gatewayIds.first)),
|
create: (context) => GateWayBloc()..add(GatWayById(gatewayIds.first)),
|
||||||
child: BlocBuilder<GateWayBloc, GateWayState>(
|
child: BlocBuilder<GateWayBloc, GateWayState>(
|
||||||
@ -25,19 +21,21 @@ class GatewayBatchControlView extends StatelessWidget
|
|||||||
if (state is GatewayLoadingState) {
|
if (state is GatewayLoadingState) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (state is UpdateGatewayState) {
|
} else if (state is UpdateGatewayState) {
|
||||||
return GridView(
|
return Row(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 50, vertical: 20),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: isLarge || isExtraLarge || isMedium ? 2 : 1,
|
|
||||||
mainAxisExtent: 140,
|
|
||||||
crossAxisSpacing: 12,
|
|
||||||
mainAxisSpacing: 12,
|
|
||||||
),
|
|
||||||
children: [
|
children: [
|
||||||
FirmwareUpdateWidget(deviceId: gatewayIds.first, version: 2),
|
SizedBox(
|
||||||
FactoryResetWidget(
|
width: 170,
|
||||||
|
height: 140,
|
||||||
|
child: FirmwareUpdateWidget(
|
||||||
|
deviceId: gatewayIds.first, version: 2)),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 170,
|
||||||
|
height: 140,
|
||||||
|
child: FactoryResetWidget(
|
||||||
callFactoryReset: () {
|
callFactoryReset: () {
|
||||||
context.read<GateWayBloc>().add(
|
context.read<GateWayBloc>().add(
|
||||||
GateWayFactoryReset(
|
GateWayFactoryReset(
|
||||||
@ -48,6 +46,7 @@ class GatewayBatchControlView extends StatelessWidget
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,6 +15,7 @@ class MainDoorSensorBloc
|
|||||||
on<MainDoorSensorControl>(_onControl);
|
on<MainDoorSensorControl>(_onControl);
|
||||||
on<MainDoorSensorFetchBatchEvent>(_onFetchBatchStatus);
|
on<MainDoorSensorFetchBatchEvent>(_onFetchBatchStatus);
|
||||||
on<MainDoorSensorReportsEvent>(_fetchReports);
|
on<MainDoorSensorReportsEvent>(_fetchReports);
|
||||||
|
on<MainDoorSensorFactoryReset>(_factoryReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
late MainDoorSensorStatusModel deviceStatus;
|
late MainDoorSensorStatusModel deviceStatus;
|
||||||
@ -137,4 +138,22 @@ class MainDoorSensorBloc
|
|||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
return super.close();
|
return super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _factoryReset(MainDoorSensorFactoryReset event,
|
||||||
|
Emitter<MainDoorSensorState> emit) async {
|
||||||
|
emit(MainDoorSensorLoadingState());
|
||||||
|
try {
|
||||||
|
final response = await DevicesManagementApi().factoryReset(
|
||||||
|
event.factoryReset,
|
||||||
|
event.deviceId,
|
||||||
|
);
|
||||||
|
if (!response) {
|
||||||
|
emit(MainDoorSensorFailedState(error: 'Failed'));
|
||||||
|
} else {
|
||||||
|
add(MainDoorSensorFetchDeviceEvent(event.deviceId));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(MainDoorSensorFailedState(error: e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../all_devices/models/factory_reset_model.dart';
|
||||||
|
|
||||||
class MainDoorSensorEvent extends Equatable {
|
class MainDoorSensorEvent extends Equatable {
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [];
|
List<Object?> get props => [];
|
||||||
@ -61,3 +63,11 @@ class MainDoorSensorReportsEvent extends MainDoorSensorEvent {
|
|||||||
required this.from,
|
required this.from,
|
||||||
required this.to});
|
required this.to});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MainDoorSensorFactoryReset extends MainDoorSensorEvent {
|
||||||
|
final String deviceId;
|
||||||
|
final FactoryResetModel factoryReset;
|
||||||
|
|
||||||
|
MainDoorSensorFactoryReset(
|
||||||
|
{required this.deviceId, required this.factoryReset});
|
||||||
|
}
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||||
|
|
||||||
|
class MainDoorSensorBatchView extends StatelessWidget {
|
||||||
|
const MainDoorSensorBatchView({super.key, required this.devicesIds});
|
||||||
|
|
||||||
|
final List<String> devicesIds;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 170,
|
||||||
|
height: 140,
|
||||||
|
child: FirmwareUpdateWidget(
|
||||||
|
deviceId: devicesIds.first,
|
||||||
|
version: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 170,
|
||||||
|
height: 140,
|
||||||
|
child: FactoryResetWidget(
|
||||||
|
callFactoryReset: () {
|
||||||
|
BlocProvider.of<MainDoorSensorBloc>(context).add(
|
||||||
|
MainDoorSensorFactoryReset(
|
||||||
|
deviceId: devicesIds.first,
|
||||||
|
factoryReset: FactoryResetModel(devicesUuid: devicesIds),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -56,7 +56,11 @@ class _FactoryResetWidgetState extends State<FactoryResetWidget> {
|
|||||||
backgroundColor: ColorsManager.greyColor,
|
backgroundColor: ColorsManager.greyColor,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Cancel',
|
'Cancel',
|
||||||
style: context.textTheme.bodyMedium,
|
style: context.textTheme.bodyMedium!.copyWith(
|
||||||
|
color: ColorsManager.blackColor,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -69,8 +73,10 @@ class _FactoryResetWidgetState extends State<FactoryResetWidget> {
|
|||||||
backgroundColor: ColorsManager.red,
|
backgroundColor: ColorsManager.red,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Reset',
|
'Reset',
|
||||||
style: context.textTheme.bodyMedium!
|
style: context.textTheme.bodyMedium!.copyWith(
|
||||||
.copyWith(color: ColorsManager.whiteColors),
|
color: ColorsManager.whiteColors,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 12),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -37,7 +37,7 @@ class DeviceBatchControlDialog extends StatelessWidget
|
|||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
devices.first.categoryName ?? 'Device Control',
|
getBatchDialogName(devices.first),
|
||||||
style: context.textTheme.titleLarge!.copyWith(
|
style: context.textTheme.titleLarge!.copyWith(
|
||||||
color: ColorsManager.dialogBlueTitle,
|
color: ColorsManager.dialogBlueTitle,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -65,7 +65,7 @@ class DeviceBatchControlDialog extends StatelessWidget
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
padding: EdgeInsets.all(1),
|
padding: const EdgeInsets.all(1),
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.close,
|
Icons.close,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
@ -92,3 +92,42 @@ class DeviceBatchControlDialog extends StatelessWidget
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getBatchDialogName(AllDevicesModel device) {
|
||||||
|
/*
|
||||||
|
3G:
|
||||||
|
1G:
|
||||||
|
2G:
|
||||||
|
GW:
|
||||||
|
DL:
|
||||||
|
WPS:
|
||||||
|
CPS:
|
||||||
|
AC:
|
||||||
|
CUR:
|
||||||
|
WH:
|
||||||
|
*/
|
||||||
|
switch (device.productType) {
|
||||||
|
case '1G':
|
||||||
|
return "Smart Light Switch";
|
||||||
|
case '2G':
|
||||||
|
return "2Gang Light";
|
||||||
|
case '3G':
|
||||||
|
return "Living Room";
|
||||||
|
case 'GW':
|
||||||
|
return "GateWay";
|
||||||
|
case 'DL':
|
||||||
|
return "Door Lock";
|
||||||
|
case 'WPS':
|
||||||
|
return "White Presence Sensor";
|
||||||
|
case 'CPS':
|
||||||
|
return "Black Presence Sensor";
|
||||||
|
case 'CUR':
|
||||||
|
return "Smart Curtains";
|
||||||
|
case 'WH':
|
||||||
|
return "Smart Water Hater";
|
||||||
|
case 'AC':
|
||||||
|
return "Smart AC";
|
||||||
|
default:
|
||||||
|
return device.categoryName ?? 'Device Control';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -87,7 +87,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
|
|||||||
children: [
|
children: [
|
||||||
TableRow(
|
TableRow(
|
||||||
children: [
|
children: [
|
||||||
_buildInfoRow('Product Name:', device.categoryName ?? 'N/A'),
|
_buildInfoRow('Product Name:', device.productName ?? 'N/A'),
|
||||||
_buildInfoRow('Device ID:', device.uuid ?? ''),
|
_buildInfoRow('Device ID:', device.uuid ?? ''),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -131,7 +131,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
|
|||||||
'Last Offline Date and Time:',
|
'Last Offline Date and Time:',
|
||||||
formatDateTime(
|
formatDateTime(
|
||||||
DateTime.fromMillisecondsSinceEpoch(
|
DateTime.fromMillisecondsSinceEpoch(
|
||||||
((device.activeTime ?? 0) * 1000),
|
((device.updateTime ?? 0) * 1000),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -96,7 +96,7 @@ class WallSensorBatchControlView extends StatelessWidget
|
|||||||
minValue: 10,
|
minValue: 10,
|
||||||
maxValue: 10000,
|
maxValue: 10000,
|
||||||
steps: 1,
|
steps: 1,
|
||||||
description: 'hr',
|
description: 'sec',
|
||||||
action: (int value) =>
|
action: (int value) =>
|
||||||
context.read<WallSensorBloc>().add(WallSensorBatchControlEvent(
|
context.read<WallSensorBloc>().add(WallSensorBatchControlEvent(
|
||||||
deviceIds: devicesIds,
|
deviceIds: devicesIds,
|
||||||
|
@ -135,7 +135,7 @@ class WallSensorControlsView extends StatelessWidget
|
|||||||
minValue: 10,
|
minValue: 10,
|
||||||
maxValue: 10000,
|
maxValue: 10000,
|
||||||
steps: 1,
|
steps: 1,
|
||||||
description: 'hr',
|
description: 'sec',
|
||||||
action: (int value) =>
|
action: (int value) =>
|
||||||
context.read<WallSensorBloc>().add(WallSensorChangeValueEvent(
|
context.read<WallSensorBloc>().add(WallSensorChangeValueEvent(
|
||||||
code: 'no_one_time',
|
code: 'no_one_time',
|
||||||
|
@ -76,7 +76,8 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
|
|||||||
final currentState = state as WaterHeaterDeviceStatusLoaded;
|
final currentState = state as WaterHeaterDeviceStatusLoaded;
|
||||||
final updatedDays = List<bool>.from(currentState.selectedDays);
|
final updatedDays = List<bool>.from(currentState.selectedDays);
|
||||||
updatedDays[event.index] = event.value;
|
updatedDays[event.index] = event.value;
|
||||||
emit(currentState.copyWith(selectedDays: updatedDays));
|
emit(currentState.copyWith(
|
||||||
|
selectedDays: updatedDays, selectedTime: currentState.selectedTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _updateFunctionOn(
|
FutureOr<void> _updateFunctionOn(
|
||||||
@ -84,7 +85,8 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
|
|||||||
Emitter<WaterHeaterState> emit,
|
Emitter<WaterHeaterState> emit,
|
||||||
) {
|
) {
|
||||||
final currentState = state as WaterHeaterDeviceStatusLoaded;
|
final currentState = state as WaterHeaterDeviceStatusLoaded;
|
||||||
emit(currentState.copyWith(functionOn: event.isOn));
|
emit(currentState.copyWith(
|
||||||
|
functionOn: event.isOn, selectedTime: currentState.selectedTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _updateScheduleEvent(
|
FutureOr<void> _updateScheduleEvent(
|
||||||
|
Reference in New Issue
Block a user