@@ -58,7 +58,7 @@ Widget CommonYesNoBtn({
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Color.fromRGBO(70, 5, 1, 0.8),
|
||||
Color(0xFF2D7AEE).withOpacity(0.14),
|
||||
Color.fromRGBO(102, 102, 102, 0.8),
|
||||
],
|
||||
),
|
||||
@@ -74,9 +74,10 @@ Widget CommonYesNoBtn({
|
||||
height: 50.h,
|
||||
width: 170.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
border: Border.all(color: Color(0xFF9A0000), width: 1.w),
|
||||
color: Color(0xFF6C0000)),
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
// border: Border.all(color: Color(0xFF9A0000), width: 1.w),
|
||||
color: Color(0xFF2D7AEE),
|
||||
),
|
||||
child: Center(child: text18W500('No')),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -84,7 +84,6 @@ class ApiUrls {
|
||||
//Stock Details
|
||||
static String stockDetailsApi = "${base}get-details-of-stock";
|
||||
|
||||
//Stock Details
|
||||
static String subscriptionApi = "${base}my-subscription-page";
|
||||
|
||||
//setting
|
||||
@@ -92,4 +91,7 @@ class ApiUrls {
|
||||
|
||||
//search
|
||||
static String searchData = "${base}search-stock";
|
||||
|
||||
//logout
|
||||
static String logout = "${base}Logout";
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
28
lib/view_model/LogoutApi/logout_api.dart
Normal file
28
lib/view_model/LogoutApi/logout_api.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:traderscircuit/Utils/api_urls.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/data/network/network_api_services.dart';
|
||||
|
||||
class LogoutAPI {
|
||||
LogoutAPI(this.data);
|
||||
var data;
|
||||
Future<ResponseData<dynamic>> logoutApi() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices().postApi(
|
||||
data,
|
||||
ApiUrls.logout,
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
Map<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
print("OTP sent successfully");
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
responseData['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
54
pubspec.lock
54
pubspec.lock
@@ -336,7 +336,9 @@ packages:
|
||||
sha256: "019cd7eee74254d33fbd2e29229367ce33063516bf6b3258a341d89e3b0f1655"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
|
||||
version: "0.5.7+7"
|
||||
|
||||
firebase_core:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -357,10 +359,12 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_core_web
|
||||
|
||||
sha256: "6643fe3dbd021e6ccfb751f7882b39df355708afbdeb4130fc50f9305a9d1a3d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.17.2"
|
||||
|
||||
firebase_crashlytics:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -568,6 +572,54 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
google_identity_services_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_identity_services_web
|
||||
sha256: "9482364c9f8b7bd36902572ebc3a7c2b5c8ee57a9c93e6eb5099c1a9ec5265d8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.1+1"
|
||||
google_sign_in:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: google_sign_in
|
||||
sha256: "0b8787cb9c1a68ad398e8010e8c8766bfa33556d2ab97c439fb4137756d7308f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.1"
|
||||
google_sign_in_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_android
|
||||
sha256: "8f2606fffd912ff8c23e8d94da106764c116112ce65fb18c78123331ae628eb3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.24"
|
||||
google_sign_in_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_ios
|
||||
sha256: a058c9880be456f21e2e8571c1126eaacd570bdc5b6c6d9d15aea4bdf22ca9fe
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.7.6"
|
||||
google_sign_in_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_platform_interface
|
||||
sha256: "1f6e5787d7a120cc0359ddf315c92309069171306242e181c09472d1b00a2971"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.5"
|
||||
google_sign_in_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_web
|
||||
sha256: f2b3af0ba52ff59439f18962fca71db860f09507a81da929fc0e719270b35db2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.3+3"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1518,6 +1570,7 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.1"
|
||||
|
||||
web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1526,6 +1579,7 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.5"
|
||||
|
||||
web_socket_channel:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -63,6 +63,8 @@ dependencies:
|
||||
flutter_branch_sdk: ^7.1.0
|
||||
socket_io_client: ^2.0.3+1
|
||||
web_socket_channel:
|
||||
google_sign_in: ^6.2.1
|
||||
firebase_auth: ^4.20.0
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Reference in New Issue
Block a user