mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
merged with dev and access_bugs and solved conflicts
This commit is contained in:
@ -14,7 +14,6 @@ class DynamicTable extends StatefulWidget {
|
||||
final void Function(bool?)? selectAll;
|
||||
final void Function(int, bool, dynamic)? onRowSelected;
|
||||
final List<String>? initialSelectedIds;
|
||||
|
||||
const DynamicTable({
|
||||
super.key,
|
||||
required this.headers,
|
||||
@ -66,14 +65,11 @@ class _DynamicTableState extends State<DynamicTable> {
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: widget.headerDecoration ??
|
||||
BoxDecoration(color: Colors.grey[200]),
|
||||
decoration: widget.headerDecoration ?? BoxDecoration(color: Colors.grey[200]),
|
||||
child: Row(
|
||||
children: [
|
||||
if (widget.withCheckBox) _buildSelectAllCheckbox(),
|
||||
...widget.headers
|
||||
.map((header) => _buildTableHeaderCell(header))
|
||||
.toList(),
|
||||
...widget.headers.map((header) => _buildTableHeaderCell(header)).toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -97,8 +93,7 @@ class _DynamicTableState extends State<DynamicTable> {
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(
|
||||
color: ColorsManager.grayColor),
|
||||
.copyWith(color: ColorsManager.grayColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -118,12 +113,10 @@ class _DynamicTableState extends State<DynamicTable> {
|
||||
return Row(
|
||||
children: [
|
||||
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))
|
||||
.map((cell) =>
|
||||
_buildTableCell(cell.toString(), widget.size.height * 0.10))
|
||||
.toList(),
|
||||
],
|
||||
);
|
||||
@ -211,6 +204,27 @@ class _DynamicTableState extends State<DynamicTable> {
|
||||
batteryLevel = double.tryParse(content.replaceAll('%', '').trim());
|
||||
}
|
||||
|
||||
Color? statusColor;
|
||||
switch (content) {
|
||||
case 'Effective':
|
||||
statusColor = ColorsManager.textGreen;
|
||||
break;
|
||||
case 'Expired':
|
||||
statusColor = ColorsManager.red;
|
||||
break;
|
||||
case 'To be effective':
|
||||
statusColor = ColorsManager.yaGreen;
|
||||
break;
|
||||
case 'Online':
|
||||
statusColor = ColorsManager.green;
|
||||
break;
|
||||
case 'Offline':
|
||||
statusColor = ColorsManager.red;
|
||||
break;
|
||||
default:
|
||||
statusColor = Colors.black; // Default color
|
||||
}
|
||||
|
||||
return Expanded(
|
||||
child: Container(
|
||||
height: size,
|
||||
@ -227,16 +241,11 @@ class _DynamicTableState extends State<DynamicTable> {
|
||||
child: Text(
|
||||
content,
|
||||
style: TextStyle(
|
||||
color: batteryLevel != null && batteryLevel < 20
|
||||
? ColorsManager.red // Red color for low battery
|
||||
: content == 'Online'
|
||||
? ColorsManager.green // Green color for Online
|
||||
: content == 'Offline'
|
||||
? ColorsManager.red // Red color for Offline
|
||||
: Colors.black,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
color: batteryLevel != null && batteryLevel < 20
|
||||
? ColorsManager.red
|
||||
: statusColor, // Use the passed color or default to black
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user