Skip to content

Commit f7abef1

Browse files
committed
refactor(engagement): improve code structure and readability
- Merge single statement blocks in HeadlineActionsRow - Remove unnecessary line breaks in _HeadlineActionsRowView constructor - Format mutedColor assignment with proper line breaks - Simplify showModalBottomSheet builder in _HeadlineActionsRowView - Adjust event handling in _HeadlineActionsRowView - Update method declaration in _HeadlineActionsRowView
1 parent 9f96218 commit f7abef1

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

lib/user_content/engagement/widgets/headline_actions_row.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,12 @@ class HeadlineActionsRow extends StatelessWidget {
3333

3434
@override
3535
Widget build(BuildContext context) {
36-
return _HeadlineActionsRowView(
37-
headline: headline,
38-
engagements: engagements,
39-
);
36+
return _HeadlineActionsRowView(headline: headline, engagements: engagements);
4037
}
4138
}
4239

4340
class _HeadlineActionsRowView extends StatelessWidget {
44-
const _HeadlineActionsRowView({
45-
required this.headline,
46-
required this.engagements,
47-
});
41+
const _HeadlineActionsRowView({required this.headline, required this.engagements});
4842

4943
final Headline headline;
5044
final List<Engagement> engagements;
@@ -73,7 +67,9 @@ class _HeadlineActionsRowView extends StatelessWidget {
7367
final commentCount = engagements.where((e) => e.comment != null).length;
7468

7569
final theme = Theme.of(context);
76-
final mutedColor = theme.colorScheme.onSurfaceVariant.withOpacity(0.6);
70+
final mutedColor = theme.colorScheme.onSurfaceVariant.withOpacity(
71+
0.6,
72+
);
7773

7874
return Padding(
7975
padding: const EdgeInsets.only(top: AppSpacing.md),
@@ -94,10 +90,7 @@ class _HeadlineActionsRowView extends StatelessWidget {
9490
onPressed: () => showModalBottomSheet<void>(
9591
context: context,
9692
isScrollControlled: true,
97-
builder: (_) => CommentsBottomSheet(
98-
headlineId: headline.id,
99-
engagements: engagements,
100-
),
93+
builder: (_) => CommentsBottomSheet(headlineId: headline.id),
10194
),
10295
),
10396
],
@@ -115,8 +108,8 @@ class _HeadlineActionsRowView extends StatelessWidget {
115108
);
116109
} else {
117110
context.read<HeadlinesFeedBloc>().add(
118-
HeadlinesFeedReactionUpdated(headline.id, reaction, context: context),
119-
);
111+
HeadlinesFeedReactionUpdated(headline.id, reaction, context: context),
112+
);
120113
}
121114
}
122115

@@ -148,7 +141,7 @@ class _HeadlineActionsRowView extends StatelessWidget {
148141
}
149142

150143
({String title, String body, String buttonText, VoidCallback? onPressed})
151-
_getBottomSheetContent({
144+
_getBottomSheetContent({
152145
required BuildContext context,
153146
required AppLocalizations l10n,
154147
required LimitationStatus status,

0 commit comments

Comments
 (0)