mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
fix bugs
This commit is contained in:
5
assets/icons/1gang.svg
Normal file
5
assets/icons/1gang.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M38.0142 39.2553L35.3682 40H20.9308H19.9999H19.0691H1.24111C0.555643 40 0 39.4444 0 38.7589V1.24111C0 0.555643 0.555643 0 1.24111 0H19.0682H20.1226H20.9543H35.4255L38.2625 1.24111C38.9479 1.24111 39.5036 1.79675 39.5036 2.48221L39.2553 38.0142C39.2553 38.6997 38.6997 39.2553 38.0142 39.2553Z" fill="#E9E9E9"/>
|
||||||
|
<path d="M38.7589 0H35.0356C35.721 0 36.2767 0.555643 36.2767 1.24111V38.7589C36.2767 39.4444 35.721 40 35.0356 40H38.7589C39.4444 40 40 39.4444 40 38.7589V1.24111C40 0.555643 39.4444 0 38.7589 0Z" fill="#D1D1D1"/>
|
||||||
|
<path opacity="0.6" d="M21.375 31.8319V33.3213C21.375 34.0067 20.9553 34.5624 20.4375 34.5624H16.3125C15.7947 34.5624 15.375 34.0067 15.375 33.3213V31.8319C15.375 31.1465 15.7947 30.5908 16.3125 30.5908H20.4375C20.9553 30.5908 21.375 31.1465 21.375 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 933 B |
7
assets/icons/2gang.svg
Normal file
7
assets/icons/2gang.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M38.0142 39.2553L35.3682 40H20.9308H19.9999H19.0691H1.24111C0.555643 40 0 39.4444 0 38.7589V1.24111C0 0.555643 0.555643 0 1.24111 0H19.0682H20.1226H20.9543H35.4255L38.2625 1.24111C38.9479 1.24111 39.5036 1.79675 39.5036 2.48221L39.2553 38.0142C39.2553 38.6997 38.6997 39.2553 38.0142 39.2553Z" fill="#E9E9E9"/>
|
||||||
|
<path d="M38.7589 0H35.0356C35.721 0 36.2767 0.555643 36.2767 1.24111V38.7589C36.2767 39.4444 35.721 40 35.0356 40H38.7589C39.4444 40 40 39.4444 40 38.7589V1.24111C40 0.555643 39.4444 0 38.7589 0Z" fill="#D1D1D1"/>
|
||||||
|
<path opacity="0.6" d="M12.0284 31.8319V33.3213C12.0284 34.0067 11.6087 34.5624 11.0909 34.5624H6.96594C6.44816 34.5624 6.02844 34.0067 6.02844 33.3213V31.8319C6.02844 31.1465 6.44816 30.5908 6.96594 30.5908H11.0909C11.6087 30.5908 12.0284 31.1465 12.0284 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
||||||
|
<path opacity="0.6" d="M26.0285 31.8319V33.3213C26.0285 34.0067 26.4482 34.5624 26.966 34.5624H31.091C31.6088 34.5624 32.0285 34.0067 32.0285 33.3213V31.8319C32.0285 31.1465 31.6088 30.5908 31.091 30.5908H26.966C26.4482 30.5908 26.0285 31.1465 26.0285 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
||||||
|
<path d="M19.0691 0H20.9308V40H19.0691V0Z" fill="#D1D1D1"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
@ -22,13 +22,7 @@ class CurtainToggle extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_managment_bloc.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
@ -78,20 +80,22 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
_selectAll = false;
|
_selectAll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _toggleSelectAll(bool? value) {
|
|
||||||
setState(() {
|
|
||||||
_selectAll = value ?? false;
|
|
||||||
_selectedRows = List<bool>.filled(widget.data.length, _selectAll);
|
|
||||||
});
|
|
||||||
widget.onSelectionChanged?.call(_selectedRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _toggleRowSelection(int index) {
|
void _toggleRowSelection(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedRows[index] = !_selectedRows[index];
|
_selectedRows[index] = !_selectedRows[index];
|
||||||
_selectAll = _selectedRows.every((isSelected) => isSelected);
|
_selectAll = _selectedRows.every((isSelected) => isSelected);
|
||||||
});
|
});
|
||||||
widget.onSelectionChanged?.call(_selectedRows);
|
widget.onSelectionChanged?.call(_selectedRows);
|
||||||
|
context.read<DeviceManagementBloc>().add(UpdateSelection(_selectedRows));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _toggleSelectAll(bool? value) {
|
||||||
|
setState(() {
|
||||||
|
_selectAll = value ?? false;
|
||||||
|
_selectedRows = List<bool>.filled(widget.data.length, _selectAll);
|
||||||
|
});
|
||||||
|
widget.onSelectionChanged?.call(_selectedRows);
|
||||||
|
context.read<DeviceManagementBloc>().add(UpdateSelection(_selectedRows));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -130,13 +134,9 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
// no password
|
// no password
|
||||||
widget.tableName == 'AccessManagement'
|
widget.tableName == 'AccessManagement' ? 'No Password ' : 'No Devices',
|
||||||
? 'No Password '
|
style:
|
||||||
: 'No Devices',
|
Theme.of(context).textTheme.bodySmall!.copyWith(color: ColorsManager.grayColor),
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.bodySmall!
|
|
||||||
.copyWith(color: ColorsManager.grayColor),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -155,10 +155,8 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
final row = widget.data[index];
|
final row = widget.data[index];
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
if (widget.withCheckBox)
|
if (widget.withCheckBox) _buildRowCheckbox(index, widget.size.height * 0.10),
|
||||||
_buildRowCheckbox(index, widget.size.height * 0.10),
|
...row.map((cell) => _buildTableCell(cell.toString(), widget.size.height * 0.10)),
|
||||||
...row.map((cell) =>
|
|
||||||
_buildTableCell(cell.toString(), widget.size.height * 0.10)),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -15,8 +15,7 @@ import 'package:syncrow_web/utils/constants/assets.dart';
|
|||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||||
|
|
||||||
class AcDeviceBatchControlView extends StatelessWidget
|
class AcDeviceBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||||
with HelperResponsiveLayout {
|
|
||||||
const AcDeviceBatchControlView({super.key, required this.devicesIds});
|
const AcDeviceBatchControlView({super.key, required this.devicesIds});
|
||||||
|
|
||||||
final List<String> devicesIds;
|
final List<String> devicesIds;
|
||||||
@ -27,8 +26,7 @@ class AcDeviceBatchControlView extends StatelessWidget
|
|||||||
final isLarge = isLargeScreenSize(context);
|
final isLarge = isLargeScreenSize(context);
|
||||||
final isMedium = isMediumScreenSize(context);
|
final isMedium = isMediumScreenSize(context);
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => AcBloc(deviceId: devicesIds.first)
|
create: (context) => AcBloc(deviceId: devicesIds.first)..add(AcFetchBatchStatusEvent(devicesIds)),
|
||||||
..add(AcFetchBatchStatusEvent(devicesIds)),
|
|
||||||
child: BlocBuilder<AcBloc, AcsState>(
|
child: BlocBuilder<AcBloc, AcsState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is ACStatusLoaded) {
|
if (state is ACStatusLoaded) {
|
||||||
@ -66,6 +64,7 @@ class AcDeviceBatchControlView extends StatelessWidget
|
|||||||
tempSet: state.status.tempSet,
|
tempSet: state.status.tempSet,
|
||||||
code: 'temp_set',
|
code: 'temp_set',
|
||||||
devicesIds: devicesIds,
|
devicesIds: devicesIds,
|
||||||
|
isBatch: true,
|
||||||
),
|
),
|
||||||
BatchAcMode(
|
BatchAcMode(
|
||||||
value: state.status.acMode,
|
value: state.status.acMode,
|
||||||
@ -99,8 +98,7 @@ class AcDeviceBatchControlView extends StatelessWidget
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'h',
|
'h',
|
||||||
style: context.textTheme.bodySmall!
|
style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor),
|
||||||
.copyWith(color: ColorsManager.blackColor),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'30',
|
'30',
|
||||||
@ -109,9 +107,7 @@ class AcDeviceBatchControlView extends StatelessWidget
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text('m',
|
Text('m', style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor)),
|
||||||
style: context.textTheme.bodySmall!
|
|
||||||
.copyWith(color: ColorsManager.blackColor)),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -133,7 +129,7 @@ class AcDeviceBatchControlView extends StatelessWidget
|
|||||||
code: 'child_lock',
|
code: 'child_lock',
|
||||||
value: state.status.childLock,
|
value: state.status.childLock,
|
||||||
label: 'Child Lock',
|
label: 'Child Lock',
|
||||||
icon: state.status.childLock ? Assets.unlock : Assets.acLock,
|
icon: state.status.childLock ? Assets.acLock : Assets.unlock,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
context.read<AcBloc>().add(AcBatchControlEvent(
|
context.read<AcBloc>().add(AcBatchControlEvent(
|
||||||
devicesIds: devicesIds,
|
devicesIds: devicesIds,
|
||||||
@ -147,8 +143,7 @@ class AcDeviceBatchControlView extends StatelessWidget
|
|||||||
callFactoryReset: () {
|
callFactoryReset: () {
|
||||||
context.read<AcBloc>().add(AcFactoryResetEvent(
|
context.read<AcBloc>().add(AcFactoryResetEvent(
|
||||||
deviceId: state.status.uuid,
|
deviceId: state.status.uuid,
|
||||||
factoryResetModel:
|
factoryResetModel: FactoryResetModel(devicesUuid: devicesIds),
|
||||||
FactoryResetModel(devicesUuid: devicesIds),
|
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -24,8 +24,7 @@ class AcDeviceControlsView extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
final isLarge = isLargeScreenSize(context);
|
final isLarge = isLargeScreenSize(context);
|
||||||
final isMedium = isMediumScreenSize(context);
|
final isMedium = isMediumScreenSize(context);
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => AcBloc(deviceId: device.uuid!)
|
create: (context) => AcBloc(deviceId: device.uuid!)..add(AcFetchDeviceStatusEvent(device.uuid!)),
|
||||||
..add(AcFetchDeviceStatusEvent(device.uuid!)),
|
|
||||||
child: BlocBuilder<AcBloc, AcsState>(
|
child: BlocBuilder<AcBloc, AcsState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is ACStatusLoaded) {
|
if (state is ACStatusLoaded) {
|
||||||
@ -98,8 +97,7 @@ class AcDeviceControlsView extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'h',
|
'h',
|
||||||
style: context.textTheme.bodySmall!
|
style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor),
|
||||||
.copyWith(color: ColorsManager.blackColor),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'30',
|
'30',
|
||||||
@ -108,9 +106,7 @@ class AcDeviceControlsView extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text('m',
|
Text('m', style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor)),
|
||||||
style: context.textTheme.bodySmall!
|
|
||||||
.copyWith(color: ColorsManager.blackColor)),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -132,7 +128,7 @@ class AcDeviceControlsView extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
code: 'child_lock',
|
code: 'child_lock',
|
||||||
value: state.status.childLock,
|
value: state.status.childLock,
|
||||||
label: 'Child Lock',
|
label: 'Child Lock',
|
||||||
icon: state.status.childLock ? Assets.unlock : Assets.acLock,
|
icon: state.status.childLock ? Assets.acLock : Assets.unlock,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
context.read<AcBloc>().add(
|
context.read<AcBloc>().add(
|
||||||
AcControlEvent(
|
AcControlEvent(
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class BatchAcMode extends StatelessWidget {
|
class BatchAcMode extends StatelessWidget {
|
||||||
const BatchAcMode({
|
const BatchAcMode({
|
||||||
@ -21,30 +22,20 @@ class BatchAcMode extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_buildIconContainer(context, TempModes.cold, Assets.freezing,
|
_buildIconContainer(context, TempModes.cold, Assets.freezing, value == TempModes.cold),
|
||||||
value == TempModes.cold),
|
_buildIconContainer(context, TempModes.hot, Assets.acSun, value == TempModes.hot),
|
||||||
_buildIconContainer(
|
_buildIconContainer(context, TempModes.wind, Assets.acAirConditioner, value == TempModes.wind),
|
||||||
context, TempModes.hot, Assets.acSun, value == TempModes.hot),
|
|
||||||
_buildIconContainer(context, TempModes.wind, Assets.acAirConditioner,
|
|
||||||
value == TempModes.wind),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIconContainer(
|
Widget _buildIconContainer(BuildContext context, TempModes mode, String assetPath, bool isSelected) {
|
||||||
BuildContext context, TempModes mode, String assetPath, bool isSelected) {
|
|
||||||
return Flexible(
|
return Flexible(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/celciuse_symbol.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/celciuse_symbol.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/increament_decreament.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/increament_decreament.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
|
||||||
|
|
||||||
class BatchCurrentTemp extends StatefulWidget {
|
class BatchCurrentTemp extends StatefulWidget {
|
||||||
const BatchCurrentTemp({
|
const BatchCurrentTemp({
|
||||||
@ -14,12 +16,14 @@ class BatchCurrentTemp extends StatefulWidget {
|
|||||||
required this.devicesIds,
|
required this.devicesIds,
|
||||||
required this.currentTemp,
|
required this.currentTemp,
|
||||||
required this.tempSet,
|
required this.tempSet,
|
||||||
|
this.isBatch,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String code;
|
final String code;
|
||||||
final List<String> devicesIds;
|
final List<String> devicesIds;
|
||||||
final int currentTemp;
|
final int currentTemp;
|
||||||
final int tempSet;
|
final int tempSet;
|
||||||
|
final bool? isBatch;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<BatchCurrentTemp> createState() => _CurrentTempState();
|
State<BatchCurrentTemp> createState() => _CurrentTempState();
|
||||||
@ -67,49 +71,39 @@ class _CurrentTempState extends State<BatchCurrentTemp> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
widget.isBatch == true
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
? Text(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
'Set Temperature',
|
||||||
children: [
|
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.grey),
|
||||||
Text(
|
)
|
||||||
'Current Temperature',
|
: Column(
|
||||||
style: Theme.of(context)
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
.textTheme
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
.bodySmall!
|
children: [
|
||||||
.copyWith(color: Colors.grey),
|
Text(
|
||||||
),
|
'Current Temperature',
|
||||||
const SizedBox(
|
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.grey),
|
||||||
height: 5,
|
),
|
||||||
),
|
const SizedBox(
|
||||||
Row(
|
height: 5,
|
||||||
children: [
|
),
|
||||||
Text(
|
Row(
|
||||||
(widget.currentTemp > 99
|
children: [
|
||||||
? widget.currentTemp / 10
|
Text(
|
||||||
: widget.currentTemp)
|
(widget.currentTemp > 99 ? widget.currentTemp / 10 : widget.currentTemp).toString(),
|
||||||
.toString(),
|
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.grey),
|
||||||
style: Theme.of(context)
|
),
|
||||||
.textTheme
|
const CelsiusSymbol(
|
||||||
.bodySmall!
|
color: Colors.grey,
|
||||||
.copyWith(color: Colors.grey),
|
)
|
||||||
),
|
],
|
||||||
const CelsiusSymbol(
|
),
|
||||||
color: Colors.grey,
|
],
|
||||||
)
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
IncrementDecrementWidget(
|
IncrementDecrementWidget(
|
||||||
value: _adjustedValue.toString(),
|
value: _adjustedValue.toString(),
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class BatchFanSpeedControl extends StatelessWidget {
|
class BatchFanSpeedControl extends StatelessWidget {
|
||||||
const BatchFanSpeedControl({
|
const BatchFanSpeedControl({
|
||||||
@ -21,23 +22,16 @@ class BatchFanSpeedControl extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
padding: 8,
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
Wrap(
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
_buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto,
|
_buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto, value == FanSpeeds.auto),
|
||||||
value == FanSpeeds.auto),
|
_buildIconContainer(context, FanSpeeds.low, Assets.acFanLow, value == FanSpeeds.low),
|
||||||
_buildIconContainer(context, FanSpeeds.low, Assets.acFanLow,
|
|
||||||
value == FanSpeeds.low),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
@ -45,10 +39,8 @@ class BatchFanSpeedControl extends StatelessWidget {
|
|||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
_buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle,
|
_buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle, value == FanSpeeds.middle),
|
||||||
value == FanSpeeds.middle),
|
_buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh, value == FanSpeeds.high),
|
||||||
_buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh,
|
|
||||||
value == FanSpeeds.high),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -56,8 +48,7 @@ class BatchFanSpeedControl extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIconContainer(BuildContext context, FanSpeeds speed,
|
Widget _buildIconContainer(BuildContext context, FanSpeeds speed, String assetPath, bool isSelected) {
|
||||||
String assetPath, bool isSelected) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.read<AcBloc>().add(
|
context.read<AcBloc>().add(
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class AcMode extends StatelessWidget {
|
class AcMode extends StatelessWidget {
|
||||||
const AcMode({
|
const AcMode({
|
||||||
@ -21,30 +22,20 @@ class AcMode extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_buildIconContainer(context, TempModes.cold, Assets.freezing,
|
_buildIconContainer(context, TempModes.cold, Assets.freezing, value == TempModes.cold),
|
||||||
value == TempModes.cold),
|
_buildIconContainer(context, TempModes.hot, Assets.acSun, value == TempModes.hot),
|
||||||
_buildIconContainer(
|
_buildIconContainer(context, TempModes.wind, Assets.acAirConditioner, value == TempModes.wind),
|
||||||
context, TempModes.hot, Assets.acSun, value == TempModes.hot),
|
|
||||||
_buildIconContainer(context, TempModes.wind, Assets.acAirConditioner,
|
|
||||||
value == TempModes.wind),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIconContainer(
|
Widget _buildIconContainer(BuildContext context, TempModes mode, String assetPath, bool isSelected) {
|
||||||
BuildContext context, TempModes mode, String assetPath, bool isSelected) {
|
|
||||||
return Flexible(
|
return Flexible(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
@ -25,13 +25,7 @@ class AcToggle extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/celciuse_symbol.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/celciuse_symbol.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/increament_decreament.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/increament_decreament.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
|
||||||
|
|
||||||
class CurrentTemp extends StatefulWidget {
|
class CurrentTemp extends StatefulWidget {
|
||||||
const CurrentTemp({
|
const CurrentTemp({
|
||||||
@ -67,13 +69,7 @@ class _CurrentTempState extends State<CurrentTemp> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -83,10 +79,7 @@ class _CurrentTempState extends State<CurrentTemp> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Current Temperature',
|
'Current Temperature',
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.grey),
|
||||||
.textTheme
|
|
||||||
.bodySmall!
|
|
||||||
.copyWith(color: Colors.grey),
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
@ -94,14 +87,8 @@ class _CurrentTempState extends State<CurrentTemp> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
(widget.currentTemp > 99
|
(widget.currentTemp > 99 ? widget.currentTemp / 10 : widget.currentTemp).toString(),
|
||||||
? widget.currentTemp / 10
|
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.grey),
|
||||||
: widget.currentTemp)
|
|
||||||
.toString(),
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.bodySmall!
|
|
||||||
.copyWith(color: Colors.grey),
|
|
||||||
),
|
),
|
||||||
const CelsiusSymbol(
|
const CelsiusSymbol(
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class FanSpeedControl extends StatelessWidget {
|
class FanSpeedControl extends StatelessWidget {
|
||||||
const FanSpeedControl({
|
const FanSpeedControl({
|
||||||
@ -21,23 +22,15 @@ class FanSpeedControl extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
Wrap(
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
_buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto,
|
_buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto, value == FanSpeeds.auto),
|
||||||
value == FanSpeeds.auto),
|
_buildIconContainer(context, FanSpeeds.low, Assets.acFanLow, value == FanSpeeds.low),
|
||||||
_buildIconContainer(context, FanSpeeds.low, Assets.acFanLow,
|
|
||||||
value == FanSpeeds.low),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
@ -45,10 +38,8 @@ class FanSpeedControl extends StatelessWidget {
|
|||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
_buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle,
|
_buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle, value == FanSpeeds.middle),
|
||||||
value == FanSpeeds.middle),
|
_buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh, value == FanSpeeds.high),
|
||||||
_buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh,
|
|
||||||
value == FanSpeeds.high),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -56,8 +47,7 @@ class FanSpeedControl extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIconContainer(BuildContext context, FanSpeeds speed,
|
Widget _buildIconContainer(BuildContext context, FanSpeeds speed, String assetPath, bool isSelected) {
|
||||||
String assetPath, bool isSelected) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.read<AcBloc>().add(
|
context.read<AcBloc>().add(
|
||||||
|
@ -6,8 +6,7 @@ import 'package:syncrow_web/services/devices_mang_api.dart';
|
|||||||
part 'device_managment_event.dart';
|
part 'device_managment_event.dart';
|
||||||
part 'device_managment_state.dart';
|
part 'device_managment_state.dart';
|
||||||
|
|
||||||
class DeviceManagementBloc
|
class DeviceManagementBloc extends Bloc<DeviceManagementEvent, DeviceManagementState> {
|
||||||
extends Bloc<DeviceManagementEvent, DeviceManagementState> {
|
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
List<AllDevicesModel> _devices = [];
|
List<AllDevicesModel> _devices = [];
|
||||||
int _onlineCount = 0;
|
int _onlineCount = 0;
|
||||||
@ -28,8 +27,7 @@ class DeviceManagementBloc
|
|||||||
on<UpdateSelection>(_onUpdateSelection);
|
on<UpdateSelection>(_onUpdateSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onFetchDevices(
|
Future<void> _onFetchDevices(FetchDevices event, Emitter<DeviceManagementState> emit) async {
|
||||||
FetchDevices event, Emitter<DeviceManagementState> emit) async {
|
|
||||||
emit(DeviceManagementLoading());
|
emit(DeviceManagementLoading());
|
||||||
try {
|
try {
|
||||||
final devices = await DevicesManagementApi().fetchDevices();
|
final devices = await DevicesManagementApi().fetchDevices();
|
||||||
@ -51,8 +49,7 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onFilterDevices(
|
void _onFilterDevices(FilterDevices event, Emitter<DeviceManagementState> emit) async {
|
||||||
FilterDevices event, Emitter<DeviceManagementState> emit) async {
|
|
||||||
if (_devices.isNotEmpty) {
|
if (_devices.isNotEmpty) {
|
||||||
_filteredDevices = List.from(_devices.where((device) {
|
_filteredDevices = List.from(_devices.where((device) {
|
||||||
switch (event.filter) {
|
switch (event.filter) {
|
||||||
@ -83,8 +80,7 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onResetFilters(
|
Future<void> _onResetFilters(ResetFilters event, Emitter<DeviceManagementState> emit) async {
|
||||||
ResetFilters event, Emitter<DeviceManagementState> emit) async {
|
|
||||||
productName = '';
|
productName = '';
|
||||||
_selectedDevices.clear();
|
_selectedDevices.clear();
|
||||||
_filteredDevices = List.from(_devices);
|
_filteredDevices = List.from(_devices);
|
||||||
@ -100,8 +96,7 @@ class DeviceManagementBloc
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onResetSelectedDevices(
|
void _onResetSelectedDevices(ResetSelectedDevices event, Emitter<DeviceManagementState> emit) {
|
||||||
ResetSelectedDevices event, Emitter<DeviceManagementState> emit) {
|
|
||||||
_selectedDevices.clear();
|
_selectedDevices.clear();
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
if (state is DeviceManagementLoaded) {
|
||||||
@ -127,14 +122,12 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSelectedFilterChanged(
|
void _onSelectedFilterChanged(SelectedFilterChanged event, Emitter<DeviceManagementState> emit) {
|
||||||
SelectedFilterChanged event, Emitter<DeviceManagementState> emit) {
|
|
||||||
_selectedIndex = event.selectedIndex;
|
_selectedIndex = event.selectedIndex;
|
||||||
add(FilterDevices(_getFilterFromIndex(_selectedIndex)));
|
add(FilterDevices(_getFilterFromIndex(_selectedIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSelectDevice(
|
void _onSelectDevice(SelectDevice event, Emitter<DeviceManagementState> emit) {
|
||||||
SelectDevice event, Emitter<DeviceManagementState> emit) {
|
|
||||||
final selectedUuid = event.selectedDevice.uuid;
|
final selectedUuid = event.selectedDevice.uuid;
|
||||||
|
|
||||||
if (_selectedDevices.any((device) => device.uuid == selectedUuid)) {
|
if (_selectedDevices.any((device) => device.uuid == selectedUuid)) {
|
||||||
@ -145,8 +138,7 @@ class DeviceManagementBloc
|
|||||||
|
|
||||||
List<AllDevicesModel> clonedSelectedDevices = List.from(_selectedDevices);
|
List<AllDevicesModel> clonedSelectedDevices = List.from(_selectedDevices);
|
||||||
|
|
||||||
bool isControlButtonEnabled =
|
bool isControlButtonEnabled = _checkIfControlButtonEnabled(clonedSelectedDevices);
|
||||||
_checkIfControlButtonEnabled(clonedSelectedDevices);
|
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
if (state is DeviceManagementLoaded) {
|
||||||
emit(DeviceManagementLoaded(
|
emit(DeviceManagementLoaded(
|
||||||
@ -155,8 +147,7 @@ class DeviceManagementBloc
|
|||||||
onlineCount: _onlineCount,
|
onlineCount: _onlineCount,
|
||||||
offlineCount: _offlineCount,
|
offlineCount: _offlineCount,
|
||||||
lowBatteryCount: _lowBatteryCount,
|
lowBatteryCount: _lowBatteryCount,
|
||||||
selectedDevice:
|
selectedDevice: clonedSelectedDevices.isNotEmpty ? clonedSelectedDevices : null,
|
||||||
clonedSelectedDevices.isNotEmpty ? clonedSelectedDevices : null,
|
|
||||||
isControlButtonEnabled: isControlButtonEnabled,
|
isControlButtonEnabled: isControlButtonEnabled,
|
||||||
));
|
));
|
||||||
} else if (state is DeviceManagementFiltered) {
|
} else if (state is DeviceManagementFiltered) {
|
||||||
@ -166,15 +157,13 @@ class DeviceManagementBloc
|
|||||||
onlineCount: _onlineCount,
|
onlineCount: _onlineCount,
|
||||||
offlineCount: _offlineCount,
|
offlineCount: _offlineCount,
|
||||||
lowBatteryCount: _lowBatteryCount,
|
lowBatteryCount: _lowBatteryCount,
|
||||||
selectedDevice:
|
selectedDevice: clonedSelectedDevices.isNotEmpty ? clonedSelectedDevices : null,
|
||||||
clonedSelectedDevices.isNotEmpty ? clonedSelectedDevices : null,
|
|
||||||
isControlButtonEnabled: isControlButtonEnabled,
|
isControlButtonEnabled: isControlButtonEnabled,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onUpdateSelection(
|
void _onUpdateSelection(UpdateSelection event, Emitter<DeviceManagementState> emit) {
|
||||||
UpdateSelection event, Emitter<DeviceManagementState> emit) {
|
|
||||||
List<AllDevicesModel> selectedDevices = [];
|
List<AllDevicesModel> selectedDevices = [];
|
||||||
List<AllDevicesModel> devicesToSelectFrom = [];
|
List<AllDevicesModel> devicesToSelectFrom = [];
|
||||||
|
|
||||||
@ -217,8 +206,7 @@ class DeviceManagementBloc
|
|||||||
|
|
||||||
bool _checkIfControlButtonEnabled(List<AllDevicesModel> selectedDevices) {
|
bool _checkIfControlButtonEnabled(List<AllDevicesModel> selectedDevices) {
|
||||||
if (selectedDevices.length > 1) {
|
if (selectedDevices.length > 1) {
|
||||||
final productTypes =
|
final productTypes = selectedDevices.map((device) => device.productType).toSet();
|
||||||
selectedDevices.map((device) => device.productType).toSet();
|
|
||||||
return productTypes.length == 1;
|
return productTypes.length == 1;
|
||||||
} else if (selectedDevices.length == 1) {
|
} else if (selectedDevices.length == 1) {
|
||||||
return true;
|
return true;
|
||||||
@ -229,10 +217,7 @@ class DeviceManagementBloc
|
|||||||
void _calculateDeviceCounts() {
|
void _calculateDeviceCounts() {
|
||||||
_onlineCount = _devices.where((device) => device.online == true).length;
|
_onlineCount = _devices.where((device) => device.online == true).length;
|
||||||
_offlineCount = _devices.where((device) => device.online == false).length;
|
_offlineCount = _devices.where((device) => device.online == false).length;
|
||||||
_lowBatteryCount = _devices
|
_lowBatteryCount = _devices.where((device) => device.batteryLevel != null && device.batteryLevel! < 20).length;
|
||||||
.where((device) =>
|
|
||||||
device.batteryLevel != null && device.batteryLevel! < 20)
|
|
||||||
.length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getFilterFromIndex(int index) {
|
String _getFilterFromIndex(int index) {
|
||||||
@ -248,8 +233,7 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSearchDevices(
|
void _onSearchDevices(SearchDevices event, Emitter<DeviceManagementState> emit) {
|
||||||
SearchDevices event, Emitter<DeviceManagementState> emit) {
|
|
||||||
if ((event.community == null || event.community!.isEmpty) &&
|
if ((event.community == null || event.community!.isEmpty) &&
|
||||||
(event.unitName == null || event.unitName!.isEmpty) &&
|
(event.unitName == null || event.unitName!.isEmpty) &&
|
||||||
(event.productName == null || event.productName!.isEmpty)) {
|
(event.productName == null || event.productName!.isEmpty)) {
|
||||||
@ -263,38 +247,21 @@ class DeviceManagementBloc
|
|||||||
List<AllDevicesModel> devicesToSearch = _filteredDevices;
|
List<AllDevicesModel> devicesToSearch = _filteredDevices;
|
||||||
|
|
||||||
if (devicesToSearch.isNotEmpty) {
|
if (devicesToSearch.isNotEmpty) {
|
||||||
_selectedDevices.clear();
|
|
||||||
_selectedIndex = _selectedIndex;
|
|
||||||
|
|
||||||
final filteredDevices = devicesToSearch.where((device) {
|
final filteredDevices = devicesToSearch.where((device) {
|
||||||
final matchesCommunity = event.community == null ||
|
final matchesCommunity = event.community == null ||
|
||||||
event.community!.isEmpty ||
|
event.community!.isEmpty ||
|
||||||
(device.room?.name
|
(device.room?.name?.toLowerCase().contains(event.community!.toLowerCase()) ?? false);
|
||||||
?.toLowerCase()
|
|
||||||
.contains(event.community!.toLowerCase()) ??
|
|
||||||
false);
|
|
||||||
final matchesUnit = event.unitName == null ||
|
final matchesUnit = event.unitName == null ||
|
||||||
event.unitName!.isEmpty ||
|
event.unitName!.isEmpty ||
|
||||||
(device.unit?.name
|
(device.unit?.name?.toLowerCase().contains(event.unitName!.toLowerCase()) ?? false);
|
||||||
?.toLowerCase()
|
|
||||||
.contains(event.unitName!.toLowerCase()) ??
|
|
||||||
false);
|
|
||||||
final matchesProductName = event.productName == null ||
|
final matchesProductName = event.productName == null ||
|
||||||
event.productName!.isEmpty ||
|
event.productName!.isEmpty ||
|
||||||
(device.name
|
(device.name?.toLowerCase().contains(event.productName!.toLowerCase()) ?? false);
|
||||||
?.toLowerCase()
|
|
||||||
.contains(event.productName!.toLowerCase()) ??
|
|
||||||
false);
|
|
||||||
final matchesDeviceName = event.productName == null ||
|
final matchesDeviceName = event.productName == null ||
|
||||||
event.productName!.isEmpty ||
|
event.productName!.isEmpty ||
|
||||||
(device.categoryName
|
(device.categoryName?.toLowerCase().contains(event.productName!.toLowerCase()) ?? false);
|
||||||
?.toLowerCase()
|
|
||||||
.contains(event.productName!.toLowerCase()) ??
|
|
||||||
false);
|
|
||||||
|
|
||||||
return matchesCommunity &&
|
return matchesCommunity && matchesUnit && (matchesProductName || matchesDeviceName);
|
||||||
matchesUnit &&
|
|
||||||
(matchesProductName || matchesDeviceName);
|
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
emit(DeviceManagementFiltered(
|
emit(DeviceManagementFiltered(
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/device_batch_control_dialog.dart';
|
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
|
||||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||||
import 'package:syncrow_web/pages/common/custom_table.dart';
|
import 'package:syncrow_web/pages/common/custom_table.dart';
|
||||||
import 'package:syncrow_web/pages/common/filter/filter_widget.dart';
|
import 'package:syncrow_web/pages/common/filter/filter_widget.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_managment_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_managment_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/device_control_dialog.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/widgets/device_search_filters.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/widgets/device_search_filters.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_batch_control_dialog.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_control_dialog.dart';
|
||||||
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
import 'package:syncrow_web/utils/format_date_time.dart';
|
import 'package:syncrow_web/utils/format_date_time.dart';
|
||||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
@ -37,8 +37,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
offlineCount = state.offlineCount;
|
offlineCount = state.offlineCount;
|
||||||
lowBatteryCount = state.lowBatteryCount;
|
lowBatteryCount = state.lowBatteryCount;
|
||||||
isControlButtonEnabled = state.isControlButtonEnabled;
|
isControlButtonEnabled = state.isControlButtonEnabled;
|
||||||
selectedDevices =
|
selectedDevices = state.selectedDevice ?? [];
|
||||||
state.selectedDevice ?? context.read<DeviceManagementBloc>().selectedDevices;
|
|
||||||
} else if (state is DeviceManagementFiltered) {
|
} else if (state is DeviceManagementFiltered) {
|
||||||
devicesToShow = state.filteredDevices;
|
devicesToShow = state.filteredDevices;
|
||||||
selectedIndex = state.selectedIndex;
|
selectedIndex = state.selectedIndex;
|
||||||
@ -46,14 +45,12 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
offlineCount = state.offlineCount;
|
offlineCount = state.offlineCount;
|
||||||
lowBatteryCount = state.lowBatteryCount;
|
lowBatteryCount = state.lowBatteryCount;
|
||||||
isControlButtonEnabled = state.isControlButtonEnabled;
|
isControlButtonEnabled = state.isControlButtonEnabled;
|
||||||
selectedDevices =
|
selectedDevices = state.selectedDevice ?? [];
|
||||||
state.selectedDevice ?? context.read<DeviceManagementBloc>().selectedDevices;
|
|
||||||
} else if (state is DeviceManagementInitial) {
|
} else if (state is DeviceManagementInitial) {
|
||||||
devicesToShow = [];
|
devicesToShow = [];
|
||||||
selectedIndex = 0;
|
selectedIndex = 0;
|
||||||
isControlButtonEnabled = false;
|
isControlButtonEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final tabs = [
|
final tabs = [
|
||||||
'All',
|
'All',
|
||||||
'Online ($onlineCount)',
|
'Online ($onlineCount)',
|
||||||
@ -66,8 +63,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding:
|
padding: isLargeScreenSize(context) ? const EdgeInsets.all(30) : const EdgeInsets.all(15),
|
||||||
isLargeScreenSize(context) ? const EdgeInsets.all(30) : const EdgeInsets.all(15),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -98,8 +94,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (selectedDevices.length > 1) {
|
} else if (selectedDevices.length > 1) {
|
||||||
final productTypes =
|
final productTypes = selectedDevices.map((device) => device.productType).toSet();
|
||||||
selectedDevices.map((device) => device.productType).toSet();
|
|
||||||
if (productTypes.length == 1) {
|
if (productTypes.length == 1) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -128,9 +123,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: isLargeScreenSize(context)
|
padding: isLargeScreenSize(context) ? const EdgeInsets.all(30) : const EdgeInsets.all(15),
|
||||||
? const EdgeInsets.all(30)
|
|
||||||
: const EdgeInsets.all(15),
|
|
||||||
child: DynamicTable(
|
child: DynamicTable(
|
||||||
withSelectAll: true,
|
withSelectAll: true,
|
||||||
cellDecoration: containerDecoration,
|
cellDecoration: containerDecoration,
|
||||||
@ -160,21 +153,16 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
device.unit?.name ?? '',
|
device.unit?.name ?? '',
|
||||||
device.room?.name ?? '',
|
device.room?.name ?? '',
|
||||||
device.batteryLevel != null ? '${device.batteryLevel}%' : '-',
|
device.batteryLevel != null ? '${device.batteryLevel}%' : '-',
|
||||||
formatDateTime(
|
formatDateTime(DateTime.fromMillisecondsSinceEpoch((device.createTime ?? 0) * 1000)),
|
||||||
DateTime.fromMillisecondsSinceEpoch((device.createTime ?? 0) * 1000)),
|
|
||||||
device.online == true ? 'Online' : 'Offline',
|
device.online == true ? 'Online' : 'Offline',
|
||||||
formatDateTime(
|
formatDateTime(DateTime.fromMillisecondsSinceEpoch((device.updateTime ?? 0) * 1000)),
|
||||||
DateTime.fromMillisecondsSinceEpoch((device.updateTime ?? 0) * 1000)),
|
|
||||||
];
|
];
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onSelectionChanged: (selectedRows) {
|
onSelectionChanged: (selectedRows) {
|
||||||
context.read<DeviceManagementBloc>().add(UpdateSelection(selectedRows));
|
context.read<DeviceManagementBloc>().add(UpdateSelection(selectedRows));
|
||||||
},
|
},
|
||||||
initialSelectedIds: context
|
initialSelectedIds:
|
||||||
.read<DeviceManagementBloc>()
|
context.read<DeviceManagementBloc>().selectedDevices.map((device) => device.uuid!).toList(),
|
||||||
.selectedDevices
|
|
||||||
.map((device) => device.uuid!)
|
|
||||||
.toList(),
|
|
||||||
isEmpty: devicesToShow.isEmpty,
|
isEmpty: devicesToShow.isEmpty,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/bloc/event.dart';
|
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/bloc/event.dart';
|
||||||
@ -23,12 +24,10 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
on<CeilingFactoryResetEvent>(_onFactoryReset);
|
on<CeilingFactoryResetEvent>(_onFactoryReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _fetchCeilingSensorStatus(
|
void _fetchCeilingSensorStatus(CeilingInitialEvent event, Emitter<CeilingSensorState> emit) async {
|
||||||
CeilingInitialEvent event, Emitter<CeilingSensorState> emit) async {
|
|
||||||
emit(CeilingLoadingInitialState());
|
emit(CeilingLoadingInitialState());
|
||||||
try {
|
try {
|
||||||
var response =
|
var response = await DevicesManagementApi().getDeviceStatus(event.deviceId);
|
||||||
await DevicesManagementApi().getDeviceStatus(event.deviceId);
|
|
||||||
deviceStatus = CeilingSensorModel.fromJson(response.status);
|
deviceStatus = CeilingSensorModel.fromJson(response.status);
|
||||||
emit(CeilingUpdateState(ceilingSensorModel: deviceStatus));
|
emit(CeilingUpdateState(ceilingSensorModel: deviceStatus));
|
||||||
// _listenToChanges();
|
// _listenToChanges();
|
||||||
@ -57,8 +56,7 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
// } catch (_) {}
|
// } catch (_) {}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void _changeValue(
|
void _changeValue(CeilingChangeValueEvent event, Emitter<CeilingSensorState> emit) async {
|
||||||
CeilingChangeValueEvent event, Emitter<CeilingSensorState> emit) async {
|
|
||||||
emit(CeilingLoadingNewSate(ceilingSensorModel: deviceStatus));
|
emit(CeilingLoadingNewSate(ceilingSensorModel: deviceStatus));
|
||||||
if (event.code == 'sensitivity') {
|
if (event.code == 'sensitivity') {
|
||||||
deviceStatus.sensitivity = event.value;
|
deviceStatus.sensitivity = event.value;
|
||||||
@ -79,8 +77,7 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onBatchControl(
|
Future<void> _onBatchControl(CeilingBatchControlEvent event, Emitter<CeilingSensorState> emit) async {
|
||||||
CeilingBatchControlEvent event, Emitter<CeilingSensorState> emit) async {
|
|
||||||
emit(CeilingLoadingNewSate(ceilingSensorModel: deviceStatus));
|
emit(CeilingLoadingNewSate(ceilingSensorModel: deviceStatus));
|
||||||
if (event.code == 'sensitivity') {
|
if (event.code == 'sensitivity') {
|
||||||
deviceStatus.sensitivity = event.value;
|
deviceStatus.sensitivity = event.value;
|
||||||
@ -123,11 +120,9 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
try {
|
try {
|
||||||
late bool response;
|
late bool response;
|
||||||
if (isBatch) {
|
if (isBatch) {
|
||||||
response = await DevicesManagementApi()
|
response = await DevicesManagementApi().deviceBatchControl(deviceId, code, value);
|
||||||
.deviceBatchControl(deviceId, code, value);
|
|
||||||
} else {
|
} else {
|
||||||
response = await DevicesManagementApi()
|
response = await DevicesManagementApi().deviceControl(deviceId, Status(code: code, value: value));
|
||||||
.deviceControl(deviceId, Status(code: code, value: value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
@ -145,16 +140,17 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _getDeviceReports(GetCeilingDeviceReportsEvent event,
|
FutureOr<void> _getDeviceReports(GetCeilingDeviceReportsEvent event, Emitter<CeilingSensorState> emit) async {
|
||||||
Emitter<CeilingSensorState> emit) async {
|
|
||||||
if (event.code.isEmpty) {
|
if (event.code.isEmpty) {
|
||||||
emit(ShowCeilingDescriptionState(description: reportString));
|
emit(ShowCeilingDescriptionState(description: reportString));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
emit(CeilingReportsLoadingState());
|
emit(CeilingReportsLoadingState());
|
||||||
|
final from = DateTime.now().subtract(const Duration(days: 30)).millisecondsSinceEpoch;
|
||||||
|
final to = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await DevicesManagementApi.getDeviceReports(deviceId, event.code)
|
await DevicesManagementApi.getDeviceReportsByDate(deviceId, event.code, from.toString(), to.toString())
|
||||||
.then((value) {
|
.then((value) {
|
||||||
emit(CeilingReportsState(deviceReport: value));
|
emit(CeilingReportsState(deviceReport: value));
|
||||||
});
|
});
|
||||||
@ -165,23 +161,19 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showDescription(
|
void _showDescription(ShowCeilingDescriptionEvent event, Emitter<CeilingSensorState> emit) {
|
||||||
ShowCeilingDescriptionEvent event, Emitter<CeilingSensorState> emit) {
|
|
||||||
emit(ShowCeilingDescriptionState(description: event.description));
|
emit(ShowCeilingDescriptionState(description: event.description));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _backToGridView(
|
void _backToGridView(BackToCeilingGridViewEvent event, Emitter<CeilingSensorState> emit) {
|
||||||
BackToCeilingGridViewEvent event, Emitter<CeilingSensorState> emit) {
|
|
||||||
emit(CeilingUpdateState(ceilingSensorModel: deviceStatus));
|
emit(CeilingUpdateState(ceilingSensorModel: deviceStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _fetchCeilingSensorBatchControl(
|
FutureOr<void> _fetchCeilingSensorBatchControl(
|
||||||
CeilingFetchDeviceStatusEvent event,
|
CeilingFetchDeviceStatusEvent event, Emitter<CeilingSensorState> emit) async {
|
||||||
Emitter<CeilingSensorState> emit) async {
|
|
||||||
emit(CeilingLoadingInitialState());
|
emit(CeilingLoadingInitialState());
|
||||||
try {
|
try {
|
||||||
var response =
|
var response = await DevicesManagementApi().getBatchStatus(event.devicesIds);
|
||||||
await DevicesManagementApi().getBatchStatus(event.devicesIds);
|
|
||||||
deviceStatus = CeilingSensorModel.fromJson(response.status);
|
deviceStatus = CeilingSensorModel.fromJson(response.status);
|
||||||
emit(CeilingUpdateState(ceilingSensorModel: deviceStatus));
|
emit(CeilingUpdateState(ceilingSensorModel: deviceStatus));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -190,8 +182,7 @@ class CeilingSensorBloc extends Bloc<CeilingSensorEvent, CeilingSensorState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _onFactoryReset(
|
FutureOr<void> _onFactoryReset(CeilingFactoryResetEvent event, Emitter<CeilingSensorState> emit) async {
|
||||||
CeilingFactoryResetEvent event, Emitter<CeilingSensorState> emit) async {
|
|
||||||
emit(CeilingLoadingNewSate(ceilingSensorModel: deviceStatus));
|
emit(CeilingLoadingNewSate(ceilingSensorModel: deviceStatus));
|
||||||
try {
|
try {
|
||||||
final response = await DevicesManagementApi().factoryReset(
|
final response = await DevicesManagementApi().factoryReset(
|
||||||
|
@ -26,8 +26,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
Table(
|
Table(
|
||||||
border: TableBorder.all(
|
border: TableBorder.all(
|
||||||
color: ColorsManager.graysColor,
|
color: ColorsManager.graysColor,
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||||
topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
TableRow(
|
TableRow(
|
||||||
@ -51,21 +50,17 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
BlocBuilder<GarageDoorBloc, GarageDoorState>(
|
BlocBuilder<GarageDoorBloc, GarageDoorState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is ScheduleGarageLoadingState) {
|
if (state is ScheduleGarageLoadingState) {
|
||||||
return const SizedBox(
|
return const SizedBox(height: 200, child: Center(child: CircularProgressIndicator()));
|
||||||
height: 200,
|
|
||||||
child: Center(child: CircularProgressIndicator()));
|
|
||||||
}
|
}
|
||||||
if (state is GarageDoorLoadedState &&
|
if (state is GarageDoorLoadedState && state.status.schedules?.isEmpty == true) {
|
||||||
state.status.schedules == null) {
|
|
||||||
return _buildEmptyState(context);
|
return _buildEmptyState(context);
|
||||||
} else if (state is GarageDoorLoadedState) {
|
} else if (state is GarageDoorLoadedState) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 200,
|
height: 200,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ColorsManager.graysColor),
|
border: Border.all(color: ColorsManager.graysColor),
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius:
|
||||||
bottomLeft: Radius.circular(20),
|
const BorderRadius.only(bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)),
|
||||||
bottomRight: Radius.circular(20)),
|
|
||||||
),
|
),
|
||||||
child: _buildTableBody(state, context));
|
child: _buildTableBody(state, context));
|
||||||
}
|
}
|
||||||
@ -83,8 +78,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
height: 200,
|
height: 200,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ColorsManager.graysColor),
|
border: Border.all(color: ColorsManager.graysColor),
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)),
|
||||||
bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)),
|
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -118,8 +112,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (state.status.schedules != null)
|
if (state.status.schedules != null)
|
||||||
for (int i = 0; i < state.status.schedules!.length; i++)
|
for (int i = 0; i < state.status.schedules!.length; i++)
|
||||||
_buildScheduleRow(
|
_buildScheduleRow(state.status.schedules![i], i, context, state),
|
||||||
state.status.schedules![i], i, context, state),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -141,8 +134,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableRow _buildScheduleRow(ScheduleModel schedule, int index,
|
TableRow _buildScheduleRow(ScheduleModel schedule, int index, BuildContext context, GarageDoorLoadedState state) {
|
||||||
BuildContext context, GarageDoorLoadedState state) {
|
|
||||||
return TableRow(
|
return TableRow(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
@ -160,8 +152,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
child: schedule.enable
|
child: schedule.enable
|
||||||
? const Icon(Icons.radio_button_checked,
|
? const Icon(Icons.radio_button_checked, color: ColorsManager.blueColor)
|
||||||
color: ColorsManager.blueColor)
|
|
||||||
: const Icon(
|
: const Icon(
|
||||||
Icons.radio_button_unchecked,
|
Icons.radio_button_unchecked,
|
||||||
color: ColorsManager.grayColor,
|
color: ColorsManager.grayColor,
|
||||||
@ -169,9 +160,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(
|
Center(child: Text(_getSelectedDays(ScheduleModel.parseSelectedDays(schedule.days)))),
|
||||||
child: Text(_getSelectedDays(
|
|
||||||
ScheduleModel.parseSelectedDays(schedule.days)))),
|
|
||||||
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
||||||
Center(child: Text(schedule.function.value ? 'On' : 'Off')),
|
Center(child: Text(schedule.function.value ? 'On' : 'Off')),
|
||||||
Center(
|
Center(
|
||||||
@ -181,24 +170,18 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
TextButton(
|
TextButton(
|
||||||
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
GarageDoorDialogHelper.showAddGarageDoorScheduleDialog(
|
GarageDoorDialogHelper.showAddGarageDoorScheduleDialog(context,
|
||||||
context,
|
schedule: schedule, index: index, isEdit: true);
|
||||||
schedule: schedule,
|
|
||||||
index: index,
|
|
||||||
isEdit: true);
|
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Edit',
|
'Edit',
|
||||||
style: context.textTheme.bodySmall!
|
style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blueColor),
|
||||||
.copyWith(color: ColorsManager.blueColor),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context
|
context.read<GarageDoorBloc>().add(DeleteGarageDoorScheduleEvent(
|
||||||
.read<GarageDoorBloc>()
|
|
||||||
.add(DeleteGarageDoorScheduleEvent(
|
|
||||||
index: index,
|
index: index,
|
||||||
scheduleId: schedule.scheduleId,
|
scheduleId: schedule.scheduleId,
|
||||||
deviceId: state.status.uuid,
|
deviceId: state.status.uuid,
|
||||||
@ -206,8 +189,7 @@ class ScheduleGarageTableWidget extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Delete',
|
'Delete',
|
||||||
style: context.textTheme.bodySmall!
|
style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blueColor),
|
||||||
.copyWith(color: ColorsManager.blueColor),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -16,12 +16,10 @@ class GateWayBloc extends Bloc<GateWayEvent, GateWayState> {
|
|||||||
on<GateWayFactoryReset>(_onFactoryReset);
|
on<GateWayFactoryReset>(_onFactoryReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _getGatWayById(
|
FutureOr<void> _getGatWayById(GatWayById event, Emitter<GateWayState> emit) async {
|
||||||
GatWayById event, Emitter<GateWayState> emit) async {
|
|
||||||
emit(GatewayLoadingState());
|
emit(GatewayLoadingState());
|
||||||
try {
|
try {
|
||||||
List<DeviceModel> devicesList =
|
List<DeviceModel> devicesList = await DevicesManagementApi.getDevicesByGatewayId(event.getWayId);
|
||||||
await DevicesManagementApi.getDevicesByGatewayId(event.getWayId);
|
|
||||||
|
|
||||||
emit(UpdateGatewayState(list: devicesList));
|
emit(UpdateGatewayState(list: devicesList));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -30,8 +28,7 @@ class GateWayBloc extends Bloc<GateWayEvent, GateWayState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _onFactoryReset(
|
FutureOr<void> _onFactoryReset(GateWayFactoryReset event, Emitter<GateWayState> emit) async {
|
||||||
GateWayFactoryReset event, Emitter<GateWayState> emit) async {
|
|
||||||
emit(GatewayLoadingState());
|
emit(GatewayLoadingState());
|
||||||
try {
|
try {
|
||||||
final response = await DevicesManagementApi().factoryReset(
|
final response = await DevicesManagementApi().factoryReset(
|
||||||
|
@ -74,7 +74,7 @@ class _DeviceItem extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
device.icon,
|
device.icon ?? 'assets/icons/gateway.svg',
|
||||||
width: 35,
|
width: 35,
|
||||||
height: 35,
|
height: 35,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
|
@ -2,15 +2,17 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
class DeviceControlsContainer extends StatelessWidget {
|
class DeviceControlsContainer extends StatelessWidget {
|
||||||
const DeviceControlsContainer({required this.child, super.key});
|
const DeviceControlsContainer({required this.child, this.padding, super.key});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
final double? padding;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
color: ColorsManager.grayColor.withOpacity(0.2),
|
color: ColorsManager.greyColor.withOpacity(0.2),
|
||||||
|
|
||||||
// boxShadow: <BoxShadow>[
|
// boxShadow: <BoxShadow>[
|
||||||
// BoxShadow(
|
// BoxShadow(
|
||||||
// color: ColorsManager.blackColor.withOpacity(0.05),
|
// color: ColorsManager.blackColor.withOpacity(0.05),
|
||||||
@ -19,7 +21,7 @@ class DeviceControlsContainer extends StatelessWidget {
|
|||||||
// spreadRadius: 0)
|
// spreadRadius: 0)
|
||||||
// ],
|
// ],
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(12),
|
padding: EdgeInsets.all(padding ?? 12),
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
@ -30,13 +31,7 @@ class ToggleWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return DeviceControlsContainer(
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
||||||
border: Border.all(color: ColorsManager.boxDivider),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/utils/enum/device_types.dart';
|
import 'package:syncrow_web/utils/enum/device_types.dart';
|
||||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
|
||||||
|
|
||||||
class DeviceModel {
|
class DeviceModel {
|
||||||
dynamic productUuid;
|
dynamic productUuid;
|
||||||
@ -51,7 +51,6 @@ class DeviceModel {
|
|||||||
factory DeviceModel.fromJson(Map<String, dynamic> json) {
|
factory DeviceModel.fromJson(Map<String, dynamic> json) {
|
||||||
String tempIcon = '';
|
String tempIcon = '';
|
||||||
DeviceType type = devicesTypesMap[json['productType']] ?? DeviceType.Other;
|
DeviceType type = devicesTypesMap[json['productType']] ?? DeviceType.Other;
|
||||||
|
|
||||||
if (type == DeviceType.LightBulb) {
|
if (type == DeviceType.LightBulb) {
|
||||||
tempIcon = Assets.lightBulb;
|
tempIcon = Assets.lightBulb;
|
||||||
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
|
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
|
||||||
@ -66,9 +65,16 @@ class DeviceModel {
|
|||||||
tempIcon = Assets.gangSwitch;
|
tempIcon = Assets.gangSwitch;
|
||||||
} else if (type == DeviceType.Gateway) {
|
} else if (type == DeviceType.Gateway) {
|
||||||
tempIcon = Assets.gateway;
|
tempIcon = Assets.gateway;
|
||||||
|
} else if (type == DeviceType.OneGang) {
|
||||||
|
tempIcon = Assets.oneGang;
|
||||||
|
} else if (type == DeviceType.TwoGang) {
|
||||||
|
tempIcon = Assets.twoGang;
|
||||||
|
} else if (type == DeviceType.WH) {
|
||||||
|
tempIcon = Assets.waterHeater;
|
||||||
} else {
|
} else {
|
||||||
tempIcon = Assets.logo;
|
tempIcon = Assets.blackLogo;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeviceModel(
|
return DeviceModel(
|
||||||
productUuid: json['productUuid'],
|
productUuid: json['productUuid'],
|
||||||
productType: json['productType'],
|
productType: json['productType'],
|
||||||
|
@ -68,8 +68,7 @@ class DevicesManagementApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> deviceBatchControl(
|
Future<bool> deviceBatchControl(List<String> uuids, String code, dynamic value) async {
|
||||||
List<String> uuids, String code, dynamic value) async {
|
|
||||||
try {
|
try {
|
||||||
final body = {
|
final body = {
|
||||||
'devicesUuid': uuids,
|
'devicesUuid': uuids,
|
||||||
@ -93,8 +92,7 @@ class DevicesManagementApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<DeviceModel>> getDevicesByGatewayId(
|
static Future<List<DeviceModel>> getDevicesByGatewayId(String gatewayId) async {
|
||||||
String gatewayId) async {
|
|
||||||
final response = await HTTPService().get(
|
final response = await HTTPService().get(
|
||||||
path: ApiEndpoints.gatewayApi.replaceAll('{gatewayUuid}', gatewayId),
|
path: ApiEndpoints.gatewayApi.replaceAll('{gatewayUuid}', gatewayId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
@ -128,9 +126,7 @@ class DevicesManagementApi {
|
|||||||
String code,
|
String code,
|
||||||
) async {
|
) async {
|
||||||
final response = await HTTPService().get(
|
final response = await HTTPService().get(
|
||||||
path: ApiEndpoints.getDeviceLogs
|
path: ApiEndpoints.getDeviceLogs.replaceAll('{uuid}', uuid).replaceAll('{code}', code),
|
||||||
.replaceAll('{uuid}', uuid)
|
|
||||||
.replaceAll('{code}', code),
|
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return DeviceReport.fromJson(json);
|
return DeviceReport.fromJson(json);
|
||||||
@ -139,8 +135,7 @@ class DevicesManagementApi {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<DeviceReport> getDeviceReportsByDate(String uuid, String code,
|
static Future<DeviceReport> getDeviceReportsByDate(String uuid, String code, [String? from, String? to]) async {
|
||||||
[String? from, String? to]) async {
|
|
||||||
final response = await HTTPService().get(
|
final response = await HTTPService().get(
|
||||||
path: ApiEndpoints.getDeviceLogsByDate
|
path: ApiEndpoints.getDeviceLogsByDate
|
||||||
.replaceAll('{uuid}', uuid)
|
.replaceAll('{uuid}', uuid)
|
||||||
@ -179,8 +174,7 @@ class DevicesManagementApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> addScheduleRecord(
|
Future<bool> addScheduleRecord(ScheduleEntry sendSchedule, String uuid) async {
|
||||||
ScheduleEntry sendSchedule, String uuid) async {
|
|
||||||
try {
|
try {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.scheduleByDeviceId.replaceAll('{deviceUuid}', uuid),
|
path: ApiEndpoints.scheduleByDeviceId.replaceAll('{deviceUuid}', uuid),
|
||||||
@ -197,13 +191,10 @@ class DevicesManagementApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<ScheduleModel>> getDeviceSchedules(
|
Future<List<ScheduleModel>> getDeviceSchedules(String uuid, String category) async {
|
||||||
String uuid, String category) async {
|
|
||||||
try {
|
try {
|
||||||
final response = await HTTPService().get(
|
final response = await HTTPService().get(
|
||||||
path: ApiEndpoints.getScheduleByDeviceId
|
path: ApiEndpoints.getScheduleByDeviceId.replaceAll('{deviceUuid}', uuid).replaceAll('{category}', category),
|
||||||
.replaceAll('{deviceUuid}', uuid)
|
|
||||||
.replaceAll('{category}', category),
|
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
List<ScheduleModel> schedules = [];
|
List<ScheduleModel> schedules = [];
|
||||||
@ -220,10 +211,7 @@ class DevicesManagementApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> updateScheduleRecord(
|
Future<bool> updateScheduleRecord({required bool enable, required String uuid, required String scheduleId}) async {
|
||||||
{required bool enable,
|
|
||||||
required String uuid,
|
|
||||||
required String scheduleId}) async {
|
|
||||||
try {
|
try {
|
||||||
final response = await HTTPService().put(
|
final response = await HTTPService().put(
|
||||||
path: ApiEndpoints.updateScheduleByDeviceId
|
path: ApiEndpoints.updateScheduleByDeviceId
|
||||||
|
@ -13,12 +13,10 @@ class Assets {
|
|||||||
static const String rightLine = "assets/images/right_line.png";
|
static const String rightLine = "assets/images/right_line.png";
|
||||||
static const String google = "assets/images/google.svg";
|
static const String google = "assets/images/google.svg";
|
||||||
static const String facebook = "assets/images/facebook.svg";
|
static const String facebook = "assets/images/facebook.svg";
|
||||||
static const String invisiblePassword =
|
static const String invisiblePassword = "assets/images/Password_invisible.svg";
|
||||||
"assets/images/Password_invisible.svg";
|
|
||||||
static const String visiblePassword = "assets/images/password_visible.svg";
|
static const String visiblePassword = "assets/images/password_visible.svg";
|
||||||
static const String accessIcon = "assets/images/access_icon.svg";
|
static const String accessIcon = "assets/images/access_icon.svg";
|
||||||
static const String spaseManagementIcon =
|
static const String spaseManagementIcon = "assets/images/spase_management_icon.svg";
|
||||||
"assets/images/spase_management_icon.svg";
|
|
||||||
static const String devicesIcon = "assets/images/devices_icon.svg";
|
static const String devicesIcon = "assets/images/devices_icon.svg";
|
||||||
static const String moveinIcon = "assets/images/movein_icon.svg";
|
static const String moveinIcon = "assets/images/movein_icon.svg";
|
||||||
static const String constructionIcon = "assets/images/construction_icon.svg";
|
static const String constructionIcon = "assets/images/construction_icon.svg";
|
||||||
@ -31,15 +29,13 @@ class Assets {
|
|||||||
static const String emptyTable = "assets/images/empty_table.svg";
|
static const String emptyTable = "assets/images/empty_table.svg";
|
||||||
|
|
||||||
// General assets
|
// General assets
|
||||||
static const String motionlessDetection =
|
static const String motionlessDetection = "assets/icons/motionless_detection.svg";
|
||||||
"assets/icons/motionless_detection.svg";
|
|
||||||
static const String acHeating = "assets/icons/ac_heating.svg";
|
static const String acHeating = "assets/icons/ac_heating.svg";
|
||||||
static const String acPowerOff = "assets/icons/ac_power_off.svg";
|
static const String acPowerOff = "assets/icons/ac_power_off.svg";
|
||||||
static const String acFanMiddle = "assets/icons/ac_fan_middle.svg";
|
static const String acFanMiddle = "assets/icons/ac_fan_middle.svg";
|
||||||
static const String switchAlarmSound = "assets/icons/switch_alarm_sound.svg";
|
static const String switchAlarmSound = "assets/icons/switch_alarm_sound.svg";
|
||||||
static const String resetOff = "assets/icons/reset_off.svg";
|
static const String resetOff = "assets/icons/reset_off.svg";
|
||||||
static const String sensitivityOperationIcon =
|
static const String sensitivityOperationIcon = "assets/icons/sesitivity_operation_icon.svg";
|
||||||
"assets/icons/sesitivity_operation_icon.svg";
|
|
||||||
static const String motionDetection = "assets/icons/motion_detection.svg";
|
static const String motionDetection = "assets/icons/motion_detection.svg";
|
||||||
static const String freezing = "assets/icons/freezing.svg";
|
static const String freezing = "assets/icons/freezing.svg";
|
||||||
static const String indicator = "assets/icons/indicator.svg";
|
static const String indicator = "assets/icons/indicator.svg";
|
||||||
@ -60,56 +56,35 @@ class Assets {
|
|||||||
static const String celsiusDegrees = "assets/icons/celsius_degrees.svg";
|
static const String celsiusDegrees = "assets/icons/celsius_degrees.svg";
|
||||||
static const String masterState = "assets/icons/master_state.svg";
|
static const String masterState = "assets/icons/master_state.svg";
|
||||||
static const String acPower = "assets/icons/ac_power.svg";
|
static const String acPower = "assets/icons/ac_power.svg";
|
||||||
static const String farDetectionFunction =
|
static const String farDetectionFunction = "assets/icons/far_detection_function.svg";
|
||||||
"assets/icons/far_detection_function.svg";
|
|
||||||
static const String nobodyTime = "assets/icons/nobody_time.svg";
|
static const String nobodyTime = "assets/icons/nobody_time.svg";
|
||||||
|
|
||||||
// Automation functions
|
// Automation functions
|
||||||
static const String tempPasswordUnlock =
|
static const String tempPasswordUnlock = "assets/icons/automation_functions/temp_password_unlock.svg";
|
||||||
"assets/icons/automation_functions/temp_password_unlock.svg";
|
static const String doorlockNormalOpen = "assets/icons/automation_functions/doorlock_normal_open.svg";
|
||||||
static const String doorlockNormalOpen =
|
static const String doorbell = "assets/icons/automation_functions/doorbell.svg";
|
||||||
"assets/icons/automation_functions/doorlock_normal_open.svg";
|
static const String remoteUnlockViaApp = "assets/icons/automation_functions/remote_unlock_via_app.svg";
|
||||||
static const String doorbell =
|
static const String doubleLock = "assets/icons/automation_functions/double_lock.svg";
|
||||||
"assets/icons/automation_functions/doorbell.svg";
|
static const String selfTestResult = "assets/icons/automation_functions/self_test_result.svg";
|
||||||
static const String remoteUnlockViaApp =
|
static const String lockAlarm = "assets/icons/automation_functions/lock_alarm.svg";
|
||||||
"assets/icons/automation_functions/remote_unlock_via_app.svg";
|
static const String presenceState = "assets/icons/automation_functions/presence_state.svg";
|
||||||
static const String doubleLock =
|
static const String currentTemp = "assets/icons/automation_functions/current_temp.svg";
|
||||||
"assets/icons/automation_functions/double_lock.svg";
|
static const String presence = "assets/icons/automation_functions/presence.svg";
|
||||||
static const String selfTestResult =
|
static const String residualElectricity = "assets/icons/automation_functions/residual_electricity.svg";
|
||||||
"assets/icons/automation_functions/self_test_result.svg";
|
static const String hijackAlarm = "assets/icons/automation_functions/hijack_alarm.svg";
|
||||||
static const String lockAlarm =
|
static const String passwordUnlock = "assets/icons/automation_functions/password_unlock.svg";
|
||||||
"assets/icons/automation_functions/lock_alarm.svg";
|
static const String remoteUnlockRequest = "assets/icons/automation_functions/remote_unlock_req.svg";
|
||||||
static const String presenceState =
|
static const String cardUnlock = "assets/icons/automation_functions/card_unlock.svg";
|
||||||
"assets/icons/automation_functions/presence_state.svg";
|
|
||||||
static const String currentTemp =
|
|
||||||
"assets/icons/automation_functions/current_temp.svg";
|
|
||||||
static const String presence =
|
|
||||||
"assets/icons/automation_functions/presence.svg";
|
|
||||||
static const String residualElectricity =
|
|
||||||
"assets/icons/automation_functions/residual_electricity.svg";
|
|
||||||
static const String hijackAlarm =
|
|
||||||
"assets/icons/automation_functions/hijack_alarm.svg";
|
|
||||||
static const String passwordUnlock =
|
|
||||||
"assets/icons/automation_functions/password_unlock.svg";
|
|
||||||
static const String remoteUnlockRequest =
|
|
||||||
"assets/icons/automation_functions/remote_unlock_req.svg";
|
|
||||||
static const String cardUnlock =
|
|
||||||
"assets/icons/automation_functions/card_unlock.svg";
|
|
||||||
static const String motion = "assets/icons/automation_functions/motion.svg";
|
static const String motion = "assets/icons/automation_functions/motion.svg";
|
||||||
static const String fingerprintUnlock =
|
static const String fingerprintUnlock = "assets/icons/automation_functions/fingerprint_unlock.svg";
|
||||||
"assets/icons/automation_functions/fingerprint_unlock.svg";
|
|
||||||
|
|
||||||
// Presence Sensor Assets
|
// Presence Sensor Assets
|
||||||
static const String sensorMotionIcon = "assets/icons/sensor_motion_ic.svg";
|
static const String sensorMotionIcon = "assets/icons/sensor_motion_ic.svg";
|
||||||
static const String sensorPresenceIcon =
|
static const String sensorPresenceIcon = "assets/icons/sensor_presence_ic.svg";
|
||||||
"assets/icons/sensor_presence_ic.svg";
|
|
||||||
static const String sensorVacantIcon = "assets/icons/sensor_vacant_ic.svg";
|
static const String sensorVacantIcon = "assets/icons/sensor_vacant_ic.svg";
|
||||||
static const String illuminanceRecordIcon =
|
static const String illuminanceRecordIcon = "assets/icons/illuminance_record_ic.svg";
|
||||||
"assets/icons/illuminance_record_ic.svg";
|
static const String presenceRecordIcon = "assets/icons/presence_record_ic.svg";
|
||||||
static const String presenceRecordIcon =
|
static const String helpDescriptionIcon = "assets/icons/help_description_ic.svg";
|
||||||
"assets/icons/presence_record_ic.svg";
|
|
||||||
static const String helpDescriptionIcon =
|
|
||||||
"assets/icons/help_description_ic.svg";
|
|
||||||
|
|
||||||
static const String lightPulp = "assets/icons/light_pulb.svg";
|
static const String lightPulp = "assets/icons/light_pulb.svg";
|
||||||
static const String acDevice = "assets/icons/ac_device.svg";
|
static const String acDevice = "assets/icons/ac_device.svg";
|
||||||
@ -183,9 +158,14 @@ class Assets {
|
|||||||
//assets/icons/water_leak_normal.svg
|
//assets/icons/water_leak_normal.svg
|
||||||
static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg';
|
static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg';
|
||||||
//assets/icons/water_leak_detected.svg
|
//assets/icons/water_leak_detected.svg
|
||||||
static const String waterLeakDetected =
|
static const String waterLeakDetected = 'assets/icons/water_leak_detected.svg';
|
||||||
'assets/icons/water_leak_detected.svg';
|
|
||||||
|
|
||||||
//assets/icons/automation_records.svg
|
//assets/icons/automation_records.svg
|
||||||
static const String automationRecords = 'assets/icons/automation_records.svg';
|
static const String automationRecords = 'assets/icons/automation_records.svg';
|
||||||
|
|
||||||
|
//assets/icons/1gang.svg
|
||||||
|
static const String oneGang = 'assets/icons/1gang.svg';
|
||||||
|
|
||||||
|
//assets/icons/2gang.svg
|
||||||
|
static const String twoGang = 'assets/icons/2gang.svg';
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,13 @@ enum DeviceType {
|
|||||||
DoorLock,
|
DoorLock,
|
||||||
Curtain,
|
Curtain,
|
||||||
Blind,
|
Blind,
|
||||||
|
OneGang,
|
||||||
|
TwoGang,
|
||||||
ThreeGang,
|
ThreeGang,
|
||||||
Gateway,
|
Gateway,
|
||||||
CeilingSensor,
|
CeilingSensor,
|
||||||
WallSensor,
|
WallSensor,
|
||||||
|
WH,
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,4 +21,8 @@ Map<String, DeviceType> devicesTypesMap = {
|
|||||||
"DL": DeviceType.DoorLock,
|
"DL": DeviceType.DoorLock,
|
||||||
"WPS": DeviceType.WallSensor,
|
"WPS": DeviceType.WallSensor,
|
||||||
"3G": DeviceType.ThreeGang,
|
"3G": DeviceType.ThreeGang,
|
||||||
|
"2G": DeviceType.TwoGang,
|
||||||
|
"1G": DeviceType.OneGang,
|
||||||
|
"CUR": DeviceType.Curtain,
|
||||||
|
"WH": DeviceType.WH,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user