diff --git a/lib/screens/post/post_publisher.dart b/lib/screens/post/post_publisher.dart index 1f5d040..82b24a9 100644 --- a/lib/screens/post/post_publisher.dart +++ b/lib/screens/post/post_publisher.dart @@ -1,4 +1,5 @@ import 'dart:ui'; +import 'dart:math' as math; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -396,7 +397,7 @@ class _PostPublisherScreenState extends State ], ), SliverToBoxAdapter(child: const Divider(height: 1)), - Gap(MediaQuery.of(context).padding.top), + Gap(math.max(MediaQuery.of(context).padding.top, 50)), ], ), ), diff --git a/lib/widgets/attachment/attachment_detail.dart b/lib/widgets/attachment/attachment_detail.dart index d2fb408..4e1030b 100644 --- a/lib/widgets/attachment/attachment_detail.dart +++ b/lib/widgets/attachment/attachment_detail.dart @@ -142,140 +142,134 @@ class _AttachmentZoomViewState extends State { Positioned( left: 16, right: 16, - bottom: MediaQuery.of(context).padding.bottom > 16 - ? -MediaQuery.of(context).padding.bottom - : 16, - child: SizedBox( - height: 180, - child: Material( - color: Colors.transparent, - child: Builder(builder: (context) { - final ud = context.read(); - final item = widget.data.elementAt( - widget.data.length > 1 - ? _pageController.page?.round() ?? 0 - : 0, - ); - final account = ud.getAccountFromCache(item.accountId); + bottom: 16, + child: Material( + color: Colors.transparent, + child: Builder(builder: (context) { + final ud = context.read(); + final item = widget.data.elementAt( + widget.data.length > 1 + ? _pageController.page?.round() ?? 0 + : 0, + ); + final account = ud.getAccountFromCache(item.accountId); - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (item.accountId > 0) - Row( - children: [ - IgnorePointer( - child: AccountImage( - content: account!.avatar, - radius: 19, - ), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (item.accountId > 0) + Row( + children: [ + IgnorePointer( + child: AccountImage( + content: account!.avatar, + radius: 19, ), - const Gap(8), - Expanded( - child: IgnorePointer( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'attachmentUploadBy'.tr(), - style: - Theme.of(context).textTheme.bodySmall, - ), - Text( - account.nick, - style: Theme.of(context) - .textTheme - .bodyMedium, - ), - ], - ), - ), - ), - if (widget.data.length > 1) - IgnorePointer( - child: Text( - '${(_pageController.page?.round() ?? 0) + 1}/${widget.data.length}', - style: GoogleFonts.robotoMono(fontSize: 13), - ).padding(right: 8), - ), - ], - ), - const Gap(4), - IgnorePointer( - child: Text( - item.alt, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontSize: 15, - fontWeight: FontWeight.w500, ), + const Gap(8), + Expanded( + child: IgnorePointer( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'attachmentUploadBy'.tr(), + style: + Theme.of(context).textTheme.bodySmall, + ), + Text( + account.nick, + style: + Theme.of(context).textTheme.bodyMedium, + ), + ], + ), + ), + ), + if (widget.data.length > 1) + IgnorePointer( + child: Text( + '${(_pageController.page?.round() ?? 0) + 1}/${widget.data.length}', + style: GoogleFonts.robotoMono(fontSize: 13), + ).padding(right: 8), + ), + ], + ), + const Gap(4), + IgnorePointer( + child: Text( + item.alt, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w500, ), ), - const Gap(2), - IgnorePointer( - child: Wrap( - spacing: 6, - children: [ - if (item.metadata['exif'] == null) - Text( - '#${item.rid}', - style: metaTextStyle, - ), - if (item.metadata['exif']?['Model'] != null) - Text( - 'attachmentShotOn'.tr(args: [ - item.metadata['exif']?['Model'], - ]), - style: metaTextStyle, - ).padding(right: 2), - if (item.metadata['exif']?['ShutterSpeed'] != null) - Text( - item.metadata['exif']?['ShutterSpeed'], - style: metaTextStyle, - ).padding(right: 2), - if (item.metadata['exif']?['ISO'] != null) - Text( - 'ISO${item.metadata['exif']?['ISO']}', - style: metaTextStyle, - ).padding(right: 2), - if (item.metadata['exif']?['Aperture'] != null) - Text( - 'f/${item.metadata['exif']?['Aperture']}', - style: metaTextStyle, - ).padding(right: 2), - if (item.metadata['exif']?['Megapixels'] != null && - item.metadata['exif']?['Model'] != null) - Text( - '${item.metadata['exif']?['Megapixels']}MP', - style: metaTextStyle, - ) - else - Text( - '${item.size} Bytes', - style: metaTextStyle, - ), + ), + const Gap(2), + IgnorePointer( + child: Wrap( + spacing: 6, + children: [ + if (item.metadata['exif'] == null) Text( - '${item.metadata['width']}x${item.metadata['height']}', + '#${item.rid}', style: metaTextStyle, ), - if (item.metadata['ratio'] != null) - Text( - (item.metadata['ratio'] as num) - .toStringAsFixed(2), - style: metaTextStyle, - ), + if (item.metadata['exif']?['Model'] != null) Text( - item.mimetype, + 'attachmentShotOn'.tr(args: [ + item.metadata['exif']?['Model'], + ]), + style: metaTextStyle, + ).padding(right: 2), + if (item.metadata['exif']?['ShutterSpeed'] != null) + Text( + item.metadata['exif']?['ShutterSpeed'], + style: metaTextStyle, + ).padding(right: 2), + if (item.metadata['exif']?['ISO'] != null) + Text( + 'ISO${item.metadata['exif']?['ISO']}', + style: metaTextStyle, + ).padding(right: 2), + if (item.metadata['exif']?['Aperture'] != null) + Text( + 'f/${item.metadata['exif']?['Aperture']}', + style: metaTextStyle, + ).padding(right: 2), + if (item.metadata['exif']?['Megapixels'] != null && + item.metadata['exif']?['Model'] != null) + Text( + '${item.metadata['exif']?['Megapixels']}MP', + style: metaTextStyle, + ) + else + Text( + '${item.size} Bytes', style: metaTextStyle, ), - ], - ), + Text( + '${item.metadata['width']}x${item.metadata['height']}', + style: metaTextStyle, + ), + if (item.metadata['ratio'] != null) + Text( + (item.metadata['ratio'] as num) + .toStringAsFixed(2), + style: metaTextStyle, + ), + Text( + item.mimetype, + style: metaTextStyle, + ), + ], ), - ], - ); - }), - ), + ), + ], + ); + }), ), ), ], diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 312a338..2031a4b 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -1,3 +1,5 @@ +import 'dart:math' as math; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -277,7 +279,7 @@ class _PostContentHeader extends StatelessWidget { context: context, transition: PopoverTransition.other, bodyBuilder: (context) => SizedBox( - width: 400, + width: math.min(400, MediaQuery.of(context).size.width - 10), child: PublisherPopoverCard( data: data.publisher, ), @@ -507,16 +509,9 @@ class _PostTruncatedHint extends StatelessWidget { const Gap(4), Text( 'postTotalLength'.plural(data.body['content_length']), - ).padding(right: 12) + ) ], ), - Row( - children: [ - const Icon(Symbols.unfold_more, size: 20), - const Gap(4), - Text('postReadMore').tr(), - ], - ) ], ).opacity(0.75); }