showInfoTablePopup usability changes

* append ":" to every key
* expect dynamic value and convert it to string in the function
This commit is contained in:
krawieck 2020-10-27 22:09:34 +01:00
parent e4055f073e
commit 4f2f6d8e3e
5 changed files with 36 additions and 35 deletions

View File

@ -132,11 +132,11 @@ class CommunityPage extends HookWidget {
title: Text('Nerd stuff'),
onTap: () {
showInfoTablePopup(context, {
'id:': community.id,
'id': community.id,
'actorId': community.actorId,
'created by:': '@${community.creatorName}',
'hot rank:': community.hotRank.toString(),
'published:': community.published.toString(),
'created by': '@${community.creatorName}',
'hot rank': community.hotRank,
'published': community.published,
});
},
),

View File

@ -69,13 +69,13 @@ class InstancePage extends HookWidget {
void _openMoreMenu(BuildContext c) {
showInfoTablePopup(context, {
'url:': instanceUrl,
'creator:': '@${site.site.creatorName}',
'version:': site.version,
'enableDownvotes:': site.site.enableDownvotes.toString(),
'enableNsfw:': site.site.enableNsfw.toString(),
'published:': site.site.published,
'updated:': site.site.updated,
'url': instanceUrl,
'creator': '@${site.site.creatorName}',
'version': site.version,
'enableDownvotes': site.site.enableDownvotes,
'enableNsfw': site.site.enableNsfw,
'published': site.site.published,
'updated': site.site.updated,
});
}

View File

@ -46,18 +46,18 @@ class Comment extends HookWidget {
_showCommentInfo(BuildContext context) {
final com = commentTree.comment;
showInfoTablePopup(context, {
'id': com.id.toString(),
'apId': com.apId.toString(),
'userId': com.userId.toString(),
'upvotes:': com.upvotes.toString(),
'downvotes:': com.downvotes.toString(),
'score:': com.score.toString(),
'% of upvotes:':
'id': com.id,
'apId': com.apId,
'userId': com.userId,
'upvotes': com.upvotes,
'downvotes': com.downvotes,
'score': com.score,
'% of upvotes':
'${(100 * (com.upvotes / (com.upvotes + com.downvotes)))}%',
'hotRank:': com.hotRank.toString(),
'hotRankActive:': com.hotRankActive.toString(),
'published:': com.published.toString(),
'updated': com.updated.toString(),
'hotRank': com.hotRank,
'hotRankActive': com.hotRankActive,
'published': com.published,
'updated': com.updated,
});
}

View File

@ -11,7 +11,8 @@ void showInfoTablePopup(BuildContext context, Map<String, dynamic> table) {
children: [
Table(
children: table.entries
.map((e) => TableRow(children: [Text(e.key), Text(e.value)]))
.map((e) => TableRow(
children: [Text('${e.key}:'), Text(e.value.toString())]))
.toList(),
),
],

View File

@ -75,19 +75,19 @@ class Post extends HookWidget {
title: Text('Nerd stuff'),
onTap: () {
showInfoTablePopup(context, {
'id:': post.id.toString(),
'apId:': post.apId,
'upvotes:': post.upvotes.toString(),
'downvotes:': post.downvotes.toString(),
'score': post.score.toString(),
'% of upvotes:':
'id': post.id,
'apId': post.apId,
'upvotes': post.upvotes,
'downvotes': post.downvotes,
'score': post.score,
'% of upvotes':
'''${(100 * (post.upvotes / (post.upvotes + post.downvotes))).toInt()}%''',
'hotRank:': post.hotRank.toString(),
'hotRank active': post.hotRankActive.toString(),
'local:': post.local.toString(),
'published:': post.published.toString(),
'updated': post.updated?.toString() ?? 'never',
'newestActivityTime:': post.newestActivityTime.toString(),
'hotRank': post.hotRank,
'hotRank active': post.hotRankActive,
'local': post.local,
'published': post.published,
'updated': post.updated ?? 'never',
'newestActivityTime': post.newestActivityTime,
});
},
),