Fix(ui): Fix some ui bugs
Find Button In DeviceLogsScreen Fix offlineText when in DarkMode Update offlineIcons
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 36 KiB |
@@ -2,10 +2,10 @@
|
|||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:sfm_app/product/constant/app/app_constants.dart';
|
|
||||||
import 'widgets/tag_widget.dart';
|
import 'widgets/tag_widget.dart';
|
||||||
import '../devices/device_model.dart';
|
import '../devices/device_model.dart';
|
||||||
import '../../bloc/device_logs_bloc.dart';
|
import '../../bloc/device_logs_bloc.dart';
|
||||||
|
import '../../product/constant/app/app_constants.dart';
|
||||||
import '../../product/constant/icon/icon_constants.dart';
|
import '../../product/constant/icon/icon_constants.dart';
|
||||||
import '../../product/extension/context_extension.dart';
|
import '../../product/extension/context_extension.dart';
|
||||||
import '../../product/services/language_services.dart';
|
import '../../product/services/language_services.dart';
|
||||||
@@ -175,11 +175,11 @@ class _DeviceLogsScreenState extends State<DeviceLogsScreen> {
|
|||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
style: const ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
WidgetStatePropertyAll(Colors.green),
|
WidgetStatePropertyAll(Theme.of(context).primaryColor),
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
WidgetStatePropertyAll(Colors.white),
|
WidgetStatePropertyAll(Theme.of(context).colorScheme.surfaceBright),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (fromDateApi.isEmpty) {
|
if (fromDateApi.isEmpty) {
|
||||||
@@ -200,8 +200,7 @@ class _DeviceLogsScreenState extends State<DeviceLogsScreen> {
|
|||||||
// log("ThingID: $thingID");
|
// log("ThingID: $thingID");
|
||||||
// log("From Date: ${DateTimeUtils.instance.formatDateTimeToString(dateTime!)}");
|
// log("From Date: ${DateTimeUtils.instance.formatDateTimeToString(dateTime!)}");
|
||||||
},
|
},
|
||||||
icon: IconConstants.instance
|
icon: Icon(Icons.search,color: Theme.of(context).colorScheme.surfaceBright,),
|
||||||
.getMaterialIcon(Icons.search),
|
|
||||||
label: Text(
|
label: Text(
|
||||||
appLocalization(context)
|
appLocalization(context)
|
||||||
.find_button_content,
|
.find_button_content,
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class _DetailDeviceScreenState extends State<DetailDeviceScreen> {
|
|||||||
if (sensorSnapshot.data != null) {
|
if (sensorSnapshot.data != null) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(appLocalization(context).detail_message),
|
title: Text(deviceSnapshot.data?.name ?? ""),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
@@ -122,28 +122,28 @@ class _DetailDeviceScreenState extends State<DetailDeviceScreen> {
|
|||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(
|
// Center(
|
||||||
child: Container(
|
// child: Container(
|
||||||
height: 50,
|
// height: 50,
|
||||||
width: 400,
|
// width: 400,
|
||||||
// color: Colors.blueAccent,
|
// // color: Colors.blueAccent,
|
||||||
alignment: Alignment.centerRight,
|
// alignment: Alignment.centerRight,
|
||||||
margin: const EdgeInsets.fromLTRB(0, 0, 0, 50),
|
// margin: const EdgeInsets.fromLTRB(0, 0, 0, 50),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
// children: [
|
||||||
const SizedBox(),
|
// const SizedBox(),
|
||||||
Text(
|
// Text(
|
||||||
deviceSnapshot.data?.name ?? "",
|
// deviceSnapshot.data?.name ?? "",
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontSize: 25,
|
// fontSize: 25,
|
||||||
fontWeight: FontWeight.w600,
|
// fontWeight: FontWeight.w600,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -157,7 +157,7 @@ class _DetailDeviceScreenState extends State<DetailDeviceScreen> {
|
|||||||
width: context.dynamicWidth(0.5),
|
width: context.dynamicWidth(0.5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: DeviceUtils.instance
|
color: DeviceUtils.instance
|
||||||
.getTableRowColor(deviceSnapshot.data?.state ?? 3),
|
.getTableRowColor(context,deviceSnapshot.data?.state ?? 3),
|
||||||
borderRadius: BorderRadius.circular(50),
|
borderRadius: BorderRadius.circular(50),
|
||||||
),
|
),
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
@@ -192,7 +192,7 @@ class _DetailDeviceScreenState extends State<DetailDeviceScreen> {
|
|||||||
)
|
)
|
||||||
: CircleAvatar(
|
: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
DeviceUtils.instance.getTableRowColor(
|
DeviceUtils.instance.getTableRowColor(context,
|
||||||
deviceSnapshot.data?.state ?? 3,
|
deviceSnapshot.data?.state ?? 3,
|
||||||
),
|
),
|
||||||
minRadius: context.mediumValue,
|
minRadius: context.mediumValue,
|
||||||
|
|||||||
@@ -89,103 +89,98 @@ class _DevicesManagerScreenState extends State<DevicesManagerScreen> {
|
|||||||
builder: (context, roleSnapshot) {
|
builder: (context, roleSnapshot) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: context.dynamicHeight(0.4),
|
height: context.dynamicHeight(0.4),
|
||||||
child: CardTheme(
|
child: PaginatedDataTable2(
|
||||||
color: Theme.of(context).colorScheme.onPrimary,
|
headingRowHeight: 30,
|
||||||
shadowColor:
|
columnSpacing: 30,
|
||||||
Theme.of(context).colorScheme.onPrimary,
|
horizontalMargin: 10,
|
||||||
child: PaginatedDataTable2(
|
fixedLeftColumns: 1,
|
||||||
headingRowHeight: 30,
|
autoRowsToHeight: true,
|
||||||
columnSpacing: 30,
|
renderEmptyRowsInTheEnd: false,
|
||||||
horizontalMargin: 10,
|
dragStartBehavior: DragStartBehavior.down,
|
||||||
fixedLeftColumns: 1,
|
minWidth: 950,
|
||||||
autoRowsToHeight: true,
|
header: Center(
|
||||||
renderEmptyRowsInTheEnd: false,
|
child: Text(
|
||||||
dragStartBehavior: DragStartBehavior.down,
|
appLocalization(context)
|
||||||
minWidth: 950,
|
.paginated_data_table_title,
|
||||||
header: Center(
|
style: context.headlineMediumTextStyle,
|
||||||
child: Text(
|
|
||||||
appLocalization(context)
|
|
||||||
.paginated_data_table_title,
|
|
||||||
style: context.headlineMediumTextStyle,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
columns: [
|
),
|
||||||
if (roleSnapshot.data ==
|
columns: [
|
||||||
RoleEnums.ADMIN.name ||
|
if (roleSnapshot.data ==
|
||||||
roleSnapshot.data ==
|
RoleEnums.ADMIN.name ||
|
||||||
RoleEnums.USER.name)
|
roleSnapshot.data ==
|
||||||
DataColumn(
|
RoleEnums.USER.name)
|
||||||
label: Text(appLocalization(context)
|
|
||||||
.paginated_data_table_column_deviceName),
|
|
||||||
),
|
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_deviceStatus),
|
.paginated_data_table_column_deviceName),
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_deviceBaterry),
|
.paginated_data_table_column_deviceStatus),
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_deviceSignal),
|
.paginated_data_table_column_deviceBaterry),
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_deviceTemperature),
|
.paginated_data_table_column_deviceSignal),
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_deviceHump),
|
.paginated_data_table_column_deviceTemperature),
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_devicePower),
|
.paginated_data_table_column_deviceHump),
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(appLocalization(context)
|
label: Text(appLocalization(context)
|
||||||
.paginated_data_table_column_action),
|
.paginated_data_table_column_devicePower),
|
||||||
),
|
),
|
||||||
],
|
DataColumn(
|
||||||
onPageChanged: (int pageIndex) {
|
label: Text(appLocalization(context)
|
||||||
// log('Chuyen page: $pageIndex');
|
.paginated_data_table_column_action),
|
||||||
},
|
),
|
||||||
// rowsPerPage:
|
],
|
||||||
// (allDeviceSnapshot.data?.length ?? 1) < 6
|
onPageChanged: (int pageIndex) {
|
||||||
// ? (allDeviceSnapshot.data?.length ??
|
// log('Chuyen page: $pageIndex');
|
||||||
// 0)
|
},
|
||||||
// : 5,
|
// rowsPerPage:
|
||||||
|
// (allDeviceSnapshot.data?.length ?? 1) < 6
|
||||||
|
// ? (allDeviceSnapshot.data?.length ??
|
||||||
|
// 0)
|
||||||
|
// : 5,
|
||||||
|
|
||||||
actions: [
|
actions: [
|
||||||
if (roleSnapshot.data ==
|
if (roleSnapshot.data ==
|
||||||
RoleEnums.USER.name ||
|
RoleEnums.USER.name ||
|
||||||
roleSnapshot.data ==
|
roleSnapshot.data ==
|
||||||
RoleEnums.ADMIN.name)
|
RoleEnums.ADMIN.name)
|
||||||
IconButton(
|
IconButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
WidgetStateProperty.all<Color>(
|
WidgetStateProperty.all<Color>(
|
||||||
Colors.green),
|
Colors.green),
|
||||||
iconColor:
|
iconColor:
|
||||||
WidgetStateProperty.all<Color>(
|
WidgetStateProperty.all<Color>(
|
||||||
Colors.white,
|
Colors.white,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onPressed: () {
|
),
|
||||||
ScaffoldMessenger.of(context)
|
onPressed: () {
|
||||||
.clearSnackBars();
|
ScaffoldMessenger.of(context)
|
||||||
addNewDevice(context,
|
.clearSnackBars();
|
||||||
roleSnapshot.data ?? role);
|
addNewDevice(context,
|
||||||
},
|
roleSnapshot.data ?? role);
|
||||||
icon: IconConstants.instance
|
},
|
||||||
.getMaterialIcon(Icons.add))
|
icon: IconConstants.instance
|
||||||
],
|
.getMaterialIcon(Icons.add))
|
||||||
source: DeviceSource(
|
],
|
||||||
devices: allDeviceSnapshot.data ?? devices,
|
source: DeviceSource(
|
||||||
context: context,
|
devices: allDeviceSnapshot.data ?? devices,
|
||||||
devicesBloc: devicesManagerBloc,
|
context: context,
|
||||||
role: role,
|
devicesBloc: devicesManagerBloc,
|
||||||
),
|
role: role,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -265,7 +260,7 @@ class DeviceSource extends DataTableSource {
|
|||||||
Text(device.name!,
|
Text(device.name!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance
|
color: DeviceUtils.instance
|
||||||
.getTableRowColor(device.state!))), onTap: () {
|
.getTableRowColor(context,device.state!))), onTap: () {
|
||||||
context.pushNamed(AppRoutes.DEVICE_DETAIL.name,
|
context.pushNamed(AppRoutes.DEVICE_DETAIL.name,
|
||||||
pathParameters: {'thingID': device.thingId!});
|
pathParameters: {'thingID': device.thingId!});
|
||||||
}),
|
}),
|
||||||
@@ -273,36 +268,36 @@ class DeviceSource extends DataTableSource {
|
|||||||
Text(deviceState,
|
Text(deviceState,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance
|
color: DeviceUtils.instance
|
||||||
.getTableRowColor(device.state!))), onTap: () {
|
.getTableRowColor(context,device.state!))), onTap: () {
|
||||||
context.pushNamed(AppRoutes.DEVICE_DETAIL.name,
|
context.pushNamed(AppRoutes.DEVICE_DETAIL.name,
|
||||||
pathParameters: {'thingID': device.thingId!});
|
pathParameters: {'thingID': device.thingId!});
|
||||||
}),
|
}),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(sensorMap['sensorBattery'] + "%",
|
Text(sensorMap['sensorBattery'] + "%",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance.getTableRowColor(device.state!))),
|
color: DeviceUtils.instance.getTableRowColor(context,device.state!))),
|
||||||
onTap: () => context.pushNamed(AppRoutes.DEVICE_DETAIL.name,
|
onTap: () => context.pushNamed(AppRoutes.DEVICE_DETAIL.name,
|
||||||
pathParameters: {'thingID': device.thingId!}),
|
pathParameters: {'thingID': device.thingId!}),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(sensorMap['sensorCsq'],
|
Text(sensorMap['sensorCsq'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance.getTableRowColor(device.state!))),
|
color: DeviceUtils.instance.getTableRowColor(context,device.state!))),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text("${sensorMap['sensorTemp']}°C",
|
Text("${sensorMap['sensorTemp']}°C",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance.getTableRowColor(device.state!))),
|
color: DeviceUtils.instance.getTableRowColor(context,device.state!))),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text("${sensorMap['sensorHum']}%",
|
Text("${sensorMap['sensorHum']}%",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance.getTableRowColor(device.state!))),
|
color: DeviceUtils.instance.getTableRowColor(context,device.state!))),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text("${sensorMap['sensorVolt']}V",
|
Text("${sensorMap['sensorVolt']}V",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance.getTableRowColor(device.state!))),
|
color: DeviceUtils.instance.getTableRowColor(context,device.state!))),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Center(
|
Center(
|
||||||
@@ -354,7 +349,7 @@ class TagState extends StatelessWidget {
|
|||||||
height: context.mediumValue,
|
height: context.mediumValue,
|
||||||
width: context.dynamicWidth(0.35),
|
width: context.dynamicWidth(0.35),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: DeviceUtils.instance.getTableRowColor(state),
|
color: DeviceUtils.instance.getTableRowColor(context,state),
|
||||||
borderRadius: BorderRadius.circular(context.mediumValue),
|
borderRadius: BorderRadius.circular(context.mediumValue),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
|
|||||||
DeviceUtils.instance.checkStateDevice(
|
DeviceUtils.instance.checkStateDevice(
|
||||||
context, devices[index].state!),
|
context, devices[index].state!),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: DeviceUtils.instance.getTableRowColor(
|
color: DeviceUtils.instance.getTableRowColor(context,
|
||||||
devices[index].state!,
|
devices[index].state!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class DeviceSource extends DataTableSource {
|
|||||||
device.name!,
|
device.name!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color:
|
||||||
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
|
DeviceUtils.instance.getTableRowColor(context,device.state ?? -1)),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
mapBloc.updateCameraPosition(
|
mapBloc.updateCameraPosition(
|
||||||
@@ -311,7 +311,7 @@ class DeviceSource extends DataTableSource {
|
|||||||
deviceState,
|
deviceState,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color:
|
||||||
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
|
DeviceUtils.instance.getTableRowColor(context,device.state ?? -1)),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
mapBloc.updateCameraPosition(
|
mapBloc.updateCameraPosition(
|
||||||
@@ -327,7 +327,7 @@ class DeviceSource extends DataTableSource {
|
|||||||
sensorMap['sensorBattery'] + "%",
|
sensorMap['sensorBattery'] + "%",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color:
|
||||||
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
|
DeviceUtils.instance.getTableRowColor(context,device.state ?? -1)),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
mapBloc.updateCameraPosition(
|
mapBloc.updateCameraPosition(
|
||||||
@@ -343,7 +343,7 @@ class DeviceSource extends DataTableSource {
|
|||||||
sensorMap['sensorCsq'],
|
sensorMap['sensorCsq'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color:
|
||||||
DeviceUtils.instance.getTableRowColor(device.state ?? -1)),
|
DeviceUtils.instance.getTableRowColor(context,device.state ?? -1)),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
mapBloc.updateCameraPosition(
|
mapBloc.updateCameraPosition(
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class DeviceUtils {
|
|||||||
return devices..sort((a, b) => (a.name ?? '').compareTo(b.name ?? ''));
|
return devices..sort((a, b) => (a.name ?? '').compareTo(b.name ?? ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
Color getTableRowColor(int state) {
|
Color getTableRowColor(BuildContext context, int state) {
|
||||||
if (state == 1) {
|
if (state == 1) {
|
||||||
return Colors.red;
|
return Colors.red;
|
||||||
} else if (state == 0) {
|
} else if (state == 0) {
|
||||||
@@ -161,7 +161,7 @@ class DeviceUtils {
|
|||||||
} else if (state == -1) {
|
} else if (state == -1) {
|
||||||
return Colors.grey;
|
return Colors.grey;
|
||||||
} else {
|
} else {
|
||||||
return Colors.black87;
|
return Theme.of(context).colorScheme.onSurface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user