Merge branch 'develop_liyi' of code-internal.star-lock.cn:StarlockTeam/app-starlock into develop_liyi

This commit is contained in:
“DaisyWu” 2025-01-22 13:56:09 +08:00
commit da6b92761d
8 changed files with 111 additions and 75 deletions

View File

@ -118,7 +118,10 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Text(value, style: TextStyle(color: Colors.white, fontSize: 22.sp)), Text(
value,
style: TextStyle(color: Colors.white, fontSize: 22.sp),
),
], ],
), ),
), ),
@ -241,13 +244,16 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Obx(() => XSDropDownWidget( Obx(
() => XSDropDownWidget(
items: state.getDropDownItemList, items: state.getDropDownItemList,
value: state.dropdownTitle.value, value: state.dropdownTitle.value,
valueChanged: (value) { valueChanged: (value) async {
state.dropdownValue.value = int.parse(value); state.dropdownValue.value = int.parse(value);
logic.mockNetworkDataRequest(isRefresh: true); await logic.mockNetworkDataRequest(isRefresh: true);
})), },
),
),
], ],
), ),
); );
@ -261,24 +267,26 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16.w), borderRadius: BorderRadius.circular(16.w),
), ),
child: Obx(() => state.lockLogItemList.isNotEmpty child: Obx(
? Timeline.tileBuilder( () => state.lockLogItemList.isNotEmpty
builder: _timelineBuilderWidget(), ? Timeline.tileBuilder(
theme: TimelineThemeData( builder: _timelineBuilderWidget(),
nodePosition: 0.04, // theme: TimelineThemeData(
connectorTheme: const ConnectorThemeData( nodePosition: 0.04, //
thickness: 1.0, connectorTheme: const ConnectorThemeData(
color: AppColors.greyLineColor, thickness: 1.0,
indent: 0.5, color: AppColors.greyLineColor,
indent: 0.5,
),
indicatorTheme: const IndicatorThemeData(
size: 8.0,
color: AppColors.greyLineColor,
position: 0.45,
),
), ),
indicatorTheme: const IndicatorThemeData( )
size: 8.0, : NoData(),
color: AppColors.greyLineColor, ),
position: 0.4,
),
),
)
: NoData()),
); );
} }
@ -288,15 +296,12 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
itemCount: state.lockLogItemList.length, itemCount: state.lockLogItemList.length,
contentsBuilder: (BuildContext context, int index) { contentsBuilder: (BuildContext context, int index) {
final DoorLockLogDataItem timelineData = state.lockLogItemList[index]; final DoorLockLogDataItem timelineData = state.lockLogItemList[index];
final DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
final String formattedTime =
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.doorLockLogDetailPage, Get.toNamed(
arguments: {'doorLockLogDataItem': timelineData}); Routers.doorLockLogDetailPage,
arguments: {'doorLockLogDataItem': timelineData},
);
}, },
child: Padding( child: Padding(
padding: EdgeInsets.only(left: 20.w, top: 20.h), padding: EdgeInsets.only(left: 20.w, top: 20.h),
@ -305,7 +310,6 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
// '$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}操作" : ""}${timelineData.recordTypeName}',
timelineData.recordStr ?? '', timelineData.recordStr ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
@ -315,15 +319,17 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
), ),
), ),
SizedBox( SizedBox(
height: 10.h, height: 12.h,
),
videoItem(
RecordListData(
recordId: state.lockLogItemList.value[index].recordId,
recordType: state.lockLogItemList.value[index].recordType,
operateDate: state.lockLogItemList.value[index].operateDate,
imagesUrl: state.lockLogItemList.value[index].imagesUrl,
videoUrl: state.lockLogItemList.value[index].videoUrl,
),
), ),
videoItem(RecordListData(
recordId: state.lockLogItemList.value[index].recordId,
recordType: state.lockLogItemList.value[index].recordType,
operateDate: state.lockLogItemList.value[index].operateDate,
imagesUrl: state.lockLogItemList.value[index].imagesUrl,
videoUrl: state.lockLogItemList.value[index].videoUrl,
)),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
@ -341,13 +347,15 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) { if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) {
final lockLogItemList = state.lockLogItemList.value; final lockLogItemList = state.lockLogItemList.value;
final list = lockLogItemList final list = lockLogItemList
.map((e) => RecordListData( .map(
videoUrl: e.videoUrl, (e) => RecordListData(
imagesUrl: e.imagesUrl, videoUrl: e.videoUrl,
operateDate: e.operateDate, imagesUrl: e.imagesUrl,
recordId: e.recordId, operateDate: e.operateDate,
recordType: e.recordType, recordId: e.recordId,
)) recordType: e.recordType,
),
)
.toList(); .toList();
final selectDateString = final selectDateString =
DateTool().dateToYMDString(state.startDate.value.toString()); DateTool().dateToYMDString(state.startDate.value.toString());
@ -369,12 +377,9 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
); );
} }
}, },
child: SizedBox( child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') ||
width: 260.w, (recordData.videoUrl != null && recordData.videoUrl != ''))
height: 260.h, ? Container(
child: Column(
children: <Widget>[
Container(
width: 260.w, width: 260.w,
height: 260.h, height: 260.h,
margin: const EdgeInsets.all(0), margin: const EdgeInsets.all(0),
@ -383,18 +388,19 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
child: _buildImageOrVideoItem(recordData), child: _buildImageOrVideoItem(recordData),
), ),
), )
], : SizedBox.shrink(),
),
),
); );
} }
_buildImageOrVideoItem(RecordListData recordData) { _buildImageOrVideoItem(RecordListData recordData) {
if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) { if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) {
return _buildVideoItem(recordData); return _buildVideoItem(recordData);
} else { } else if (recordData.imagesUrl != null &&
recordData.imagesUrl!.isNotEmpty) {
return _buildImageItem(recordData); return _buildImageItem(recordData);
} else {
return SizedBox.shrink();
} }
} }
@ -411,12 +417,9 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
errorBuilder: errorBuilder:
(BuildContext context, Object error, StackTrace? stackTrace) { (BuildContext context, Object error, StackTrace? stackTrace) {
// //
return RotatedBox( return Image.asset(
quarterTurns: -1, 'images/icon_unHaveData.png', //
child: Image.asset( fit: BoxFit.cover,
'images/icon_unHaveData.png', //
fit: BoxFit.cover,
),
); );
}, },
), ),

