refactor(ui): update tags in DeviceLogsScreen
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:developer';
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:sfm_app/feature/device_log/widgets/tag_widget.dart';
|
||||
import 'package:sfm_app/feature/devices/device_model.dart';
|
||||
import 'package:sfm_app/feature/device_log/device_logs_bloc.dart';
|
||||
import 'package:sfm_app/product/constant/icon/icon_constants.dart';
|
||||
@@ -179,6 +180,8 @@ class _DeviceLogsScreenState extends State<DeviceLogsScreen> {
|
||||
style: const ButtonStyle(
|
||||
backgroundColor: MaterialStatePropertyAll(
|
||||
Colors.green),
|
||||
foregroundColor: MaterialStatePropertyAll(
|
||||
Colors.white),
|
||||
),
|
||||
onPressed: () {
|
||||
if (fromDateApi.isEmpty) {
|
||||
@@ -196,8 +199,8 @@ class _DeviceLogsScreenState extends State<DeviceLogsScreen> {
|
||||
dateTime!,
|
||||
sensors);
|
||||
}
|
||||
log("ThingID: $thingID");
|
||||
log("From Date: ${DateTimeUtils.instance.formatDateTimeToString(dateTime!)}");
|
||||
// log("ThingID: $thingID");
|
||||
// log("From Date: ${DateTimeUtils.instance.formatDateTimeToString(dateTime!)}");
|
||||
},
|
||||
icon: IconConstants.instance
|
||||
.getMaterialIcon(Icons.search),
|
||||
@@ -275,8 +278,7 @@ class _DeviceLogsScreenState extends State<DeviceLogsScreen> {
|
||||
ListTile(
|
||||
subtitle:
|
||||
Text(DeviceUtils.instance.getDeviceSensorsLog(context, sensor)),
|
||||
// leading: const Icon(Icons.sensors_outlined),
|
||||
leading: Text(index.toString()),
|
||||
leading: leadingList(sensor),
|
||||
title: Text(
|
||||
DateTimeUtils.instance
|
||||
.convertCurrentMillisToDateTimeString(sensor.time ?? 0),
|
||||
@@ -299,4 +301,23 @@ class _DeviceLogsScreenState extends State<DeviceLogsScreen> {
|
||||
deviceLogsBloc.sinkHasMore.add(hasMore);
|
||||
deviceLogsBloc.getDeviceLogByThingID(offset, thingID, dateTime!, sensors);
|
||||
}
|
||||
|
||||
Widget leadingList(SensorLogs sensor) {
|
||||
Color boxColor;
|
||||
String content;
|
||||
if (sensor.name == "1" || sensor.name == "11") {
|
||||
boxColor = Colors.blue;
|
||||
content = "Điều khiển";
|
||||
} else {
|
||||
boxColor = Colors.lightGreen;
|
||||
content = "Sự kiện";
|
||||
}
|
||||
|
||||
return TagWidgetShared(
|
||||
boxColor: boxColor,
|
||||
tagContent: content,
|
||||
boxHeight: context.mediumValue,
|
||||
boxWidth: context.dynamicWidth(0.2),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user