Files
winded/lib/features/profile/presentation/widgets/role_chip.dart
T
philip b239ae3e5f Initial commit: Flutter app + PHP/MySQL backend on Hostinger
Replaces Firebase with a self-hosted PHP/MySQL API served from
winded.prymsolutions.com. Includes full backend (schema, auth, events,
teams, brackets, suggestions, stats, media, file upload) and updated
Flutter repositories and domain models.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 20:13:57 -07:00

69 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import '../../domain/user_profile.dart';
/// Small color-coded label that names the user's role. Used in the profile
/// header so the role is glanceable on phone widths.
class RoleChip extends StatelessWidget {
const RoleChip({super.key, required this.role});
final UserRole role;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final scheme = theme.colorScheme;
final (Color background, Color foreground, IconData icon, String label) =
switch (role) {
UserRole.admin => (
scheme.primary.withValues(alpha: 0.18),
scheme.primary,
Icons.verified_user_outlined,
'ADMIN',
),
UserRole.manager => (
Colors.amber.withValues(alpha: 0.18),
Colors.amber.shade300,
Icons.shield_outlined,
'MANAGER',
),
UserRole.player => (
Colors.green.withValues(alpha: 0.18),
Colors.green.shade300,
Icons.sports_soccer,
'PLAYER',
),
UserRole.viewer => (
scheme.surfaceContainerHighest,
scheme.onSurfaceVariant,
Icons.visibility_outlined,
'VIEWER',
),
};
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: background,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(icon, size: 14, color: foreground),
const SizedBox(width: 6),
Text(
label,
style: theme.textTheme.labelMedium?.copyWith(
color: foreground,
fontWeight: FontWeight.w800,
letterSpacing: 1.2,
),
),
],
),
);
}
}