import 'package:flutter/material.dart'; import 'package:myauthapp/main.dart'; import 'package:myauthapp/screens/login_screen.dart'; class ProfileScreen extends StatelessWidget { const ProfileScreen({super.key}); @override Widget build(BuildContext context) { final user = supabase.auth.currentUser; final profileImageUrl = user?.userMetadata?['avatar_url']; final fullName = user?.userMetadata?['full_name']; return Scaffold( appBar: AppBar( title: const Text('Profile'), actions: [ TextButton( onPressed: () async { await supabase.auth.signOut(); if (context.mounted) { Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (context) => const LoginScreen()), ); } }, child: const Text('Sign out'), ) ], ), body: Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ if (profileImageUrl != null) ClipOval( child: Image.network( profileImageUrl, width: 100, height: 100, fit: BoxFit.cover, ), ), const SizedBox(height: 16), Text( fullName ?? '', style: Theme.of(context).textTheme.headlineMedium, ), const SizedBox(height: 32), ], ), ), ); } }