logout
This commit is contained in:
@@ -84,7 +84,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
drawerEnableOpenDragGesture: false,
|
||||
key: _scaffoldKey1,
|
||||
backgroundColor: Colors.black,
|
||||
drawer: Container(child: const SideMenu()),
|
||||
drawer: Container(
|
||||
width: 300,
|
||||
child: const SideMenu(),
|
||||
),
|
||||
extendBody: true,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 70.h,
|
||||
|
||||
@@ -6,8 +6,10 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
|
||||
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
|
||||
import 'package:traderscircuit/Utils/Common/sized_box.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/Utils/text.dart';
|
||||
import 'package:traderscircuit/resources/routes/route_name.dart';
|
||||
import 'package:traderscircuit/view_model/LogoutApi/logout_api.dart';
|
||||
import 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart';
|
||||
|
||||
import 'webview_subscription.dart';
|
||||
@@ -161,7 +163,7 @@ class _SideMenuState extends State<SideMenu> {
|
||||
title: text18W400('My Subscription'),
|
||||
trailing: Container(
|
||||
height: 35.h,
|
||||
width: 122.w,
|
||||
width: 80.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
color: const Color(0xFF34C759),
|
||||
@@ -221,20 +223,20 @@ class _SideMenuState extends State<SideMenu> {
|
||||
title: text18W400('Update My KYC'),
|
||||
trailing: Container(
|
||||
height: 40.h,
|
||||
width: 122.w,
|
||||
width: 80.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
color: const Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
border: Border.all(color: const Color(0xFF9A0000))),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
text12W400('Pending'),
|
||||
text10W300('Pending'),
|
||||
Container(
|
||||
height: 30.h,
|
||||
width: 30.h,
|
||||
height: 22.h,
|
||||
width: 22.w,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
@@ -272,12 +274,12 @@ class _SideMenuState extends State<SideMenu> {
|
||||
title: text18W400('My Risk Profile'),
|
||||
trailing: Container(
|
||||
height: 35.h,
|
||||
width: 122.w,
|
||||
width: 80.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
color: const Color(0xFF0093FF),
|
||||
),
|
||||
child: Center(child: text14W500('Conservative')),
|
||||
child: Center(child: text10W300('Conservative')),
|
||||
),
|
||||
selected: true,
|
||||
onTap: () {
|
||||
@@ -385,10 +387,11 @@ LogOutdialog(context) {
|
||||
width: 140.w,
|
||||
child: CommonYesNoBtn(
|
||||
yesonTap: () async {
|
||||
SharedPreferences prefs =
|
||||
await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
Get.offNamed(RouteName.loginscreen);
|
||||
_handleLogout();
|
||||
// SharedPreferences prefs =
|
||||
// await SharedPreferences.getInstance();
|
||||
// await prefs.clear();
|
||||
// Get.offNamed(RouteName.loginscreen);
|
||||
},
|
||||
)),
|
||||
SizedBox(
|
||||
@@ -477,7 +480,8 @@ void navigateTo(int index, BuildContext context) {
|
||||
sizedBoxHeight(50.h),
|
||||
CommonYesNoBtn(
|
||||
yesonTap: () {
|
||||
Get.toNamed(RouteName.loginscreen);
|
||||
_handleLogout();
|
||||
// Get.toNamed(RouteName.loginscreen);
|
||||
},
|
||||
noonTap: () {
|
||||
Get.back();
|
||||
@@ -537,3 +541,26 @@ class sideBarTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleLogout() async {
|
||||
// Create an instance of the API with required data
|
||||
var logoutApi = LogoutAPI({
|
||||
// Add any required data here, e.g., user token or ID
|
||||
});
|
||||
|
||||
// Call the logout API
|
||||
final response = await logoutApi.logoutApi();
|
||||
|
||||
// Handle the response
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
// Clear any user-related data here if necessary
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
|
||||
// Navigate to the login screen
|
||||
Get.offAllNamed(RouteName.loginscreen);
|
||||
} else {
|
||||
// Show an error message if logout failed
|
||||
Get.snackbar('Error', response.message ?? 'Logout failed');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user