1import 'package:flutter/material.dart'; 2import 'package:go_router/go_router.dart'; 3import 'package:provider/provider.dart'; 4 5import '../../constants/app_colors.dart'; 6import '../../providers/auth_provider.dart'; 7import '../../widgets/primary_button.dart'; 8 9class ProfileScreen extends StatelessWidget { 10 const ProfileScreen({super.key}); 11 12 @override 13 Widget build(BuildContext context) { 14 final authProvider = Provider.of<AuthProvider>(context); 15 final isAuthenticated = authProvider.isAuthenticated; 16 17 return Scaffold( 18 backgroundColor: const Color(0xFF0B0F14), 19 appBar: AppBar( 20 backgroundColor: const Color(0xFF0B0F14), 21 foregroundColor: Colors.white, 22 title: const Text('Profile'), 23 automaticallyImplyLeading: false, 24 ), 25 body: Center( 26 child: Padding( 27 padding: const EdgeInsets.all(24), 28 child: Column( 29 mainAxisAlignment: MainAxisAlignment.center, 30 children: [ 31 const Icon(Icons.person, size: 64, color: AppColors.primary), 32 const SizedBox(height: 24), 33 Text( 34 isAuthenticated ? 'Your Profile' : 'Profile', 35 style: const TextStyle( 36 fontSize: 28, 37 color: Colors.white, 38 fontWeight: FontWeight.bold, 39 ), 40 ), 41 const SizedBox(height: 16), 42 if (isAuthenticated && authProvider.did != null) ...[ 43 Text( 44 'Signed in as:', 45 style: TextStyle( 46 fontSize: 14, 47 color: Colors.white.withValues(alpha: 0.6), 48 ), 49 ), 50 const SizedBox(height: 4), 51 Text( 52 authProvider.did!, 53 style: const TextStyle( 54 fontSize: 16, 55 color: Color(0xFFB6C2D2), 56 fontFamily: 'monospace', 57 ), 58 textAlign: TextAlign.center, 59 ), 60 const SizedBox(height: 48), 61 PrimaryButton( 62 title: 'Sign Out', 63 onPressed: () async { 64 await authProvider.signOut(); 65 if (context.mounted) { 66 context.go('/'); 67 } 68 }, 69 variant: ButtonVariant.outline, 70 ), 71 ] else ...[ 72 const Text( 73 'Sign in to view your profile', 74 style: TextStyle(fontSize: 16, color: Color(0xFFB6C2D2)), 75 textAlign: TextAlign.center, 76 ), 77 const SizedBox(height: 48), 78 PrimaryButton( 79 title: 'Sign in', 80 onPressed: () => context.go('/login'), 81 ), 82 ], 83 ], 84 ), 85 ), 86 ), 87 ); 88 } 89}