Skip to content

Commit 1665446

Browse files
committed
refactor(content_management): replace multiple IconButton with PopupMenuButton
- Remove fixedWidth constraint from DataColumn2 - Replace individual Edit and Delete IconButtons with a PopupMenuButton - Add more_vert icon for secondary actions - Implement PopupMenuEntry for Edit and Delete options - Maintain the existing functionality and navigation
1 parent 24ce9bc commit 1665446

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

lib/content_management/view/draft_sources_page.dart

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class DraftSourcesPage extends StatelessWidget {
118118
DataColumn2(
119119
label: Text(l10n.actions),
120120
size: ColumnSize.S,
121-
fixedWidth: 120,
122121
),
123122
],
124123
source: _DraftSourcesDataSource(
@@ -206,6 +205,7 @@ class _DraftSourcesDataSource 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 _DraftSourcesDataSource extends DataTableSource {
215215
);
216216
},
217217
),
218-
IconButton(
219-
icon: const Icon(Icons.edit),
220-
tooltip: l10n.editSource,
221-
onPressed: () {
222-
context.goNamed(
223-
Routes.editSourceName,
224-
pathParameters: {'id': source.id},
225-
);
226-
},
227-
),
228-
IconButton(
229-
icon: const Icon(Icons.delete_forever),
230-
tooltip: l10n.deleteForever,
231-
onPressed: () {
232-
context.read<DraftSourcesBloc>().add(
233-
DeleteDraftSourceForeverRequested(source.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.editSourceName,
226+
pathParameters: {'id': source.id},
227+
);
228+
} else if (value == 'delete') {
229+
context.read<DraftSourcesBloc>().add(
230+
DeleteDraftSourceForeverRequested(source.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.editSource),
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)