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