This commit is contained in:
guozhigq
2024-08-11 18:43:21 +08:00
parent 66148cd1de
commit 1f9a65a5d2
2 changed files with 88 additions and 61 deletions

View File

@ -19,6 +19,7 @@ import 'package:pilipala/plugin/pl_gallery/index.dart';
import 'package:pilipala/plugin/pl_popup/index.dart'; import 'package:pilipala/plugin/pl_popup/index.dart';
import 'package:pilipala/utils/app_scheme.dart'; import 'package:pilipala/utils/app_scheme.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/url_utils.dart'; import 'package:pilipala/utils/url_utils.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
@ -35,6 +36,7 @@ class ReplyItem extends StatelessWidget {
this.showReplyRow = true, this.showReplyRow = true,
this.replyReply, this.replyReply,
this.replyType, this.replyType,
this.replySave = false,
super.key, super.key,
}); });
final ReplyItemModel? replyItem; final ReplyItemModel? replyItem;
@ -43,6 +45,7 @@ class ReplyItem extends StatelessWidget {
final bool? showReplyRow; final bool? showReplyRow;
final Function? replyReply; final Function? replyReply;
final ReplyType? replyType; final ReplyType? replyType;
final bool? replySave;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -50,12 +53,18 @@ class ReplyItem extends StatelessWidget {
child: InkWell( child: InkWell(
// 点击整个评论区 评论详情/回复 // 点击整个评论区 评论详情/回复
onTap: () { onTap: () {
if (replySave!) {
return;
}
feedBack(); feedBack();
if (replyReply != null) { if (replyReply != null) {
replyReply!(replyItem, null, replyItem!.replies!.isNotEmpty); replyReply!(replyItem, null, replyItem!.replies!.isNotEmpty);
} }
}, },
onLongPress: () { onLongPress: () {
if (replySave!) {
return;
}
feedBack(); feedBack();
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
@ -238,7 +247,7 @@ class ReplyItem extends StatelessWidget {
), ),
), ),
// 操作区域 // 操作区域
bottonAction(context, replyItem!.replyControl), bottonAction(context, replyItem!.replyControl, replySave),
// 一楼的评论 // 一楼的评论
if ((replyItem!.replyControl!.isShow! || if ((replyItem!.replyControl!.isShow! ||
replyItem!.replies!.isNotEmpty) && replyItem!.replies!.isNotEmpty) &&
@ -259,7 +268,7 @@ class ReplyItem extends StatelessWidget {
} }
// 感谢、回复、复制 // 感谢、回复、复制
Widget bottonAction(BuildContext context, replyControl) { Widget bottonAction(BuildContext context, replyControl, replySave) {
ColorScheme colorScheme = Theme.of(context).colorScheme; ColorScheme colorScheme = Theme.of(context).colorScheme;
TextTheme textTheme = Theme.of(context).textTheme; TextTheme textTheme = Theme.of(context).textTheme;
return Row( return Row(
@ -292,16 +301,26 @@ class ReplyItem extends StatelessWidget {
}); });
}, },
child: Row(children: [ child: Row(children: [
Icon(Icons.reply, if (!replySave!) ...[
size: 18, color: colorScheme.outline.withOpacity(0.8)), Icon(Icons.reply,
const SizedBox(width: 3), size: 18, color: colorScheme.outline.withOpacity(0.8)),
Text( const SizedBox(width: 3),
'回复', Text(
style: TextStyle( '回复',
fontSize: textTheme.labelMedium!.fontSize, style: TextStyle(
color: colorScheme.outline, fontSize: textTheme.labelMedium!.fontSize,
color: colorScheme.outline,
),
)
],
if (replySave!)
Text(
IdUtils.av2bv(replyItem!.oid!),
style: TextStyle(
fontSize: textTheme.labelMedium!.fontSize,
color: colorScheme.outline,
),
), ),
),
]), ]),
), ),
), ),
@ -1097,7 +1116,7 @@ class MorePanel extends StatelessWidget {
leading: const Icon(Icons.copy_outlined, size: 19), leading: const Icon(Icons.copy_outlined, size: 19),
title: Text('自由复制', style: textTheme.titleSmall), title: Text('自由复制', style: textTheme.titleSmall),
), ),
if (mainFloor) if (mainFloor && item.content.pictures.isEmpty)
ListTile( ListTile(
onTap: () async => await menuActionHandler('save'), onTap: () async => await menuActionHandler('save'),
minLeadingWidth: 0, minLeadingWidth: 0,

View File

@ -76,64 +76,72 @@ class _ReplySaveState extends State<ReplySave> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return SafeArea(
width: Get.width, top: false,
height: Get.height, bottom: false,
margin: EdgeInsets.fromLTRB( child: BackdropFilter(
0, filter: ImageFilter.blur(sigmaX: 4.0, sigmaY: 4.0),
MediaQuery.of(context).padding.top + 4, child: Container(
0, width: Get.width,
MediaQuery.of(context).padding.bottom + 4, height: Get.height,
), padding: EdgeInsets.fromLTRB(
color: Colors.transparent, 0,
child: Column( MediaQuery.of(context).padding.top + 4,
children: [ 0,
Expanded( MediaQuery.of(context).padding.bottom + 4,
child: Container( ),
clipBehavior: Clip.antiAlias, color: Colors.black54,
decoration: BoxDecoration( child: Column(
borderRadius: BorderRadius.circular(20), children: [
), Expanded(
child: Center( child: Container(
child: SingleChildScrollView( clipBehavior: Clip.antiAlias,
child: RepaintBoundary( decoration: BoxDecoration(
key: _boundaryKey, borderRadius: BorderRadius.circular(20),
child: IntrinsicHeight( ),
child: Stack( child: Center(
children: [ child: SingleChildScrollView(
ReplyItem( child: RepaintBoundary(
replyItem: widget.replyItem, key: _boundaryKey,
showReplyRow: false, child: IntrinsicHeight(
child: Stack(
children: [
ReplyItem(
replyItem: widget.replyItem,
showReplyRow: false,
replySave: true,
),
Positioned.fill(
child: Column(
children: _createColumnWidgets(),
),
),
],
), ),
Positioned.fill( ),
child: Column(
children: _createColumnWidgets(),
),
),
],
), ),
), ),
), ),
), ),
), ),
), const SizedBox(height: 20),
), Row(
const SizedBox(height: 20), mainAxisAlignment: MainAxisAlignment.center,
Row( children: [
mainAxisAlignment: MainAxisAlignment.center, FilledButton(
children: [ onPressed: () => Get.back(),
FilledButton( child: const Text('取消'),
onPressed: () => Get.back(), ),
child: const Text('取消'), const SizedBox(width: 40),
), FilledButton(
const SizedBox(width: 40), onPressed: _generatePicWidget,
FilledButton( child: const Text('保存'),
onPressed: _generatePicWidget, ),
child: const Text('保存'), ],
), ),
], ],
), ),
], ),
), ),
); );
} }