💄 Better ui
This commit is contained in:
parent
8dbf6ff4f3
commit
a6d8e2e311
@ -56,10 +56,6 @@ class _ArticleDetailScreenState extends State<ArticleDetailScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: const Divider(thickness: 0.3, height: 1)
|
|
||||||
.paddingOnly(top: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: SizedBox(height: MediaQuery.of(context).padding.bottom),
|
child: SizedBox(height: MediaQuery.of(context).padding.bottom),
|
||||||
),
|
),
|
||||||
|
@ -5,7 +5,7 @@ import 'package:solian/models/articles.dart';
|
|||||||
import 'package:solian/widgets/account/account_avatar.dart';
|
import 'package:solian/widgets/account/account_avatar.dart';
|
||||||
import 'package:solian/widgets/account/account_profile_popup.dart';
|
import 'package:solian/widgets/account/account_profile_popup.dart';
|
||||||
import 'package:solian/widgets/articles/article_quick_action.dart';
|
import 'package:solian/widgets/articles/article_quick_action.dart';
|
||||||
import 'package:solian/widgets/feed/feed_content.dart';
|
import 'package:solian/widgets/markdown_text_content.dart';
|
||||||
import 'package:solian/widgets/feed/feed_tags.dart';
|
import 'package:solian/widgets/feed/feed_tags.dart';
|
||||||
import 'package:timeago/timeago.dart' show format;
|
import 'package:timeago/timeago.dart' show format;
|
||||||
|
|
||||||
@ -179,15 +179,11 @@ class _ArticleItemState extends State<ArticleItem> {
|
|||||||
right: 16,
|
right: 16,
|
||||||
left: 16,
|
left: 16,
|
||||||
),
|
),
|
||||||
const Divider(thickness: 0.3, height: 0.3).paddingSymmetric(
|
MarkdownTextContent(content: item.content).paddingOnly(
|
||||||
vertical: 10,
|
left: 20,
|
||||||
),
|
right: 20,
|
||||||
FeedContent(content: item.content).paddingSymmetric(
|
|
||||||
horizontal: 20,
|
|
||||||
),
|
|
||||||
const Divider(thickness: 0.3, height: 0.3).paddingOnly(
|
|
||||||
top: 10,
|
top: 10,
|
||||||
bottom: 6,
|
bottom: 8,
|
||||||
),
|
),
|
||||||
buildFooter().paddingOnly(left: 20),
|
buildFooter().paddingOnly(left: 20),
|
||||||
if (widget.isReactable)
|
if (widget.isReactable)
|
||||||
|
@ -24,11 +24,11 @@ class ArticleListWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PagedSliverList<int, Article>.separated(
|
return PagedSliverList<int, Article>.separated(
|
||||||
|
addRepaintBoundaries: true,
|
||||||
pagingController: controller,
|
pagingController: controller,
|
||||||
builderDelegate: PagedChildBuilderDelegate<Article>(
|
builderDelegate: PagedChildBuilderDelegate<Article>(
|
||||||
itemBuilder: (context, item, index) {
|
itemBuilder: (context, item, index) {
|
||||||
return RepaintBoundary(
|
return CenteredContainer(
|
||||||
child: CenteredContainer(
|
|
||||||
child: ArticleListEntryWidget(
|
child: ArticleListEntryWidget(
|
||||||
isClickable: isClickable,
|
isClickable: isClickable,
|
||||||
item: item,
|
item: item,
|
||||||
@ -36,7 +36,6 @@ class ArticleListWidget extends StatelessWidget {
|
|||||||
controller.refresh();
|
controller.refresh();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -102,8 +102,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildEntry(Attachment element, int idx) {
|
Widget buildEntry(Attachment element, int idx) {
|
||||||
return RepaintBoundary(
|
return GestureDetector(
|
||||||
child: GestureDetector(
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: widget.width ?? MediaQuery.of(context).size.width,
|
width: widget.width ?? MediaQuery.of(context).size.width,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -176,7 +175,6 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ class ChatEventList extends StatelessWidget {
|
|||||||
final item = chatController.currentEvents[index].data;
|
final item = chatController.currentEvents[index].data;
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: RepaintBoundary(
|
|
||||||
child: ChatEvent(
|
child: ChatEvent(
|
||||||
key: Key('m${item.uuid}'),
|
key: Key('m${item.uuid}'),
|
||||||
item: item,
|
item: item,
|
||||||
@ -66,7 +65,6 @@ class ChatEventList extends StatelessWidget {
|
|||||||
top: !isMerged ? 8 : 0,
|
top: !isMerged ? 8 : 0,
|
||||||
bottom: !hasMerged ? 8 : 0,
|
bottom: !hasMerged ? 8 : 0,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/models/event.dart';
|
import 'package:solian/models/event.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:solian/widgets/markdown_text_content.dart';
|
||||||
import 'package:markdown/markdown.dart' as markdown;
|
|
||||||
|
|
||||||
class ChatEventMessage extends StatelessWidget {
|
class ChatEventMessage extends StatelessWidget {
|
||||||
final Event item;
|
final Event item;
|
||||||
@ -44,28 +42,7 @@ class ChatEventMessage extends StatelessWidget {
|
|||||||
final body = EventMessageBody.fromJson(item.body);
|
final body = EventMessageBody.fromJson(item.body);
|
||||||
final hasAttachment = body.attachments?.isNotEmpty ?? false;
|
final hasAttachment = body.attachments?.isNotEmpty ?? false;
|
||||||
|
|
||||||
return Markdown(
|
return MarkdownTextContent(content: body.text).paddingOnly(
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
data: body.text,
|
|
||||||
selectable: true,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
extensionSet: markdown.ExtensionSet(
|
|
||||||
markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
|
||||||
<markdown.InlineSyntax>[
|
|
||||||
markdown.EmojiSyntax(),
|
|
||||||
markdown.AutolinkExtensionSyntax(),
|
|
||||||
...markdown.ExtensionSet.gitHubFlavored.inlineSyntaxes
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTapLink: (text, href, title) async {
|
|
||||||
if (href == null) return;
|
|
||||||
await launchUrlString(
|
|
||||||
href,
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).paddingOnly(
|
|
||||||
left: isQuote ? 0 : 12,
|
left: isQuote ? 0 : 12,
|
||||||
right: isQuote ? 0 : 12,
|
right: isQuote ? 0 : 12,
|
||||||
top: body.quoteEvent == null ? 2 : 0,
|
top: body.quoteEvent == null ? 2 : 0,
|
||||||
|
@ -24,11 +24,11 @@ class FeedListWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PagedSliverList<int, FeedRecord>.separated(
|
return PagedSliverList<int, FeedRecord>.separated(
|
||||||
|
addRepaintBoundaries: true,
|
||||||
pagingController: controller,
|
pagingController: controller,
|
||||||
builderDelegate: PagedChildBuilderDelegate<FeedRecord>(
|
builderDelegate: PagedChildBuilderDelegate<FeedRecord>(
|
||||||
itemBuilder: (context, item, index) {
|
itemBuilder: (context, item, index) {
|
||||||
return RepaintBoundary(
|
return CenteredContainer(
|
||||||
child: CenteredContainer(
|
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
@ -57,7 +57,6 @@ class FeedListWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -3,10 +3,10 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
|||||||
import 'package:markdown/markdown.dart' as markdown;
|
import 'package:markdown/markdown.dart' as markdown;
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class FeedContent extends StatelessWidget {
|
class MarkdownTextContent extends StatelessWidget {
|
||||||
final String content;
|
final String content;
|
||||||
|
|
||||||
const FeedContent({super.key, required this.content});
|
const MarkdownTextContent({super.key, required this.content});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -15,6 +15,16 @@ class FeedContent extends StatelessWidget {
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
data: content,
|
data: content,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
|
styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith(
|
||||||
|
horizontalRuleDecoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
width: 1.0,
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
extensionSet: markdown.ExtensionSet(
|
extensionSet: markdown.ExtensionSet(
|
||||||
markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
||||||
<markdown.InlineSyntax>[
|
<markdown.InlineSyntax>[
|
@ -7,7 +7,7 @@ import 'package:solian/router.dart';
|
|||||||
import 'package:solian/widgets/account/account_avatar.dart';
|
import 'package:solian/widgets/account/account_avatar.dart';
|
||||||
import 'package:solian/widgets/account/account_profile_popup.dart';
|
import 'package:solian/widgets/account/account_profile_popup.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:solian/widgets/feed/feed_content.dart';
|
import 'package:solian/widgets/markdown_text_content.dart';
|
||||||
import 'package:solian/widgets/feed/feed_tags.dart';
|
import 'package:solian/widgets/feed/feed_tags.dart';
|
||||||
import 'package:solian/widgets/posts/post_quick_action.dart';
|
import 'package:solian/widgets/posts/post_quick_action.dart';
|
||||||
import 'package:timeago/timeago.dart' show format;
|
import 'package:timeago/timeago.dart' show format;
|
||||||
@ -190,7 +190,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
buildHeader().paddingSymmetric(horizontal: 12),
|
buildHeader().paddingSymmetric(horizontal: 12),
|
||||||
FeedContent(content: item.content).paddingOnly(
|
MarkdownTextContent(content: item.content).paddingOnly(
|
||||||
left: 16,
|
left: 16,
|
||||||
right: 12,
|
right: 12,
|
||||||
top: 2,
|
top: 2,
|
||||||
@ -231,7 +231,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
buildHeader(),
|
buildHeader(),
|
||||||
FeedContent(content: item.content)
|
MarkdownTextContent(content: item.content)
|
||||||
.paddingOnly(left: 12, right: 8),
|
.paddingOnly(left: 12, right: 8),
|
||||||
if (widget.item.replyTo != null && widget.isShowEmbed)
|
if (widget.item.replyTo != null && widget.isShowEmbed)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
@ -275,7 +275,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
attachmentsId: item.attachments ?? List.empty(),
|
attachmentsId: item.attachments ?? List.empty(),
|
||||||
divided: true,
|
divided: true,
|
||||||
),
|
),
|
||||||
if (!widget.isShowReply && widget.isReactable)
|
if (widget.isShowReply && widget.isReactable)
|
||||||
PostQuickAction(
|
PostQuickAction(
|
||||||
isShowReply: widget.isShowReply,
|
isShowReply: widget.isShowReply,
|
||||||
isReactable: widget.isReactable,
|
isReactable: widget.isReactable,
|
||||||
|
@ -24,11 +24,11 @@ class PostListWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PagedSliverList<int, Post>.separated(
|
return PagedSliverList<int, Post>.separated(
|
||||||
|
addRepaintBoundaries: true,
|
||||||
pagingController: controller,
|
pagingController: controller,
|
||||||
builderDelegate: PagedChildBuilderDelegate<Post>(
|
builderDelegate: PagedChildBuilderDelegate<Post>(
|
||||||
itemBuilder: (context, item, index) {
|
itemBuilder: (context, item, index) {
|
||||||
return RepaintBoundary(
|
return CenteredContainer(
|
||||||
child: CenteredContainer(
|
|
||||||
child: PostListEntryWidget(
|
child: PostListEntryWidget(
|
||||||
isShowEmbed: isShowEmbed,
|
isShowEmbed: isShowEmbed,
|
||||||
isNestedClickable: isNestedClickable,
|
isNestedClickable: isNestedClickable,
|
||||||
@ -38,7 +38,6 @@ class PostListWidget extends StatelessWidget {
|
|||||||
controller.refresh();
|
controller.refresh();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user