fix(bugs): update mapStyle when change theme

This commit is contained in:
anhtunz
2025-01-22 23:13:55 +07:00
parent 408c92d843
commit bcf205f171
12 changed files with 526 additions and 543 deletions

View File

@@ -93,9 +93,13 @@ onTapMarker(
double.parse(device.settings!.longitude!),
);
},
style: const ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.blue),
foregroundColor: WidgetStatePropertyAll(Colors.white),
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(
Theme.of(context).toggleButtonsTheme.fillColor),
foregroundColor: WidgetStatePropertyAll(
Theme.of(context).canvasColor),
iconColor: WidgetStatePropertyAll(
Theme.of(context).canvasColor),
),
child: Row(
children: [
@@ -129,6 +133,7 @@ onTapMarker(
style: const ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.pink),
foregroundColor: WidgetStatePropertyAll(Colors.white),
iconColor: WidgetStatePropertyAll(Colors.white),
),
icon: IconConstants.instance
.getMaterialIcon(Icons.local_hospital),
@@ -249,7 +254,7 @@ onTapMarker(
),
],
source: deviceSource,
rowsPerPage: 5,
rowsPerPage: devices.length > 4 ? 5 : devices.length,
),
],
),
@@ -279,13 +284,18 @@ class DeviceSource extends DataTableSource {
String deviceState =
DeviceUtils.instance.checkStateDevice(context, device.state!);
return DataRow.byIndex(
color: WidgetStatePropertyAll(
DeviceUtils.instance.getTableRowColor(device.state ?? -1),
),
// color: WidgetStatePropertyAll(
// DeviceUtils.instance.getTableRowColor(device.state ?? -1),
// ),
index: index,
cells: [
DataCell(
Text(device.name!),
Text(
device.name!,
style: TextStyle(
color:
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
),
onTap: () {
mapBloc.updateCameraPosition(
controller,
@@ -297,7 +307,12 @@ class DeviceSource extends DataTableSource {
},
),
DataCell(
Text(deviceState),
Text(
deviceState,
style: TextStyle(
color:
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
),
onTap: () {
mapBloc.updateCameraPosition(
controller,
@@ -308,7 +323,12 @@ class DeviceSource extends DataTableSource {
},
),
DataCell(
Text(sensorMap['sensorBattery'] + "%"),
Text(
sensorMap['sensorBattery'] + "%",
style: TextStyle(
color:
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
),
onTap: () {
mapBloc.updateCameraPosition(
controller,
@@ -319,7 +339,12 @@ class DeviceSource extends DataTableSource {
},
),
DataCell(
Text(sensorMap['sensorCsq']),
Text(
sensorMap['sensorCsq'],
style: TextStyle(
color:
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
),
onTap: () {
mapBloc.updateCameraPosition(
controller,