update
This commit is contained in:
parent
a76d3a0f35
commit
e3dc94a768
33 changed files with 368 additions and 184 deletions
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:pharmacy_mobile/auth/auth_service.dart';
|
||||
import 'package:pharmacy_mobile/blocs/guest/functions/bloc_getgueststatus.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/customer_pagebackground_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/customer_title_widget.dart';
|
||||
|
|
@ -16,11 +17,25 @@ class CustomerProfilePage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _CustomerProfilePageState extends State<CustomerProfilePage> {
|
||||
final authService = AuthService();
|
||||
final _authService = AuthService();
|
||||
late bool _isGuest = false;
|
||||
|
||||
void _signOut() async {
|
||||
// ignore: use_build_context_synchronously
|
||||
await authService.signOut().then((_) => {context.go('/'), showNotification(context, 'Logged Out', true)});
|
||||
await _authService.signOut().then((_) => {context.go('/'), showNotification(context, 'Logged Out', true)});
|
||||
}
|
||||
|
||||
void checkGuest() async {
|
||||
final guest = await blocGetGuestStatus(context);
|
||||
setState(() {
|
||||
_isGuest = guest;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
checkGuest();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -34,7 +49,7 @@ class _CustomerProfilePageState extends State<CustomerProfilePage> {
|
|||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'My Profile'),
|
||||
_isGuest ? const TextWidget(text: 'Guest Profile') : const TextWidget(text: 'My Profile'),
|
||||
const Gap(16),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue