finilizing the alert dialog for logut

This commit is contained in:
ashrafzarkanisala
2024-10-23 02:40:44 +03:00
parent bd7651fa8c
commit 1c9943cfdb
7 changed files with 315 additions and 63 deletions

View File

@ -1,14 +1,12 @@
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:flutter_svg/flutter_svg.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/constants/assets.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
import 'package:syncrow_web/utils/user_drop_down_menu.dart';
class WebAppBar extends StatefulWidget {
final Widget? title;
@ -58,15 +56,15 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
if (widget.rightBody != null) widget.rightBody!,
Row(
children: [
const SizedBox.square(
SizedBox.square(
dimension: 40,
child: CircleAvatar(
backgroundColor: Colors.white,
backgroundColor: ColorsManager.whiteColors,
child: SizedBox.square(
dimension: 35,
child: CircleAvatar(
backgroundColor: Colors.grey,
child: FlutterLogo(),
child: SvgPicture.asset(
Assets.logoGrey,
fit: BoxFit.cover,
),
),
),
@ -112,15 +110,15 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
const SizedBox(
width: 10,
),
const SizedBox.square(
SizedBox.square(
dimension: 40,
child: CircleAvatar(
backgroundColor: Colors.white,
backgroundColor: ColorsManager.whiteColors,
child: SizedBox.square(
dimension: 35,
child: CircleAvatar(
backgroundColor: Colors.grey,
child: FlutterLogo(),
child: SvgPicture.asset(
Assets.logoGrey,
fit: BoxFit.cover,
),
),
),
@ -136,54 +134,55 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
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,
),
)
UserDropdownMenu(user: user),
// 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,
// ),
// )
],
),
],