File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/flyer_chat_reactions/lib/src/widgets Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,17 @@ class _ReactionsListState extends State<ReactionsList> {
105105 t.typography.bodyMedium,
106106 ),
107107 );
108+ final validReactions = widget.reactions.where ((r) => r.count > 0 ).toList ();
108109
109110 final filteredReactions =
110111 selectedEmoji == null
111- ? widget.reactions
112- : widget.reactions.where ((r) => r.emoji == selectedEmoji).toList ();
112+ ? validReactions
113+ : validReactions.where ((r) => r.emoji == selectedEmoji).toList ();
114+
115+ final totalReactionCount = widget.reactions.fold (
116+ 0 ,
117+ (sum, r) => sum + r.count,
118+ );
113119
114120 return Container (
115121 clipBehavior: Clip .hardEdge,
@@ -131,7 +137,7 @@ class _ReactionsListState extends State<ReactionsList> {
131137 children: [
132138 _buildChip (
133139 label: Text (
134- '${widget .styleConfig .allFilterChipLabel } • ${ widget . reactions . length } ' ,
140+ '${widget .styleConfig .allFilterChipLabel } • $totalReactionCount ' ,
135141 ),
136142 theme: theme,
137143 selected: selectedEmoji == null ,
@@ -142,7 +148,7 @@ class _ReactionsListState extends State<ReactionsList> {
142148 },
143149 ),
144150 const SizedBox (width: 8 ),
145- ...widget.reactions .map (
151+ ...validReactions .map (
146152 (reaction) => Padding (
147153 padding: const EdgeInsets .only (right: 8 ),
148154 child: _buildChip (
You can’t perform that action at this time.
0 commit comments