Compare commits

..

No commits in common. "6e442c144e02f86982ec2443f7b6cd886911b806" and "65c6083640e5006d73a83ee17c05422303446fa1" have entirely different histories.

7 changed files with 24 additions and 82 deletions

View File

@ -484,5 +484,5 @@
"authMaximumAuthStepsDesc": "The maximum number of authentication steps when logging in, higher value is more secure, lower value is more convenient; default is 2", "authMaximumAuthStepsDesc": "The maximum number of authentication steps when logging in, higher value is more secure, lower value is more convenient; default is 2",
"auditLog": "Audit log", "auditLog": "Audit log",
"shareImage": "Share as image", "shareImage": "Share as image",
"shareImageFooter": "Only on the Solar Network" "shareImageFooter": "See more interesting posts on Solar Network"
} }

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_resizable_container/flutter_resizable_container.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -43,20 +42,14 @@ class ChatListShell extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RootContainer( return RootContainer(
child: ResizableContainer( child: Row(
direction: Axis.horizontal,
divider: ResizableDivider(
thickness: 0.3,
color: Theme.of(context).dividerColor,
),
children: [ children: [
const ResizableChild( const SizedBox(
minSize: 280, width: 360,
maxSize: 520,
size: ResizableSize.pixels(320),
child: ChatList(), child: ChatList(),
), ),
ResizableChild(child: child ?? const EmptyPagePlaceholder()), const VerticalDivider(thickness: 0.3, width: 0.3),
Expanded(child: child ?? const EmptyPagePlaceholder()),
], ],
), ),
); );

View File

@ -89,25 +89,10 @@ class _PostActionState extends State<PostAction> {
} }
Future<void> _shareImage() async { Future<void> _shareImage() async {
final List<String> attachments = widget.item.body['attachments'] is List
? List.from(widget.item.body['attachments']?.whereType<String>())
: List.empty();
final hasAttachment = attachments.isNotEmpty;
final screenshot = ScreenshotController(); final screenshot = ScreenshotController();
final image = await screenshot.captureFromLongWidget( final image = await screenshot.captureFromWidget(
MediaQuery( PostShareImage(item: widget.item),
data: MediaQuery.of(context),
child: PostShareImage(item: widget.item),
),
context: context, context: context,
pixelRatio: 2,
constraints: BoxConstraints(
minWidth: 480,
maxWidth: hasAttachment ? 480 : 640,
minHeight: 640,
maxHeight: double.infinity,
),
); );
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
final imageFile = await File( final imageFile = await File(
@ -115,16 +100,8 @@ class _PostActionState extends State<PostAction> {
).create(); ).create();
await imageFile.writeAsBytes(image); await imageFile.writeAsBytes(image);
final box = context.findRenderObject() as RenderBox?;
final file = XFile(imageFile.path); final file = XFile(imageFile.path);
await Share.shareXFiles( await Share.shareXFiles([file]);
[file],
subject: 'postShareSubject'.trParams({
'username': widget.item.author.nick,
}),
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
await imageFile.delete(); await imageFile.delete();
} }

View File

@ -31,7 +31,6 @@ class PostItem extends StatefulWidget {
final bool isOverrideEmbedClickable; final bool isOverrideEmbedClickable;
final bool isFullDate; final bool isFullDate;
final bool isContentSelectable; final bool isContentSelectable;
final bool isNonScrollAttachment;
final bool showFeaturedReply; final bool showFeaturedReply;
final String? attachmentParent; final String? attachmentParent;
@ -50,7 +49,6 @@ class PostItem extends StatefulWidget {
this.isOverrideEmbedClickable = false, this.isOverrideEmbedClickable = false,
this.isFullDate = false, this.isFullDate = false,
this.isContentSelectable = false, this.isContentSelectable = false,
this.isNonScrollAttachment = false,
this.showFeaturedReply = false, this.showFeaturedReply = false,
this.attachmentParent, this.attachmentParent,
this.padding, this.padding,
@ -216,7 +214,6 @@ class _PostItemState extends State<PostItem> {
_PostAttachmentWidget( _PostAttachmentWidget(
item: item, item: item,
padding: widget.padding, padding: widget.padding,
isNonScrollAttachment: widget.isNonScrollAttachment,
), ),
if (widget.showFeaturedReply) if (widget.showFeaturedReply)
_PostFeaturedReplyWidget(item: item).paddingSymmetric( _PostFeaturedReplyWidget(item: item).paddingSymmetric(
@ -383,13 +380,8 @@ class _PostFeaturedReplyWidget extends StatelessWidget {
class _PostAttachmentWidget extends StatelessWidget { class _PostAttachmentWidget extends StatelessWidget {
final Post item; final Post item;
final EdgeInsets? padding; final EdgeInsets? padding;
final bool isNonScrollAttachment;
const _PostAttachmentWidget({ const _PostAttachmentWidget({required this.item, required this.padding});
required this.item,
required this.padding,
required this.isNonScrollAttachment,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -409,6 +401,14 @@ class _PostAttachmentWidget extends StatelessWidget {
autoload: false, autoload: false,
isFullWidth: true, isFullWidth: true,
); );
} else if (attachments.length == 1) {
return AttachmentList(
parentId: item.id.toString(),
attachmentIds: item.preload == null ? attachments : null,
attachments: item.preload?.attachments,
autoload: false,
isColumn: true,
).paddingSymmetric(horizontal: (padding?.horizontal ?? 0) + 14);
} else if (attachments.length > 1 && } else if (attachments.length > 1 &&
attachments.length % 3 == 0 && attachments.length % 3 == 0 &&
!isLargeScreen) { !isLargeScreen) {
@ -419,14 +419,6 @@ class _PostAttachmentWidget extends StatelessWidget {
autoload: false, autoload: false,
isGrid: true, isGrid: true,
).paddingSymmetric(horizontal: (padding?.horizontal ?? 0) + 14); ).paddingSymmetric(horizontal: (padding?.horizontal ?? 0) + 14);
} else if (attachments.length == 1 || isNonScrollAttachment) {
return AttachmentList(
parentId: item.id.toString(),
attachmentIds: item.preload == null ? attachments : null,
attachments: item.preload?.attachments,
autoload: false,
isColumn: true,
).paddingSymmetric(horizontal: (padding?.horizontal ?? 0) + 14);
} else { } else {
return AttachmentList( return AttachmentList(
parentId: item.id.toString(), parentId: item.id.toString(),

View File

@ -15,15 +15,14 @@ class PostShareImage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final textColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.3); final textColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.3);
return RootContainer( return RootContainer(
child: Wrap( child: Column(
alignment: WrapAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
runAlignment: WrapAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
const SizedBox(height: 40), const Gap(24),
Material( Material(
color: Colors.transparent, color: Colors.transparent,
child: Card( child: Card(
margin: EdgeInsets.zero,
child: PostItem( child: PostItem(
item: item, item: item,
isShowEmbed: true, isShowEmbed: true,
@ -31,15 +30,11 @@ class PostShareImage extends StatelessWidget {
showFeaturedReply: false, showFeaturedReply: false,
isReactable: false, isReactable: false,
isShowReply: false, isShowReply: false,
isNonScrollAttachment: true, padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 16,
),
onComment: () {}, onComment: () {},
), ),
), ),
).paddingOnly(bottom: 24), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -85,12 +80,6 @@ class PostShareImage extends StatelessWidget {
version: QrVersions.auto, version: QrVersions.auto,
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
size: 48, size: 48,
dataModuleStyle: QrDataModuleStyle(
color: Theme.of(context).colorScheme.onSurface,
),
eyeStyle: QrEyeStyle(
color: Theme.of(context).colorScheme.onSurface,
),
), ),
), ),
), ),

View File

@ -803,14 +803,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.23" version: "2.0.23"
flutter_resizable_container:
dependency: "direct main"
description:
name: flutter_resizable_container
sha256: "5b15c79c6cc338ed79640c706bb5176baa3333d92fd3627ad279aa3e25d2f0e7"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
flutter_secure_storage: flutter_secure_storage:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -87,7 +87,6 @@ dependencies:
timeline_tile: ^2.0.0 timeline_tile: ^2.0.0
screenshot: ^3.0.0 screenshot: ^3.0.0
qr_flutter: ^4.1.0 qr_flutter: ^4.1.0
flutter_resizable_container: ^3.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: