Skip to content

Commit e51691f

Browse files
committed
style(content_management): improve layout and spacing of action buttons
- Add visualDensity and iconSize to Edit button for better appearance - Wrap PopupMenuButton in SizedBox to adjust width and prevent layout overflow - Reduce iconSize of overflow button for consistency with Edit button
1 parent 02502fb commit e51691f

File tree

1 file changed

+70
-64
lines changed

1 file changed

+70
-64
lines changed

lib/content_management/widgets/content_action_buttons.dart

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class ContentActionButtons extends StatelessWidget {
5353
// Action 1: Edit (always visible as the first action)
5454
visibleActions.add(
5555
IconButton(
56+
visualDensity: VisualDensity.compact,
57+
iconSize: 20,
5658
icon: const Icon(Icons.edit),
5759
tooltip: l10n.edit,
5860
onPressed: () {
@@ -152,70 +154,74 @@ class ContentActionButtons extends StatelessWidget {
152154
// (publish/archive/restore for draft/active/archived, and delete for draft/archived headlines).
153155
// So, we will always show the ellipsis.
154156
visibleActions.add(
155-
PopupMenuButton<String>(
156-
icon: const Icon(Icons.more_vert),
157-
tooltip: l10n.moreActions,
158-
onSelected: (value) {
159-
switch (value) {
160-
case 'publish':
161-
if (item is Headline) {
162-
context.read<ContentManagementBloc>().add(
163-
PublishHeadlineRequested(itemId),
164-
);
165-
} else if (item is Topic) {
166-
context.read<ContentManagementBloc>().add(
167-
PublishTopicRequested(itemId),
168-
);
169-
} else if (item is Source) {
170-
context.read<ContentManagementBloc>().add(
171-
PublishSourceRequested(itemId),
172-
);
173-
}
174-
case 'archive':
175-
if (item is Headline) {
176-
context.read<ContentManagementBloc>().add(
177-
ArchiveHeadlineRequested(itemId),
178-
);
179-
} else if (item is Topic) {
180-
context.read<ContentManagementBloc>().add(
181-
ArchiveTopicRequested(itemId),
182-
);
183-
} else if (item is Source) {
184-
context.read<ContentManagementBloc>().add(
185-
ArchiveSourceRequested(itemId),
186-
);
187-
}
188-
case 'restore':
189-
if (item is Headline) {
190-
context.read<ContentManagementBloc>().add(
191-
RestoreHeadlineRequested(itemId),
192-
);
193-
} else if (item is Topic) {
194-
context.read<ContentManagementBloc>().add(
195-
RestoreTopicRequested(itemId),
196-
);
197-
} else if (item is Source) {
198-
context.read<ContentManagementBloc>().add(
199-
RestoreSourceRequested(itemId),
200-
);
201-
}
202-
case 'delete':
203-
if (item is Headline) {
204-
context.read<ContentManagementBloc>().add(
205-
DeleteHeadlineForeverRequested(itemId),
206-
);
207-
} else if (item is Topic) {
208-
context.read<ContentManagementBloc>().add(
209-
DeleteTopicForeverRequested(itemId),
210-
);
211-
} else if (item is Source) {
212-
context.read<ContentManagementBloc>().add(
213-
DeleteSourceForeverRequested(itemId),
214-
);
215-
}
216-
}
217-
},
218-
itemBuilder: (BuildContext context) => overflowMenuItems,
157+
SizedBox(
158+
width: 32,
159+
child: PopupMenuButton<String>(
160+
iconSize: 20,
161+
icon: const Icon(Icons.more_vert),
162+
tooltip: l10n.moreActions,
163+
onSelected: (value) {
164+
switch (value) {
165+
case 'publish':
166+
if (item is Headline) {
167+
context.read<ContentManagementBloc>().add(
168+
PublishHeadlineRequested(itemId),
169+
);
170+
} else if (item is Topic) {
171+
context.read<ContentManagementBloc>().add(
172+
PublishTopicRequested(itemId),
173+
);
174+
} else if (item is Source) {
175+
context.read<ContentManagementBloc>().add(
176+
PublishSourceRequested(itemId),
177+
);
178+
}
179+
case 'archive':
180+
if (item is Headline) {
181+
context.read<ContentManagementBloc>().add(
182+
ArchiveHeadlineRequested(itemId),
183+
);
184+
} else if (item is Topic) {
185+
context.read<ContentManagementBloc>().add(
186+
ArchiveTopicRequested(itemId),
187+
);
188+
} else if (item is Source) {
189+
context.read<ContentManagementBloc>().add(
190+
ArchiveSourceRequested(itemId),
191+
);
192+
}
193+
case 'restore':
194+
if (item is Headline) {
195+
context.read<ContentManagementBloc>().add(
196+
RestoreHeadlineRequested(itemId),
197+
);
198+
} else if (item is Topic) {
199+
context.read<ContentManagementBloc>().add(
200+
RestoreTopicRequested(itemId),
201+
);
202+
} else if (item is Source) {
203+
context.read<ContentManagementBloc>().add(
204+
RestoreSourceRequested(itemId),
205+
);
206+
}
207+
case 'delete':
208+
if (item is Headline) {
209+
context.read<ContentManagementBloc>().add(
210+
DeleteHeadlineForeverRequested(itemId),
211+
);
212+
} else if (item is Topic) {
213+
context.read<ContentManagementBloc>().add(
214+
DeleteTopicForeverRequested(itemId),
215+
);
216+
} else if (item is Source) {
217+
context.read<ContentManagementBloc>().add(
218+
DeleteSourceForeverRequested(itemId),
219+
);
220+
}
221+
}
222+
},
223+
itemBuilder: (BuildContext context) => overflowMenuItems,
224+
),
219225
),
220226
);
221227

0 commit comments

Comments
 (0)