sign in with pocketbase working

This commit is contained in:
davmar
2026-09-09 19:59:38 +02:00
parent ae464ff304
commit c6d1fdb19e
27 changed files with 1267 additions and 312 deletions
+90
View File
@@ -0,0 +1,90 @@
/// Signed-in account details and sign-out.
library;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/auth_provider.dart';
import '../utils/constants.dart';
import '../widgets/responsive_body.dart';
class AccountScreen extends StatelessWidget {
const AccountScreen({super.key});
@override
Widget build(BuildContext context) {
final auth = context.watch<AuthController>();
final theme = Theme.of(context);
final colors = theme.colorScheme;
return Scaffold(
appBar: AppBar(title: const Text('Account')),
body: ResponsiveBody(
child: ListView(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 32),
children: [
Center(
child: CircleAvatar(
radius: 36,
backgroundColor: colors.primaryContainer,
child: Text(
auth.initials,
style: theme.textTheme.headlineSmall?.copyWith(
color: colors.onPrimaryContainer,
),
),
),
),
const SizedBox(height: 16),
Text(
auth.displayName,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall,
),
if (auth.email case final email?)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
email,
textAlign: TextAlign.center,
style: theme.textTheme.bodyMedium?.copyWith(
color: colors.onSurfaceVariant,
),
),
),
const SizedBox(height: 24),
Card(
child: Column(
children: [
ListTile(
leading: const Icon(Icons.cloud_outlined),
title: const Text('PocketBase server'),
subtitle: Text(kPocketBaseUrl),
),
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.phone_android_outlined),
title: const Text('Local data'),
subtitle: const Text(
'Labels, notes, and bank cache remain on this device.',
),
),
],
),
),
const SizedBox(height: 24),
OutlinedButton.icon(
onPressed: () async {
await auth.logout();
if (!context.mounted) return;
Navigator.of(context).pop();
},
icon: const Icon(Icons.logout),
label: const Text('Sign out'),
),
],
),
),
);
}
}