From 6dfce6a158346d4e16ab4a34d8482ad776158304 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 23 Jun 2024 23:23:05 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20chatItem=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whisper_detail/widget/chat_item.dart | 90 ++++++++----------- 1 file changed, 39 insertions(+), 51 deletions(-) diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index f64cf223..77e38073 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -1,4 +1,5 @@ // ignore_for_file: must_be_immutable +// ignore_for_file: constant_identifier_names import 'dart:convert'; import 'package:flutter/material.dart'; @@ -8,7 +9,6 @@ import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/utils/route_push.dart'; import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/storage.dart'; - import '../../../http/search.dart'; enum MsgType { @@ -409,12 +409,6 @@ class ChatItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ const SizedBox(width: safeDistanceval), - if (isOwner) - Text( - Utils.dateFormat(item.timestamp), - style: Theme.of(context).textTheme.labelSmall!.copyWith( - color: Theme.of(context).colorScheme.outline), - ), Container( constraints: const BoxConstraints( maxWidth: 300.0, // 设置最大宽度为200.0 @@ -444,51 +438,45 @@ class ChatItem extends StatelessWidget { right: 8, ), padding: const EdgeInsets.all(paddingVal), - child: messageContent(context), - // child: Column( - // crossAxisAlignment: isOwner - // ? CrossAxisAlignment.end - // : CrossAxisAlignment.start, - // children: [ - // messageContent(context), - // SizedBox(height: isPic ? 7 : 2), - // Row( - // mainAxisSize: MainAxisSize.min, - // children: [ - // Text( - // Utils.dateFormat(item.timestamp), - // style: Theme.of(context) - // .textTheme - // .labelSmall! - // .copyWith( - // color: isOwner - // ? Theme.of(context) - // .colorScheme - // .onPrimary - // .withOpacity(0.8) - // : Theme.of(context) - // .colorScheme - // .onSecondaryContainer - // .withOpacity(0.8)), - // ), - // item.msgStatus == 1 - // ? Text( - // ' 已撤回', - // style: - // Theme.of(context).textTheme.labelSmall!, - // ) - // : const SizedBox() - // ], - // ) - // ], - // ), - ), - if (!isOwner) - Text( - Utils.dateFormat(item.timestamp), - style: Theme.of(context).textTheme.labelSmall!.copyWith( - color: Theme.of(context).colorScheme.outline), + child: Column( + crossAxisAlignment: isOwner + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, + children: [ + messageContent(context), + SizedBox(height: isPic ? 7 : 4), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + Utils.dateFormat(item.timestamp), + style: Theme.of(context) + .textTheme + .labelSmall! + .copyWith( + color: isOwner + ? Theme.of(context) + .colorScheme + .onPrimary + .withOpacity(0.8) + : Theme.of(context) + .colorScheme + .onSecondaryContainer + .withOpacity(0.8)), + ), + item.msgStatus == 1 + ? Text( + ' 已撤回', + style: Theme.of(context) + .textTheme + .labelSmall!, + ) + : const SizedBox() + ], + ) + ], ), + ), const SizedBox(width: safeDistanceval), ], ),