Skip to content

Commit 09e7185

Browse files
committed
refactor(feed_core): adjust headline tile layouts and styles
- Move source row to the top of HeadlineTileImageStart - Adjust padding and alignment in HeadlineTileImageStart and HeadlineTileImageTop - Simplify HeadlineTileTextOnly layout - Remove top padding from HeadlineActionsRow - Minor adjustments to spacing and layout in all headline tiles
1 parent 5afeddc commit 09e7185

File tree

4 files changed

+74
-73
lines changed

4 files changed

+74
-73
lines changed

lib/shared/widgets/feed_core/headline_tile_image_start.dart

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,27 @@ class HeadlineTileImageStart extends StatelessWidget {
4848
child: Column(
4949
crossAxisAlignment: CrossAxisAlignment.start,
5050
children: [
51+
Padding(
52+
padding: const EdgeInsets.fromLTRB(
53+
AppSpacing.md,
54+
AppSpacing.md,
55+
AppSpacing.md,
56+
0,
57+
),
58+
child: HeadlineSourceRow(headline: headline),
59+
),
5160
InkWell(
52-
onTap:
53-
onHeadlineTap ??
61+
onTap: onHeadlineTap ??
5462
() => HeadlineTapHandler.handleHeadlineTap(context, headline),
5563
child: Padding(
56-
padding: const EdgeInsets.all(AppSpacing.md),
64+
padding: const EdgeInsets.fromLTRB(
65+
AppSpacing.md,
66+
AppSpacing.sm,
67+
AppSpacing.md,
68+
AppSpacing.sm,
69+
),
5770
child: Row(
58-
crossAxisAlignment: CrossAxisAlignment.start,
71+
crossAxisAlignment: CrossAxisAlignment.center,
5972
children: [
6073
SizedBox(
6174
width: 72,
@@ -76,44 +89,37 @@ class HeadlineTileImageStart extends StatelessWidget {
7689
},
7790
errorBuilder: (context, error, stackTrace) =>
7891
ColoredBox(
79-
color: colorScheme.surfaceContainerHighest,
80-
child: Icon(
81-
Icons.broken_image_outlined,
82-
color: colorScheme.onSurfaceVariant,
83-
size: AppSpacing.xl,
84-
),
85-
),
92+
color: colorScheme.surfaceContainerHighest,
93+
child: Icon(
94+
Icons.broken_image_outlined,
95+
color: colorScheme.onSurfaceVariant,
96+
size: AppSpacing.xl,
97+
),
98+
),
8699
),
87100
),
88101
),
89102
const SizedBox(width: AppSpacing.md),
90103
Expanded(
91-
child: Column(
92-
crossAxisAlignment: CrossAxisAlignment.start,
93-
children: [
94-
HeadlineSourceRow(headline: headline),
95-
const SizedBox(height: AppSpacing.sm),
96-
Text.rich(
97-
TextSpan(
98-
children: [
99-
if (headline.isBreaking)
100-
TextSpan(
101-
text: '${l10n.breakingNewsPrefix} - ',
102-
style: textTheme.titleMedium?.copyWith(
103-
fontWeight: FontWeight.w500,
104-
color: colorScheme.primary,
105-
),
106-
),
107-
TextSpan(text: headline.title),
108-
],
109-
),
110-
style: textTheme.titleMedium?.copyWith(
111-
fontWeight: FontWeight.w500,
112-
),
113-
maxLines: 2,
114-
overflow: TextOverflow.ellipsis,
115-
),
116-
],
104+
child: Text.rich(
105+
TextSpan(
106+
children: [
107+
if (headline.isBreaking)
108+
TextSpan(
109+
text: '${l10n.breakingNewsPrefix} - ',
110+
style: textTheme.titleMedium?.copyWith(
111+
fontWeight: FontWeight.w500,
112+
color: colorScheme.primary,
113+
),
114+
),
115+
TextSpan(text: headline.title),
116+
],
117+
),
118+
style: textTheme.titleMedium?.copyWith(
119+
fontWeight: FontWeight.w500,
120+
),
121+
maxLines: 3,
122+
overflow: TextOverflow.ellipsis,
117123
),
118124
),
119125
],
@@ -125,7 +131,7 @@ class HeadlineTileImageStart extends StatelessWidget {
125131
AppSpacing.md,
126132
0,
127133
AppSpacing.md,
128-
AppSpacing.xs,
134+
AppSpacing.sm,
129135
),
130136
child: BlocBuilder<HeadlinesFeedBloc, HeadlinesFeedState>(
131137
builder: (context, state) {

lib/shared/widgets/feed_core/headline_tile_image_top.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ class HeadlineTileImageTop extends StatelessWidget {
122122
),
123123
),
124124
),
125+
const SizedBox(height: AppSpacing.md),
125126
Padding(
126127
padding: const EdgeInsets.fromLTRB(
127128
AppSpacing.md,
129+
0,
128130
AppSpacing.md,
129-
AppSpacing.md,
130-
AppSpacing.md,
131+
AppSpacing.sm,
131132
),
132133
child: BlocBuilder<HeadlinesFeedBloc, HeadlinesFeedState>(
133134
builder: (context, state) {

lib/shared/widgets/feed_core/headline_tile_text_only.dart

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,14 @@ class HeadlineTileTextOnly extends StatelessWidget {
8282
maxLines: 2,
8383
overflow: TextOverflow.ellipsis,
8484
),
85-
Padding(
86-
padding: const EdgeInsets.only(top: AppSpacing.md),
87-
child: BlocBuilder<HeadlinesFeedBloc, HeadlinesFeedState>(
88-
builder: (context, state) {
89-
return HeadlineActionsRow(
90-
headline: headline,
91-
engagements:
92-
state.engagementsMap[headline.id] ?? [],
93-
);
94-
},
95-
),
85+
const SizedBox(height: AppSpacing.md),
86+
BlocBuilder<HeadlinesFeedBloc, HeadlinesFeedState>(
87+
builder: (context, state) {
88+
return HeadlineActionsRow(
89+
headline: headline,
90+
engagements: state.engagementsMap[headline.id] ?? [],
91+
);
92+
},
9693
),
9794
],
9895
),

lib/user_content/engagement/widgets/headline_actions_row.dart

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,27 @@ class _HeadlineActionsRowView extends StatelessWidget {
7171
final theme = Theme.of(context);
7272
final mutedColor = theme.colorScheme.onSurfaceVariant.withOpacity(0.6);
7373

74-
return Padding(
75-
padding: const EdgeInsets.only(top: AppSpacing.md),
76-
child: Row(
77-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
78-
children: [
79-
Expanded(
80-
child: InlineReactionSelector(
81-
unselectedColor: mutedColor,
82-
selectedReaction: userReaction,
83-
onReactionSelected: (reaction) =>
84-
_onReactionSelected(context, reaction),
85-
),
74+
return Row(
75+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
76+
children: [
77+
Expanded(
78+
child: InlineReactionSelector(
79+
unselectedColor: mutedColor,
80+
selectedReaction: userReaction,
81+
onReactionSelected: (reaction) =>
82+
_onReactionSelected(context, reaction),
8683
),
87-
if (isCommentingEnabled)
88-
_CommentsButton(
89-
commentCount: commentCount,
90-
onPressed: () => showModalBottomSheet<void>(
91-
context: context,
92-
isScrollControlled: true,
93-
builder: (_) => CommentsBottomSheet(headlineId: headline.id),
94-
),
84+
),
85+
if (isCommentingEnabled)
86+
_CommentsButton(
87+
commentCount: commentCount,
88+
onPressed: () => showModalBottomSheet<void>(
89+
context: context,
90+
isScrollControlled: true,
91+
builder: (_) => CommentsBottomSheet(headlineId: headline.id),
9592
),
96-
],
97-
),
93+
),
94+
],
9895
);
9996
}
10097

0 commit comments

Comments
 (0)