2023-07-22 21:29:32 -06:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
|
2023-07-27 01:40:26 -06:00
|
|
|
import '../../../global/api.dart';
|
|
|
|
import '../../../global/store.dart';
|
|
|
|
import '../../../global/widgets/ui_button.dart';
|
|
|
|
|
2023-07-22 21:29:32 -06:00
|
|
|
class SettingsScreen extends ConsumerStatefulWidget {
|
|
|
|
const SettingsScreen({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
ConsumerState<SettingsScreen> createState() => _SettingsScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-07-27 01:40:26 -06:00
|
|
|
final user = ref.read(userProvider);
|
|
|
|
final family = ref.read(familyProvider);
|
|
|
|
return Column(
|
2023-07-22 21:29:32 -06:00
|
|
|
children: [
|
2023-07-27 01:40:26 -06:00
|
|
|
const Text('Settings'),
|
|
|
|
const SizedBox(height: 20),
|
2023-07-30 19:26:56 -06:00
|
|
|
Text(user?.name ?? 'N/A'),
|
|
|
|
Text("Username: ${user?.username ?? 'N/A'}"),
|
|
|
|
Text("Email: ${user?.email ?? 'N/A'}"),
|
2023-07-27 01:40:26 -06:00
|
|
|
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),
|
2023-07-22 21:29:32 -06:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|