Compare commits

..

No commits in common. "e1ddd22e4e59a1dd037d303b34f68cf1455d1adf" and "724bd6592e2e48917e47d100f995507326f2d504" have entirely different histories.

3 changed files with 71 additions and 116 deletions

View File

@ -34,17 +34,8 @@ class AutoCacheImage extends StatelessWidget {
progressIndicatorBuilder: noProgressIndicator progressIndicatorBuilder: noProgressIndicator
? null ? null
: (context, url, downloadProgress) => Center( : (context, url, downloadProgress) => Center(
child: TweenAnimationBuilder( child: CircularProgressIndicator(
tween: Tween( value: downloadProgress.progress,
begin: 0,
end: downloadProgress.progress ?? 0,
),
duration: const Duration(milliseconds: 300),
builder: (context, value, _) => CircularProgressIndicator(
value: downloadProgress.progress != null
? value.toDouble()
: null,
),
), ),
), ),
errorWidget: noErrorWidget errorWidget: noErrorWidget
@ -83,20 +74,11 @@ class AutoCacheImage extends StatelessWidget {
ImageChunkEvent? loadingProgress) { ImageChunkEvent? loadingProgress) {
if (loadingProgress == null) return child; if (loadingProgress == null) return child;
return Center( return Center(
child: TweenAnimationBuilder( child: CircularProgressIndicator(
tween: Tween( value: loadingProgress.expectedTotalBytes != null
begin: 0, ? loadingProgress.cumulativeBytesLoaded /
end: loadingProgress.expectedTotalBytes != null loadingProgress.expectedTotalBytes!
? loadingProgress.cumulativeBytesLoaded / : null,
loadingProgress.expectedTotalBytes!
: 0,
),
duration: const Duration(milliseconds: 300),
builder: (context, value, _) => CircularProgressIndicator(
value: loadingProgress.expectedTotalBytes != null
? value.toDouble()
: null,
),
), ),
); );
}, },

View File

@ -101,14 +101,11 @@ class _PostItemState extends State<PostItem> {
onChange: (size) { onChange: (size) {
setState(() => _contentHeight = size.height); setState(() => _contentHeight = size.height);
}, },
child: SingleChildScrollView( child: MarkdownTextContent(
physics: const NeverScrollableScrollPhysics(), parentId: 'p${item.id}',
child: MarkdownTextContent( content: item.body['content'],
parentId: 'p${item.id}', isAutoWarp: item.type == 'story',
content: item.body['content'], isSelectable: widget.isContentSelectable,
isAutoWarp: item.type == 'story',
isSelectable: widget.isContentSelectable,
),
).paddingOnly( ).paddingOnly(
left: 16, left: 16,
right: 12, right: 12,
@ -212,17 +209,14 @@ class _PostItemState extends State<PostItem> {
onChange: (size) { onChange: (size) {
setState(() => _contentHeight = size.height); setState(() => _contentHeight = size.height);
}, },
child: SingleChildScrollView( child: MarkdownTextContent(
physics: const NeverScrollableScrollPhysics(), parentId: 'p${item.id}-embed',
child: MarkdownTextContent( content: item.body['content'],
parentId: 'p${item.id}-embed', isAutoWarp: item.type == 'story',
content: item.body['content'], isSelectable: widget.isContentSelectable,
isAutoWarp: item.type == 'story', isLargeText: item.type == 'article' &&
isSelectable: widget.isContentSelectable, widget.isFullContent,
isLargeText: item.type == 'article' && ).paddingOnly(left: 12, right: 8),
widget.isFullContent,
).paddingOnly(left: 12, right: 8),
),
), ),
), ),
if (_contentHeight >= 320 && !widget.isFullContent) if (_contentHeight >= 320 && !widget.isFullContent)
@ -377,81 +371,60 @@ class _PostFeaturedReplyWidget extends StatelessWidget {
child: Column( child: Column(
children: snapshot.data! children: snapshot.data!
.map( .map(
(reply) => ClipRRect( (reply) => Row(
borderRadius: const BorderRadius.all(Radius.circular(8)), mainAxisAlignment: MainAxisAlignment.center,
child: OpenContainer( crossAxisAlignment: CrossAxisAlignment.start,
closedBuilder: (_, openContainer) => Row( children: [
mainAxisAlignment: MainAxisAlignment.center, AccountAvatar(content: reply.author.avatar, radius: 10),
crossAxisAlignment: CrossAxisAlignment.start, const Gap(6),
children: [ Text(
AccountAvatar( reply.author.nick,
content: reply.author.avatar, style: const TextStyle(fontWeight: FontWeight.bold),
radius: 10, ),
), const Gap(6),
const Gap(6), Text(
Text( format(
reply.author.nick, reply.publishedAt?.toLocal() ?? DateTime.now(),
style: locale: 'en_short',
const TextStyle(fontWeight: FontWeight.bold), ),
), ).paddingOnly(top: 0.5),
const Gap(6), const Gap(8),
Text( Expanded(
format( child: Column(
reply.publishedAt?.toLocal() ?? DateTime.now(), crossAxisAlignment: CrossAxisAlignment.start,
locale: 'en_short', children: [
MarkdownTextContent(
isAutoWarp: reply.type == 'story',
content: reply.body['content'],
parentId:
'p${item.id}-featured-reply${reply.id}',
), ),
).paddingOnly(top: 0.5), if (reply.body['attachments'] is List &&
const Gap(8), reply.body['attachments'].isNotEmpty)
Expanded( Row(
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Icon(
children: [ Icons.file_copy,
MarkdownTextContent( size: 15,
isAutoWarp: reply.type == 'story', color: unFocusColor,
content: reply.body['content'], ).paddingOnly(right: 5),
parentId: Text(
'p${item.id}-featured-reply${reply.id}', 'attachmentHint'.trParams(
), {
if (reply.body['attachments'] is List && 'count': reply
reply.body['attachments'].isNotEmpty) .body['attachments'].length
Row( .toString(),
children: [ },
Icon( ),
Icons.file_copy, style: TextStyle(color: unFocusColor),
size: 15,
color: unFocusColor,
).paddingOnly(right: 5),
Text(
'attachmentHint'.trParams(
{
'count': reply
.body['attachments'].length
.toString(),
},
),
style: TextStyle(color: unFocusColor),
),
],
), ),
], ],
), ),
), ],
],
).paddingSymmetric(horizontal: 12, vertical: 8),
openBuilder: (_, __) => TitleShell(
title: 'postDetail'.tr,
child: PostDetailScreen(
id: reply.id.toString(),
post: reply,
), ),
), ),
closedElevation: 0, ],
openElevation: 0, ).paddingSymmetric(horizontal: 12, vertical: 8),
closedColor:
Theme.of(context).colorScheme.surfaceContainer,
openColor: Theme.of(context).colorScheme.surface,
),
),
) )
.toList(), .toList(),
), ),

View File

@ -2,7 +2,7 @@ name: solian
description: "The Solar Network App" description: "The Solar Network App"
publish_to: "none" publish_to: "none"
version: 1.2.3+2 version: 1.2.3+1
environment: environment:
sdk: ">=3.3.4 <4.0.0" sdk: ">=3.3.4 <4.0.0"