mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
enhancement and bug fixes
This commit is contained in:
@ -131,7 +131,10 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (widget.withCheckBox) _buildSelectAllCheckbox(),
|
if (widget.withCheckBox) _buildSelectAllCheckbox(),
|
||||||
...widget.headers.map((header) => _buildTableHeaderCell(header)),
|
...List.generate(widget.headers.length, (index) {
|
||||||
|
return _buildTableHeaderCell(widget.headers[index], index);
|
||||||
|
})
|
||||||
|
//...widget.headers.map((header) => _buildTableHeaderCell(header)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -224,7 +227,7 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTableHeaderCell(String title) {
|
Widget _buildTableHeaderCell(String title, int index) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
@ -235,7 +238,7 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
constraints: const BoxConstraints.expand(height: 40),
|
constraints: const BoxConstraints.expand(height: 40),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4),
|
padding: EdgeInsets.symmetric(horizontal: index == widget.headers.length - 1 ? 12 : 8.0, vertical: 4),
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
style: context.textTheme.titleSmall!.copyWith(
|
style: context.textTheme.titleSmall!.copyWith(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
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:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@ -33,190 +33,56 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
int currentPage = 0;
|
int currentPage = 0;
|
||||||
|
|
||||||
List<EventDevice> record = [
|
List<EventDevice> record = [
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:43'), value: '2286'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:35'), value: '2285'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:43'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:29'), value: '2284'),
|
||||||
value: '2286'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:25'), value: '2285'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:21'), value: '2284'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:17'), value: '2285'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:35'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:15:07'), value: '2286'),
|
||||||
value: '2285'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:14:47'), value: '2285'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:14:40'), value: '2284'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:14:23'), value: '2285'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:29'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2024-10-23 11:14:13'), value: '2284'),
|
||||||
value: '2284'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:43'), value: '2286'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:35'), value: '2285'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:29'), value: '2284'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:25'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:25'), value: '2285'),
|
||||||
value: '2285'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:21'), value: '2284'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:17'), value: '2285'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:15:07'), value: '2286'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:21'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:14:47'), value: '2285'),
|
||||||
value: '2284'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:14:40'), value: '2284'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:14:23'), value: '2285'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-10-23 11:14:13'), value: '2284'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:17'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:43'), value: '2286'),
|
||||||
value: '2285'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:35'), value: '2285'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:29'), value: '2284'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:25'), value: '2285'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:15:07'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:21'), value: '2284'),
|
||||||
value: '2286'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:17'), value: '2285'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:15:07'), value: '2286'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:14:47'), value: '2285'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:14:47'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:14:40'), value: '2284'),
|
||||||
value: '2285'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:14:23'), value: '2285'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-23 11:14:13'), value: '2284'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-11 11:15:43'), value: '2286'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:14:40'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-11 11:15:35'), value: '2285'),
|
||||||
value: '2284'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-12 11:15:29'), value: '2284'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-13 11:15:25'), value: '2285'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-14 11:15:21'), value: '2284'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:14:23'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-15 11:15:17'), value: '2285'),
|
||||||
value: '2285'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-16 11:15:07'), value: '2286'),
|
||||||
EventDevice(
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-17 11:14:47'), value: '2285'),
|
||||||
code: 'VoltageA',
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-18 11:14:40'), value: '2284'),
|
||||||
eventTime: DateTime.parse('2024-10-23 11:14:13'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-19 11:14:23'), value: '2285'),
|
||||||
value: '2284'),
|
EventDevice(code: 'VoltageA', eventTime: DateTime.parse('2023-02-20 11:14:13'), value: '2284'),
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:43'),
|
|
||||||
value: '2286'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:35'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:29'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:25'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:21'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:17'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:15:07'),
|
|
||||||
value: '2286'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:14:47'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:14:40'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:14:23'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-10-23 11:14:13'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:43'),
|
|
||||||
value: '2286'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:35'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:29'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:25'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:21'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:17'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:15:07'),
|
|
||||||
value: '2286'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:14:47'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:14:40'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:14:23'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-23 11:14:13'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-11 11:15:43'),
|
|
||||||
value: '2286'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-11 11:15:35'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-12 11:15:29'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-13 11:15:25'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-14 11:15:21'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-15 11:15:17'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-16 11:15:07'),
|
|
||||||
value: '2286'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-17 11:14:47'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-18 11:14:40'),
|
|
||||||
value: '2284'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-19 11:14:23'),
|
|
||||||
value: '2285'),
|
|
||||||
EventDevice(
|
|
||||||
code: 'VoltageA',
|
|
||||||
eventTime: DateTime.parse('2023-02-20 11:14:13'),
|
|
||||||
value: '2284'),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
FutureOr<void> _onFetchDeviceStatus(
|
FutureOr<void> _onFetchDeviceStatus(SmartPowerFetchDeviceEvent event, Emitter<SmartPowerState> emit) async {
|
||||||
SmartPowerFetchDeviceEvent event, Emitter<SmartPowerState> emit) async {
|
|
||||||
emit(SmartPowerLoading());
|
emit(SmartPowerLoading());
|
||||||
try {
|
try {
|
||||||
var status =
|
var status = await DevicesManagementApi().getPowerClampInfo(event.deviceId);
|
||||||
await DevicesManagementApi().getPowerClampInfo(event.deviceId);
|
|
||||||
deviceStatus = PowerClampModel.fromJson(status);
|
deviceStatus = PowerClampModel.fromJson(status);
|
||||||
|
|
||||||
phaseData = [
|
phaseData = [
|
||||||
@ -248,22 +114,19 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _onArrowPressed(
|
FutureOr<void> _onArrowPressed(SmartPowerArrowPressedEvent event, Emitter<SmartPowerState> emit) {
|
||||||
SmartPowerArrowPressedEvent event, Emitter<SmartPowerState> emit) {
|
|
||||||
currentPage = (currentPage + event.direction + 4) % 4;
|
currentPage = (currentPage + event.direction + 4) % 4;
|
||||||
emit(SmartPowerStatusLoaded(deviceStatus, currentPage));
|
emit(SmartPowerStatusLoaded(deviceStatus, currentPage));
|
||||||
emit(GetDeviceStatus());
|
emit(GetDeviceStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _onPageChanged(
|
FutureOr<void> _onPageChanged(SmartPowerPageChangedEvent event, Emitter<SmartPowerState> emit) {
|
||||||
SmartPowerPageChangedEvent event, Emitter<SmartPowerState> emit) {
|
|
||||||
currentPage = event.page;
|
currentPage = event.page;
|
||||||
emit(SmartPowerStatusLoaded(deviceStatus, currentPage));
|
emit(SmartPowerStatusLoaded(deviceStatus, currentPage));
|
||||||
emit(GetDeviceStatus());
|
emit(GetDeviceStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onFactoryReset(
|
Future<void> _onFactoryReset(SmartPowerFactoryReset event, Emitter<SmartPowerState> emit) async {
|
||||||
SmartPowerFactoryReset event, Emitter<SmartPowerState> emit) async {
|
|
||||||
emit(SmartPowerLoading());
|
emit(SmartPowerLoading());
|
||||||
try {
|
try {
|
||||||
final response = await DevicesManagementApi().factoryReset(
|
final response = await DevicesManagementApi().factoryReset(
|
||||||
@ -280,8 +143,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onBatchControl(
|
Future<void> _onBatchControl(PowerBatchControlEvent event, Emitter<SmartPowerState> emit) async {
|
||||||
PowerBatchControlEvent event, Emitter<SmartPowerState> emit) async {
|
|
||||||
final oldValue = deviceStatus.status;
|
final oldValue = deviceStatus.status;
|
||||||
|
|
||||||
_updateLocalValue(event.code, event.value);
|
_updateLocalValue(event.code, event.value);
|
||||||
@ -297,14 +159,11 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onFetchBatchStatus(
|
Future<void> _onFetchBatchStatus(SmartPowerFetchBatchEvent event, Emitter<SmartPowerState> emit) async {
|
||||||
SmartPowerFetchBatchEvent event, Emitter<SmartPowerState> emit) async {
|
|
||||||
emit(SmartPowerLoading());
|
emit(SmartPowerLoading());
|
||||||
try {
|
try {
|
||||||
final response =
|
final response = await DevicesManagementApi().getPowerStatus(event.devicesIds);
|
||||||
await DevicesManagementApi().getPowerStatus(event.devicesIds);
|
PowerClampBatchModel deviceStatus = PowerClampBatchModel.fromJson(response);
|
||||||
PowerClampBatchModel deviceStatus =
|
|
||||||
PowerClampBatchModel.fromJson(response);
|
|
||||||
|
|
||||||
emit(SmartPowerLoadBatchControll(deviceStatus));
|
emit(SmartPowerLoadBatchControll(deviceStatus));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -336,11 +195,9 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
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) {
|
||||||
@ -360,8 +217,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _revertValueAndEmit(String deviceId, String code, dynamic oldValue,
|
void _revertValueAndEmit(String deviceId, String code, dynamic oldValue, Emitter<SmartPowerState> emit) {
|
||||||
Emitter<SmartPowerState> emit) {
|
|
||||||
_updateLocalValue(code, oldValue);
|
_updateLocalValue(code, oldValue);
|
||||||
emit(SmartPowerLoadBatchControll(deviceBatchStatus));
|
emit(SmartPowerLoadBatchControll(deviceBatchStatus));
|
||||||
}
|
}
|
||||||
@ -418,10 +274,8 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
int selectedYear = DateTime.now().year;
|
int selectedYear = DateTime.now().year;
|
||||||
int selectedMonth = DateTime.now().month;
|
int selectedMonth = DateTime.now().month;
|
||||||
|
|
||||||
FixedExtentScrollController yearController =
|
FixedExtentScrollController yearController = FixedExtentScrollController(initialItem: selectedYear - 1905);
|
||||||
FixedExtentScrollController(initialItem: selectedYear - 1905);
|
FixedExtentScrollController monthController = FixedExtentScrollController(initialItem: selectedMonth - 1);
|
||||||
FixedExtentScrollController monthController =
|
|
||||||
FixedExtentScrollController(initialItem: selectedMonth - 1);
|
|
||||||
|
|
||||||
return await showDialog<DateTime>(
|
return await showDialog<DateTime>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -440,8 +294,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
padding: EdgeInsets.all(16.0),
|
padding: EdgeInsets.all(16.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Select Month and Year',
|
'Select Month and Year',
|
||||||
style:
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
@ -484,8 +337,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
builder: (context, index) {
|
builder: (context, index) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
DateFormat.MMMM()
|
DateFormat.MMMM().format(DateTime(0, index + 1)),
|
||||||
.format(DateTime(0, index + 1)),
|
|
||||||
style: const TextStyle(fontSize: 18),
|
style: const TextStyle(fontSize: 18),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -500,8 +352,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
horizontal: 16.0, vertical: 8.0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -514,8 +365,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final selectedDateTime =
|
final selectedDateTime = DateTime(selectedYear, selectedMonth);
|
||||||
DateTime(selectedYear, selectedMonth);
|
|
||||||
Navigator.of(context).pop(selectedDateTime);
|
Navigator.of(context).pop(selectedDateTime);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -533,8 +383,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
|
|
||||||
Future<DateTime?> selectYear(BuildContext context) async {
|
Future<DateTime?> selectYear(BuildContext context) async {
|
||||||
int selectedYear = DateTime.now().year;
|
int selectedYear = DateTime.now().year;
|
||||||
FixedExtentScrollController yearController =
|
FixedExtentScrollController yearController = FixedExtentScrollController(initialItem: selectedYear - 1905);
|
||||||
FixedExtentScrollController(initialItem: selectedYear - 1905);
|
|
||||||
|
|
||||||
return await showDialog<DateTime>(
|
return await showDialog<DateTime>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -553,8 +402,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
padding: EdgeInsets.all(16.0),
|
padding: EdgeInsets.all(16.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Select Year',
|
'Select Year',
|
||||||
style:
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
@ -581,22 +429,21 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
horizontal: 16.0, vertical: 8.0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context) .pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final selectedDateTime = DateTime(selectedYear);
|
final selectedDateTime = DateTime(selectedYear);
|
||||||
Navigator.of(context).pop(selectedDateTime);
|
Navigator.of(context).pop(selectedDateTime);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -624,9 +471,12 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
|
||||||
height: 350,
|
height: 350,
|
||||||
width: 350,
|
width: 350,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -642,8 +492,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
horizontal: 16.0, vertical: 8.0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -675,8 +524,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
|
|
||||||
String formattedDate = DateFormat('yyyy/MM/dd').format(DateTime.now());
|
String formattedDate = DateFormat('yyyy/MM/dd').format(DateTime.now());
|
||||||
|
|
||||||
void checkDayMonthYearSelected(
|
void checkDayMonthYearSelected(SelectDateEvent event, Emitter<SmartPowerState> emit) async {
|
||||||
SelectDateEvent event, Emitter<SmartPowerState> emit) async {
|
|
||||||
Future<DateTime?> Function(BuildContext context)? dateSelector;
|
Future<DateTime?> Function(BuildContext context)? dateSelector;
|
||||||
String dateFormat;
|
String dateFormat;
|
||||||
switch (currentIndex) {
|
switch (currentIndex) {
|
||||||
@ -702,7 +550,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
emit(SmartPowerLoading());
|
emit(FakeState());
|
||||||
});
|
});
|
||||||
// Use the selected picker
|
// Use the selected picker
|
||||||
await dateSelector(event.context).then((newDate) {
|
await dateSelector(event.context).then((newDate) {
|
||||||
@ -718,27 +566,21 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
// formattedDate = newDate.toString();
|
// formattedDate = newDate.toString();
|
||||||
});
|
});
|
||||||
emit(FilterRecordsState(filteredRecords: energyDataList));
|
emit(FilterRecordsState(filteredRecords: energyDataList));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EnergyData> energyDataList = [];
|
List<EnergyData> energyDataList = [];
|
||||||
void _filterRecordsByDate(
|
void _filterRecordsByDate(FilterRecordsByDateEvent event, Emitter<SmartPowerState> emit) {
|
||||||
FilterRecordsByDateEvent event, Emitter<SmartPowerState> emit) {
|
// emit(SmartPowerLoading());
|
||||||
emit(SmartPowerLoading());
|
|
||||||
|
|
||||||
if (event.viewType == 'Year') {
|
if (event.viewType == 'Year') {
|
||||||
formattedDate = event.selectedDate.year.toString();
|
formattedDate = event.selectedDate.year.toString();
|
||||||
filteredRecords = record
|
filteredRecords = record.where((record) => record.eventTime!.year == event.selectedDate.year).toList();
|
||||||
.where((record) => record.eventTime!.year == event.selectedDate.year)
|
|
||||||
.toList();
|
|
||||||
} else if (event.viewType == 'Month') {
|
} else if (event.viewType == 'Month') {
|
||||||
formattedDate =
|
formattedDate = "${event.selectedDate.year.toString()}-${getMonthShortName(event.selectedDate.month)}";
|
||||||
"${event.selectedDate.year.toString()}-${getMonthShortName(event.selectedDate.month)}";
|
|
||||||
|
|
||||||
filteredRecords = record
|
filteredRecords = record
|
||||||
.where((record) =>
|
.where((record) =>
|
||||||
record.eventTime!.year == event.selectedDate.year &&
|
record.eventTime!.year == event.selectedDate.year && record.eventTime!.month == event.selectedDate.month)
|
||||||
record.eventTime!.month == event.selectedDate.month)
|
|
||||||
.toList();
|
.toList();
|
||||||
} else if (event.viewType == 'Day') {
|
} else if (event.viewType == 'Day') {
|
||||||
formattedDate =
|
formattedDate =
|
||||||
@ -756,8 +598,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
energyDataList = filteredRecords.map((eventDevice) {
|
energyDataList = filteredRecords.map((eventDevice) {
|
||||||
return EnergyData(
|
return EnergyData(
|
||||||
event.viewType == 'Year'
|
event.viewType == 'Year'
|
||||||
? getMonthShortName(
|
? getMonthShortName(int.tryParse(DateFormat('MM').format(eventDevice.eventTime!))!)
|
||||||
int.tryParse(DateFormat('MM').format(eventDevice.eventTime!))!)
|
|
||||||
: event.viewType == 'Month'
|
: event.viewType == 'Month'
|
||||||
? DateFormat('yyyy/MM/dd').format(eventDevice.eventTime!)
|
? DateFormat('yyyy/MM/dd').format(eventDevice.eventTime!)
|
||||||
: DateFormat('HH:mm:ss').format(eventDevice.eventTime!),
|
: DateFormat('HH:mm:ss').format(eventDevice.eventTime!),
|
||||||
@ -773,11 +614,10 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String endChartDate = '';
|
String endChartDate = '';
|
||||||
|
|
||||||
void selectDateRange() async {
|
void selectDateRange() async {
|
||||||
DateTime startDate = dateTime!;
|
DateTime startDate = dateTime!;
|
||||||
DateTime endDate = DateTime(startDate.year, startDate.month + 1, 1)
|
DateTime endDate = DateTime(startDate.year, startDate.month + 1, 1).subtract(Duration(days: 1));
|
||||||
.subtract(Duration(days: 1));
|
|
||||||
String formattedEndDate = DateFormat('dd/MM/yyyy').format(endDate);
|
String formattedEndDate = DateFormat('dd/MM/yyyy').format(endDate);
|
||||||
endChartDate = ' - $formattedEndDate';
|
endChartDate = ' - $formattedEndDate';
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ class SmartPowerState extends Equatable {
|
|||||||
class SmartPowerInitial extends SmartPowerState {}
|
class SmartPowerInitial extends SmartPowerState {}
|
||||||
|
|
||||||
class SmartPowerLoading extends SmartPowerState {}
|
class SmartPowerLoading extends SmartPowerState {}
|
||||||
|
|
||||||
class GetDeviceStatus extends SmartPowerState {}
|
class GetDeviceStatus extends SmartPowerState {}
|
||||||
//GetDeviceStatus
|
//GetDeviceStatus
|
||||||
|
|
||||||
@ -25,6 +26,8 @@ class SmartPowerLoadBatchControll extends SmartPowerState {
|
|||||||
|
|
||||||
class DateSelectedState extends SmartPowerState {}
|
class DateSelectedState extends SmartPowerState {}
|
||||||
|
|
||||||
|
class FakeState extends SmartPowerState {}
|
||||||
|
|
||||||
class SmartPowerStatusLoaded extends SmartPowerState {
|
class SmartPowerStatusLoaded extends SmartPowerState {
|
||||||
final PowerClampModel deviceStatus;
|
final PowerClampModel deviceStatus;
|
||||||
final int currentPage;
|
final int currentPage;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/painting.dart';
|
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
@ -20,57 +19,61 @@ class PowerClampInfoCard extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Padding(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(5.0),
|
margin: const EdgeInsets.symmetric(horizontal: 6),
|
||||||
child: Container(
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
color: ColorsManager.whiteColors,
|
||||||
color: ColorsManager.graysColor,
|
borderRadius: BorderRadius.circular(20),
|
||||||
borderRadius: BorderRadius.circular(20),
|
),
|
||||||
),
|
height: 55,
|
||||||
height: 55,
|
child: Row(
|
||||||
child: Row(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
children: [
|
||||||
children: [
|
const SizedBox(
|
||||||
SvgPicture.asset(
|
width: 16,
|
||||||
iconPath,
|
),
|
||||||
fit: BoxFit.fill,
|
SvgPicture.asset(
|
||||||
),
|
iconPath,
|
||||||
Column(
|
fit: BoxFit.fill,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
const SizedBox(
|
||||||
children: [
|
width: 18,
|
||||||
Text(
|
),
|
||||||
title,
|
Column(
|
||||||
style: TextStyle(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
fontSize: 8,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
fontWeight: FontWeight.w400,
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 8,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Text(
|
||||||
Row(
|
unit,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
style: const TextStyle(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
fontSize: 15,
|
||||||
children: [
|
fontWeight: FontWeight.w700,
|
||||||
Text(
|
|
||||||
value,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
unit,
|
],
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: 15,
|
],
|
||||||
fontWeight: FontWeight.w700,
|
)
|
||||||
),
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -3,17 +3,16 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_event.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_event.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_state.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_state.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/power_clamp/view/phase_widget.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_chart.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_chart.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_info_card.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_info_card.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/view/phase_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.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/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||||
|
|
||||||
//Smart Power Clamp
|
//Smart Power Clamp
|
||||||
class SmartPowerDeviceControl extends StatelessWidget
|
class SmartPowerDeviceControl extends StatelessWidget with HelperResponsiveLayout {
|
||||||
with HelperResponsiveLayout {
|
|
||||||
final String deviceId;
|
final String deviceId;
|
||||||
|
|
||||||
const SmartPowerDeviceControl({super.key, required this.deviceId});
|
const SmartPowerDeviceControl({super.key, required this.deviceId});
|
||||||
@ -21,14 +20,19 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => SmartPowerBloc(deviceId: deviceId)
|
create: (context) => SmartPowerBloc(deviceId: deviceId)..add(SmartPowerFetchDeviceEvent(deviceId)),
|
||||||
..add(SmartPowerFetchDeviceEvent(deviceId)),
|
|
||||||
child: BlocBuilder<SmartPowerBloc, SmartPowerState>(
|
child: BlocBuilder<SmartPowerBloc, SmartPowerState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final _blocProvider = BlocProvider.of<SmartPowerBloc>(context);
|
final _blocProvider = BlocProvider.of<SmartPowerBloc>(context);
|
||||||
|
|
||||||
if (state is SmartPowerLoading) {
|
if (state is SmartPowerLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
} else if (state is FakeState) {
|
||||||
|
return _buildStatusControls(
|
||||||
|
currentPage: _blocProvider.currentPage,
|
||||||
|
context: context,
|
||||||
|
blocProvider: _blocProvider,
|
||||||
|
);
|
||||||
} else if (state is GetDeviceStatus) {
|
} else if (state is GetDeviceStatus) {
|
||||||
return _buildStatusControls(
|
return _buildStatusControls(
|
||||||
currentPage: _blocProvider.currentPage,
|
currentPage: _blocProvider.currentPage,
|
||||||
@ -56,6 +60,7 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
}) {
|
}) {
|
||||||
PageController _pageController = PageController(initialPage: currentPage);
|
PageController _pageController = PageController(initialPage: currentPage);
|
||||||
return Container(
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||||
child: DeviceControlsContainer(
|
child: DeviceControlsContainer(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@ -63,62 +68,54 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Live',
|
'Live',
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 32, fontWeight: FontWeight.w700, color: ColorsManager.blackColor),
|
||||||
fontSize: 32,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: ColorsManager.grayColor),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
PowerClampInfoCard(
|
PowerClampInfoCard(
|
||||||
iconPath: Assets.powerActiveIcon,
|
iconPath: Assets.powerActiveIcon,
|
||||||
title: 'Active',
|
title: 'Active',
|
||||||
value: blocProvider
|
value: blocProvider.deviceStatus.status.general.dataPoints[2].value.toString(),
|
||||||
.deviceStatus.status.general.dataPoints[2].value
|
|
||||||
.toString(),
|
|
||||||
unit: '',
|
unit: '',
|
||||||
),
|
),
|
||||||
PowerClampInfoCard(
|
PowerClampInfoCard(
|
||||||
iconPath: Assets.voltMeterIcon,
|
iconPath: Assets.voltMeterIcon,
|
||||||
title: 'Current',
|
title: 'Current',
|
||||||
value: blocProvider
|
value: blocProvider.deviceStatus.status.general.dataPoints[1].value.toString(),
|
||||||
.deviceStatus.status.general.dataPoints[1].value
|
|
||||||
.toString(),
|
|
||||||
unit: ' A',
|
unit: ' A',
|
||||||
),
|
),
|
||||||
PowerClampInfoCard(
|
PowerClampInfoCard(
|
||||||
iconPath: Assets.frequencyIcon,
|
iconPath: Assets.frequencyIcon,
|
||||||
title: 'Frequency',
|
title: 'Frequency',
|
||||||
value: blocProvider
|
value: blocProvider.deviceStatus.status.general.dataPoints[4].value.toString(),
|
||||||
.deviceStatus.status.general.dataPoints[4].value
|
|
||||||
.toString(),
|
|
||||||
unit: ' Hz',
|
unit: ' Hz',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
PhaseWidget(
|
PhaseWidget(
|
||||||
phaseData: blocProvider.phaseData,
|
phaseData: blocProvider.phaseData,
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 10,
|
top: 10,
|
||||||
left: 20,
|
left: 20,
|
||||||
right: 20,
|
right: 20,
|
||||||
|
bottom: 10,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
height: 325,
|
height: 300,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@ -175,14 +172,12 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
children: [
|
children: [
|
||||||
EnergyConsumptionPage(
|
EnergyConsumptionPage(
|
||||||
formattedDate:
|
formattedDate: '${blocProvider.formattedDate}${blocProvider.endChartDate}',
|
||||||
'${blocProvider.formattedDate}${blocProvider.endChartDate}',
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
blocProvider.add(SelectDateEvent(context: context));
|
blocProvider.add(SelectDateEvent(context: context));
|
||||||
blocProvider.add(FilterRecordsByDateEvent(
|
blocProvider.add(FilterRecordsByDateEvent(
|
||||||
selectedDate: blocProvider.dateTime!,
|
selectedDate: blocProvider.dateTime!,
|
||||||
viewType: blocProvider
|
viewType: blocProvider.views[blocProvider.currentIndex]));
|
||||||
.views[blocProvider.currentIndex]));
|
|
||||||
},
|
},
|
||||||
widget: blocProvider.dateSwitcher(),
|
widget: blocProvider.dateSwitcher(),
|
||||||
chartData: blocProvider.energyDataList.isNotEmpty
|
chartData: blocProvider.energyDataList.isNotEmpty
|
||||||
|
@ -52,6 +52,7 @@ class _FactoryResetWidgetState extends State<FactoryResetWidget> {
|
|||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
height: 20,
|
height: 20,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
padding: 0,
|
||||||
onPressed: _toggleConfirmation,
|
onPressed: _toggleConfirmation,
|
||||||
backgroundColor: ColorsManager.greyColor,
|
backgroundColor: ColorsManager.greyColor,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -69,14 +70,16 @@ class _FactoryResetWidgetState extends State<FactoryResetWidget> {
|
|||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
height: 20,
|
height: 20,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
padding: 0,
|
||||||
onPressed: widget.callFactoryReset,
|
onPressed: widget.callFactoryReset,
|
||||||
backgroundColor: ColorsManager.red,
|
backgroundColor: ColorsManager.red,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Reset',
|
'Reset',
|
||||||
style: context.textTheme.bodyMedium!.copyWith(
|
style: context.textTheme.bodyMedium!.copyWith(
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 12),
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user