Skip to content

Commit a60e33b

Browse files
committed
refactor(users): improve email display and role icon logic
- Replace SingleChildScrollView with Row and Flexible for email display - Add TextOverflow.ellipsis for long email addresses - Simplify premium and role icon display logic - Use getPremiumIcon and getRoleIcon methods for better maintainability
1 parent 6153f23 commit a60e33b

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

lib/user_management/view/users_page.dart

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -226,44 +226,20 @@ class _UsersDataSource extends DataTableSource {
226226
// The email cell is wrapped in an Expanded widget to allow truncation.
227227
cells: [
228228
DataCell(
229-
SingleChildScrollView(
230-
scrollDirection: Axis.horizontal,
231-
child: Row(
232-
children: [
233-
Text(user.email),
229+
Row(
230+
children: [
231+
Flexible(
232+
child: Text(user.email, overflow: TextOverflow.ellipsis),
233+
),
234+
if (user.appRole.getPremiumIcon(l10n) case final icon?) ...[
234235
const SizedBox(width: AppSpacing.sm),
235-
if (user.appRole.isPremium)
236-
Tooltip(
237-
message: l10n.premiumUserTooltip,
238-
child: const Icon(
239-
Icons.star,
240-
color: Colors.amber,
241-
size: 16,
242-
),
243-
),
244-
if (user.dashboardRole.isPrivileged) ...[
245-
const SizedBox(width: AppSpacing.xs),
246-
if (user.dashboardRole == DashboardUserRole.admin)
247-
Tooltip(
248-
message: l10n.adminUserTooltip,
249-
child: const Icon(
250-
Icons.admin_panel_settings,
251-
color: Colors.blueAccent,
252-
size: 16,
253-
),
254-
)
255-
else if (user.dashboardRole == DashboardUserRole.publisher)
256-
Tooltip(
257-
message: l10n.publisherUserTooltip,
258-
child: const Icon(
259-
Icons.publish,
260-
color: Colors.green,
261-
size: 16,
262-
),
263-
),
264-
],
236+
icon,
265237
],
266-
),
238+
if (user.dashboardRole.getRoleIcon(l10n) case final icon?) ...[
239+
const SizedBox(width: AppSpacing.xs),
240+
icon,
241+
],
242+
],
267243
),
268244
),
269245
if (!isMobile)

0 commit comments

Comments
 (0)