Skip to content

Commit 1b63ce6

Browse files
committed
refactor(content_management): replace individual buttons with PopupMenuButton for secondary actions
- Remove fixedWidth from DataColumn2 to resolve layout issue - Replace Edit and Delete buttons with a single PopupMenuButton - Add more_vert icon for secondary actions - Implement itemBuilder for PopupMenuButton to include Edit and Delete options - Update action tooltips and localization strings
1 parent 1665446 commit 1b63ce6

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

lib/content_management/view/draft_topics_page.dart

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class DraftTopicsPage extends StatelessWidget {
118118
DataColumn2(
119119
label: Text(l10n.actions),
120120
size: ColumnSize.S,
121-
fixedWidth: 120,
122121
),
123122
],
124123
source: _DraftTopicsDataSource(
@@ -206,6 +205,7 @@ class _DraftTopicsDataSource extends DataTableSource {
206205
DataCell(
207206
Row(
208207
children: [
208+
// Primary action: Publish button
209209
IconButton(
210210
icon: const Icon(Icons.publish),
211211
tooltip: l10n.publish,
@@ -215,24 +215,44 @@ class _DraftTopicsDataSource extends DataTableSource {
215215
);
216216
},
217217
),
218-
IconButton(
219-
icon: const Icon(Icons.edit),
220-
tooltip: l10n.editTopic,
221-
onPressed: () {
222-
context.goNamed(
223-
Routes.editTopicName,
224-
pathParameters: {'id': topic.id},
225-
);
226-
},
227-
),
228-
IconButton(
229-
icon: const Icon(Icons.delete_forever),
230-
tooltip: l10n.deleteForever,
231-
onPressed: () {
232-
context.read<DraftTopicsBloc>().add(
233-
DeleteDraftTopicForeverRequested(topic.id),
234-
);
218+
// Secondary actions: Edit and Delete via PopupMenuButton
219+
PopupMenuButton<String>(
220+
icon: const Icon(Icons.more_vert),
221+
tooltip: l10n.moreActions,
222+
onSelected: (value) {
223+
if (value == 'edit') {
224+
context.goNamed(
225+
Routes.editTopicName,
226+
pathParameters: {'id': topic.id},
227+
);
228+
} else if (value == 'delete') {
229+
context.read<DraftTopicsBloc>().add(
230+
DeleteDraftTopicForeverRequested(topic.id),
231+
);
232+
}
235233
},
234+
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
235+
PopupMenuItem<String>(
236+
value: 'edit',
237+
child: Row(
238+
children: [
239+
const Icon(Icons.edit),
240+
const SizedBox(width: AppSpacing.sm),
241+
Text(l10n.editTopic),
242+
],
243+
),
244+
),
245+
PopupMenuItem<String>(
246+
value: 'delete',
247+
child: Row(
248+
children: [
249+
const Icon(Icons.delete_forever),
250+
const SizedBox(width: AppSpacing.sm),
251+
Text(l10n.deleteForever),
252+
],
253+
),
254+
),
255+
],
236256
),
237257
],
238258
),

0 commit comments

Comments
 (0)