mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
Bug fixes, and added a logout button
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/pages/common/custom_dialog.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_state.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class WebAppBar extends StatefulWidget {
|
||||
@ -128,6 +133,57 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
|
||||
'${user.firstName} ${user.lastName}',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showCustomDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
title: 'Logout',
|
||||
message: 'Are you sure you want to logout?',
|
||||
actions: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
AuthBloc.logout();
|
||||
context.go(RoutesConst.auth);
|
||||
},
|
||||
child: DefaultButton(
|
||||
child: Text(
|
||||
'Ok',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.copyWith(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
},
|
||||
child: DefaultButton(
|
||||
child: Text(
|
||||
'Cancel',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.copyWith(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.logout,
|
||||
color: ColorsManager.whiteColors,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user