Skip to content

Commit 0cd4ce3

Browse files
authored
Merge pull request #89 from flutter-news-app-full-source-code/fix/content-management-archive-page-actions-column--overflow
Fix/content management archive page actions column overflow
2 parents 139f0d3 + 6ef9765 commit 0cd4ce3

File tree

9 files changed

+135
-55
lines changed

9 files changed

+135
-55
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<p align="center">
88
<a href="https://flutter-news-app-full-source-code.github.io/flutter-news-app-web-dashboard-full-source-code/"><img src="https://img.shields.io/badge/LIVE_DEMO-VIEW-orange?style=for-the-badge" alt="Live Demo: View"></a>
99
<a href="https://flutter-news-app-full-source-code.github.io/docs/web-dashboard/local-setup/"><img src="https://img.shields.io/badge/DOCUMENTATION-READ-slategray?style=for-the-badge" alt="Documentation: Read"></a>
10-
<img src="https://img.shields.io/badge/coverage-_%25-green?style=for-the-badge" alt="coverage: 0%">
10+
<img src="https://img.shields.io/badge/coverage-_%25-red?style=for-the-badge" alt="">
1111
</p>
1212
<p align="center">
1313
<a href="LICENSE"><img src="https://img.shields.io/badge/TRIAL_LICENSE-VIEW_TERMS-blue?style=for-the-badge" alt="Trial License: View Terms"></a>

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
),

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
),

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
),

lib/l10n/app_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,6 +2593,12 @@ abstract class AppLocalizations {
25932593
/// In en, this message translates to:
25942594
/// **'Enable In-Article Ads for {role}'**
25952595
String enableInArticleAdsForRoleLabel(String role);
2596+
2597+
/// Tooltip for the button that opens a menu with more actions for a table row.
2598+
///
2599+
/// In en, this message translates to:
2600+
/// **'More Actions'**
2601+
String get moreActions;
25962602
}
25972603

25982604
class _AppLocalizationsDelegate

lib/l10n/app_localizations_ar.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,4 +1387,7 @@ class AppLocalizationsAr extends AppLocalizations {
13871387
String enableInArticleAdsForRoleLabel(String role) {
13881388
return 'تمكين الإعلانات داخل المقال لـ $role';
13891389
}
1390+
1391+
@override
1392+
String get moreActions => 'المزيد من الإجراءات';
13901393
}

lib/l10n/app_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,4 +1392,7 @@ class AppLocalizationsEn extends AppLocalizations {
13921392
String enableInArticleAdsForRoleLabel(String role) {
13931393
return 'Enable In-Article Ads for $role';
13941394
}
1395+
1396+
@override
1397+
String get moreActions => 'More Actions';
13951398
}

lib/l10n/arb/app_ar.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,5 +1755,9 @@
17551755
"example": "مستخدم ضيف"
17561756
}
17571757
}
1758+
},
1759+
"moreActions": "المزيد من الإجراءات",
1760+
"@moreActions": {
1761+
"description": "تلميح الزر الذي يفتح قائمة تحتوي على المزيد من الإجراءات لصف في الجدول."
17581762
}
17591763
}

lib/l10n/arb/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,5 +1751,9 @@
17511751
"example": "Guest User"
17521752
}
17531753
}
1754+
},
1755+
"moreActions": "More Actions",
1756+
"@moreActions": {
1757+
"description": "Tooltip for the button that opens a menu with more actions for a table row."
17541758
}
17551759
}

0 commit comments

Comments
 (0)