mod: msg top: show time

Closes #387

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-05 17:39:04 +08:00
parent 72dd0b9e81
commit 08b0a93064
5 changed files with 92 additions and 68 deletions

View File

@@ -3,6 +3,7 @@ import 'package:PiliPlus/common/widgets/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/utils/app_scheme.dart'; import 'package:PiliPlus/utils/app_scheme.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -86,7 +87,15 @@ class _AtMePageState extends State<AtMePage> {
.textTheme .textTheme
.bodyMedium! .bodyMedium!
.copyWith( .copyWith(
color: Theme.of(context).colorScheme.outline)) color:
Theme.of(context).colorScheme.outline)),
const SizedBox(height: 4),
Text(
Utils.dateFormat(loadingState.response[index].atTime),
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.outline,
),
),
], ],
), ),
trailing: loadingState.response[index].item?.image != null && trailing: loadingState.response[index].item?.image != null &&

View File

@@ -3,6 +3,7 @@ import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/msg/msgfeed_like_me.dart'; import 'package:PiliPlus/models/msg/msgfeed_like_me.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:PiliPlus/common/widgets/network_img_layer.dart'; import 'package:PiliPlus/common/widgets/network_img_layer.dart';
@@ -150,26 +151,35 @@ class _LikeMePageState extends State<LikeMePage> {
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
subtitle: subtitle: Column(
item.item?.title != null && item.item?.title != "" crossAxisAlignment: CrossAxisAlignment.start,
? Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, if (item.item?.title?.isNotEmpty == true) ...[
children: [ const SizedBox(height: 4),
const SizedBox(height: 4), Text(item.item!.title!,
Text(item.item?.title ?? "", maxLines: 3,
maxLines: 3, overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, style: Theme.of(context)
style: Theme.of(context) .textTheme
.textTheme .bodyMedium!
.bodyMedium! .copyWith(
.copyWith( color: Theme.of(context)
color: Theme.of(context) .colorScheme
.colorScheme .outline,
.outline, height: 1.5)),
height: 1.5)) ],
], const SizedBox(height: 4),
) Text(
: null, Utils.dateFormat(item.likeTime),
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(
color: Theme.of(context).colorScheme.outline,
),
),
],
),
trailing: trailing:
item.item?.image != null && item.item?.image != "" item.item?.image != null && item.item?.image != ""
? NetworkImgLayer( ? NetworkImgLayer(

View File

@@ -1,6 +1,7 @@
import 'package:PiliPlus/common/widgets/loading_widget.dart'; import 'package:PiliPlus/common/widgets/loading_widget.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:PiliPlus/common/widgets/network_img_layer.dart'; import 'package:PiliPlus/common/widgets/network_img_layer.dart';
@@ -74,52 +75,56 @@ class _ReplyMePageState extends State<ReplyMePage> {
.copyWith(color: Theme.of(context).colorScheme.primary), .copyWith(color: Theme.of(context).colorScheme.primary),
), ),
subtitle: Column( subtitle: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox(height: 4), const SizedBox(height: 4),
Text(
loadingState.response[index].item?.sourceContent ??
"",
style: Theme.of(context).textTheme.bodyMedium),
const SizedBox(height: 4),
if (loadingState
.response[index].item?.targetReplyContent !=
null &&
loadingState
.response[index].item?.targetReplyContent !=
"")
Text( Text(
loadingState.response[index].item?.sourceContent ?? "| ${loadingState.response[index].item?.targetReplyContent}",
"", maxLines: 1,
style: Theme.of(context).textTheme.bodyMedium), overflow: TextOverflow.ellipsis,
const SizedBox(height: 4), style: Theme.of(context)
if (loadingState .textTheme
.response[index].item?.targetReplyContent != .labelMedium!
null && .copyWith(
loadingState color:
.response[index].item?.targetReplyContent != Theme.of(context).colorScheme.outline,
"") height: 1.5)),
Text( if (loadingState.response[index].item?.rootReplyContent !=
"| ${loadingState.response[index].item?.targetReplyContent}", null &&
maxLines: 1, loadingState.response[index].item?.rootReplyContent !=
overflow: TextOverflow.ellipsis, "")
style: Theme.of(context) Text(
.textTheme " | ${loadingState.response[index].item?.rootReplyContent}",
.labelMedium! maxLines: 1,
.copyWith( overflow: TextOverflow.ellipsis,
color: style: Theme.of(context)
Theme.of(context).colorScheme.outline, .textTheme
height: 1.5)), .labelMedium!
if (loadingState .copyWith(
.response[index].item?.rootReplyContent != color:
null && Theme.of(context).colorScheme.outline,
loadingState height: 1.5)),
.response[index].item?.rootReplyContent != Text(
"") Utils.dateFormat(
Text( loadingState.response[index].replyTime),
" | ${loadingState.response[index].item?.rootReplyContent}", style: Theme.of(context).textTheme.bodyMedium!.copyWith(
maxLines: 1, color: Theme.of(context).colorScheme.outline,
overflow: TextOverflow.ellipsis, ),
style: ),
Theme.of(context) ],
.textTheme ),
.labelMedium!
.copyWith(
color: Theme.of(context)
.colorScheme
.outline,
height: 1.5)),
]),
); );
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (BuildContext context, int index) {

View File

@@ -119,7 +119,7 @@ class _SysMsgPageState extends State<SysMsgPage> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.bodySmall! .bodyMedium!
.copyWith( .copyWith(
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),

View File

@@ -1207,7 +1207,7 @@ class Utils {
// 时间显示刚刚x分钟前 // 时间显示刚刚x分钟前
static String dateFormat(timeStamp, {formatType = 'list'}) { static String dateFormat(timeStamp, {formatType = 'list'}) {
if (timeStamp == 0 || timeStamp == null || timeStamp == '') { if (timeStamp == null || timeStamp == 0 || timeStamp == '') {
return ''; return '';
} }
// 当前时间 // 当前时间