opt save panel

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-14 20:02:09 +08:00
parent d73588f1fd
commit 470e519a2b

View File

@@ -336,266 +336,258 @@ class _SavePanelState extends State<SavePanel> {
final padding = MediaQuery.viewPaddingOf(context); final padding = MediaQuery.viewPaddingOf(context);
final maxWidth = context.mediaQueryShortestSide; final maxWidth = context.mediaQueryShortestSide;
late final coverSize = MediaQuery.textScalerOf(context).scale(65); late final coverSize = MediaQuery.textScalerOf(context).scale(65);
return GestureDetector( return Stack(
behavior: HitTestBehavior.opaque, clipBehavior: .none,
onTap: Get.back, alignment: .center,
child: Stack( children: [
clipBehavior: Clip.none, SingleChildScrollView(
alignment: Alignment.center, hitTestBehavior: .deferToChild,
children: [ padding: .only(
SingleChildScrollView( top: 12 + padding.top,
padding: EdgeInsets.only( bottom: 80 + padding.bottom,
top: 12 + padding.top, ),
bottom: 80 + padding.bottom, child: Container(
), width: maxWidth,
child: Listener( padding: const .symmetric(horizontal: 12),
child: RepaintBoundary(
key: boundaryKey,
child: Container( child: Container(
width: maxWidth, clipBehavior: .hardEdge,
padding: const EdgeInsets.symmetric(horizontal: 12), decoration: BoxDecoration(
child: RepaintBoundary( color: theme.colorScheme.surface,
key: boundaryKey, borderRadius: const .all(.circular(12)),
child: Container( ),
clipBehavior: Clip.hardEdge, child: AnimatedSize(
decoration: BoxDecoration( curve: Curves.easeInOut,
color: theme.colorScheme.surface, alignment: .topCenter,
borderRadius: const .all(.circular(12)), duration: const Duration(milliseconds: 255),
), child: Column(
child: AnimatedSize( mainAxisSize: .min,
curve: Curves.easeInOut, crossAxisAlignment: .start,
alignment: Alignment.topCenter, children: [
duration: const Duration(milliseconds: 255), switch (_item) {
child: Column( ReplyInfo reply => IgnorePointer(
mainAxisSize: MainAxisSize.min, child: ReplyItemGrpc(
crossAxisAlignment: CrossAxisAlignment.start, replyItem: reply,
children: [ replyLevel: 0,
if (_item case final ReplyInfo reply) needDivider: false,
IgnorePointer( upMid: widget.upMid,
child: ReplyItemGrpc( ),
replyItem: reply, ),
replyLevel: 0, DynamicItemModel dyn => IgnorePointer(
needDivider: false, child: DynamicPanel(
upMid: widget.upMid, item: dyn,
isDetail: true,
isSave: true,
),
),
_ => throw UnsupportedError(_item.toString()),
},
if (cover?.isNotEmpty == true &&
title?.isNotEmpty == true)
Container(
height: 81,
clipBehavior: Clip.hardEdge,
margin: const .symmetric(horizontal: 12),
padding: const .all(8),
decoration: BoxDecoration(
color: theme.colorScheme.onInverseSurface,
borderRadius: const .all(.circular(8)),
),
child: Row(
spacing: 10,
children: [
NetworkImgLayer(
src: cover!,
height: coverSize,
width: coverType == .def16_9
? coverSize * StyleString.aspectRatio16x9
: coverSize,
quality: 100,
borderRadius: const .all(.circular(6)),
), ),
) Expanded(
else if (_item case final DynamicItemModel dyn) child: Column(
IgnorePointer( crossAxisAlignment: .start,
child: DynamicPanel( children: [
item: dyn, Expanded(
isDetail: true, child: Text(
isSave: true, '$title\n',
), maxLines: 2,
), overflow: .ellipsis,
if (cover?.isNotEmpty == true && ),
title?.isNotEmpty == true) ),
Container( if (pubdate != null)
height: 81, Text(
clipBehavior: Clip.hardEdge, DateFormatUtils.format(
margin: const .symmetric(horizontal: 12), pubdate,
padding: const .all(8), format: dateFormat,
decoration: BoxDecoration(
color: theme.colorScheme.onInverseSurface,
borderRadius: const .all(.circular(8)),
),
child: Row(
children: [
NetworkImgLayer(
src: cover!,
height: coverSize,
width: coverType == .def16_9
? coverSize *
StyleString.aspectRatio16x9
: coverSize,
quality: 100,
borderRadius: const .all(.circular(6)),
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: .start,
children: [
Text(
'$title\n',
maxLines: 2,
overflow: .ellipsis,
), ),
if (pubdate != null) ...[ style: TextStyle(
const Spacer(), color: theme.colorScheme.outline,
Text( ),
DateFormatUtils.format( ),
pubdate, ],
format: dateFormat, ),
), ),
style: TextStyle( ],
color: theme.colorScheme.outline, ),
),
showBottom
? Stack(
clipBehavior: .none,
children: [
if (uri.isNotEmpty)
Align(
alignment: .centerRight,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: .min,
crossAxisAlignment: .end,
spacing: 4,
children: [
if (uname?.isNotEmpty == true)
Text(
'@$uname',
maxLines: 1,
overflow: .ellipsis,
style: TextStyle(
color: theme
.colorScheme
.primary,
),
),
Text(
'识别二维码,$viewType$itemType',
textAlign: .end,
style: TextStyle(
color: theme
.colorScheme
.onSurfaceVariant,
),
),
Text(
DateFormatUtils.longFormatDs
.format(.now()),
textAlign: .end,
style: TextStyle(
fontSize: 13,
color:
theme.colorScheme.outline,
),
),
],
),
),
GestureDetector(
onTap: () => Utils.copyText(uri),
child: Container(
width: 88,
height: 88,
margin: const .all(12),
padding: const .all(3),
color: theme.brightness.isDark
? Colors.white
: theme.colorScheme.surface,
child: PrettyQrView.data(
data: uri,
decoration:
const PrettyQrDecoration(
shape:
PrettyQrSquaresSymbol(),
),
), ),
), ),
], ),
], ],
), ),
), ),
], Align(
), alignment: .centerLeft,
), child: Image.asset(
showBottom 'assets/images/logo/logo_2.png',
? Stack( width: 100,
clipBehavior: Clip.none, cacheWidth: 100.cacheSize(context),
children: [ color: theme.colorScheme.onSurfaceVariant,
if (uri.isNotEmpty) ),
Align( ),
alignment: Alignment.centerRight, ],
child: Row( )
children: [ : const SizedBox(height: 12),
Expanded( ],
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.end,
spacing: 4,
children: [
if (uname?.isNotEmpty == true)
Text(
'@$uname',
maxLines: 1,
overflow: .ellipsis,
style: TextStyle(
color: theme
.colorScheme
.primary,
),
),
Text(
'识别二维码,$viewType$itemType',
textAlign: TextAlign.end,
style: TextStyle(
color: theme
.colorScheme
.onSurfaceVariant,
),
),
Text(
DateFormatUtils.longFormatDs
.format(.now()),
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 13,
color: theme
.colorScheme
.outline,
),
),
],
),
),
GestureDetector(
onTap: () => Utils.copyText(uri),
child: Container(
width: 88,
height: 88,
margin: const .all(12),
padding: const .all(3),
color: theme.brightness.isDark
? Colors.white
: theme.colorScheme.surface,
child: PrettyQrView.data(
data: uri,
decoration:
const PrettyQrDecoration(
shape:
PrettyQrSquaresSymbol(),
),
),
),
),
],
),
),
Align(
alignment: Alignment.centerLeft,
child: Image.asset(
'assets/images/logo/logo_2.png',
width: 100,
cacheWidth: 100.cacheSize(context),
color:
theme.colorScheme.onSurfaceVariant,
),
),
],
)
: const SizedBox(height: 12),
],
),
),
), ),
), ),
), ),
), ),
), ),
Positioned( ),
left: 0, Positioned(
right: 0, left: 0,
bottom: 0, right: 0,
child: DecoratedBox( bottom: 0,
decoration: const BoxDecoration( child: DecoratedBox(
gradient: LinearGradient( decoration: const BoxDecoration(
begin: Alignment.topCenter, gradient: LinearGradient(
end: Alignment.bottomCenter, begin: .topCenter,
colors: [ end: .bottomCenter,
Colors.transparent, colors: [
Colors.black54, Colors.transparent,
], Colors.black54,
), ],
), ),
child: Padding( ),
padding: EdgeInsets.only( child: Padding(
left: padding.left, padding: EdgeInsets.only(
right: padding.right, left: padding.left,
bottom: 25 + padding.bottom, right: padding.right,
), bottom: 25 + padding.bottom,
child: Row( ),
spacing: 40, child: Row(
mainAxisAlignment: MainAxisAlignment.center, spacing: 40,
children: [ mainAxisAlignment: .center,
children: [
iconButton(
size: 42,
tooltip: '关闭',
icon: const Icon(Icons.clear),
onPressed: Get.back,
bgColor: theme.colorScheme.onInverseSurface,
iconColor: theme.colorScheme.onSurfaceVariant,
),
iconButton(
size: 42,
tooltip: showBottom ? '隐藏' : '显示',
context: context,
icon: showBottom
? const Icon(Icons.visibility_off)
: const Icon(Icons.visibility),
onPressed: () => setState(() {
showBottom = !showBottom;
}),
),
if (PlatformUtils.isMobile)
iconButton( iconButton(
size: 42, size: 42,
tooltip: '关闭', tooltip: '分享',
icon: const Icon(Icons.clear),
onPressed: Get.back,
bgColor: theme.colorScheme.onInverseSurface,
iconColor: theme.colorScheme.onSurfaceVariant,
),
iconButton(
size: 42,
tooltip: showBottom ? '隐藏' : '显示',
context: context, context: context,
icon: showBottom icon: const Icon(Icons.share),
? const Icon(Icons.visibility_off) onPressed: () => _onSaveOrSharePic(true),
: const Icon(Icons.visibility),
onPressed: () => setState(() {
showBottom = !showBottom;
}),
), ),
if (PlatformUtils.isMobile) iconButton(
iconButton( size: 42,
size: 42, tooltip: '保存',
tooltip: '分享', context: context,
context: context, icon: const Icon(Icons.save_alt),
icon: const Icon(Icons.share), onPressed: _onSaveOrSharePic,
onPressed: () => _onSaveOrSharePic(true), ),
), ],
iconButton(
size: 42,
tooltip: '保存',
context: context,
icon: const Icon(Icons.save_alt),
onPressed: _onSaveOrSharePic,
),
],
),
), ),
), ),
), ),
], ),
), ],
); );
} }
} }