mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: save reply (#629)
Closes #614 opt: more panel Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1140,12 +1140,8 @@ class ReplyItem extends StatelessWidget {
|
||||
Color errorColor = Theme.of(context).colorScheme.error;
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQueryData.fromView(
|
||||
WidgetsBinding.instance.platformDispatcher.views.single)
|
||||
.padding
|
||||
.bottom +
|
||||
20),
|
||||
padding:
|
||||
EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_save.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/zan_grpc.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
@@ -43,8 +44,8 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
this.onViewImage,
|
||||
this.onDismissed,
|
||||
this.callback,
|
||||
required this.onCheckReply,
|
||||
required this.onToggleTop,
|
||||
this.onCheckReply,
|
||||
this.onToggleTop,
|
||||
});
|
||||
final ReplyInfo replyItem;
|
||||
final String? replyLevel;
|
||||
@@ -60,8 +61,8 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
final VoidCallback? onViewImage;
|
||||
final ValueChanged<int>? onDismissed;
|
||||
final Function(List<String>, int)? callback;
|
||||
final ValueChanged<ReplyInfo> onCheckReply;
|
||||
final Function(bool isUpTop, int rpid) onToggleTop;
|
||||
final ValueChanged<ReplyInfo>? onCheckReply;
|
||||
final Function(bool isUpTop, int rpid)? onToggleTop;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -277,7 +278,6 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
},
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
lfAvtar(context),
|
||||
const SizedBox(width: 12),
|
||||
@@ -344,8 +344,12 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
),
|
||||
// title
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 10, left: 45, right: 6, bottom: 4),
|
||||
padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
left: replyLevel == '' ? 6 : 45,
|
||||
right: 6,
|
||||
bottom: 4,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
String text = replyItem.content.message;
|
||||
@@ -400,12 +404,12 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
// 操作区域
|
||||
buttonAction(context, replyItem.replyControl),
|
||||
if (replyLevel != '') buttonAction(context, replyItem.replyControl),
|
||||
// 一楼的评论
|
||||
if (( //replyItem.replyControl!.isShow! ||
|
||||
if (showReplyRow &&
|
||||
( //replyItem.replyControl!.isShow! ||
|
||||
replyItem.replies.isNotEmpty ||
|
||||
replyItem.replyControl.subReplyEntryText.isNotEmpty) &&
|
||||
showReplyRow) ...[
|
||||
replyItem.replyControl.subReplyEntryText.isNotEmpty)) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5, bottom: 12),
|
||||
child: replyItemRow(
|
||||
@@ -1195,11 +1199,31 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
break;
|
||||
case 'checkReply':
|
||||
Get.back();
|
||||
onCheckReply(item);
|
||||
onCheckReply?.call(item);
|
||||
break;
|
||||
case 'top':
|
||||
Get.back();
|
||||
onToggleTop(item.replyControl.isUpTop, item.id.toInt());
|
||||
onToggleTop?.call(item.replyControl.isUpTop, item.id.toInt());
|
||||
break;
|
||||
case 'saveReply':
|
||||
Get.back();
|
||||
Get.generalDialog(
|
||||
barrierLabel: '',
|
||||
barrierDismissible: true,
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return ReplySavePanel(replyItem: item);
|
||||
},
|
||||
transitionDuration: const Duration(milliseconds: 255),
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
var tween = Tween<double>(begin: 0, end: 1)
|
||||
.chain(CurveTween(curve: Curves.easeInOut));
|
||||
return FadeTransition(
|
||||
opacity: animation.drive(tween),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
routeSettings: RouteSettings(arguments: Get.arguments),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -1207,93 +1231,108 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
|
||||
Color errorColor = Theme.of(context).colorScheme.error;
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQueryData.fromView(
|
||||
WidgetsBinding.instance.platformDispatcher.views.single)
|
||||
.padding
|
||||
.bottom +
|
||||
20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: Get.back,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(28),
|
||||
topRight: Radius.circular(28),
|
||||
),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
return MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeLeft: true,
|
||||
removeRight: true,
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: Get.back,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(28),
|
||||
topRight: Radius.circular(28),
|
||||
),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (ownerMid == upMid.toInt() || ownerMid == item.member.mid.toInt())
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('delete'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.delete_outlined, color: errorColor, size: 19),
|
||||
title: Text('删除',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.copyWith(color: errorColor)),
|
||||
),
|
||||
if (ownerMid != 0)
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('report'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.error_outline, color: errorColor, size: 19),
|
||||
title: Text('举报',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.copyWith(color: errorColor)),
|
||||
),
|
||||
if (replyLevel == '1' && isSubReply.not && ownerMid == upMid.toInt())
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('top'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.vertical_align_top, size: 19),
|
||||
title: Text('${replyItem.replyControl.isUpTop ? '取消' : ''}置顶',
|
||||
style: Theme.of(context).textTheme.titleSmall!),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('copyAll'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.copy_all_outlined, size: 19),
|
||||
title: Text('复制全部', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('copyFreedom'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.copy_outlined, size: 19),
|
||||
title: Text('自由复制', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
if (item.mid.toInt() == ownerMid)
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('checkReply'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Icon(Icons.shield_outlined, size: 19),
|
||||
const Icon(Icons.reply, size: 12),
|
||||
],
|
||||
if (ownerMid == upMid.toInt() ||
|
||||
ownerMid == item.member.mid.toInt())
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('delete'),
|
||||
minLeadingWidth: 0,
|
||||
leading:
|
||||
Icon(Icons.delete_outlined, color: errorColor, size: 19),
|
||||
title: Text('删除',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.copyWith(color: errorColor)),
|
||||
),
|
||||
if (ownerMid != 0)
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('report'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.error_outline, color: errorColor, size: 19),
|
||||
title: Text('举报',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.copyWith(color: errorColor)),
|
||||
),
|
||||
if (replyLevel == '1' &&
|
||||
isSubReply.not &&
|
||||
ownerMid == upMid.toInt())
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('top'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.vertical_align_top, size: 19),
|
||||
title: Text('${replyItem.replyControl.isUpTop ? '取消' : ''}置顶',
|
||||
style: Theme.of(context).textTheme.titleSmall!),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('copyAll'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.copy_all_outlined, size: 19),
|
||||
title:
|
||||
Text('检查评论', style: Theme.of(context).textTheme.titleSmall),
|
||||
Text('复制全部', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
],
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('copyFreedom'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.copy_outlined, size: 19),
|
||||
title:
|
||||
Text('自由复制', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('saveReply'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.save_alt, size: 19),
|
||||
title:
|
||||
Text('保存评论', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
if (item.mid.toInt() == ownerMid)
|
||||
ListTile(
|
||||
onTap: () => menuActionHandler('checkReply'),
|
||||
minLeadingWidth: 0,
|
||||
leading: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Icon(Icons.shield_outlined, size: 19),
|
||||
const Icon(Icons.reply, size: 12),
|
||||
],
|
||||
),
|
||||
title:
|
||||
Text('检查评论', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
385
lib/pages/video/detail/reply/widgets/reply_save.dart
Normal file
385
lib/pages/video/detail/reply/widgets/reply_save.dart
Normal file
@@ -0,0 +1,385 @@
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui';
|
||||
import 'package:PiliPlus/common/widgets/icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pretty_qr_code/pretty_qr_code.dart';
|
||||
import 'package:saver_gallery/saver_gallery.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
class ReplySavePanel extends StatefulWidget {
|
||||
const ReplySavePanel({required this.replyItem, super.key});
|
||||
|
||||
final ReplyInfo replyItem;
|
||||
|
||||
@override
|
||||
State<ReplySavePanel> createState() => _ReplySavePanelState();
|
||||
}
|
||||
|
||||
class _ReplySavePanelState extends State<ReplySavePanel> {
|
||||
final boundaryKey = GlobalKey();
|
||||
|
||||
void _onSaveOrSharePic([bool isShare = false]) async {
|
||||
SmartDialog.showLoading();
|
||||
try {
|
||||
RenderRepaintBoundary boundary = boundaryKey.currentContext!
|
||||
.findRenderObject() as RenderRepaintBoundary;
|
||||
var image = await boundary.toImage(pixelRatio: 3);
|
||||
ByteData? byteData = await image.toByteData(format: ImageByteFormat.png);
|
||||
Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||
String picName =
|
||||
"plpl_reply_${DateTime.now().toString().replaceAll(RegExp(r'[- :]'), '').split('.').first}";
|
||||
if (isShare) {
|
||||
Get.back();
|
||||
SmartDialog.dismiss();
|
||||
Share.shareXFiles(
|
||||
[
|
||||
XFile.fromData(
|
||||
pngBytes,
|
||||
name: picName,
|
||||
mimeType: 'image/png',
|
||||
)
|
||||
],
|
||||
sharePositionOrigin: await Utils.isIpad()
|
||||
? Rect.fromLTWH(0, 0, Get.width, Get.height / 2)
|
||||
: null,
|
||||
);
|
||||
} else {
|
||||
final result = await SaverGallery.saveImage(
|
||||
pngBytes,
|
||||
fileName: '$picName.png',
|
||||
androidRelativePath: "Pictures/PiliPlus",
|
||||
skipIfExists: false,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result.isSuccess) {
|
||||
Get.back();
|
||||
SmartDialog.showToast('保存成功');
|
||||
} else if (result.errorMessage?.isNotEmpty == true) {
|
||||
SmartDialog.showToast(result.errorMessage!);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('on save/share reply: $e');
|
||||
SmartDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String? cover;
|
||||
String? title;
|
||||
int? pubdate;
|
||||
String? uname;
|
||||
String uri = '';
|
||||
|
||||
final currentRoute = Get.currentRoute;
|
||||
late final hasRoot = widget.replyItem.hasRoot();
|
||||
|
||||
if (currentRoute.startsWith('/video')) {
|
||||
try {
|
||||
final heroTag = Get.arguments?['heroTag'];
|
||||
late final ctr = Get.find<VideoIntroController>(tag: heroTag);
|
||||
cover = ctr.videoDetail.value.pic;
|
||||
title = ctr.videoDetail.value.title;
|
||||
pubdate = ctr.videoDetail.value.pubdate;
|
||||
uname = ctr.videoDetail.value.owner?.name;
|
||||
} catch (_) {}
|
||||
uri =
|
||||
'bilibili://video/${widget.replyItem.oid}?comment_root_id=${hasRoot ? widget.replyItem.root : widget.replyItem.id}${hasRoot ? '&comment_secondary_id=${widget.replyItem.id}' : ''}';
|
||||
} else if (currentRoute.startsWith('/dynamicDetail')) {
|
||||
try {
|
||||
DynamicItemModel item = Get.arguments['item'];
|
||||
uname = item.modules?.moduleAuthor?.name;
|
||||
final type = widget.replyItem.type.toInt();
|
||||
late final oid = item.idStr;
|
||||
late final rootId =
|
||||
hasRoot ? widget.replyItem.root : widget.replyItem.id;
|
||||
late final anchor = hasRoot ? 'anchor=${widget.replyItem.id}&' : '';
|
||||
late final enterUri = 'bilibili://following/detail/$oid';
|
||||
uri = switch (type) {
|
||||
1 =>
|
||||
'bilibili://video/${item.basic!['rid_str']}?comment_root_id=${hasRoot ? widget.replyItem.root : widget.replyItem.id}${hasRoot ? '&comment_secondary_id=${widget.replyItem.id}' : ''}',
|
||||
11 ||
|
||||
12 =>
|
||||
'bilibili://comment/detail/$type/${item.basic!['rid_str']}/$rootId/?${anchor}enterUri=$enterUri',
|
||||
_ =>
|
||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=$enterUri',
|
||||
};
|
||||
} catch (_) {}
|
||||
} else if (currentRoute.startsWith('/Scaffold')) {
|
||||
try {
|
||||
final type = widget.replyItem.type.toInt();
|
||||
late final oid = Get.arguments['oid'];
|
||||
late final rootId =
|
||||
hasRoot ? widget.replyItem.root : widget.replyItem.id;
|
||||
late final anchor = hasRoot ? 'anchor=${widget.replyItem.id}&' : '';
|
||||
late final enterUri = 'bilibili://following/detail/$oid';
|
||||
uri = switch (type) {
|
||||
1 =>
|
||||
'bilibili://video/$oid?comment_root_id=${hasRoot ? widget.replyItem.root : widget.replyItem.id}${hasRoot ? '&comment_secondary_id=${widget.replyItem.id}' : ''}',
|
||||
11 ||
|
||||
12 =>
|
||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=${Get.arguments['enterUri']}',
|
||||
_ =>
|
||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=$enterUri',
|
||||
};
|
||||
} catch (_) {}
|
||||
} else if (currentRoute.startsWith('/htmlRender')) {
|
||||
try {
|
||||
final type = widget.replyItem.type.toInt();
|
||||
late final oid = widget.replyItem.oid;
|
||||
late final rootId =
|
||||
hasRoot ? widget.replyItem.root : widget.replyItem.id;
|
||||
late final anchor = hasRoot ? 'anchor=${widget.replyItem.id}&' : '';
|
||||
late final enterUri =
|
||||
'bilibili://following/detail/${Get.parameters['id']}';
|
||||
uri =
|
||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=$enterUri';
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
debugPrint(uri);
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(top: 12, bottom: 80),
|
||||
child: SafeArea(
|
||||
child: GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
width: min(Get.width, Get.height),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: RepaintBoundary(
|
||||
key: boundaryKey,
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
IgnorePointer(
|
||||
child: ReplyItemGrpc(
|
||||
replyItem: widget.replyItem,
|
||||
showReplyRow: false,
|
||||
replyLevel: '',
|
||||
needDivider: false,
|
||||
),
|
||||
),
|
||||
if (cover?.isNotEmpty == true &&
|
||||
title?.isNotEmpty == true)
|
||||
Container(
|
||||
height: 81,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: 12),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
src: cover!,
|
||||
height: MediaQuery.textScalerOf(context)
|
||||
.scale(65),
|
||||
width: MediaQuery.textScalerOf(context)
|
||||
.scale(65) *
|
||||
16 /
|
||||
9,
|
||||
quality: 100,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'$title\n',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (pubdate != null) ...[
|
||||
const Spacer(),
|
||||
Text(
|
||||
Utils.dateFormat(
|
||||
pubdate,
|
||||
formatType: 'detail',
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/logo/logo_2.png',
|
||||
width: 100,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
if (uri.isNotEmpty) ...[
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if (uname?.isNotEmpty == true) ...[
|
||||
Text(
|
||||
'@$uname',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
Text(
|
||||
'识别二维码,查看评论',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
DateTime.now()
|
||||
.toString()
|
||||
.split('.')
|
||||
.first,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Container(
|
||||
color: Get.isDarkMode
|
||||
? Colors.white
|
||||
: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: PrettyQrView.data(
|
||||
data: uri,
|
||||
decoration: const PrettyQrDecoration(
|
||||
shape: PrettyQrRoundedSymbol(
|
||||
borderRadius: BorderRadius.zero,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
Colors.black87,
|
||||
Colors.transparent,
|
||||
],
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.only(bottom: 25, top: 10),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
iconButton(
|
||||
size: 42,
|
||||
tooltip: '关闭',
|
||||
context: context,
|
||||
icon: Icons.clear,
|
||||
onPressed: Get.back,
|
||||
bgColor: Theme.of(context).colorScheme.onInverseSurface,
|
||||
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 40),
|
||||
iconButton(
|
||||
size: 42,
|
||||
tooltip: '分享',
|
||||
context: context,
|
||||
icon: Icons.share,
|
||||
onPressed: () => _onSaveOrSharePic(true),
|
||||
),
|
||||
const SizedBox(width: 40),
|
||||
iconButton(
|
||||
size: 42,
|
||||
tooltip: '保存',
|
||||
context: context,
|
||||
icon: Icons.save_alt,
|
||||
onPressed: () => _onSaveOrSharePic(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -67,10 +67,8 @@ class VideoReplyReplyController extends ReplyController
|
||||
firstFloor = replies.root;
|
||||
}
|
||||
if (id != null) {
|
||||
index = replies.root.replies
|
||||
.map((item) => item.id.toInt())
|
||||
.toList()
|
||||
.indexOf(id!);
|
||||
index =
|
||||
replies.root.replies.indexWhere((item) => item.id.toInt() == id);
|
||||
if (index == -1) {
|
||||
index = null;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user