sp:1677 [FE] Device status in Control modal always shows "Online" regardless of actual status (#287)

<!--
  Thanks for contributing!

Provide a description of your changes below and a general summary in the
title

Please look at the following checklist to ensure that your PR can be
accepted quickly:
-->

## Jira Ticket
[SP-1677](https://syncrow.atlassian.net/browse/SP-1677)

## Description

status depend on the real status of the device afterit was static 

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ]  New feature (non-breaking change which adds functionality)
- [x] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ]  Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] 🧹 Code refactor
- [ ]  Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore 


[SP-1677]:
https://syncrow.atlassian.net/browse/SP-1677?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
This commit is contained in:
Rafeek-khoudare
2025-06-25 08:18:10 +03:00
committed by GitHub

View File

@ -79,6 +79,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
} }
Widget _buildDeviceInfoSection() { Widget _buildDeviceInfoSection() {
final isOnlineDevice = device.online != null && device.online!;
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 25, horizontal: 50), padding: const EdgeInsets.symmetric(vertical: 25, horizontal: 50),
child: Table( child: Table(
@ -107,7 +108,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
'Installation Date and Time:', 'Installation Date and Time:',
formatDateTime( formatDateTime(
DateTime.fromMillisecondsSinceEpoch( DateTime.fromMillisecondsSinceEpoch(
((device.createTime ?? 0) * 1000), (device.createTime ?? 0) * 1000,
), ),
), ),
), ),
@ -126,12 +127,16 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
), ),
TableRow( TableRow(
children: [ children: [
_buildInfoRow('Status:', 'Online', statusColor: Colors.green), _buildInfoRow(
'Status:',
isOnlineDevice ? 'Online' : 'offline',
statusColor: isOnlineDevice ? Colors.green : Colors.red,
),
_buildInfoRow( _buildInfoRow(
'Last Offline Date and Time:', 'Last Offline Date and Time:',
formatDateTime( formatDateTime(
DateTime.fromMillisecondsSinceEpoch( DateTime.fromMillisecondsSinceEpoch(
((device.updateTime ?? 0) * 1000), (device.updateTime ?? 0) * 1000,
), ),
), ),
), ),