Skip to content

Commit 5640214

Browse files
committed
hide vote and comment icons/counts when data coming from api
1 parent 060c557 commit 5640214

File tree

3 files changed

+60
-50
lines changed

3 files changed

+60
-50
lines changed

lib/features/explore/presentation/widgets/waves_list_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class _WavesListViewState extends State<WavesListView> {
9696
ThreadTile(
9797
item: items[index],
9898
threadType: controller.threadType,
99+
showVoteAndComment: false,
99100
),
100101
if (index == items.length - 1)
101102
PaginationLoader(

lib/features/threads/presentation/thread_feed/widgets/interaction_tile.dart

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ import 'package:waves/features/threads/presentation/thread_feed/widgets/vote_ico
1414
class InteractionTile extends StatelessWidget {
1515
const InteractionTile(
1616
{this.hideCommentInfo = false,
17+
this.showVoteAndComment = true,
1718
super.key,
1819
required this.item,
1920
this.removeCommentGesture = false});
2021

2122
final ThreadFeedModel item;
2223
final bool hideCommentInfo;
24+
final bool showVoteAndComment;
2325
final bool removeCommentGesture;
2426

2527
@override
@@ -34,43 +36,45 @@ class InteractionTile extends StatelessWidget {
3436
final iconColor = theme.primaryColorDark.withOpacity(0.8);
3537
const iconGap = 5.0;
3638
const borderRadius = BorderRadius.all(Radius.circular(40));
37-
final rowChildren = <Widget>[
38-
VoteIconButton(
39-
item: item,
40-
iconColor: iconColor,
41-
iconGap: iconGap,
42-
textStyle: style(theme),
43-
),
44-
];
39+
final rowChildren = <Widget>[];
40+
41+
void addSpacer() {
42+
if (rowChildren.isNotEmpty) {
43+
rowChildren.add(gap());
44+
}
45+
}
46+
47+
if (showVoteAndComment) {
48+
rowChildren.add(
49+
VoteIconButton(
50+
item: item,
51+
iconColor: iconColor,
52+
iconGap: iconGap,
53+
textStyle: style(theme),
54+
),
55+
);
56+
}
4557

4658
if (item.pendingPayoutValue != null) {
47-
rowChildren
48-
..add(gap())
49-
..add(ThreadEarnings(
59+
addSpacer();
60+
rowChildren.add(
61+
ThreadEarnings(
5062
pendingPayoutvalue: item.pendingPayoutValue,
5163
iconColor: iconColor,
5264
iconGap: iconGap,
5365
textStyle: style(theme),
54-
));
66+
),
67+
);
5568
}
5669

57-
rowChildren
58-
..add(gap())
59-
..add(
70+
if (showVoteAndComment && !hideCommentInfo) {
71+
addSpacer();
72+
rowChildren.add(
6073
IconWithText(
6174
onTap: () {
6275
if (!removeCommentGesture) {
6376
context.pushNamed(Routes.commentDetailView, extra: item);
6477
}
65-
// if (context.read<UserController>().isUserLoggedIn) {
66-
// context.pushNamed(
67-
// Routes.addCommentView,
68-
// queryParameters: {
69-
// RouteKeys.accountName: item.author,
70-
// RouteKeys.permlink: item.permlink
71-
// },
72-
// );
73-
// }
7478
},
7579
icon: Icons.comment,
7680
iconColor: iconColor,
@@ -79,34 +83,36 @@ class InteractionTile extends StatelessWidget {
7983
iconGap: iconGap,
8084
textStyle: style(theme),
8185
),
82-
)
83-
..add(gap())
84-
..add(
85-
IconWithText(
86-
onTap: () {
87-
Share.share(
88-
'https://ecency.com/${item.category}/@${item.author}/${item.permlink}');
89-
},
86+
);
87+
}
88+
89+
addSpacer();
90+
rowChildren.add(
91+
IconWithText(
92+
onTap: () {
93+
Share.share(
94+
'https://ecency.com/${item.category}/@${item.author}/${item.permlink}');
95+
},
96+
borderRadius: borderRadius,
97+
icon: Icons.share,
98+
iconColor: iconColor,
99+
),
100+
);
101+
102+
addSpacer();
103+
rowChildren.add(
104+
BookmarkButton(
90105
borderRadius: borderRadius,
91-
icon: Icons.share,
92106
iconColor: iconColor,
93-
),
94-
)
95-
..add(gap())
96-
..add(
97-
BookmarkButton(
98-
borderRadius: borderRadius,
99-
iconColor: iconColor,
100-
isBookmarked:
101-
bookmarkProvider.isBookmarkPresent(item.idString),
102-
onAdd: () {
103-
bookmarkProvider.addBookmark(item.idString, item);
104-
},
105-
onRemove: () {
106-
bookmarkProvider.removeBookmark(item.idString);
107-
},
108-
toastType: '${item.author}/${item.permlink}'),
109-
);
107+
isBookmarked: bookmarkProvider.isBookmarkPresent(item.idString),
108+
onAdd: () {
109+
bookmarkProvider.addBookmark(item.idString, item);
110+
},
111+
onRemove: () {
112+
bookmarkProvider.removeBookmark(item.idString);
113+
},
114+
toastType: '${item.author}/${item.permlink}'),
115+
);
110116

111117
return Padding(
112118
padding: const EdgeInsets.only(right: 4),

lib/features/threads/presentation/thread_feed/widgets/thread_tile.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ class ThreadTile extends StatelessWidget {
1717
const ThreadTile(
1818
{this.hideCommentInfo = false,
1919
this.threadType = ThreadFeedType.ecency,
20+
this.showVoteAndComment = true,
2021
super.key,
2122
required this.item});
2223

2324
final ThreadFeedModel item;
2425
final bool hideCommentInfo;
2526
final ThreadFeedType threadType;
27+
final bool showVoteAndComment;
2628

2729
@override
2830
Widget build(BuildContext context) {
@@ -69,6 +71,7 @@ class ThreadTile extends StatelessWidget {
6971
InteractionTile(
7072
item: item,
7173
hideCommentInfo: hideCommentInfo,
74+
showVoteAndComment: showVoteAndComment,
7275
)
7376
],
7477
),

0 commit comments

Comments
 (0)