diff --git a/lib/modules/alarm/data/datasource/details/alarm_details_datasource.dart b/lib/modules/alarm/data/datasource/details/alarm_details_datasource.dart index 952ba918..7074aad3 100644 --- a/lib/modules/alarm/data/datasource/details/alarm_details_datasource.dart +++ b/lib/modules/alarm/data/datasource/details/alarm_details_datasource.dart @@ -29,8 +29,7 @@ class AlarmDetailsDatasource implements IAlarmDetailsDatasource { required String comment, }) { return thingsboardClient.getAlarmService().postAlarmComment( - AlarmComment(null, null, alarmId, null, AlarmCommentType.OTHER, comment, null), - + AlarmComment(null, null, alarmId, null, AlarmCommentType.OTHER, {'text': comment}, null), ); } @@ -49,7 +48,7 @@ class AlarmDetailsDatasource implements IAlarmDetailsDatasource { required String comment, }) { return thingsboardClient.getAlarmService().postAlarmComment( - AlarmComment(id, null, alarmId, null, AlarmCommentType.OTHER, comment, null) + AlarmComment(id, null, alarmId, null, AlarmCommentType.OTHER, {'text': comment, 'edited': 'true'}, null), ); } diff --git a/lib/modules/alarm/presentation/widgets/activity/alarm_edit_comment_textfield.dart b/lib/modules/alarm/presentation/widgets/activity/alarm_edit_comment_textfield.dart index e5b7d4b0..21860093 100644 --- a/lib/modules/alarm/presentation/widgets/activity/alarm_edit_comment_textfield.dart +++ b/lib/modules/alarm/presentation/widgets/activity/alarm_edit_comment_textfield.dart @@ -78,7 +78,7 @@ class _AlarmEditCommentState extends State { @override void initState() { - textController.text = widget.commentToEdit.comment.toString(); + textController.text = (widget.commentToEdit.comment as AlarmCommentJsonNode).text; super.initState(); } diff --git a/lib/modules/alarm/presentation/widgets/activity/system_activity_widget.dart b/lib/modules/alarm/presentation/widgets/activity/system_activity_widget.dart index 7053ba8d..62a6c4c5 100644 --- a/lib/modules/alarm/presentation/widgets/activity/system_activity_widget.dart +++ b/lib/modules/alarm/presentation/widgets/activity/system_activity_widget.dart @@ -24,7 +24,7 @@ class SystemActivityWidget extends StatelessWidget { ), ), Text( - activity.comment.toString(), + (activity.comment as AlarmCommentJsonNode).text, style: TbTextStyles.bodyLarge.copyWith( color: Colors.black.withValues(alpha: .54), ), diff --git a/lib/modules/alarm/presentation/widgets/activity/user_comment_widget.dart b/lib/modules/alarm/presentation/widgets/activity/user_comment_widget.dart index 1faaf6c6..5ae8adec 100644 --- a/lib/modules/alarm/presentation/widgets/activity/user_comment_widget.dart +++ b/lib/modules/alarm/presentation/widgets/activity/user_comment_widget.dart @@ -163,7 +163,7 @@ class _UserCommentState extends State { ), const SizedBox(width: 4), Visibility( - visible: widget.activity.comment.edited == true, + visible: (widget.activity.comment as AlarmCommentJsonNode).edited, child: Text( ' ${S.of(context).edited}', style: TbTextStyles.bodyMedium.copyWith( @@ -174,7 +174,7 @@ class _UserCommentState extends State { ], ), Text( - widget.activity.comment.toString(), + (widget.activity.comment as AlarmCommentJsonNode).text, style: TbTextStyles.bodyLarge.copyWith( color: Colors.black.withValues(alpha: .54), ),