View File

@ -1,4 +1,3 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -225,8 +224,13 @@ class __DerivedRecordWidgetState extends State<_DerivedRecordWidget> {
Future<String> downloadAndSaveFile(String url) async { Future<String> downloadAndSaveFile(String url) async {
final http.Response response = await http.get(Uri.parse(url)); final http.Response response = await http.get(Uri.parse(url));
if (response.statusCode == 200) { if (response.statusCode == 200) {
// yyyyMMdd
final String formattedDate =
DateFormat('yyyyMMdd').format(DateTime.now());
final Directory directory = await getApplicationDocumentsDirectory(); final Directory directory = await getApplicationDocumentsDirectory();
final File file = File('${directory.path}/record.xlsx'); final File file =
File('${directory.path}/openLockRecord_${formattedDate}.xlsx');
await file.writeAsBytes(response.bodyBytes); await file.writeAsBytes(response.bodyBytes);
return file.path; return file.path;
} else { } else {

View File

@ -34,7 +34,7 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
talkePingOverTimeTimerManager.cancel(); talkePingOverTimeTimerManager.cancel();
talkDataOverTimeTimerManager.cancel(); talkDataOverTimeTimerManager.cancel();
EasyLoading.showToast('已挂断'.tr); // EasyLoading.showToast('已挂断'.tr);
Get.back(); Get.back();
} }

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/talk/startChart/constant/talk_constant.dart'; import 'package:star_lock/talk/startChart/constant/talk_constant.dart';
import 'package:star_lock/talk/startChart/constant/talk_status.dart'; import 'package:star_lock/talk/startChart/constant/talk_status.dart';
import 'package:star_lock/talk/startChart/start_chart_manage.dart'; import 'package:star_lock/talk/startChart/start_chart_manage.dart';
@ -27,7 +28,9 @@ class TalkePingOverTimeTimerManager {
// //
static void _handleTalkePingOverTime() { static void _handleTalkePingOverTime() {
if (talkStatus.status == TalkStatus.answeredSuccessfully) { //
if (talkStatus.status == TalkStatus.answeredSuccessfully ||
talkStatus.status == TalkStatus.proactivelyCallWaitingAnswer) {
EasyLoading.showToast('通话异常中断'.tr, duration: 2000.milliseconds); EasyLoading.showToast('通话异常中断'.tr, duration: 2000.milliseconds);
// //
StartChartManage().stopTalkPingMessageTimer(); StartChartManage().stopTalkPingMessageTimer();
@ -42,6 +45,7 @@ class TalkePingOverTimeTimerManager {
// //
void start() { void start() {
AppLog.log('启动talkping判断');
// //
_timer?.cancel(); _timer?.cancel();
_timer = Timer(timeout, onTimeout); _timer = Timer(timeout, onTimeout);

View File

@ -57,6 +57,7 @@ class ScpMessageBaseHandle {
ToPeerId: scpMessage.FromPeerId!, ToPeerId: scpMessage.FromPeerId!,
FromPeerId: scpMessage.ToPeerId!, FromPeerId: scpMessage.ToPeerId!,
PayloadType: scpMessage.PayloadType!, PayloadType: scpMessage.PayloadType!,
messageId: scpMessage.MessageId!,
); );
} }

View File

@ -422,6 +422,9 @@ class StartChartManage {
}, },
); );
talkStatus.setProactivelyCallWaitingAnswer(); talkStatus.setProactivelyCallWaitingAnswer();
startTalkPingMessageTimer();
// ping超时判断定时器
talkePingOverTimeTimerManager.start();
} }
/// ///
@ -598,15 +601,20 @@ class StartChartManage {
} }
// //
void sendGenericRespSuccessMessage( void sendGenericRespSuccessMessage({
{required String ToPeerId, required String ToPeerId,
required String FromPeerId, required String FromPeerId,
required int PayloadType}) async { required int PayloadType,
required int messageId,
}) async {
if (messageId == null) {
messageId = MessageCommand.getNextMessageId(ToPeerId, increment: false);
}
final message = MessageCommand.genericRespSuccessMessage( final message = MessageCommand.genericRespSuccessMessage(
ToPeerId: ToPeerId, ToPeerId: ToPeerId,
FromPeerId: FromPeerId, FromPeerId: FromPeerId,
PayloadType: PayloadType, PayloadType: PayloadType,
MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: false), MessageId: messageId,
); );
await _sendMessage(message: message); await _sendMessage(message: message);
} }

View File

@ -122,15 +122,15 @@ class _XSDropDownWidgetState extends State<XSDropDownWidget> {
child: Container( child: Container(
margin: margin:
EdgeInsets.only(left: 0.w, right: 0, top: 0, bottom: 0), EdgeInsets.only(left: 0.w, right: 0, top: 0, bottom: 0),
color: item.itemValue == currentValue // color: item.itemValue == currentValue
? AppColors.mainColor // ? AppColors.mainColor
: null, // // : null, //
child: Text( child: Text(
item.itemTitle, item.itemTitle,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: item.itemValue == currentValue color: item.itemValue == currentValue
? Colors.white ? AppColors.mainColor
: Colors.black, // : Colors.black, //
), ),
), ),

View File

@ -1148,6 +1148,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.6" version: "1.0.6"
nested:
dependency: transitive
description:
name: nested
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
network_info_plus: network_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1388,6 +1396,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "21.1.2" version: "21.1.2"
provider:
dependency: "direct main"
description:
name: provider
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
url: "https://pub.dev"
source: hosted
version: "6.1.2"
pub_semver: pub_semver:
dependency: transitive dependency: transitive
description: description: