mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 00:26:18 +08:00
show auto reply tip
opt pm msg Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -35,14 +35,11 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.9),
|
||||
);
|
||||
final padding = MediaQuery.paddingOf(context);
|
||||
final divider = [
|
||||
const SizedBox(height: 10),
|
||||
Divider(
|
||||
height: 1,
|
||||
final divider = Divider(
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
];
|
||||
);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('${_controller.voteId != null ? '' : '发起'}投票'),
|
||||
@@ -74,7 +71,7 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
inputFormatters: [LengthLimitingTextInputFormatter(32)],
|
||||
),
|
||||
),
|
||||
...divider,
|
||||
divider,
|
||||
Obx(
|
||||
() => _buildInput(
|
||||
theme,
|
||||
@@ -85,7 +82,7 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
inputFormatters: [LengthLimitingTextInputFormatter(100)],
|
||||
),
|
||||
),
|
||||
...divider,
|
||||
divider,
|
||||
const SizedBox(height: 40),
|
||||
Obx(
|
||||
() {
|
||||
@@ -118,7 +115,7 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
hintText: '选项内容,最多20字',
|
||||
inputFormatters: [LengthLimitingTextInputFormatter(20)],
|
||||
))
|
||||
..addAll(divider);
|
||||
..add(divider);
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -188,7 +185,7 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
...divider,
|
||||
divider,
|
||||
Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
@@ -238,7 +235,7 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
...divider,
|
||||
divider,
|
||||
const SizedBox(height: 40),
|
||||
Obx(() {
|
||||
final canCreate = _controller.canCreate.value;
|
||||
|
||||
@@ -19,6 +19,7 @@ import 'package:PiliPlus/utils/image_util.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -40,6 +41,13 @@ class ChatItem extends StatelessWidget {
|
||||
final VoidCallback? onLongPress;
|
||||
final bool isOwner;
|
||||
|
||||
// 消息来源
|
||||
// enum MsgSource {
|
||||
// EN_MSG_SOURCE_AUTOREPLY_BY_FOLLOWED = 8; //
|
||||
// EN_MSG_SOURCE_AUTOREPLY_BY_RECEIVE_MSG = 9; //
|
||||
// EN_MSG_SOURCE_AUTOREPLY_BY_KEYWORDS = 10; //
|
||||
// EN_MSG_SOURCE_AUTOREPLY_BY_VOYAGE = 11; //
|
||||
// };
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isPic = item.msgType == MsgType.EN_MSG_TYPE_PIC.value; // 图片
|
||||
@@ -125,6 +133,22 @@ class ChatItem extends StatelessWidget {
|
||||
color: theme.colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
if (item.msgSource >= 8 &&
|
||||
item.msgSource <= 11) ...[
|
||||
Divider(
|
||||
height: 10,
|
||||
thickness: 1,
|
||||
color: theme.colorScheme.outline
|
||||
.withValues(alpha: 0.2),
|
||||
),
|
||||
Text(
|
||||
'此条消息为自动回复',
|
||||
style:
|
||||
theme.textTheme.labelMedium!.copyWith(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -150,7 +174,7 @@ class ChatItem extends StatelessWidget {
|
||||
case MsgType.EN_MSG_TYPE_TIP_MESSAGE:
|
||||
return msgTypeTipMessage_18(theme, content);
|
||||
case MsgType.EN_MSG_TYPE_TEXT:
|
||||
return msgTypeText_1(content: content, textColor: textColor);
|
||||
return msgTypeText_1(theme, content: content, textColor: textColor);
|
||||
case MsgType.EN_MSG_TYPE_PIC:
|
||||
return msgTypePic_2(context, content);
|
||||
case MsgType.EN_MSG_TYPE_SHARE_V2:
|
||||
@@ -588,7 +612,8 @@ class ChatItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget msgTypeText_1({
|
||||
Widget msgTypeText_1(
|
||||
ThemeData theme, {
|
||||
required dynamic content,
|
||||
required Color textColor,
|
||||
}) {
|
||||
@@ -606,11 +631,18 @@ class ChatItem extends StatelessWidget {
|
||||
'size': e.size * 24.0,
|
||||
};
|
||||
}
|
||||
final regex = RegExp(
|
||||
[
|
||||
...emojiMap.keys.map(RegExp.escape),
|
||||
Constants.urlRegex.pattern,
|
||||
].join('|'),
|
||||
);
|
||||
content['content'].splitMapJoin(
|
||||
RegExp(r"\[[^\[\]]+\]"),
|
||||
regex,
|
||||
onMatch: (Match match) {
|
||||
final emojiKey = match[0]!;
|
||||
final emoji = emojiMap[emojiKey];
|
||||
final matchStr = match[0]!;
|
||||
if (matchStr.startsWith('[')) {
|
||||
final emoji = emojiMap[matchStr];
|
||||
if (emoji != null) {
|
||||
final size = emoji['size'];
|
||||
children.add(
|
||||
@@ -624,7 +656,17 @@ class ChatItem extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
children.add(TextSpan(text: emojiKey, style: style));
|
||||
children.add(TextSpan(text: matchStr, style: style));
|
||||
}
|
||||
} else {
|
||||
children.add(
|
||||
TextSpan(
|
||||
text: matchStr,
|
||||
style: style.copyWith(color: theme.colorScheme.primary),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () => PiliScheme.routePushFromUrl(matchStr),
|
||||
),
|
||||
);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user