Skip to content

Commit 7172abc

Browse files
committed
feat: add optional trailing widget to headline item
- Added trailing widget parameter - Display trailing widget at end of row
1 parent 427c5ae commit 7172abc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/headlines-feed/widgets/headline_item_widget.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class HeadlineItemWidget extends StatelessWidget {
1010
const HeadlineItemWidget({
1111
required this.headline,
1212
required this.targetRouteName, // Add targetRouteName
13+
this.trailing, // Add optional trailing widget
1314
super.key,
1415
});
1516

@@ -19,6 +20,9 @@ class HeadlineItemWidget extends StatelessWidget {
1920
/// The named route to navigate to when the item is tapped.
2021
final String targetRouteName; // Add targetRouteName
2122

23+
/// An optional widget to display at the end of the row.
24+
final Widget? trailing;
25+
2226
// Helper for date formatting
2327
static final _dateFormatter = DateFormat.yMd().add_jm();
2428

@@ -159,6 +163,11 @@ class HeadlineItemWidget extends StatelessWidget {
159163
],
160164
),
161165
),
166+
// Add the trailing widget if provided
167+
if (trailing != null) ...[
168+
const SizedBox(width: AppSpacing.md),
169+
trailing!,
170+
],
162171
],
163172
),
164173
),

0 commit comments

Comments
 (0)