Skip to content

Commit 24ce9bc

Browse files
committed
refactor(content_management): replace individual buttons with PopupMenuButton for secondary actions
- Remove fixedWidth from DataColumn2 - Replace Edit and Delete buttons with a PopupMenuButton - Add 'edit' and 'delete' options to the popup menu - Update tooltips and icons for the new menu items
1 parent 86b3a50 commit 24ce9bc

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

lib/content_management/view/draft_headlines_page.dart

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class DraftHeadlinesPage extends StatelessWidget {
122122
DataColumn2(
123123
label: Text(l10n.actions),
124124
size: ColumnSize.S,
125-
fixedWidth: 120,
126125
),
127126
],
128127
source: _DraftHeadlinesDataSource(
@@ -211,6 +210,7 @@ class _DraftHeadlinesDataSource extends DataTableSource {
211210
DataCell(
212211
Row(
213212
children: [
213+
// Primary action: Publish button
214214
IconButton(
215215
icon: const Icon(Icons.publish),
216216
tooltip: l10n.publish,
@@ -220,24 +220,44 @@ class _DraftHeadlinesDataSource extends DataTableSource {
220220
);
221221
},
222222
),
223-
IconButton(
224-
icon: const Icon(Icons.edit),
225-
tooltip: l10n.editHeadline,
226-
onPressed: () {
227-
context.goNamed(
228-
Routes.editHeadlineName,
229-
pathParameters: {'id': headline.id},
230-
);
231-
},
232-
),
233-
IconButton(
234-
icon: const Icon(Icons.delete_forever),
235-
tooltip: l10n.deleteForever,
236-
onPressed: () {
237-
context.read<DraftHeadlinesBloc>().add(
238-
DeleteDraftHeadlineForeverRequested(headline.id),
239-
);
223+
// Secondary actions: Edit and Delete via PopupMenuButton
224+
PopupMenuButton<String>(
225+
icon: const Icon(Icons.more_vert),
226+
tooltip: l10n.moreActions,
227+
onSelected: (value) {
228+
if (value == 'edit') {
229+
context.goNamed(
230+
Routes.editHeadlineName,
231+
pathParameters: {'id': headline.id},
232+
);
233+
} else if (value == 'delete') {
234+
context.read<DraftHeadlinesBloc>().add(
235+
DeleteDraftHeadlineForeverRequested(headline.id),
236+
);
237+
}
240238
},
239+
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
240+
PopupMenuItem<String>(
241+
value: 'edit',
242+
child: Row(
243+
children: [
244+
const Icon(Icons.edit),
245+
const SizedBox(width: AppSpacing.sm),
246+
Text(l10n.editHeadline),
247+
],
248+
),
249+
),
250+
PopupMenuItem<String>(
251+
value: 'delete',
252+
child: Row(
253+
children: [
254+
const Icon(Icons.delete_forever),
255+
const SizedBox(width: AppSpacing.sm),
256+
Text(l10n.deleteForever),
257+
],
258+
),
259+
),
260+
],
241261
),
242262
],
243263
),

0 commit comments

Comments
 (0)