relatica/lib/screens/profile_screen.dart

39 wiersze
1.1 KiB
Dart
Czysty Zwykły widok Historia

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../controls/app_bottom_nav_bar.dart';
import '../controls/padding.dart';
import '../services/auth_service.dart';
class ProfileScreen extends StatelessWidget {
const ProfileScreen({super.key});
@override
Widget build(BuildContext context) {
final authService = context.watch<AuthService>();
return Scaffold(
appBar: AppBar(
title: Text('Profile'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Profile: ${authService.currentClient.fold(onSuccess: (client) => client.credentials.handle, onError: (error) => 'Error Getting Profile')}'),
VerticalPadding(),
ElevatedButton(
onPressed: () async {
await authService.signOut();
},
child: Text('Sign Out')),
],
),
),
bottomNavigationBar: AppBottomNavBar(
currentButton: NavBarButtons.profile,
),
);
}
}