💄 Optimize tags
This commit is contained in:
parent
b241956ce7
commit
10ed44d2e2
@ -100,15 +100,40 @@ class FeedCreationButton extends StatelessWidget {
|
||||
future: auth.isAuthorized,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData && snapshot.data == true) {
|
||||
return IconButton(
|
||||
return PopupMenuButton(
|
||||
icon: const Icon(Icons.add_circle),
|
||||
onPressed: () {
|
||||
AppRouter.instance.pushNamed('postPublishing').then((val) {
|
||||
if (val != null && onCreated != null) {
|
||||
onCreated!();
|
||||
}
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context) => [
|
||||
PopupMenuItem(
|
||||
child: ListTile(
|
||||
title: Text('postCreate'.tr),
|
||||
leading: const Icon(Icons.article),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
),
|
||||
onTap: () {
|
||||
AppRouter.instance.pushNamed('postPublishing').then((val) {
|
||||
if (val != null && onCreated != null) {
|
||||
onCreated!();
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
PopupMenuItem(
|
||||
child: ListTile(
|
||||
title: Text('articleCreate'.tr),
|
||||
leading: const Icon(Icons.newspaper),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
),
|
||||
onTap: () {},
|
||||
),
|
||||
PopupMenuItem(
|
||||
child: ListTile(
|
||||
title: Text('draftBoxOpen'.tr),
|
||||
leading: const Icon(Icons.drafts),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
),
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return const SizedBox();
|
||||
|
@ -81,6 +81,9 @@ class SolianMessages extends Translations {
|
||||
'notifyAllRead': 'Mark all as read',
|
||||
'notifyEmpty': 'All notifications read',
|
||||
'notifyEmptyCaption': 'It seems like nothing happened recently',
|
||||
'postCreate': 'Create new post',
|
||||
'articleCreate': 'Create new article',
|
||||
'draftBoxOpen': 'Open draft box',
|
||||
'postNew': 'Create a new post',
|
||||
'postNewInRealmHint': 'Add post in realm @realm',
|
||||
'postAction': 'Post',
|
||||
@ -322,6 +325,9 @@ class SolianMessages extends Translations {
|
||||
'notifyAllRead': '已读所有通知',
|
||||
'notifyEmpty': '通知箱为空',
|
||||
'notifyEmptyCaption': '看起来最近没发生什么呢',
|
||||
'postCreate': '发表帖子',
|
||||
'articleCreate': '发表文章',
|
||||
'draftBoxOpen': '打开草稿箱',
|
||||
'postNew': '创建新帖子',
|
||||
'postNewInRealmHint': '在领域 @realm 里发表新帖子',
|
||||
'postAction': '发表',
|
||||
|
@ -12,29 +12,18 @@ class FeedTagsList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const borderRadius = BorderRadius.all(
|
||||
Radius.circular(8),
|
||||
);
|
||||
|
||||
return Wrap(
|
||||
alignment: WrapAlignment.start,
|
||||
spacing: 6,
|
||||
children: tags
|
||||
.map(
|
||||
(x) => GestureDetector(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: borderRadius,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
|
||||
child: Text(
|
||||
'#${x.alias}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
(x) => InkWell(
|
||||
child: Text(
|
||||
'#${x.alias}',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
|
@ -111,17 +111,29 @@ class _PostItemState extends State<PostItem> {
|
||||
}));
|
||||
}
|
||||
|
||||
List<Widget> widgets = List.empty(growable: true);
|
||||
|
||||
if (widget.item.tags?.isNotEmpty ?? false) {
|
||||
widgets.add(FeedTagsList(tags: widget.item.tags!));
|
||||
}
|
||||
if (labels.isNotEmpty) {
|
||||
return Text(
|
||||
widgets.add(Text(
|
||||
labels.join(' · '),
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.75),
|
||||
),
|
||||
).paddingOnly(top: 2);
|
||||
} else {
|
||||
));
|
||||
}
|
||||
|
||||
if (widgets.isEmpty) {
|
||||
return const SizedBox();
|
||||
} else {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: widgets,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,10 +222,7 @@ class _PostItemState extends State<PostItem> {
|
||||
top: 2,
|
||||
bottom: hasAttachment ? 4 : 0,
|
||||
),
|
||||
buildFooter().paddingOnly(left: 16),
|
||||
if (widget.item.tags?.isNotEmpty ?? false)
|
||||
FeedTagsList(tags: widget.item.tags!)
|
||||
.paddingOnly(left: 12, top: 6, bottom: 2),
|
||||
buildFooter().paddingOnly(left: 16, top: 2),
|
||||
AttachmentList(
|
||||
parentId: widget.overrideAttachmentParent ?? widget.item.alias,
|
||||
attachmentsId: item.attachments ?? List.empty(),
|
||||
@ -275,10 +284,7 @@ class _PostItemState extends State<PostItem> {
|
||||
);
|
||||
},
|
||||
),
|
||||
buildFooter().paddingOnly(left: 12),
|
||||
if (widget.item.tags?.isNotEmpty ?? false)
|
||||
FeedTagsList(tags: widget.item.tags!)
|
||||
.paddingOnly(left: 4, top: 6, bottom: 2),
|
||||
buildFooter().paddingOnly(left: 12, top: 2),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user