This commit is contained in:
Abhishek Raju Garad
2024-06-18 11:26:15 +05:30
parent bc1d3b4834
commit 57bd55cb50
7 changed files with 176 additions and 41 deletions

View File

@@ -58,7 +58,7 @@ Widget CommonYesNoBtn({
begin: Alignment.topLeft, begin: Alignment.topLeft,
end: Alignment.bottomRight, end: Alignment.bottomRight,
colors: [ colors: [
Color.fromRGBO(70, 5, 1, 0.8), Color(0xFF2D7AEE).withOpacity(0.14),
Color.fromRGBO(102, 102, 102, 0.8), Color.fromRGBO(102, 102, 102, 0.8),
], ],
), ),
@@ -74,9 +74,10 @@ Widget CommonYesNoBtn({
height: 50.h, height: 50.h,
width: 170.w, width: 170.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: Color(0xFF9A0000), width: 1.w), // border: Border.all(color: Color(0xFF9A0000), width: 1.w),
color: Color(0xFF6C0000)), color: Color(0xFF2D7AEE),
),
child: Center(child: text18W500('No')), child: Center(child: text18W500('No')),
), ),
) )

View File

@@ -86,7 +86,6 @@ class ApiUrls {
//Stock Details //Stock Details
static String stockDetailsApi = "${base}get-details-of-stock"; static String stockDetailsApi = "${base}get-details-of-stock";
//Stock Details
static String subscriptionApi = "${base}my-subscription-page"; static String subscriptionApi = "${base}my-subscription-page";
//setting //setting
@@ -94,4 +93,7 @@ class ApiUrls {
//search //search
static String searchData = "${base}search-stock"; static String searchData = "${base}search-stock";
//logout
static String logout = "${base}Logout";
} }

View File

