forked from eatvio/eatvio_app
feat: alert dialog before log out, enlarge logo size on auth screen
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:eatvio_app/features/dev_tools/presentation/dev_tools_screen.dart
|
||||
import 'package:eatvio_app/features/my_diets/presentation/my_diets_screen.dart';
|
||||
import 'package:eatvio_app/features/my_plans/presentation/my_plans_screen.dart';
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -141,15 +142,36 @@ class MenuScreen extends StatelessWidget {
|
||||
|
||||
_onTapLogout(BuildContext context) {
|
||||
return () async {
|
||||
try {
|
||||
await sl<Dio>().post(
|
||||
baseUrl + '/api/profile/logout',
|
||||
);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
await TokenStorage.removeTokenInStorage();
|
||||
GoRouter.of(context).go('/auth-screen', extra: true);
|
||||
}
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text("Выход"),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: () async {
|
||||
try {
|
||||
await sl<Dio>().post(
|
||||
baseUrl + '/api/profile/logout',
|
||||
);
|
||||
} catch (e) {
|
||||
} finally {
|
||||
await TokenStorage.removeTokenInStorage();
|
||||
GoRouter.of(context).go('/auth-screen', extra: true);
|
||||
}
|
||||
},
|
||||
child: Text("Выйти"),
|
||||
isDestructiveAction: true,
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text("Отмена"),
|
||||
),
|
||||
],
|
||||
content: Text("Вы уверены что хотите выйти из аккаунта?"),
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user