rluv_client/lib/features/settings/screens/settings_screen.dart
2023-07-27 01:40:26 -06:00

45 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../global/api.dart';
import '../../../global/store.dart';
import '../../../global/widgets/ui_button.dart';
class SettingsScreen extends ConsumerStatefulWidget {
const SettingsScreen({super.key});
@override
ConsumerState<SettingsScreen> createState() => _SettingsScreenState();
}
class _SettingsScreenState extends ConsumerState<SettingsScreen> {
@override
Widget build(BuildContext context) {
final user = ref.read(userProvider);
final family = ref.read(familyProvider);
return Column(
children: [
const Text('Settings'),
const SizedBox(height: 20),
Text(user!.name),
Text("Username: ${user.username ?? 'N/A'}"),
Text("Email: ${user.email ?? 'N/A'}"),
Text("Family Code: ${family?.code ?? 'N/A'}"),
const Spacer(),
UiButton(
onPressed: () {
ref.read(jwtProvider.notifier).revokeToken();
// Navigator.pushAndRemoveUntil(
// context,
// MaterialPageRoute(builder: (ctx) => const AccountCreateScreen()),
// (_) => false,
// );
},
text: 'Sign Out',
),
const SizedBox(height: 20),
],
);
}
}