@@ -84,7 +84,10 @@ class _HomeScreenState extends State<HomeScreen> {
drawerEnableOpenDragGesture: false, drawerEnableOpenDragGesture: false,
key: _scaffoldKey1, key: _scaffoldKey1,
backgroundColor: Colors.black, backgroundColor: Colors.black,
drawer: Container(child: const SideMenu()), drawer: Container(
width: 300,
child: const SideMenu(),
),
extendBody: true, extendBody: true,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 70.h, toolbarHeight: 70.h,

View File

@@ -6,8 +6,10 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart'; import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart'; import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.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/Utils/text.dart';
import 'package:traderscircuit/resources/routes/route_name.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 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart';
import 'webview_subscription.dart'; import 'webview_subscription.dart';
@@ -161,7 +163,7 @@ class _SideMenuState extends State<SideMenu> {
title: text18W400('My Subscription'), title: text18W400('My Subscription'),
trailing: Container( trailing: Container(
height: 35.h, height: 35.h,
width: 122.w, width: 80.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r), borderRadius: BorderRadius.circular(6.r),
color: const Color(0xFF34C759), color: const Color(0xFF34C759),
@@ -221,20 +223,20 @@ class _SideMenuState extends State<SideMenu> {
title: text18W400('Update My KYC'), title: text18W400('Update My KYC'),
trailing: Container( trailing: Container(
height: 40.h, height: 40.h,
width: 122.w, width: 80.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r), borderRadius: BorderRadius.circular(6.r),
color: const Color(0xFF3A3A3A).withOpacity(0.6), color: const Color(0xFF3A3A3A).withOpacity(0.6),
border: Border.all(color: const Color(0xFF9A0000))), border: Border.all(color: const Color(0xFF9A0000))),
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w), padding: EdgeInsets.symmetric(horizontal: 4.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
text12W400('Pending'), text10W300('Pending'),
Container( Container(
height: 30.h, height: 22.h,
width: 30.h, width: 22.w,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: AssetImage(
@@ -272,12 +274,12 @@ class _SideMenuState extends State<SideMenu> {
title: text18W400('My Risk Profile'), title: text18W400('My Risk Profile'),
trailing: Container( trailing: Container(
height: 35.h, height: 35.h,
width: 122.w, width: 80.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r), borderRadius: BorderRadius.circular(6.r),
color: const Color(0xFF0093FF), color: const Color(0xFF0093FF),
), ),
child: Center(child: text14W500('Conservative')), child: Center(child: text10W300('Conservative')),
), ),
selected: true, selected: true,
onTap: () { onTap: () {
@@ -385,10 +387,11 @@ LogOutdialog(context) {
width: 140.w, width: 140.w,
child: CommonYesNoBtn( child: CommonYesNoBtn(
yesonTap: () async { yesonTap: () async {
SharedPreferences prefs = _handleLogout();
await SharedPreferences.getInstance(); // SharedPreferences prefs =
await prefs.clear(); // await SharedPreferences.getInstance();
Get.offNamed(RouteName.loginscreen); // await prefs.clear();
// Get.offNamed(RouteName.loginscreen);
}, },
)), )),
SizedBox( SizedBox(
@@ -477,7 +480,8 @@ void navigateTo(int index, BuildContext context) {
sizedBoxHeight(50.h), sizedBoxHeight(50.h),
CommonYesNoBtn( CommonYesNoBtn(
yesonTap: () { yesonTap: () {
Get.toNamed(RouteName.loginscreen); _handleLogout();
// Get.toNamed(RouteName.loginscreen);
}, },
noonTap: () { noonTap: () {
Get.back(); 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');
}
}

View 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;
}
}

View File

@@ -5,10 +5,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: _flutterfire_internals name: _flutterfire_internals
sha256: "4eec93681221723a686ad580c2e7d960e1017cf1a4e0a263c2573c2c6b0bf5cd" sha256: "37a42d06068e2fe3deddb2da079a8c4d105f241225ba27b7122b37e9865fd8f7"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.25" version: "1.3.35"
another_flushbar: another_flushbar:
dependency: transitive dependency: transitive
description: description:
@@ -337,14 +337,38 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.5+21" version: "0.5.5+21"
firebase_auth:
dependency: "direct main"
description:
name: firebase_auth
sha256: cfc2d970829202eca09e2896f0a5aa7c87302817ecc0bdfa954f026046bf10ba
url: "https://pub.dev"
source: hosted
version: "4.20.0"
firebase_auth_platform_interface:
dependency: transitive
description:
name: firebase_auth_platform_interface
sha256: a0270e1db3b2098a14cb2a2342b3cd2e7e458e0c391b1f64f6f78b14296ec093
url: "https://pub.dev"
source: hosted
version: "7.3.0"
firebase_auth_web:
dependency: transitive
description:
name: firebase_auth_web
sha256: "64e067e763c6378b7e774e872f0f59f6812885e43020e25cde08f42e9459837b"
url: "https://pub.dev"
source: hosted
version: "5.12.0"
firebase_core: firebase_core:
dependency: "direct main" dependency: "direct main"
description: description:
name: firebase_core name: firebase_core
sha256: "53316975310c8af75a96e365f9fccb67d1c544ef0acdbf0d88bbe30eedd1c4f9" sha256: "26de145bb9688a90962faec6f838247377b0b0d32cc0abecd9a4e43525fc856c"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.27.0" version: "2.32.0"
firebase_core_platform_interface: firebase_core_platform_interface:
dependency: transitive dependency: transitive
description: description:
@@ -357,10 +381,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: firebase_core_web name: firebase_core_web
sha256: c8e1d59385eee98de63c92f961d2a7062c5d9a65e7f45bdc7f1b0b205aab2492 sha256: "22fcb352744908224fc7be3caae254836099786acfe5df6e9fe901e9c2575a41"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.11.5" version: "2.17.1"
firebase_crashlytics: firebase_crashlytics:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -568,6 +592,54 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" 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: html:
dependency: transitive dependency: transitive
description: description:
@@ -732,26 +804,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.0.0" version: "10.0.4"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "3.0.3"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "3.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@@ -844,10 +916,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.11.0" version: "1.12.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@@ -1297,10 +1369,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.1" version: "0.7.0"
timeago: timeago:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1474,10 +1546,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "13.0.0" version: "14.2.1"
wakelock: wakelock:
dependency: transitive dependency: transitive
description: description:
@@ -1522,10 +1594,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: web name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.0" version: "0.5.1"
web_socket_channel: web_socket_channel:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1559,5 +1631,5 @@ packages:
source: hosted source: hosted
version: "6.3.0" version: "6.3.0"
sdks: sdks:
dart: ">=3.2.0 <4.0.0" dart: ">=3.4.0 <4.0.0"
flutter: ">=3.16.0" flutter: ">=3.22.0"

View File

@@ -63,6 +63,8 @@ dependencies:
flutter_branch_sdk: ^7.1.0 flutter_branch_sdk: ^7.1.0
socket_io_client: ^2.0.3+1 socket_io_client: ^2.0.3+1
web_socket_channel: web_socket_channel:
google_sign_in: ^6.2.1
firebase_auth: ^4.20.0
dev_dependencies: dev_dependencies: