diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b61b240..429bd5e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ - @@ -62,7 +61,7 @@ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index ecb91ba..23972ed 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -3,7 +3,7 @@ NSFaceIDUsageDescription - Why is my app authenticating using face id? + for authentication CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -11,7 +11,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) + com.app.traderscircuit CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/lib/Utils/Common/commonBotton.dart b/lib/Utils/Common/commonBotton.dart index f1d3e18..d456589 100644 --- a/lib/Utils/Common/commonBotton.dart +++ b/lib/Utils/Common/commonBotton.dart @@ -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')), ), ) diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index 7e0f3dc..1b87fc9 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -1,8 +1,6 @@ class ApiUrls { // PIE BASE URL FOR SMALL CASE --> NEED TO BE UPDATED - static const String pieBase = "https://app.piadvisors.in/"; - //Base URL static const base = "https://tradercircuit.betadelivery.com/api/"; @@ -86,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 @@ -94,4 +91,7 @@ class ApiUrls { //search static String searchData = "${base}search-stock"; + + //logout + static String logout = "${base}Logout"; } diff --git a/lib/data/network/network_api_services.dart b/lib/data/network/network_api_services.dart index 6f9fc9d..4de2ee2 100644 --- a/lib/data/network/network_api_services.dart +++ b/lib/data/network/network_api_services.dart @@ -38,6 +38,14 @@ class NetworkApiServices { data: response.data, ResponseStatus.SUCCESS, ); + } else if (response.statusCode == 203) { + print(response.data); + return ResponseData("validation", ResponseStatus.PRIVATE, + data: response.data); + } else if (response.statusCode == 202) { + print(response.data); + return ResponseData("success", ResponseStatus.PRIVATE, + data: response.data); } else { try { return ResponseData( @@ -72,7 +80,7 @@ class NetworkApiServices { SharedPreferences prefs = await SharedPreferences.getInstance(); String? token = prefs.getString('accessToken'); try { - response = await dio.post(url, + response = await dio.post(url, data: data, options: (token == null || token == "") ? Options( @@ -99,9 +107,9 @@ class NetworkApiServices { return ResponseData("success", ResponseStatus.SUCCESS, data: response.data); } else if (response.statusCode == 203) { - print(response.data); + print(response.data['message'].toString()); return ResponseData("validation", ResponseStatus.PRIVATE, - data: response.data); + data: response.data['message'].toString()); } else if (response.statusCode == 202) { print(response.data); return ResponseData("success", ResponseStatus.PRIVATE, diff --git a/lib/main.dart b/lib/main.dart index 59e492c..c91f1f5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,6 +3,7 @@ import 'dart:developer'; import 'dart:ui'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -10,14 +11,13 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_branch_sdk/flutter_branch_sdk.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:onesignal_flutter/onesignal_flutter.dart'; +import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:traderscircuit/Utils/utils.dart'; import 'package:traderscircuit/firebase_options.dart'; -import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart'; import 'package:traderscircuit/resources/routes/route_name.dart'; -import 'package:firebase_core/firebase_core.dart'; import 'package:traderscircuit/resources/routes/routes.dart'; -import 'package:onesignal_flutter/onesignal_flutter.dart'; import 'view_model/LoginPage/Loginbloc.dart'; import 'view_model/SendOtp/sendOtpbloc.dart'; @@ -53,7 +53,7 @@ Future main() async { //smallcase ScgatewayFlutterPlugin.setConfigEnvironment( GatewayEnvironment.PRODUCTION, - 'pi-advisors', + 'traderscircuit', false, [], ); @@ -89,6 +89,7 @@ class _MyAppState extends State with WidgetsBindingObserver { super.initState(); Utils.getStoragePermission(); WidgetsBinding.instance.addObserver(this); + FlutterBranchSdk.init().then((value) => listenDynamicLinks()); connectivity = Connectivity(); checkInternet(); @@ -109,11 +110,10 @@ class _MyAppState extends State with WidgetsBindingObserver { }); } }); - // print(_connectionStatus); } void listenDynamicLinks() async { - streamSubscription = FlutterBranchSdk.initSession().listen((data) { + streamSubscription = FlutterBranchSdk.listSession().listen((data) { print('listenDynamicLinks - DeepLink Data: $data'); controllerData.sink.add((data.toString())); if (data.containsKey('+clicked_branch_link') && diff --git a/lib/model/HomeModel/home_model.dart b/lib/model/HomeModel/home_model.dart index 222baf0..d508d84 100644 --- a/lib/model/HomeModel/home_model.dart +++ b/lib/model/HomeModel/home_model.dart @@ -10,14 +10,14 @@ class HomeModel { status = json['status']; statusCode = json['status_code']; message = json['message']; - data = json['data'] != null ? new Data.fromJson(json['data']) : null; + data = json['data'] != null ? Data.fromJson(json['data']) : null; } Map toJson() { - final Map data = new Map(); - data['status'] = this.status; - data['status_code'] = this.statusCode; - data['message'] = this.message; + final Map data = {}; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; if (this.data != null) { data['data'] = this.data!.toJson(); } @@ -54,30 +54,29 @@ class Data { exploreTheUnseenActiveCalls = []; json['explore_the_unseen_active_calls'].forEach((v) { exploreTheUnseenActiveCalls! - .add(new ExploreTheUnseenActiveCalls.fromJson(v)); + .add(ExploreTheUnseenActiveCalls.fromJson(v)); }); } if (json['explore_the_unseen_exited_calls'] != null) { exploreTheUnseenExitedCalls = []; json['explore_the_unseen_exited_calls'].forEach((v) { exploreTheUnseenExitedCalls! - .add(new ExploreTheUnseenExitedCalls.fromJson(v)); + .add(ExploreTheUnseenExitedCalls.fromJson(v)); }); } indexLiveData = json['index_live_data'] != null - ? new IndexLiveData.fromJson(json['index_live_data']) - : null; - userData = json['user_data'] != null - ? new UserData.fromJson(json['user_data']) + ? IndexLiveData.fromJson(json['index_live_data']) : null; + userData = + json['user_data'] != null ? UserData.fromJson(json['user_data']) : null; if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } contentByteVideo = json['content_byte_video'] != null - ? new ContentByteVideo.fromJson(json['content_byte_video']) + ? ContentByteVideo.fromJson(json['content_byte_video']) : null; isUpstoxTokenRefreshed = json['isUpstoxTokenRefreshed']; upstoxAccessToken = json['upstoxAccessToken']; @@ -86,31 +85,31 @@ class Data { } Map toJson() { - final Map data = new Map(); - if (this.exploreTheUnseenActiveCalls != null) { + final Map data = {}; + if (exploreTheUnseenActiveCalls != null) { data['explore_the_unseen_active_calls'] = - this.exploreTheUnseenActiveCalls!.map((v) => v.toJson()).toList(); + exploreTheUnseenActiveCalls!.map((v) => v.toJson()).toList(); } - if (this.exploreTheUnseenExitedCalls != null) { + if (exploreTheUnseenExitedCalls != null) { data['explore_the_unseen_exited_calls'] = - this.exploreTheUnseenExitedCalls!.map((v) => v.toJson()).toList(); + exploreTheUnseenExitedCalls!.map((v) => v.toJson()).toList(); } - if (this.indexLiveData != null) { - data['index_live_data'] = this.indexLiveData!.toJson(); + if (indexLiveData != null) { + data['index_live_data'] = indexLiveData!.toJson(); } - if (this.userData != null) { - data['user_data'] = this.userData!.toJson(); + if (userData != null) { + data['user_data'] = userData!.toJson(); } - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - if (this.contentByteVideo != null) { - data['content_byte_video'] = this.contentByteVideo!.toJson(); + if (contentByteVideo != null) { + data['content_byte_video'] = contentByteVideo!.toJson(); } - data['isUpstoxTokenRefreshed'] = this.isUpstoxTokenRefreshed; - data['upstoxAccessToken'] = this.upstoxAccessToken; - data['upstox_client_id'] = this.upstoxClientId; - data['upstox_secret_key'] = this.upstoxSecretKey; + data['isUpstoxTokenRefreshed'] = isUpstoxTokenRefreshed; + data['upstoxAccessToken'] = upstoxAccessToken; + data['upstox_client_id'] = upstoxClientId; + data['upstox_secret_key'] = upstoxSecretKey; return data; } } @@ -170,35 +169,35 @@ class ExploreTheUnseenActiveCalls { createdAt = json['created_at']; docs = json['docs']; productTypeData = json['product_type_data'] != null - ? new ProductTypeData.fromJson(json['product_type_data']) + ? ProductTypeData.fromJson(json['product_type_data']) : null; actionData = json['action_data'] != null - ? new ActionData.fromJson(json['action_data']) + ? ActionData.fromJson(json['action_data']) : null; } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['product_type_xid'] = this.productTypeXid; - data['recommendation_actions_xid'] = this.recommendationActionsXid; - data['stock_name'] = this.stockName; - data['instrument_key'] = this.instrumentKey; - data['stock_image'] = this.stockImage; - data['duration'] = this.duration; - data['current_price'] = this.currentPrice; - data['buy_price'] = this.buyPrice; - data['target_price'] = this.targetPrice; - data['stop_loss'] = this.stopLoss; - data['is_send_recommendation_now'] = this.isSendRecommendationNow; - data['schedule_date_time'] = this.scheduleDateTime; - data['created_at'] = this.createdAt; - data['docs'] = this.docs; - if (this.productTypeData != null) { - data['product_type_data'] = this.productTypeData!.toJson(); + final Map data = {}; + data['id'] = id; + data['product_type_xid'] = productTypeXid; + data['recommendation_actions_xid'] = recommendationActionsXid; + data['stock_name'] = stockName; + data['instrument_key'] = instrumentKey; + data['stock_image'] = stockImage; + data['duration'] = duration; + data['current_price'] = currentPrice; + data['buy_price'] = buyPrice; + data['target_price'] = targetPrice; + data['stop_loss'] = stopLoss; + data['is_send_recommendation_now'] = isSendRecommendationNow; + data['schedule_date_time'] = scheduleDateTime; + data['created_at'] = createdAt; + data['docs'] = docs; + if (productTypeData != null) { + data['product_type_data'] = productTypeData!.toJson(); } - if (this.actionData != null) { - data['action_data'] = this.actionData!.toJson(); + if (actionData != null) { + data['action_data'] = actionData!.toJson(); } return data; } @@ -259,35 +258,35 @@ class ExploreTheUnseenExitedCalls { createdAt = json['created_at']; docs = json['docs']; productTypeData = json['product_type_data'] != null - ? new ProductTypeData.fromJson(json['product_type_data']) + ? ProductTypeData.fromJson(json['product_type_data']) : null; actionData = json['action_data'] != null - ? new ActionData.fromJson(json['action_data']) + ? ActionData.fromJson(json['action_data']) : null; } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['product_type_xid'] = this.productTypeXid; - data['recommendation_actions_xid'] = this.recommendationActionsXid; - data['stock_name'] = this.stockName; - data['instrument_key'] = this.instrumentKey; - data['stock_image'] = this.stockImage; - data['duration'] = this.duration; - data['current_price'] = this.currentPrice; - data['buy_price'] = this.buyPrice; - data['target_price'] = this.targetPrice; - data['stop_loss'] = this.stopLoss; - data['is_send_recommendation_now'] = this.isSendRecommendationNow; - data['schedule_date_time'] = this.scheduleDateTime; - data['created_at'] = this.createdAt; - data['docs'] = this.docs; - if (this.productTypeData != null) { - data['product_type_data'] = this.productTypeData!.toJson(); + final Map data = {}; + data['id'] = id; + data['product_type_xid'] = productTypeXid; + data['recommendation_actions_xid'] = recommendationActionsXid; + data['stock_name'] = stockName; + data['instrument_key'] = instrumentKey; + data['stock_image'] = stockImage; + data['duration'] = duration; + data['current_price'] = currentPrice; + data['buy_price'] = buyPrice; + data['target_price'] = targetPrice; + data['stop_loss'] = stopLoss; + data['is_send_recommendation_now'] = isSendRecommendationNow; + data['schedule_date_time'] = scheduleDateTime; + data['created_at'] = createdAt; + data['docs'] = docs; + if (productTypeData != null) { + data['product_type_data'] = productTypeData!.toJson(); } - if (this.actionData != null) { - data['action_data'] = this.actionData!.toJson(); + if (actionData != null) { + data['action_data'] = actionData!.toJson(); } return data; } @@ -309,11 +308,11 @@ class ProductTypeData { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['title'] = this.title; - data['is_active'] = this.isActive; - data['created_at'] = this.createdAt; + final Map data = {}; + data['id'] = id; + data['title'] = title; + data['is_active'] = isActive; + data['created_at'] = createdAt; return data; } } @@ -334,11 +333,11 @@ class ActionData { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['is_active'] = this.isActive; - data['created_at'] = this.createdAt; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['is_active'] = isActive; + data['created_at'] = createdAt; return data; } } @@ -351,12 +350,12 @@ class IndexLiveData { IndexLiveData.fromJson(Map json) { status = json['status']; - data = json['data'] != null ? new Data1.fromJson(json['data']) : null; + data = json['data'] != null ? Data1.fromJson(json['data']) : null; } Map toJson() { - final Map data = new Map(); - data['status'] = this.status; + final Map data = {}; + data['status'] = status; if (this.data != null) { data['data'] = this.data!.toJson(); } @@ -372,20 +371,20 @@ class Data1 { Data1.fromJson(Map json) { nSEINDEXNiftyBank = json['NSE_INDEX:Nifty Bank'] != null - ? new NSEINDEXNiftyBank.fromJson(json['NSE_INDEX:Nifty Bank']) + ? NSEINDEXNiftyBank.fromJson(json['NSE_INDEX:Nifty Bank']) : null; nSEINDEXNifty50 = json['NSE_INDEX:Nifty 50'] != null - ? new NSEINDEXNifty50.fromJson(json['NSE_INDEX:Nifty 50']) + ? NSEINDEXNifty50.fromJson(json['NSE_INDEX:Nifty 50']) : null; } Map toJson() { - final Map data = new Map(); - if (this.nSEINDEXNiftyBank != null) { - data['NSE_INDEX:Nifty Bank'] = this.nSEINDEXNiftyBank!.toJson(); + final Map data = {}; + if (nSEINDEXNiftyBank != null) { + data['NSE_INDEX:Nifty Bank'] = nSEINDEXNiftyBank!.toJson(); } - if (this.nSEINDEXNifty50 != null) { - data['NSE_INDEX:Nifty 50'] = this.nSEINDEXNifty50!.toJson(); + if (nSEINDEXNifty50 != null) { + data['NSE_INDEX:Nifty 50'] = nSEINDEXNifty50!.toJson(); } return data; } @@ -400,8 +399,8 @@ class NSEINDEXNiftyBank { double? lastPrice; String? volume; String? averagePrice; - Null? oi; - dynamic? netChange; + void oi; + dynamic netChange; String? totalBuyQuantity; String? totalSellQuantity; String? lowerCircuitLimit; @@ -429,12 +428,12 @@ class NSEINDEXNiftyBank { this.oiDayLow}); NSEINDEXNiftyBank.fromJson(Map json) { - ohlc = json['ohlc'] != null ? new Ohlc.fromJson(json['ohlc']) : null; + ohlc = json['ohlc'] != null ? Ohlc.fromJson(json['ohlc']) : null; timestamp = json['timestamp']; instrumentToken = json['instrument_token']; symbol = json['symbol']; - lastPrice = json['last_price']; + lastPrice = _parseJsonToDouble(json['last_price']); volume = json['volume']; averagePrice = json['average_price']; oi = json['oi']; @@ -449,26 +448,25 @@ class NSEINDEXNiftyBank { } Map toJson() { - final Map data = new Map(); - if (this.ohlc != null) { - data['ohlc'] = this.ohlc!.toJson(); + final Map data = {}; + if (ohlc != null) { + data['ohlc'] = ohlc!.toJson(); } - data['timestamp'] = this.timestamp; - data['instrument_token'] = this.instrumentToken; - data['symbol'] = this.symbol; - data['last_price'] = this.lastPrice; - data['volume'] = this.volume; - data['average_price'] = this.averagePrice; - data['oi'] = this.oi; - data['net_change'] = this.netChange; - data['total_buy_quantity'] = this.totalBuyQuantity; - data['total_sell_quantity'] = this.totalSellQuantity; - data['lower_circuit_limit'] = this.lowerCircuitLimit; - data['upper_circuit_limit'] = this.upperCircuitLimit; - data['last_trade_time'] = this.lastTradeTime; - data['oi_day_high'] = this.oiDayHigh; - data['oi_day_low'] = this.oiDayLow; + data['timestamp'] = timestamp; + data['instrument_token'] = instrumentToken; + data['symbol'] = symbol; + data['last_price'] = lastPrice; + data['volume'] = volume; + data['average_price'] = averagePrice; + data['net_change'] = netChange; + data['total_buy_quantity'] = totalBuyQuantity; + data['total_sell_quantity'] = totalSellQuantity; + data['lower_circuit_limit'] = lowerCircuitLimit; + data['upper_circuit_limit'] = upperCircuitLimit; + data['last_trade_time'] = lastTradeTime; + data['oi_day_high'] = oiDayHigh; + data['oi_day_low'] = oiDayLow; return data; } } @@ -482,18 +480,18 @@ class Ohlc { Ohlc({this.open, this.high, this.low, this.close}); Ohlc.fromJson(Map json) { - open = json['open']; - high = json['high']; - low = json['low']; - close = json['close']; + open = _parseJsonToDouble(json['open']); + high = _parseJsonToDouble(json['high']); + low = _parseJsonToDouble(json['low']); + close = _parseJsonToDouble(json['close']); } Map toJson() { - final Map data = new Map(); - data['open'] = this.open; - data['high'] = this.high; - data['low'] = this.low; - data['close'] = this.close; + final Map data = {}; + data['open'] = open; + data['high'] = high; + data['low'] = low; + data['close'] = close; return data; } } @@ -505,9 +503,8 @@ class NSEINDEXNifty50 { String? instrumentToken; String? symbol; double? lastPrice; - Null? volume; - Null? averagePrice; - Null? oi; + double? volume; + double? averagePrice; double? netChange; String? totalBuyQuantity; String? totalSellQuantity; @@ -525,7 +522,6 @@ class NSEINDEXNifty50 { this.lastPrice, this.volume, this.averagePrice, - this.oi, this.netChange, this.totalBuyQuantity, this.totalSellQuantity, @@ -536,15 +532,14 @@ class NSEINDEXNifty50 { this.oiDayLow}); NSEINDEXNifty50.fromJson(Map json) { - ohlc = json['ohlc'] != null ? new Ohlc.fromJson(json['ohlc']) : null; + ohlc = json['ohlc'] != null ? Ohlc.fromJson(json['ohlc']) : null; timestamp = json['timestamp']; instrumentToken = json['instrument_token']; symbol = json['symbol']; - lastPrice = json['last_price']; + lastPrice = json['last_price'].toDouble(); volume = json['volume']; averagePrice = json['average_price']; - oi = json['oi']; netChange = json['net_change']; totalBuyQuantity = json['total_buy_quantity']; totalSellQuantity = json['total_sell_quantity']; @@ -556,26 +551,26 @@ class NSEINDEXNifty50 { } Map toJson() { - final Map data = new Map(); - if (this.ohlc != null) { - data['ohlc'] = this.ohlc!.toJson(); + final Map data = {}; + if (ohlc != null) { + data['ohlc'] = ohlc!.toJson(); } - data['timestamp'] = this.timestamp; - data['instrument_token'] = this.instrumentToken; - data['symbol'] = this.symbol; - data['last_price'] = this.lastPrice; - data['volume'] = this.volume; - data['average_price'] = this.averagePrice; - data['oi'] = this.oi; - data['net_change'] = this.netChange; - data['total_buy_quantity'] = this.totalBuyQuantity; - data['total_sell_quantity'] = this.totalSellQuantity; - data['lower_circuit_limit'] = this.lowerCircuitLimit; - data['upper_circuit_limit'] = this.upperCircuitLimit; - data['last_trade_time'] = this.lastTradeTime; - data['oi_day_high'] = this.oiDayHigh; - data['oi_day_low'] = this.oiDayLow; + data['timestamp'] = timestamp; + data['instrument_token'] = instrumentToken; + data['symbol'] = symbol; + data['last_price'] = lastPrice; + data['volume'] = volume; + data['average_price'] = averagePrice; + + data['net_change'] = netChange; + data['total_buy_quantity'] = totalBuyQuantity; + data['total_sell_quantity'] = totalSellQuantity; + data['lower_circuit_limit'] = lowerCircuitLimit; + data['upper_circuit_limit'] = upperCircuitLimit; + data['last_trade_time'] = lastTradeTime; + data['oi_day_high'] = oiDayHigh; + data['oi_day_low'] = oiDayLow; return data; } } @@ -609,14 +604,14 @@ class UserData { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['first_name'] = this.firstName; - data['last_name'] = this.lastName; - data['user_name'] = this.userName; - data['profile_photo'] = this.profilePhoto; - data['is_active'] = this.isActive; - data['created_at'] = this.createdAt; + final Map data = {}; + data['id'] = id; + data['first_name'] = firstName; + data['last_name'] = lastName; + data['user_name'] = userName; + data['profile_photo'] = profilePhoto; + data['is_active'] = isActive; + data['created_at'] = createdAt; return data; } } @@ -635,10 +630,10 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['title'] = this.title; - data['created_at'] = this.createdAt; + final Map data = {}; + data['id'] = id; + data['title'] = title; + data['created_at'] = createdAt; return data; } } @@ -684,18 +679,28 @@ class ContentByteVideo { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['content_type'] = this.contentType; - data['title'] = this.title; - data['description'] = this.description; - data['tags'] = this.tags; - data['file'] = this.file; - data['category_id'] = this.categoryId; - data['image'] = this.image; - data['is_active'] = this.isActive; - data['created_at'] = this.createdAt; - data['link'] = this.link; + final Map data = {}; + data['id'] = id; + data['content_type'] = contentType; + data['title'] = title; + data['description'] = description; + data['tags'] = tags; + data['file'] = file; + data['category_id'] = categoryId; + data['image'] = image; + data['is_active'] = isActive; + data['created_at'] = createdAt; + data['link'] = link; return data; } } + +double? _parseJsonToDouble(dynamic value) { + if (value is int) { + return value.toDouble(); + } else if (value is double) { + return value; + } else { + return null; // Or handle it in another appropriate way + } +} diff --git a/lib/model/SmallCaseModel/broker_account_model.dart b/lib/model/SmallCaseModel/broker_account_model.dart index 16b1a4e..7f2810f 100644 --- a/lib/model/SmallCaseModel/broker_account_model.dart +++ b/lib/model/SmallCaseModel/broker_account_model.dart @@ -1,34 +1,76 @@ class BrokerAccountModel { - final String? id; - final String? userId; - final String? brokerName; - final String? authToken; - final String? txnId; + String? status; + int? statusCode; + String? message; + List? data; - const BrokerAccountModel({ - required this.id, - required this.userId, - required this.brokerName, - required this.authToken, - required this.txnId, - }); + BrokerAccountModel({this.status, this.statusCode, this.message, this.data}); - factory BrokerAccountModel.fromJson(Map json) { - return BrokerAccountModel( - id: json['id'].toString(), - userId: json['user_id'].toString(), - brokerName: json['broker_name'] as String?, - authToken: json['auth_token'] as String?, - txnId: json['transaction_id'] as String?, - ); + BrokerAccountModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(Data.fromJson(v)); + }); + } } Map toJson() { final Map data = {}; - data['user_id'] = userId; - data['broker_name'] = brokerName; - data['auth_token'] = authToken; - data['transaction_id'] = txnId; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; + if (this.data != null) { + data['data'] = this.data!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + int? iamPrincipalXid; + String? brokerName; + String? authToken; + String? transactionId; + int? isActive; + String? createdAt; + String? updatedAt; + + Data( + {this.id, + this.iamPrincipalXid, + this.brokerName, + this.authToken, + this.transactionId, + this.isActive, + this.createdAt, + this.updatedAt}); + + Data.fromJson(Map json) { + id = json['id']; + iamPrincipalXid = json['iam_principal_xid']; + brokerName = json['broker_name']; + authToken = json['auth_token']; + transactionId = json['transaction_id']; + isActive = json['is_active']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['iam_principal_xid'] = iamPrincipalXid; + data['broker_name'] = brokerName; + data['auth_token'] = authToken; + data['transaction_id'] = transactionId; + data['is_active'] = isActive; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; return data; } } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index 7fc6ce7..3af7fc1 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -1,32 +1,28 @@ import 'package:get/get.dart'; import 'package:traderscircuit/Utils/Common/noInternet.dart'; -import 'package:traderscircuit/model/StockDetailsModel/stock_details_model.dart'; import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:traderscircuit/view/MainScreen/ExploreUnseen.dart'; +import 'package:traderscircuit/view/MainScreen/HomeScreen.dart'; +import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; +import 'package:traderscircuit/view/MainScreen/Notification.dart'; +import 'package:traderscircuit/view/MainScreen/ShortTrade.dart'; import 'package:traderscircuit/view/MainScreen/stockDetails/Search.dart'; import 'package:traderscircuit/view/MainScreen/stockDetails/option_chain_screen.dart'; import 'package:traderscircuit/view/MainScreen/stockDetails/stock_details_screen.dart'; import 'package:traderscircuit/view/Sidemenu/AboutUs.dart'; -import 'package:traderscircuit/view/Sidemenu/ContentByte/ContentBytes.dart'; import 'package:traderscircuit/view/Sidemenu/ContentByte/AudioMore.dart'; +import 'package:traderscircuit/view/Sidemenu/ContentByte/ContentBytes.dart'; import 'package:traderscircuit/view/Sidemenu/ContentByte/ReadMore.dart'; import 'package:traderscircuit/view/Sidemenu/ContentByte/VideosMore.dart'; import 'package:traderscircuit/view/Sidemenu/FaqScreen.dart'; import 'package:traderscircuit/view/Sidemenu/PrivacyPolicy.dart'; import 'package:traderscircuit/view/Sidemenu/Settings.dart'; +import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart'; import 'package:traderscircuit/view/Sidemenu/TermsAndCondition.dart'; import 'package:traderscircuit/view/Sidemenu/contactUs/contact_us_main.dart'; import 'package:traderscircuit/view/Sidemenu/myProfile/my_profile_screen.dart'; - import 'package:traderscircuit/view/login/AddDetails.dart'; import 'package:traderscircuit/view/login/Kyc.dart'; - -import 'package:traderscircuit/view/MainScreen/HomeScreen.dart'; -import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; -import 'package:traderscircuit/view/MainScreen/Notification.dart'; -import 'package:traderscircuit/view/MainScreen/ShortTrade.dart'; -import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart'; - import 'package:traderscircuit/view/login/LoginScreen.dart'; import 'package:traderscircuit/view/login/UpdateRiskProfile.dart'; import 'package:traderscircuit/view/login/VerifyOtp.dart'; @@ -207,7 +203,7 @@ class AppRoutes { ), //search - GetPage( + GetPage( name: RouteName.search, page: () => const Search(), ), diff --git a/lib/view/MainScreen/HomeScreen.dart b/lib/view/MainScreen/HomeScreen.dart index 7bb4de5..9a86a88 100644 --- a/lib/view/MainScreen/HomeScreen.dart +++ b/lib/view/MainScreen/HomeScreen.dart @@ -1,10 +1,6 @@ // import 'package:flutter/material.dart'; -import 'dart:developer'; - -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:gap/gap.dart'; @@ -15,11 +11,8 @@ import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart'; import 'package:traderscircuit/Utils/Common/sized_box.dart'; import 'package:traderscircuit/Utils/text.dart'; import 'package:traderscircuit/controller/contact_us_controller.dart'; - -import 'package:traderscircuit/model/HomeModel/home_model.dart'; - import 'package:traderscircuit/controller/products_controller.dart'; - +import 'package:traderscircuit/model/HomeModel/home_model.dart'; import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:traderscircuit/view/MainScreen/ExploreUnseen.dart'; import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; @@ -39,7 +32,7 @@ class HomeScreen extends StatefulWidget { } class _HomeScreenState extends State { - GlobalKey _scaffoldKey1 = GlobalKey(); + final GlobalKey _scaffoldKey1 = GlobalKey(); RxString userName = "User".obs; HomeModel homeModel = HomeModel(); @@ -69,9 +62,13 @@ class _HomeScreenState extends State { } String calculatePercentageChange(double openPrice, double currentPrice) { - final percentageChange = ((currentPrice - openPrice) / openPrice) * 100; - - log(percentageChange.toStringAsFixed(2)); + double closePrice = 0; + if (currentPrice.toString().contains("-")) { + closePrice = openPrice - currentPrice; + } else { + closePrice = openPrice + currentPrice; + } + final percentageChange = ((closePrice - openPrice) / openPrice) * 100; return percentageChange.toStringAsFixed(2); } @@ -87,7 +84,10 @@ class _HomeScreenState extends State { 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, @@ -112,7 +112,7 @@ class _HomeScreenState extends State { SizedBox( width: 10.w, ), - Icon( + const Icon( Icons.search, color: Colors.white, ), @@ -175,7 +175,7 @@ class _HomeScreenState extends State { fontFamily: 'hiragino', fontWeight: FontWeight.w500), ), - SizedBox( + const SizedBox( height: 10, ), !homeModel.data!.isUpstoxTokenRefreshed! @@ -186,6 +186,8 @@ class _HomeScreenState extends State { : SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, children: [ commoncontainer( width: 250.w, @@ -207,10 +209,10 @@ class _HomeScreenState extends State { homeModel.data!.indexLiveData!.data! .nSEINDEXNifty50!.ohlc!.open!, homeModel.data!.indexLiveData!.data! - .nSEINDEXNifty50!.lastPrice!, + .nSEINDEXNifty50!.netChange!, ), ), - sizedBoxWidth(8.w), + sizedBoxWidth(10.w), commoncontainer( width: 250.w, text: homeModel @@ -239,7 +241,7 @@ class _HomeScreenState extends State { homeModel.data!.indexLiveData!.data! .nSEINDEXNiftyBank!.ohlc!.open!, homeModel.data!.indexLiveData!.data! - .nSEINDEXNiftyBank!.lastPrice!, + .nSEINDEXNiftyBank!.netChange!, ), ), ], @@ -283,7 +285,7 @@ class _HomeScreenState extends State { 'assets/images/svg/Vector (2).svg'), sizedBoxWidth(10.w), ProfileObj!.data!.isSubscriptionTaken == true - ? SizedBox() + ? const SizedBox() : InkWell( child: text18W500('UNLOCK NOW!'), onTap: () async { @@ -417,7 +419,7 @@ class _HomeScreenState extends State { child: text16W400_DADADA( 'The Beauty and Power of Video')), // sizedBoxWidth(10.w), - const Spacer(), + const SizedBox(width: 4), InkWell( onTap: () { Get.toNamed(RouteName.contentbytes); @@ -718,7 +720,6 @@ Widget cardcallWidget( ), GestureDetector( onTap: () { - log("RUNNING"); Get.to(const ExploreUnseen()); }, child: Container( @@ -807,7 +808,7 @@ Widget commoncontainer({ ), ), child: Padding( - padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 5.w), + padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 4.w), child: Column( children: [ Row( @@ -817,7 +818,7 @@ Widget commoncontainer({ sizedBoxWidth(5.w), text16W600(amount), sizedBoxWidth(5.w), - rate.contains("-") + rate.contains("-") || percentageChange.contains("-") ? SvgPicture.asset( 'assets/images/svg/Line 587.svg', height: 15.h, @@ -832,12 +833,12 @@ Widget commoncontainer({ ), ], ), - sizedBoxHeight(8.w), + sizedBoxHeight(6.w), text14W400( rate.contains("-") ? "$rate ($percentageChange%)" : "+$rate ($percentageChange%)", - clr: rate.contains("-") + clr: rate.contains("-") || percentageChange.contains("-") ? const Color(0xFFFF0000) : rate == "0.0" ? Colors.grey diff --git a/lib/view/MainScreen/Portfolio/Holdings.dart b/lib/view/MainScreen/Portfolio/Holdings.dart deleted file mode 100644 index c30aff5..0000000 --- a/lib/view/MainScreen/Portfolio/Holdings.dart +++ /dev/null @@ -1,711 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:get/get.dart'; -import 'package:glassmorphism/glassmorphism.dart'; -import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.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/text.dart'; -import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; -import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart'; -import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; - -class Holdings extends StatefulWidget { - const Holdings({super.key}); - - @override - State createState() => _HoldingsState(); -} - -class _HoldingsState extends State { - GlobalKey _scaffoldKey1 = GlobalKey(); - List containerTexts = [ - "Portfolio 1", - "Portfolio 1", - "Portfolio 1", - "Portfolio 1", - "Portfolio 1" - ]; - final selectedIndex = 0.obs; - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - _onBackButtonPressed(context); - return true; // Return true to allow the pop action - }, - child: Scaffold( - key: _scaffoldKey1, - backgroundColor: Colors.black, - drawerEnableOpenDragGesture: false, - drawer: Container(child: SideMenu()), - extendBody: true, - appBar: AppBar( - scrolledUnderElevation: 0.0, - backgroundColor: Colors.black, - elevation: 0, - automaticallyImplyLeading: false, - titleSpacing: 0, - leading: InkWell( - onTap: () { - _scaffoldKey1.currentState?.openDrawer(); - }, - child: Center( - child: Image.asset( - 'assets/images/png/menu.png', - height: 15.h, - width: 20.w, - ), - ), - ), - ), - body: Stack( - children: [ - CommonBlurLeft(), - CommonBlurRight(), - Stack( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: ListView( - physics: NeverScrollableScrollPhysics(), - children: [ - text25W600("My Portfolio"), - SizedBox( - height: 10, - ), - DefaultTabController( - length: 5, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - PortfolioTabBar(), - SizedBox( - height: 30.h, - ), - SizedBox( - height: 570.h, - child: TabBarView( - children: [ - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - ], - ), - ), - ], - ), - ), - sizedBoxHeight(40.h), - ], - ), - ), - ], - ), - ], - ), - bottomNavigationBar: bottomnavigationbar(mainController), - ), - ); - } - - Future _onBackButtonPressed(BuildContext context) async { - bool? exitApp = await showDialog( - context: context, - builder: (context) { - return AlertDialog( - backgroundColor: const Color(0xFFFFF3E4), - title: const Text('Exit App'), - content: const Text('Do you really want to close the app?'), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(false); - }, - child: const Text( - 'No', - style: TextStyle( - color: Color(0xff1B243D), - ), - ), - ), - TextButton( - onPressed: () { - SystemNavigator.pop(); - Navigator.pop(context); - }, - child: const Text( - 'Yes', - style: TextStyle( - color: Color(0xff1B243D), - ), - ), - ) - ], - ); - }); - return exitApp ?? false; - } - - Widget Holdings() { - return Obx(() { - WidgetsBinding.instance.addPostFrameCallback((_) { - if (selectedIndex == 1) _unlockbottomsheet(); - }); - return selectedIndex == 0 - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(20.h), - HoldingCard( - text: 'TATA MOTORS', - content: 'Text', - ), - sizedBoxHeight(25.h), - Table( - children: [ - TableRow( - children: [ - TableCell( - child: Text( - "Stock Name", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - TableCell( - child: Text( - "AVG Price", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - TableCell( - child: Text( - "Quantity", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - TableCell( - child: Text( - "Exchange", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - ], - ), - ], - ), - Divider( - color: Color(0xFF3A3A3A), - ), - Expanded( - child: ListView.separated( - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemCount: 16, - itemBuilder: ((context, index) { - return Table( - children: [ - TableRow( - children: [ - TableCell( - child: Text( - "TATA MOTORS", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - TableCell( - child: Text( - "416.66", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - TableCell( - child: Text( - "3", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - TableCell( - child: Text( - "BSE", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - ), - ), - ], - ), - ], - ); - }), - separatorBuilder: (BuildContext context, int index) { - return Divider(); - }, - ), - ), - SizedBox( - height: 30.h, - ) - ], - ) - : selectedIndex == 1 - ? Column( - children: [], - ) - : Column( - children: [], - ); - }); - } - - void _unlockbottomsheet() { - Get.bottomSheet( - SizedBox( - height: 200, - child: commonGlassContainer( - width: double.infinity, - height: 200, - borderradius: 2, - customWidget: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Image.asset( - // 'assets/images/png/Group 1000003722.png', - // height: 100.h, - // ), - // sizedBoxHeight(25.h), - text20W400('Please subscribed to unlock'), - sizedBoxHeight(30.h), - CommonBtn(text: 'Subscribe Now'), - ], - ), - ), - ), - backgroundColor: Colors.black.withOpacity(0.3), - ); - } - - Widget PortfolioReview() { - List> cardSwing = [ - { - 'text': 'Performance Overview:', - 'content': - 'Your portfolio has generated a total return of 15% over the past six months, outperforming the S&P 500 index by 5%.', - }, - { - 'text': 'Asset Allocation:', - 'content': - 'Your portfolio is well-diversified, with 60% allocated to equities, 30% to bonds, and 10% to cash equivalents.', - }, - { - 'text': 'Individual Holdings Analysis:', - 'content': - 'Your investment in Company XYZ has performed exceptionally well, with a 25% increase in share price since purchase, driven by strong quarterly earnings.', - }, - ]; - - return SingleChildScrollView( - child: Column( - children: [ - sizedBoxHeight(20.h), - Obx(() { - return selectedIndex == 0 - ? Column( - children: List.generate(cardSwing.length, (index) { - return Column( - children: [ - PortfolioCard( - text: cardSwing[index]['text']!, - content: cardSwing[index]['content']!, - ), - sizedBoxHeight(20.h) - ], - ); - }), - ) - : selectedIndex == 1 - ? Column( - children: List.generate(cardSwing.length, (index) { - return Column( - children: [ - PortfolioCard( - text: cardSwing[index]['text']!, - content: cardSwing[index]['content']!, - ), - sizedBoxHeight(20.h) - ], - ); - }), - ) - : Column( - children: List.generate(cardSwing.length, (index) { - return Column( - children: [ - PortfolioCard( - text: cardSwing[index]['text']!, - content: cardSwing[index]['content']!, - ), - sizedBoxHeight(20.h) - ], - ); - }), - ); - }), - sizedBoxHeight(200.h) - ], - ), - ); - } - - Widget PortfolioCard({ - required String text, - required String content, - }) { - return commonGlassContainer( - width: double.infinity, - height: 166.h, - borderradius: 8, - customWidget: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), - child: Row( - children: [ - Container( - decoration: BoxDecoration( - color: Color(0xFF6C0000), - borderRadius: BorderRadius.circular(2), - ), - height: 25.h, - width: 4.w, - ), - sizedBoxWidth(15.w), - text18W600(text), - Spacer(), - ], - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 18), - child: text16W400(content), - ) - ], - ), - ); - } - - Widget HoldingCard({ - required String text, - required String content, - }) { - return commonGlassContainer( - width: double.infinity, - height: 166.h, - borderradius: 8, - customWidget: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), - child: Row( - children: [ - GlassmorphicContainer( - width: 47.w, - height: 47.h, - borderRadius: 100, - blur: 10, - alignment: Alignment.center, - border: 0.9, - linearGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - Color(0xff3A3A3A), - Color(0xFF3A3A3A), - ], - ), - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - Color.fromRGBO(70, 5, 1, 0.8), - Color.fromRGBO(102, 102, 102, 0.8), - ], - ), - child: Center( - child: Image.asset( - 'assets/images/png/TATAMOTORS.NS_BIG 1.png', - width: 26.w, - height: 23.h, - ), - ), - ), - sizedBoxWidth(15.w), - text18W600(text), - Spacer(), - ], - ), - ), - Container( - width: double.infinity, - height: 1.h, - color: Color(0xFF3A3A3A), - ), - Padding( - padding: const EdgeInsets.all(18), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text14W400_979797('Portfolio Value'), - sizedBoxHeight(5.h), - SizedBox(width: 150.w, child: text15W600("₹ 40,000")) - ], - ), - sizedBoxWidth(30.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text14W400_979797('%P/L'), - sizedBoxHeight(5.h), - text14W400_00FF19("-36.006%") - ], - ) - ], - ), - ], - ), - ) - ], - ), - ); - } - - Widget topContainer(String text, int index) { - return Obx(() { - return selectedIndex.value == index - ? Container( - height: 40.h, - width: 126.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color(0Xff6C0000), - ), - child: Center(child: text16W500(text)), - ) - : commonGlassContainer( - width: 126.w, - height: 40.h, - borderradius: 5, - customWidget: Center(child: text16W400(text)), - ); - }); - } -} - -class HoldingsTabBar extends StatelessWidget { - // Set the desired height - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - border: Border.all(color: Color(0Xff3A3A3A)), - borderRadius: BorderRadius.circular(8.r), - ), - padding: const EdgeInsets.all(8.0), // Set the desired padding - child: TabBar( - indicator: BoxDecoration( - color: const Color(0xff6C0000), - borderRadius: BorderRadius.circular(5), - ), - dividerColor: Colors.transparent, - labelStyle: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: const Color(0xFFFFFFFF), - labelColor: Colors.white, - unselectedLabelColor: const Color(0xffFFFFFF), - overlayColor: MaterialStateProperty.all(const Color(0xFFFFFFFF)), - tabs: const [ - Tab( - text: 'Holdings', - ), - Tab( - text: 'Portfolio Reviews', - ), - ]), - ); - } -} - -class PortfolioTabBar extends StatelessWidget { - // Set the desired height - - @override - Widget build(BuildContext context) { - return TabBar( - tabAlignment: TabAlignment.start, - isScrollable: true, - dividerColor: Colors.transparent, - labelStyle: TextStyle( - fontSize: 18.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'hiragino'), - indicatorSize: TabBarIndicatorSize.tab, - indicatorWeight: 2, - indicatorColor: const Color(0xff6C0000), - labelColor: Colors.white, - unselectedLabelColor: const Color(0xFF464646), - overlayColor: MaterialStateProperty.all(const Color(0xFFFFFFFF)), - tabs: const [ - Tab( - text: 'Portfolio 1', - ), - Tab( - text: 'Portfolio 2', - ), - Tab( - text: 'Portfolio 3', - ), - Tab( - text: 'Portfolio 4', - ), - Tab( - text: 'Portfolio 5', - ), - ]); - } -} diff --git a/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart b/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart index 13a22bd..7682da3 100644 --- a/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart +++ b/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart @@ -1,21 +1,24 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:developer'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:glassmorphism/glassmorphism.dart'; import 'package:lottie/lottie.dart'; import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart'; import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.dart'; import 'package:traderscircuit/Utils/Common/commonBotton.dart'; +import 'package:traderscircuit/Utils/Common/sized_box.dart'; import 'package:traderscircuit/Utils/text.dart'; import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; -import 'package:traderscircuit/view/MainScreen/Portfolio/Holdings.dart'; import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart'; import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; +import '../../../Utils/Common/comonGlassmorphicContainer.dart'; import '../../../model/SmallCaseModel/broker_account_model.dart'; import '../../../view_model/SmallCaseApi/smallcase_api_methods.dart'; @@ -27,233 +30,327 @@ class Portfolio extends StatefulWidget { } class _PortfolioState extends State { - GlobalKey _scaffoldKey1 = GlobalKey(); + final GlobalKey _scaffoldKey1 = GlobalKey(); List containerTexts = ["Swing Trade", "Multibagger", "Options"]; final selectedIndex = 0.obs; + RxBool noBrokerAvailable = true.obs; FutureGroup fetchUserIdAndBrokerAccounts = FutureGroup(); - List myBrokerAccounts = []; + List myBrokerAccounts = []; + @override void initState() { - // fetchUserIdAndBrokerAccounts.add(getUserId()); // TODO Need to add userid here fetchUserIdAndBrokerAccounts.add(fetchBrokerAccounts()); fetchUserIdAndBrokerAccounts.close(); - // fetchUserIdAndBrokerAccounts.future.then((value) { - // int userId = value[0]; - // List brokerAccounts = value[1]; - // try { - // myBrokerAccounts.addAll(brokerAccounts - // .where((element) => element.userId == userId.toString())); - // } catch (e) {} - // debugPrint("myBrokerAccounts.length ${myBrokerAccounts.length}"); - // debugPrint("BrokerAccounts.length ${brokerAccounts.length}"); - // if (myBrokerAccounts.isEmpty) { - // setState(() { - // body = Center( - // child: Column( - // mainAxisSize: MainAxisSize.min, - // children: [ - // const Text("You need to add broker account"), - // const Text("to fetch holdings"), - // const SizedBox(height: 6), - // OutlinedButton( - // onPressed: () { - // //Get.off(Broker()); - // Get.to(() => Broker()); - // }, - // child: const Text("Brokerage Account"), - // ) - // ], - // )); - // }); - // } else { - // setBodyToBrokers(); - // } - // }); + fetchUserIdAndBrokerAccounts.future.then((value) { + log(value.toString()); + + try { + myBrokerAccounts = value[0] as List; + } catch (e) {} + debugPrint("myBrokerAccounts.length ${myBrokerAccounts.length}"); + + if (myBrokerAccounts.isEmpty) { + noBrokerAvailable.value = true; + } else { + noBrokerAvailable.value = false; + } + }); super.initState(); } - // void setBodyToBrokers() { - // setState(() { - // body = Padding( - // padding: const EdgeInsets.only(top: 28, left: 28, right: 28), - // child: Column(mainAxisSize: MainAxisSize.min, children: [ - // const Text("Please select your broker account"), - // const SizedBox(height: 8), - // Expanded( - // child: ListView.builder( - // itemCount: myBrokerAccounts.length, - // itemBuilder: (context, index) { - // return OutlinedButton( - // onPressed: () { - // setState(() { - // body = const Center(child: CircularProgressIndicator()); - // }); - // fetchHoldingsImportTxnId( - // myBrokerAccounts.elementAt(index).authToken!) - // .then((txnIdResponse) { - // if (txnIdResponse.statusCode == 200) { - // debugPrint('SESSION STARTED'); - // debugPrint( - // 'AUTH TOKEN: ${myBrokerAccounts.elementAt(index).authToken!}'); - // fetchHoldingsImportTxnId( - // myBrokerAccounts.elementAt(index).authToken!) - // .then((txnRes) { - // String txnId = - // jsonDecode(txnRes.body)['data']['transactionId']; - // debugPrint('TXN ID $txnId'); - // ScgatewayFlutterPlugin.triggerGatewayTransaction( - // txnId) - // .then( - // (txnRes) { - // debugPrint('TXN RES $txnRes'); - // if (txnRes != null) { - // fetchHoldings( - // //holdingsAuthToken - // myBrokerAccounts - // .elementAt(index) - // .authToken!) - // .then( - // (holdings) { - // setState(() { - // // body = netWorthPage(holdings); - // }); - // }, - // ); - // } - // }, - // ); - // }); - // } else { - // debugPrint('SESSION EXPIRED'); - // onTxnTimeout(); - // } - // }); - // }, - // child: Text(myBrokerAccounts.elementAt(index).brokerName!), - // ); - // }, - // ), - // ) - // ]), - // ); - // }); - // } + Widget holdings() { + return Obx(() { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (selectedIndex.value == 1) _unlockbottomsheet(); + }); + return selectedIndex.value == 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(25.h), + GestureDetector( + onTap: () { + log(myBrokerAccounts[selectedIndex.value].brokerName!); + ScgatewayFlutterPlugin.setConfigEnvironment( + GatewayEnvironment.PRODUCTION, + 'traderscircuit', + false, + [myBrokerAccounts[selectedIndex.value].brokerName!], + ); + fetchHoldingsImportTxnId(myBrokerAccounts + .elementAt(selectedIndex.value) + .authToken!) + .then((txnIdResponse) { + if (txnIdResponse != "Failed") { + fetchHoldingsImportTxnId(myBrokerAccounts + .elementAt(selectedIndex.value) + .authToken!) + .then((txnIdResponse) { + debugPrint('SESSION STARTED'); + debugPrint( + 'AUTH TOKEN: ${myBrokerAccounts.elementAt(selectedIndex.value).authToken!}'); + String txnId = txnIdResponse; + debugPrint('TXN ID $txnId'); + ScgatewayFlutterPlugin.triggerGatewayTransaction( + txnId) + .then( + (txnRes) { + debugPrint('TXN RES $txnRes'); + if (txnRes != null) { + fetchHoldings( + //holdingsAuthToken + myBrokerAccounts + .elementAt(selectedIndex.value) + .authToken!) + .then( + (holdings) { + setState(() {}); + }, + ); + } + }, + ); + }); + } else { + debugPrint('SESSION EXPIRED'); + onTxnTimeout(); + } + }); + }, + child: Align( + alignment: Alignment.centerRight, + child: Container( + width: 180, + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: const Color(0xff6C0000), + ), + child: Center(child: text15W600("Update Stock's")), + ), + ), + ), + sizedBoxHeight(25.h), + Table( + children: [ + TableRow( + children: [ + TableCell( + child: Text( + "Stock Name", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + ), + ), + TableCell( + child: Text( + "AVG Price", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + ), + ), + TableCell( + child: Text( + "Quantity", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + ), + ), + ], + ), + ], + ), + const Divider( + color: Color(0xFF3A3A3A), + ), + Expanded( + child: ListView.separated( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + itemCount: 16, + itemBuilder: ((context, index) { + return Table( + children: [ + TableRow( + children: [ + TableCell( + child: Text( + "TATA MOTORS", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + ), + ), + TableCell( + child: Text( + "416.66", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + ), + ), + TableCell( + child: Text( + "3", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + ), + ), + ], + ), + ], + ); + }), + separatorBuilder: (BuildContext context, int index) { + return const Divider(); + }, + ), + ), + SizedBox( + height: 30.h, + ) + ], + ) + : selectedIndex == 1 + ? const Column( + children: [], + ) + : const Column( + children: [], + ); + }); + } - // void onTxnTimeout() { - // bool showDialogContent = true; - // bool replaceDialogContentWithLoader = false; - // showDialog( - // barrierDismissible: false, - // context: context, - // builder: (context) => AlertDialog(content: StatefulBuilder( - // builder: (context, setDialogState) { - // return Column( - // mainAxisSize: MainAxisSize.min, - // children: [ - // Visibility( - // visible: showDialogContent, - // child: Column( - // mainAxisSize: MainAxisSize.min, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // const Text("Transaction Timeout", - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 18, - // )), - // const SizedBox(height: 18), - // const Text("You need to login again to continue"), - // const SizedBox(height: 18), - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // OutlinedButton( - // onPressed: () { - // setBodyToBrokers(); - // Get.back(); - // }, - // child: const Text("Cancel"), - // ), - // const SizedBox(width: 12), - // ElevatedButton( - // onPressed: () { - // setDialogState(() { - // showDialogContent = false; - // replaceDialogContentWithLoader = true; - // }); - // //login again - // fetchAuthToken().then((fetchedAuthToken) { - // debugPrint( - // "fetchedAuthToken $fetchedAuthToken"); - // fetchBrokerConnectTxnId( - // authToken: fetchedAuthToken) - // .then( - // (txnId) => - // ScgatewayFlutterPlugin.initGateway( - // fetchedAuthToken) - // .then( - // (value) => ScgatewayFlutterPlugin - // .triggerGatewayTransaction( - // txnId, - // ).then( - // (loginRes) { - // if (loginRes != null) { - // var data = - // jsonDecode(loginRes)['data']; - // if (data != null) { - // String authToken = jsonDecode( - // data)['smallcaseAuthToken']; - // String brokerName = - // jsonDecode(data)['broker']; - // String txnId = jsonDecode( - // data)['transactionId']; - // getUserId().then((userId) { - // postBrokerAccount( - // userId: userId! - // .toString(), - // brokerName: - // brokerName, - // authToken: authToken, - // txnId: txnId) - // .then((isPosted) { - // if (isPosted) { - // // Get.back(); - // // setBodyToBrokers(); - // Get.off(Holdings()); - // } - // }); - // }); - // } - // } - // }, - // ), - // ), - // ); - // }); - // }, - // child: const Text("Login Again"), - // ), - // ], - // ) - // ], - // ), - // ), - // Visibility( - // visible: replaceDialogContentWithLoader, - // child: const Padding( - // padding: EdgeInsets.symmetric(vertical: 28.0), - // child: Center( - // child: CircularProgressIndicator(), - // ), - // ), - // ) - // ], - // ); - // }, - // ))); - // } + void onTxnTimeout() { + bool showDialogContent = true; + bool replaceDialogContentWithLoader = false; + showDialog( + barrierDismissible: false, + context: context, + builder: (context) => AlertDialog(content: StatefulBuilder( + builder: (context, setDialogState) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Visibility( + visible: showDialogContent, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text("Transaction Timeout", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18, + )), + const SizedBox(height: 18), + const Text("You need to login again to continue"), + const SizedBox(height: 18), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + OutlinedButton( + onPressed: () { + Get.back(); + }, + child: const Text("Cancel"), + ), + const SizedBox(width: 12), + ElevatedButton( + onPressed: () { + setDialogState(() { + showDialogContent = false; + replaceDialogContentWithLoader = true; + }); + //login again + fetchAuthToken().then((fetchedAuthToken) { + debugPrint( + "fetchedAuthToken $fetchedAuthToken"); + fetchBrokerConnectTxnId( + authToken: fetchedAuthToken) + .then( + (txnId) => + ScgatewayFlutterPlugin.initGateway( + fetchedAuthToken, + ).then( + (value) => ScgatewayFlutterPlugin + .triggerGatewayTransaction( + txnId, + ).then( + (loginRes) { + if (loginRes != null) { + var data = + jsonDecode(loginRes)['data']; + if (data != null) { + String authToken = jsonDecode( + data)['smallcaseAuthToken']; + String brokerName = + jsonDecode(data)['broker']; + String txnId = jsonDecode( + data)['transactionId']; + + postBrokerAccount( + brokerName: brokerName, + authToken: authToken, + txnId: txnId) + .then((isPosted) { + if (isPosted) { + Get.back(); + } + }); + } + } + }, + ), + ), + ); + }); + }, + child: const Text("Login Again"), + ), + ], + ) + ], + ), + ), + Visibility( + visible: replaceDialogContentWithLoader, + child: const Padding( + padding: EdgeInsets.symmetric(vertical: 28.0), + child: Center( + child: CircularProgressIndicator(), + ), + ), + ) + ], + ); + }, + ))); + } @override Widget build(BuildContext context) { @@ -266,7 +363,7 @@ class _PortfolioState extends State { key: _scaffoldKey1, backgroundColor: Colors.black, drawerEnableOpenDragGesture: false, - drawer: Container(child: const SideMenu()), + drawer: const SideMenu(), extendBody: true, appBar: AppBar( scrolledUnderElevation: 0.0, @@ -287,115 +384,521 @@ class _PortfolioState extends State { ), ), ), - body: Stack( - children: [ - const CommonBlurLeft(), - const CommonBlurRight(), - Stack( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Column( - children: [ - Row( - children: [ - text25W600("My Portfolio"), - ], - ), - SizedBox( - height: 30.h, - ), - Text( - 'Please click the "Add" button below to add a portfolio.', - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: 'hiragino', - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w400, - ), - ), - const Spacer(), - LottieBuilder.asset( - "assets/images/png/TAdlX7YnR7 (1).json", - width: 200.w, - height: 200.h, - ), - const Spacer(), - CommonBtn( - text: "Add", - onTap: () { - // replaceAddAccountBtnWithLoader(); - // Timer.periodic(Duration(seconds: 8), (timer) { - // // replaceLoaderWithAddAccountBtn(); - // timer.cancel(); - // }); - fetchAuthToken().then((fetchedAuthToken) { - debugPrint("fetchedAuthToken $fetchedAuthToken"); - fetchBrokerConnectTxnId( - authToken: fetchedAuthToken) - .then( - (txnId) => ScgatewayFlutterPlugin.initGateway( - fetchedAuthToken) - .then( - (value) => ScgatewayFlutterPlugin - .triggerGatewayTransaction( - txnId, - ).then( - (loginRes) { - if (loginRes != null) { - var data = jsonDecode(loginRes)['data']; - if (data != null) { - String authToken = jsonDecode( - data)['smallcaseAuthToken']; - String brokerName = - jsonDecode(data)['broker']; - String txnId = - jsonDecode(data)['transactionId']; - // getUserId().then((userId) { - postBrokerAccount( - userId: "12", - brokerName: brokerName, - authToken: authToken, - txnId: txnId) - .then((isPosted) { - // replaceLoaderWithAddAccountBtn(); - // Navigator.pushReplacement( - // context, - // MaterialPageRoute( - // builder: (context) => - // Broker())); - ScaffoldMessenger.of(context) - .clearSnackBars(); - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar( - content: Text( - 'New broker account is added'))); - }); - // }); - // replaceLoaderWithAddAccountBtn(); - } - } + body: Obx( + () => Stack( + children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + !noBrokerAvailable.value + ? Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 16), + child: ListView( + physics: const NeverScrollableScrollPhysics(), + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + text25W600("My Portfolio"), + GestureDetector( + onTap: () { + fetchAuthToken().then((fetchedAuthToken) { + debugPrint( + "fetchedAuthToken $fetchedAuthToken"); + fetchBrokerConnectTxnId( + authToken: fetchedAuthToken) + .then( + (txnId) => ScgatewayFlutterPlugin + .initGateway(fetchedAuthToken) + .then( + (value) => ScgatewayFlutterPlugin + .triggerGatewayTransaction( + txnId, + ).then( + (loginRes) { + log(loginRes.toString()); + if (loginRes != null) { + var data = jsonDecode( + loginRes)['data']; + if (data != null) { + String authToken = + jsonDecode(data)[ + 'smallcaseAuthToken']; + String brokerName = + jsonDecode( + data)['broker']; + String txnId = jsonDecode( + data)['transactionId']; + + postBrokerAccount( + brokerName: + brokerName, + authToken: + authToken, + txnId: txnId) + .then((isPosted) { + ScaffoldMessenger.of( + context) + .clearSnackBars(); + ScaffoldMessenger.of( + context) + .showSnackBar( + const SnackBar( + content: Text( + 'New broker account is added'))); + }); + } + } + }, + ), + ), + ); + }); + setState(() {}); }, + child: Container( + width: 80, + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: const Color(0xff6C0000), + ), + child: Center(child: text15W600("ADD")), + ), ), + ], + ), + const SizedBox( + height: 10, + ), + DefaultTabController( + length: myBrokerAccounts.length, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + PortfolioTabBar( + portfolioLength: myBrokerAccounts.length, + portoflioName: myBrokerAccounts, + ), + SizedBox( + height: 30.h, + ), + SizedBox( + height: 570.h, + child: TabBarView( + children: List.generate( + myBrokerAccounts.length, (count) { + return DefaultTabController( + length: 2, + child: Column( + children: [ + const HoldingsTabBar(), + Expanded( + child: TabBarView( + children: [ + holdings(), + PortfolioReview(), + ], + ), + ), + ], + ), + ); + }), + ), + ), + ], ), - ); - }); - }), - const Spacer(), - ], - ), - ), - ], - ) - ], + ), + sizedBoxHeight(40.h), + ], + ), + ), + ], + ) + : Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 16), + child: Column( + children: [ + Row( + children: [ + text25W600("My Portfolio"), + ], + ), + SizedBox( + height: 30.h, + ), + Text( + 'Please click the "Add" button below to add a portfolio.', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'hiragino', + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w400, + ), + ), + const Spacer(), + LottieBuilder.asset( + "assets/images/png/TAdlX7YnR7 (1).json", + width: 200.w, + height: 200.h, + ), + const Spacer(), + CommonBtn( + text: "Add", + onTap: () { + fetchAuthToken().then((fetchedAuthToken) { + debugPrint( + "fetchedAuthToken $fetchedAuthToken"); + fetchBrokerConnectTxnId( + authToken: fetchedAuthToken) + .then( + (txnId) => + ScgatewayFlutterPlugin.initGateway( + fetchedAuthToken) + .then( + (value) => ScgatewayFlutterPlugin + .triggerGatewayTransaction( + txnId, + ).then( + (loginRes) { + log(loginRes.toString()); + if (loginRes != null) { + var data = jsonDecode( + loginRes)['data']; + if (data != null) { + String authToken = + jsonDecode(data)[ + 'smallcaseAuthToken']; + String brokerName = + jsonDecode( + data)['broker']; + String txnId = jsonDecode( + data)['transactionId']; + + postBrokerAccount( + brokerName: + brokerName, + authToken: authToken, + txnId: txnId) + .then((isPosted) { + ScaffoldMessenger.of( + context) + .clearSnackBars(); + ScaffoldMessenger.of( + context) + .showSnackBar( + const SnackBar( + content: Text( + 'New broker account is added'))); + + fetchUserIdAndBrokerAccounts + .add( + fetchBrokerAccounts()); + fetchUserIdAndBrokerAccounts + .close(); + fetchUserIdAndBrokerAccounts + .future + .then((value) { + log(value.toString()); + + try { + myBrokerAccounts = + value[0] + as List; + } catch (e) {} + debugPrint( + "myBrokerAccounts.length ${myBrokerAccounts.length}"); + + if (myBrokerAccounts + .isEmpty) { + noBrokerAvailable + .value = true; + } else { + noBrokerAvailable + .value = false; + } + }); + setState(() {}); + }); + } + } + }, + ), + ), + ); + }); + }), + const Spacer(), + ], + ), + ), + ], + ) + ], + ), ), bottomNavigationBar: bottomnavigationbar(mainController), ), ); } + Widget topContainer(String text, int index) { + return Obx(() { + return selectedIndex.value == index + ? Container( + height: 40.h, + width: 126.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: const Color(0Xff6C0000), + ), + child: Center(child: text16W500(text)), + ) + : commonGlassContainer( + width: 126.w, + height: 40.h, + borderradius: 5, + customWidget: Center(child: text16W400(text)), + ); + }); + } + + void _unlockbottomsheet() { + Get.bottomSheet( + SizedBox( + height: 200, + child: commonGlassContainer( + width: double.infinity, + height: 200, + borderradius: 2, + customWidget: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Image.asset( + // 'assets/images/png/Group 1000003722.png', + // height: 100.h, + // ), + // sizedBoxHeight(25.h), + text20W400('Please subscribed to unlock'), + sizedBoxHeight(30.h), + CommonBtn(text: 'Subscribe Now'), + ], + ), + ), + ), + backgroundColor: Colors.black.withOpacity(0.3), + ); + } + + Widget PortfolioReview() { + List> cardSwing = [ + { + 'text': 'Performance Overview:', + 'content': + 'Your portfolio has generated a total return of 15% over the past six months, outperforming the S&P 500 index by 5%.', + }, + { + 'text': 'Asset Allocation:', + 'content': + 'Your portfolio is well-diversified, with 60% allocated to equities, 30% to bonds, and 10% to cash equivalents.', + }, + { + 'text': 'Individual Holdings Analysis:', + 'content': + 'Your investment in Company XYZ has performed exceptionally well, with a 25% increase in share price since purchase, driven by strong quarterly earnings.', + }, + ]; + + return SingleChildScrollView( + child: Column( + children: [ + sizedBoxHeight(20.h), + Obx(() { + return selectedIndex.value == 0 + ? Column( + children: List.generate(cardSwing.length, (index) { + return Column( + children: [ + PortfolioCard( + text: cardSwing[index]['text']!, + content: cardSwing[index]['content']!, + ), + sizedBoxHeight(20.h) + ], + ); + }), + ) + : selectedIndex.value == 1 + ? Column( + children: List.generate(cardSwing.length, (index) { + return Column( + children: [ + PortfolioCard( + text: cardSwing[index]['text']!, + content: cardSwing[index]['content']!, + ), + sizedBoxHeight(20.h) + ], + ); + }), + ) + : Column( + children: List.generate(cardSwing.length, (index) { + return Column( + children: [ + PortfolioCard( + text: cardSwing[index]['text']!, + content: cardSwing[index]['content']!, + ), + sizedBoxHeight(20.h) + ], + ); + }), + ); + }), + sizedBoxHeight(200.h) + ], + ), + ); + } + + Widget PortfolioCard({ + required String text, + required String content, + }) { + return commonGlassContainer( + width: double.infinity, + height: 166.h, + borderradius: 8, + customWidget: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), + child: Row( + children: [ + Container( + decoration: BoxDecoration( + color: const Color(0xFF6C0000), + borderRadius: BorderRadius.circular(2), + ), + height: 25.h, + width: 4.w, + ), + sizedBoxWidth(15.w), + text18W600(text), + const Spacer(), + ], + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 18), + child: text16W400(content), + ) + ], + ), + ); + } + + Widget HoldingCard({ + required String text, + required String content, + }) { + return commonGlassContainer( + width: double.infinity, + height: 166.h, + borderradius: 8, + customWidget: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), + child: Row( + children: [ + GlassmorphicContainer( + width: 47.w, + height: 47.h, + borderRadius: 100, + blur: 10, + alignment: Alignment.center, + border: 0.9, + linearGradient: const LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + Color(0xff3A3A3A), + Color(0xFF3A3A3A), + ], + ), + borderGradient: const LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + Color.fromRGBO(70, 5, 1, 0.8), + Color.fromRGBO(102, 102, 102, 0.8), + ], + ), + child: Center( + child: Image.asset( + 'assets/images/png/TATAMOTORS.NS_BIG 1.png', + width: 26.w, + height: 23.h, + ), + ), + ), + sizedBoxWidth(15.w), + text18W600(text), + const Spacer(), + ], + ), + ), + Container( + width: double.infinity, + height: 1.h, + color: const Color(0xFF3A3A3A), + ), + Padding( + padding: const EdgeInsets.all(18), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text14W400_979797('Portfolio Value'), + sizedBoxHeight(5.h), + SizedBox(width: 150.w, child: text15W600("₹ 40,000")) + ], + ), + sizedBoxWidth(30.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text14W400_979797('%P/L'), + sizedBoxHeight(5.h), + text14W400_00FF19("-36.006%") + ], + ) + ], + ), + ], + ), + ) + ], + ), + ); + } + Future _onBackButtonPressed(BuildContext context) async { bool? exitApp = await showDialog( context: context, @@ -434,3 +937,80 @@ class _PortfolioState extends State { return exitApp ?? false; } } + +class HoldingsTabBar extends StatelessWidget { + const HoldingsTabBar({super.key}); + + // Set the desired height + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + border: Border.all(color: const Color(0Xff3A3A3A)), + borderRadius: BorderRadius.circular(8.r), + ), + padding: const EdgeInsets.all(8.0), // Set the desired padding + child: TabBar( + indicator: BoxDecoration( + color: const Color(0xff6C0000), + borderRadius: BorderRadius.circular(5), + ), + dividerColor: Colors.transparent, + labelStyle: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + indicatorSize: TabBarIndicatorSize.tab, + indicatorColor: const Color(0xFFFFFFFF), + labelColor: Colors.white, + unselectedLabelColor: const Color(0xffFFFFFF), + overlayColor: WidgetStateProperty.all(const Color(0xFFFFFFFF)), + tabs: const [ + Tab( + text: 'Holdings', + ), + Tab( + text: 'Portfolio Reviews', + ), + ]), + ); + } +} + +class PortfolioTabBar extends StatelessWidget { + final int portfolioLength; + final List portoflioName; + const PortfolioTabBar({ + super.key, + required this.portfolioLength, + required this.portoflioName, + }); + + // Set the desired height + + @override + Widget build(BuildContext context) { + return TabBar( + tabAlignment: TabAlignment.start, + isScrollable: true, + dividerColor: Colors.transparent, + labelStyle: TextStyle( + fontSize: 18.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + indicatorSize: TabBarIndicatorSize.tab, + indicatorWeight: 2, + indicatorColor: const Color(0xff6C0000), + labelColor: Colors.white, + unselectedLabelColor: const Color(0xFF464646), + overlayColor: WidgetStateProperty.all(const Color(0xFFFFFFFF)), + tabs: List.generate(portfolioLength, (counter) { + return Tab( + text: portoflioName[counter].brokerName, + ); + })); + } +} diff --git a/lib/view/MainScreen/ShortTrade.dart b/lib/view/MainScreen/ShortTrade.dart index ca505a7..a72fed1 100644 --- a/lib/view/MainScreen/ShortTrade.dart +++ b/lib/view/MainScreen/ShortTrade.dart @@ -164,6 +164,8 @@ class _ShortTradeState extends State { SizedBox( height: 0.57.sh, child: TabBarView( + physics: + NeverScrollableScrollPhysics(), children: [ ActiveCallsTab(productsController .selectedIndex.value == @@ -460,8 +462,7 @@ class _ShortTradeState extends State { ), ), ); - - } + } void _unlockbottomsheet() { Get.bottomSheet( diff --git a/lib/view/MainScreen/stockDetails/option_chain_screen.dart b/lib/view/MainScreen/stockDetails/option_chain_screen.dart index 10f9c2d..7d81b24 100644 --- a/lib/view/MainScreen/stockDetails/option_chain_screen.dart +++ b/lib/view/MainScreen/stockDetails/option_chain_screen.dart @@ -1,8 +1,6 @@ import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:gap/gap.dart'; import 'package:get/get.dart' hide FormData; import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart'; import 'package:traderscircuit/Utils/Common/sized_box.dart'; @@ -19,7 +17,6 @@ class OptionChainScreen extends StatefulWidget { } class _OptionChainScreenState extends State { - Color _indicatorColor = Color(0xff00C236); List containerTexts = [ "9 MAY", "10 MAY", @@ -35,6 +32,7 @@ class _OptionChainScreenState extends State { drawerEnableOpenDragGesture: false, extendBody: true, appBar: const CommonAppbar( + height: 50, titleTxt: "", ), body: Stack( @@ -54,7 +52,6 @@ class _OptionChainScreenState extends State { SizedBox( height: 60, width: double.infinity, - // color: Colors.amber, child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, @@ -73,47 +70,100 @@ class _OptionChainScreenState extends State { ); }), ), - Table( - border: TableBorder.symmetric( - outside: BorderSide( + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + border: Border.all( width: 1, - color: Color(0xFF4A73FB).withOpacity(0.3), + color: const Color(0xFF4A73FB).withOpacity(0.3), ), ), - columnWidths: { - 0: FlexColumnWidth(1), - 1: FlexColumnWidth(1), - 2: FlexColumnWidth(2), - 3: FlexColumnWidth(1), - 4: FlexColumnWidth(1), - }, - children: [ - TableRow( - decoration: BoxDecoration(color: Colors.transparent), - children: [ - tableMainHeader('Calls'), - tableMainHeader(''), - tableMainHeader('Option Chain'), - tableMainHeader(''), - tableMainHeader('Puts'), - ], - ), - TableRow( - decoration: BoxDecoration(color: Color(0xff00295C)), - children: [ - tableHeader('OI', 'change'), - tableHeader('LTP', 'change'), - tableHeader('Price', ''), - tableHeader('LTP', 'change'), - tableHeader('OI', 'change'), - ], - ), - ...List.generate( - 15, - (index) => tableRow(index), - ), - ], - ) + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, horizontal: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + tableMainHeader('Calls'), + tableMainHeader('Option Chain'), + tableMainHeader('Puts'), + ], + ), + ), + Container( + decoration: BoxDecoration( + color: const Color(0xff00295C), + border: Border( + top: BorderSide( + width: 1, + color: const Color(0xFF4A73FB) + .withOpacity(0.3), + ), + )), + child: Row( + children: [ + Expanded(child: tableHeader('OI', 'change')), + Expanded(child: tableHeader('LTP', 'change')), + Expanded( + flex: 2, child: tableHeader('Price', '')), + Expanded(child: tableHeader('LTP', 'change')), + Expanded(child: tableHeader('OI', 'change')), + ], + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height - 330, + child: ListView.separated( + itemCount: 20, + itemBuilder: (context, index) { + // return index == 5 + // ? Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // tableCell('0.3', '', + // isActive: false), + // tableCell('271.00', ''), + // tableCell('22,250', '', + // isMiddleElement: true), + // tableCell('41.35', ''), + // tableCell('0.3', ''), + // ], + // ) + // : + return Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + tableCell('0.3', ''), + tableCell('271.00', ''), + tableCell('22,250', '', + isMiddleElement: true), + tableCell('41.35', ''), + tableCell('0.3', ''), + ], + ); + }, + separatorBuilder: + (BuildContext context, int index) { + return index == 5 + ? const Stack(children: [ + Divider( + height: 5, + color: Colors.transparent), + PositionedOverlay() + ]) + : const SizedBox( + height: 0, + ); + }, + ), + ), + ], + ), + ), ], ), ), @@ -148,7 +198,7 @@ class _OptionChainScreenState extends State { Widget tableMainHeader(String text) { return Center( child: Padding( - padding: const EdgeInsets.symmetric(vertical: 127.0), + padding: const EdgeInsets.symmetric(vertical: 10.0), child: Text(text, style: TextStyle( color: Colors.white, @@ -164,38 +214,41 @@ class _OptionChainScreenState extends State { color: index % 2 == 0 ? Colors.transparent : Colors.transparent, ), children: [ - tableCell('1,43,875', '\n59,625'), - tableCell('271.00', '\n-45.65'), + tableCell('0.3', ''), + tableCell('271.00', ''), tableCell('22,250', ''), - tableCell('41.35', '\n-8.20'), - tableCell('10,07,275', '\n2,71,400'), + tableCell('41.35', ''), + tableCell('0.3', ''), ], ); } - Widget tableCell(String text, String text1) { - return Padding( - padding: const EdgeInsets.all(5.0), - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - text: text, - style: TextStyle( - fontWeight: FontWeight.w500, - fontSize: 12.sp, - ), - children: [ - TextSpan( - text: "\n${text1}", + Widget tableCell(String text, String text1, {bool? isMiddleElement}) { + return isMiddleElement == true + ? Container( + decoration: const BoxDecoration( + border: Border( + right: BorderSide(width: 1, color: Color(0xFF4A73FB)), + left: BorderSide(width: 1, color: Color(0xFF4A73FB)))), + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 2), + child: Text( + text, style: TextStyle( - fontWeight: FontWeight.w300, - fontSize: 11.sp, - color: Colors.green), + fontWeight: FontWeight.w500, + fontSize: 12.sp, + color: Colors.white), ), - ], - ), - ), - ); + ) + : Padding( + padding: const EdgeInsets.all(6.0), + child: Text( + text, + style: TextStyle( + fontWeight: FontWeight.w500, + fontSize: 12.sp, + color: Colors.white), + ), + ); } Widget topContainer(String text, int index) { @@ -227,6 +280,8 @@ List listData(List data) { } class OptionChainTable extends StatelessWidget { + const OptionChainTable({super.key}); + @override Widget build(BuildContext context) { return Padding( @@ -235,7 +290,7 @@ class OptionChainTable extends StatelessWidget { child: Column( children: [ Table( - columnWidths: { + columnWidths: const { 0: FlexColumnWidth(1), 1: FlexColumnWidth(1), 2: FlexColumnWidth(1), @@ -246,7 +301,7 @@ class OptionChainTable extends StatelessWidget { // border: TableBorder.all(color: Colors.white), children: [ TableRow( - decoration: BoxDecoration(color: Colors.black), + decoration: const BoxDecoration(color: Colors.black), children: [ tableHeader('OI\nchange'), tableHeader('LTP\nchange'), @@ -269,7 +324,8 @@ class OptionChainTable extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: Center( child: Text(text, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), + style: const TextStyle( + color: Colors.white, fontWeight: FontWeight.bold)), ), ); } @@ -295,8 +351,87 @@ class OptionChainTable extends StatelessWidget { return Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Text(text, style: TextStyle(color: Colors.white)), + child: Text(text, style: const TextStyle(color: Colors.white)), ), ); } } + +class DottedLinePainter extends CustomPainter { + final Color color; + + DottedLinePainter({required this.color}); + + @override + void paint(Canvas canvas, Size size) { + var paint = Paint() + ..color = color + ..strokeWidth = 1 + ..style = PaintingStyle.stroke; + + var max = size.width; + var dashWidth = 5; + var dashSpace = 3; + double startX = 0; + + while (startX < max) { + canvas.drawLine(Offset(startX, 0), Offset(startX + dashWidth, 0), paint); + startX += dashWidth + dashSpace; + } + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return false; + } +} + +class PositionedOverlay extends StatelessWidget { + const PositionedOverlay({super.key}); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: Get.width - 10, + child: Row( + children: [ + Expanded( + child: CustomPaint( + painter: DottedLinePainter(color: const Color(0xFF4A73FB)), + child: Container( + height: 1, + ), + ), + ), + Container( + padding: const EdgeInsets.all(5), + color: const Color(0xff00295C), + alignment: Alignment.center, + child: Text('22,851.75', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11.sp)), + ), + Expanded( + child: CustomPaint( + painter: DottedLinePainter(color: const Color(0xFF4A73FB)), + child: Container( + height: 1, + ), + ), + ), + ], + ), + ); + } + + double calculateOverlayPosition(BoxConstraints constraints) { + // Calculate the position where you want to show the overlay + // For example, to show the overlay at a certain position (e.g., between the 5th and 6th items), + // you can use the item height and the item index to calculate the exact position + double itemHeight = 56.0; // Example item height, adjust as needed + int overlayIndex = 5; // Index where you want to show the overlay + return overlayIndex * itemHeight; + } +} diff --git a/lib/view/MainScreen/stockDetails/stock_details_screen.dart b/lib/view/MainScreen/stockDetails/stock_details_screen.dart index c38be91..cbae427 100644 --- a/lib/view/MainScreen/stockDetails/stock_details_screen.dart +++ b/lib/view/MainScreen/stockDetails/stock_details_screen.dart @@ -95,12 +95,12 @@ class _StockDetailsScreenState extends State { netChange = dynamicData['net_change'].toString(); _calculatePercentageChange( stockDetailsModel!.data!.stockData!.ohlc!.open!, - stockDetailsModel!.data!.stockData!.lastPrice!); + stockDetailsModel!.data!.stockData!.netChange!); isLoading.value = false; }); - // initializeWebSocket(); + // initializeWebSocket(); } else { isLoading.value = false; } @@ -109,7 +109,13 @@ class _StockDetailsScreenState extends State { } void _calculatePercentageChange(double openPrice, double currentPrice) { - final percentageChange = ((currentPrice - openPrice) / openPrice) * 100; + double closePrice = 0; + if (currentPrice.toString().contains("-")) { + closePrice = openPrice - currentPrice; + } else { + closePrice = openPrice + currentPrice; + } + final percentageChange = ((closePrice - openPrice) / openPrice) * 100; percentageDifference = percentageChange.toStringAsFixed(2); } @@ -237,7 +243,7 @@ class _StockDetailsScreenState extends State { netChange = dynamicData['net_change'].toString(); _calculatePercentageChange( stockDetailsModel!.data!.stockData!.ohlc!.open!, - stockDetailsModel!.data!.stockData!.lastPrice!); + stockDetailsModel!.data!.stockData!.netChange!); isLoading.value = false; }); }); diff --git a/lib/view/MainScreen/stockDetails/upstock_websocket.dart b/lib/view/MainScreen/stockDetails/upstock_websocket.dart index 1170a20..8fce13d 100644 --- a/lib/view/MainScreen/stockDetails/upstock_websocket.dart +++ b/lib/view/MainScreen/stockDetails/upstock_websocket.dart @@ -16,17 +16,17 @@ class UpstoxWebSocket { void connect() { final url = - 'wss://api.upstox.com/live/v1/feed?apiKey=$apiKey&accessToken=$accessToken'; + "wss://wsfeeder-api.upstox.com/market-data-feeder/v2/upstox-developer-api/feeds?requestId=19c52224-22a5-4b59-b0cd-ff4a5653ce89&code=QOEBW-14ce77bb-d33c-48b0-8a49-20cf2a4b2088"; _channel = WebSocketChannel.connect(Uri.parse(url)); - _channel?.sink.add(json.encode({ - "guid": "someguid", - "method": "subscribe", - "data": { - "mode": "full", - "instrumentKeys": instrument, - } - })); + // _channel?.sink.add(json.encode({ + // "guid": "someguid", + // "method": "subscribe", + // "data": { + // "mode": "full", + // "instrumentKeys": instrument, + // } + // })); _channel?.stream.listen((data) { print('Received: $data'); diff --git a/lib/view/Sidemenu/Sidemenu.dart b/lib/view/Sidemenu/Sidemenu.dart index 0613d6e..4a5bcb5 100644 --- a/lib/view/Sidemenu/Sidemenu.dart +++ b/lib/view/Sidemenu/Sidemenu.dart @@ -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 { 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 { 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 { 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 _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'); + } +} diff --git a/lib/view/login/LoginScreen.dart b/lib/view/login/LoginScreen.dart index a56e976..fbc7eb8 100644 --- a/lib/view/login/LoginScreen.dart +++ b/lib/view/login/LoginScreen.dart @@ -338,7 +338,7 @@ class _LoginScreenState extends State { if (isValid!) { FocusManager.instance.primaryFocus ?.unfocus(); - if (isValid != null && isValid) { + if (isValid != null && isValid) { Map myLoginData = { "mobile_number": phonecontroller.text, }; diff --git a/lib/view_model/LogoutApi/logout_api.dart b/lib/view_model/LogoutApi/logout_api.dart new file mode 100644 index 0000000..ecc0e72 --- /dev/null +++ b/lib/view_model/LogoutApi/logout_api.dart @@ -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> logoutApi() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + final response = await NetworkApiServices().postApi( + data, + ApiUrls.logout, + ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("OTP sent successfully"); + } else { + return ResponseData( + responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } +} diff --git a/lib/view_model/SendOtp/sendOtpbloc.dart b/lib/view_model/SendOtp/sendOtpbloc.dart index 0ba9db0..667784e 100644 --- a/lib/view_model/SendOtp/sendOtpbloc.dart +++ b/lib/view_model/SendOtp/sendOtpbloc.dart @@ -20,7 +20,8 @@ class SendOtpBloc extends Bloc { if (resp.status == ResponseStatus.SUCCESS) { emit(SendOtpState.success); - } else { + } + else { emit(SendOtpState.failure); } } catch (e) { diff --git a/lib/view_model/SmallCaseApi/smallcase_api_methods.dart b/lib/view_model/SmallCaseApi/smallcase_api_methods.dart index 4726b06..e4b44c9 100644 --- a/lib/view_model/SmallCaseApi/smallcase_api_methods.dart +++ b/lib/view_model/SmallCaseApi/smallcase_api_methods.dart @@ -1,9 +1,14 @@ import 'dart:convert'; +import 'dart:developer'; + +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart'; import '../../Utils/api_urls.dart'; +import '../../Utils/base_manager.dart'; +import '../../data/network/network_api_services.dart'; import '../../model/SmallCaseModel/broker_account_model.dart'; // void openDashboardPage(BuildContext context) { @@ -19,83 +24,142 @@ import '../../model/SmallCaseModel/broker_account_model.dart'; // } //broker account table -//fetch broker accounts -Future> fetchBrokerAccounts() async { - final response = await http.Client() - .get(Uri.parse('${ApiUrls.pieBase}api/get_broker_account_data')); - final parsed = jsonDecode(response.body); - return parsed - .map((json) => BrokerAccountModel.fromJson(json)) - .toList(); -} //delete broker account Future deleteBrokerAccount(int id) async { final response = await http.Client() - .get(Uri.parse('${ApiUrls.pieBase}api/delete_brokerage_account/$id')); + .get(Uri.parse('${ApiUrls.base}api/delete_brokerage_account/$id')); if (response.statusCode == 200) return true; return false; } //post broker account Future postBrokerAccount({ - required String userId, required String brokerName, required String authToken, required String txnId, }) async { - var response = await http.post( - Uri.parse('${ApiUrls.pieBase}api/add_broker_account'), - body: { - "user_id": userId, + final response = await NetworkApiServices().postApi( + FormData.fromMap({ "broker_name": brokerName, "auth_token": authToken, "transaction_id": txnId, - }, + }), + '${ApiUrls.base}add-broker-account', ); - if (response.statusCode == 200) return true; + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + return true; + } else { + return false; + } + } return false; } -Future fetchAuthToken() async { - var response = await http.get( - Uri.parse( - '${ApiUrls.pieBase}api/get_small_case_auth_token/', - ), +//fetch broker accounts +Future> fetchBrokerAccounts() async { + final response = await NetworkApiServices().getApi( + '${ApiUrls.base}get-broker-account-data', ); - return jsonDecode(response.body)['data']; + // log(response.data.toString()); + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + BrokerAccountModel brokerAccountModel = + BrokerAccountModel.fromJson(responseData); + + return brokerAccountModel.data!; + } else { + return []; + } + } + return []; +} + +Future fetchAuthToken() async { + final response = await NetworkApiServices().getApi( + '${ApiUrls.base}get-small-case-auth-token', + ); + // log(response.data.toString()); + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + return response.data['data']; + } else { + return "Failed"; + } + } + return "Failed"; } Future fetchBrokerConnectTxnId({required String authToken}) async { - var response = await http.get( - Uri.parse( - '${ApiUrls.pieBase}api/get_small_case_broker_connect_transaction/$authToken', - ), + final response = await NetworkApiServices().postApi( + FormData.fromMap({"auth_token": authToken}), + '${ApiUrls.base}get-transaction-id', ); - return jsonDecode(response.body)['data']['transactionId']; + log(response.data.toString()); + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + return response.data['data']["data"] + ['transactionId']; // jsonDecode(response.body) + } else { + return "Failed"; + } + } + return "Failed"; } -Future fetchHoldingsImportTxnId(String authToken) async { - var response = await http.get( - Uri.parse( - '${ApiUrls.pieBase}api/get_small_case_holding_import_transaction_id/$authToken', - ), +Future fetchHoldingsImportTxnId(String authToken) async { + log(authToken); + final response = await NetworkApiServices().postApi( + FormData.fromMap({"auth_token": authToken}), + '${ApiUrls.base}create-transaction-holdings-import', ); - return response; + log(response.data.toString()); + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success" && + !responseData.toString().contains( + "{status: error, status_code: 500, message: Something went wrong.}")) { + return response.data['data']["data"] + ['transactionId']; // jsonDecode(response.body) + } else { + return "Failed"; + } + } + return "Failed"; } Future> fetchHoldings(String authToken) async { - var response = await http.get( - Uri.parse( - '${ApiUrls.pieBase}api/fetch_small_case_holding/$authToken', - ), + final response = await NetworkApiServices().postApi( + FormData.fromMap({"auth_token": authToken}), + '${ApiUrls.base}fetch-holdings', ); - return jsonDecode(response.body)['data']; + log(response.data.toString()); + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + return responseData; + } else { + return {}; + } + } + return {}; } Future fetchStocksOrderTxnId(String authToken, String body) async { var response = await http.post(Uri.parse( - '${ApiUrls.pieBase}api/create_post_transaction_stock_order?body=$body&auth_token=$authToken')); + '${ApiUrls.base}api/create_post_transaction_stock_order?body=$body&auth_token=$authToken')); var txnId = jsonDecode(response.body)['data']['transactionId']; return txnId; } diff --git a/pubspec.lock b/pubspec.lock index 08dba9f..3699c01 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,18 +21,18 @@ packages: dependency: transitive description: name: archive - sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d url: "https://pub.dev" source: hosted - version: "3.4.10" + version: "3.6.1" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: "direct main" description: @@ -53,10 +53,10 @@ packages: dependency: "direct main" description: name: audio_video_progress_bar - sha256: ccc7d7b83d2a16c52d4a7fb332faabd1baa053fb0e4c16815aefd3945ab33b81 + sha256: "552b1f73c56c4c88407999e0a8507176f60c56de3e6d63bc20a0eab48467d4c9" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" bloc: dependency: transitive description: @@ -93,10 +93,10 @@ packages: dependency: transitive description: name: cached_network_image_web - sha256: "42a835caa27c220d1294311ac409a43361088625a4f23c820b006dd9bffb3316" + sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" characters: dependency: transitive description: @@ -157,10 +157,10 @@ packages: dependency: transitive description: name: cross_file - sha256: "2f9d2cbccb76127ba28528cb3ae2c2326a122446a83de5a056aaa3880d3882c5" + sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32" url: "https://pub.dev" source: hosted - version: "0.3.3+7" + version: "0.3.4+1" crypto: dependency: transitive description: @@ -181,10 +181,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.8" dbus: dependency: transitive description: @@ -213,10 +213,10 @@ packages: dependency: "direct main" description: name: dio - sha256: "0978e9a3e45305a80a7210dbeaf79d6ee8bee33f70c8e542dc654c952070217f" + sha256: "11e40df547d418cc0c4900a9318b26304e665da6fa4755399a9ff9efd09034b5" url: "https://pub.dev" source: hosted - version: "5.4.2+1" + version: "5.4.3+1" dotted_border: dependency: "direct main" description: @@ -261,10 +261,10 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: @@ -293,10 +293,10 @@ packages: dependency: transitive description: name: file_selector_macos - sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 url: "https://pub.dev" source: hosted - version: "0.9.3+3" + version: "0.9.4" file_selector_platform_interface: dependency: transitive description: @@ -317,50 +317,30 @@ packages: dependency: "direct main" description: name: firebase_analytics - sha256: b13cbf1ee78744ca5e6b762e9218db3bd3967a0edfed75f58339907892a2ccb9 + sha256: dbf1e7ab22cfb1f4a4adb103b46a26276b4edc593d4a78ef6fb942bafc92e035 url: "https://pub.dev" source: hosted - version: "10.8.9" + version: "10.10.7" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - sha256: "416b33d62033db5ecd2df719fcb657ad04e9995fa0fc392ffdab4ca0e76cb679" + sha256: "3729b74f8cf1d974a27ba70332ecb55ff5ff560edc8164a6469f4a055b429c37" url: "https://pub.dev" source: hosted - version: "3.9.9" + version: "3.10.8" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - sha256: "9dca9d8d468172444ef18cabb73fe99f7aae24733bfad67115bd36bffd2d65c1" + sha256: "019cd7eee74254d33fbd2e29229367ce33063516bf6b3258a341d89e3b0f1655" url: "https://pub.dev" source: hosted - 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" + + + version: "0.5.7+7" + + firebase_core: dependency: "direct main" description: @@ -373,34 +353,36 @@ packages: dependency: transitive description: name: firebase_core_platform_interface - sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + sha256: "1003a5a03a61fc9a22ef49f37cbcb9e46c86313a7b2e7029b9390cf8c6fc32cb" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "22fcb352744908224fc7be3caae254836099786acfe5df6e9fe901e9c2575a41" + + sha256: "6643fe3dbd021e6ccfb751f7882b39df355708afbdeb4130fc50f9305a9d1a3d" url: "https://pub.dev" source: hosted - version: "2.17.1" + version: "2.17.2" + firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics - sha256: c4f1b723d417bc9c4774810e774ff91df8fb0032d33fb2888b2c887e865581b8 + sha256: "9897c01efaa950d2f6da8317d12452749a74dc45f33b46390a14cfe28067f271" url: "https://pub.dev" source: hosted - version: "3.4.18" + version: "3.5.7" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: c5a11fca3df76a98e3fa68fde8b10a08aacb9a7639f619fbfd4dad6c67a08643 + sha256: "16a71e08fbf6e00382816e1b13397898c29a54fa0ad969c2c2a3b82a704877f0" url: "https://pub.dev" source: hosted - version: "3.6.25" + version: "3.6.35" fl_chart: dependency: "direct main" description: @@ -418,10 +400,10 @@ packages: dependency: "direct main" description: name: flutter_bloc - sha256: f0ecf6e6eb955193ca60af2d5ca39565a86b8a142452c5b24d96fb477428f4d2 + sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a url: "https://pub.dev" source: hosted - version: "8.1.5" + version: "8.1.6" flutter_branch_sdk: dependency: "direct main" description: @@ -506,10 +488,10 @@ packages: dependency: transitive description: name: flutter_isolate - sha256: "8ab879634322a012feb096153cf759caa118d81300189d1730455f3718bca24b" + sha256: "994ddec596da4ca12ca52154fd59404077584643eb7e3f1008a55fda9fe0b76b" url: "https://pub.dev" source: hosted - version: "2.0.5-pre" + version: "2.0.4" flutter_lints: dependency: "direct dev" description: @@ -522,18 +504,18 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.0.20" flutter_screenutil: dependency: "direct main" description: name: flutter_screenutil - sha256: "8cf100b8e4973dc570b6415a2090b0bfaa8756ad333db46939efc3e774ee100d" + sha256: "8239210dd68bee6b0577aa4a090890342d04a136ce1c81f98ee513fc0ce891de" url: "https://pub.dev" source: hosted - version: "5.9.0" + version: "5.9.3" flutter_svg: dependency: "direct main" description: @@ -556,10 +538,10 @@ packages: dependency: "direct main" description: name: fluttertoast - sha256: dfdde255317af381bfc1c486ed968d5a43a2ded9c931e87cbecd88767d6a71c1 + sha256: "7eae679e596a44fdf761853a706f74979f8dd3cd92cf4e23cae161fda091b847" url: "https://pub.dev" source: hosted - version: "8.2.4" + version: "8.2.6" gap: dependency: "direct main" description: @@ -580,10 +562,10 @@ packages: dependency: transitive description: name: get_it - sha256: e6017ce7fdeaf218dc51a100344d8cb70134b80e28b760f8bb23c242437bafd7 + sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 url: "https://pub.dev" source: hosted - version: "7.6.7" + version: "7.7.0" glassmorphism: dependency: "direct main" description: @@ -612,10 +594,12 @@ packages: dependency: transitive description: name: google_sign_in_android - sha256: "7647893c65e6720973f0e579051c8f84b877b486614d9f70a404259c41a4632e" + + sha256: "8f2606fffd912ff8c23e8d94da106764c116112ce65fb18c78123331ae628eb3" url: "https://pub.dev" source: hosted - version: "6.1.23" + version: "6.1.24" + google_sign_in_ios: dependency: transitive description: @@ -636,10 +620,12 @@ packages: dependency: transitive description: name: google_sign_in_web - sha256: fc0f14ed45ea616a6cfb4d1c7534c2221b7092cc4f29a709f0c3053cc3e821bd + + sha256: f2b3af0ba52ff59439f18962fca71db860f09507a81da929fc0e719270b35db2 url: "https://pub.dev" source: hosted - version: "0.12.4" + version: "0.12.3+3" + html: dependency: transitive description: @@ -692,34 +678,34 @@ packages: dependency: "direct main" description: name: image_picker - sha256: "26222b01a0c9a2c8fe02fc90b8208bd3325da5ed1f4a2acabf75939031ac0bdd" + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" url: "https://pub.dev" source: hosted - version: "1.0.7" + version: "1.1.2" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "39f2bfe497e495450c81abcd44b62f56c2a36a37a175da7d137b4454977b51b1" + sha256: "4161e1f843d8480d2e9025ee22411778c3c9eb7e40076dcf2da23d8242b7b51c" url: "https://pub.dev" source: hosted - version: "0.8.9+3" + version: "0.8.12+3" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + sha256: "5d6eb13048cd47b60dbf1a5495424dea226c5faf3950e20bf8120a58efb5b5f3" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.4" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" url: "https://pub.dev" source: hosted - version: "0.8.9+1" + version: "0.8.12" image_picker_linux: dependency: transitive description: @@ -740,10 +726,10 @@ packages: dependency: transitive description: name: image_picker_platform_interface - sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" url: "https://pub.dev" source: hosted - version: "2.9.3" + version: "2.10.0" image_picker_windows: dependency: transitive description: @@ -764,10 +750,10 @@ packages: dependency: transitive description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" js: dependency: transitive description: @@ -780,50 +766,50 @@ packages: dependency: "direct main" description: name: just_audio - sha256: b7cb6bbf3750caa924d03f432ba401ec300fd90936b3f73a9b33d58b1e96286b + sha256: "5abfab1d199e01ab5beffa61b3e782350df5dad036cb8c83b79fa45fc656614e" url: "https://pub.dev" source: hosted - version: "0.9.37" + version: "0.9.38" just_audio_platform_interface: dependency: transitive description: name: just_audio_platform_interface - sha256: c3dee0014248c97c91fe6299edb73dc4d6c6930a2f4f713579cd692d9e47f4a1 + sha256: "0243828cce503c8366cc2090cefb2b3c871aa8ed2f520670d76fd47aa1ab2790" url: "https://pub.dev" source: hosted - version: "4.2.2" + version: "4.3.0" just_audio_web: dependency: transitive description: name: just_audio_web - sha256: "134356b0fe3d898293102b33b5fd618831ffdc72bb7a1b726140abdf22772b70" + sha256: "0edb481ad4aa1ff38f8c40f1a3576013c3420bf6669b686fe661627d49bc606c" url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.4.11" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: @@ -844,26 +830,26 @@ packages: dependency: "direct main" description: name: local_auth - sha256: "27679ed8e0d7daab2357db6bb7076359e083a56b295c0c59723845301da6aed9" + sha256: "280421b416b32de31405b0a25c3bd42dfcef2538dfbb20c03019e02a5ed55ed0" url: "https://pub.dev" source: hosted - version: "2.1.8" + version: "2.2.0" local_auth_android: dependency: transitive description: name: local_auth_android - sha256: "3bcd732dda7c75fcb7ddaef12e131230f53dcc8c00790d0d6efb3aa0fbbeda57" + sha256: "48dfb2d954da8ef6a77adfc93a29998f7729e9308eaa817e91dea4500317b2c8" url: "https://pub.dev" source: hosted - version: "1.0.37" - local_auth_ios: + version: "1.0.39" + local_auth_darwin: dependency: transitive description: - name: local_auth_ios - sha256: eb283b530029b334698918f1e282d4483737cbca972ff21b9193be3d6de8e2b8 + name: local_auth_darwin + sha256: e424ebf90d5233452be146d4a7da4bcd7a70278b67791592f3fde1bda8eef9e2 url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "1.3.1" local_auth_platform_interface: dependency: transitive description: @@ -916,18 +902,18 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" mime: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" nested: dependency: transitive description: @@ -988,26 +974,26 @@ packages: dependency: transitive description: name: path_provider - sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + sha256: "9c96da072b421e98183f9ea7464898428e764bc0ce5567f27ec8693442e72514" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.5" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -1044,18 +1030,18 @@ packages: dependency: transitive description: name: permission_handler_android - sha256: "8bb852cd759488893805c3161d0b2b5db55db52f773dbb014420b304055ba2c5" + sha256: b29a799ca03be9f999aa6c39f7de5209482d638e6f857f6b93b0875c618b7e54 url: "https://pub.dev" source: hosted - version: "12.0.6" + version: "12.0.7" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: e9ad66020b89ff1b63908f247c2c6f931c6e62699b756ef8b3c4569350cd8662 + sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0 url: "https://pub.dev" source: hosted - version: "9.4.4" + version: "9.4.5" permission_handler_html: dependency: transitive description: @@ -1084,10 +1070,10 @@ packages: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.2" pin_code_fields: dependency: "direct main" description: @@ -1100,10 +1086,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -1112,14 +1098,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" - url: "https://pub.dev" - source: hosted - version: "3.7.4" provider: dependency: transitive description: @@ -1140,10 +1118,10 @@ packages: dependency: "direct main" description: name: scgateway_flutter_plugin - sha256: c52831292d73b7004af314f7e34ea4c510110da3e7d1cc274a745b3524e6a724 + sha256: "271354169511e130668b0cd06c3bd2c1c64a7a7383a328120587a5170ec75dd8" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.0+3" share_plus: dependency: transitive description: @@ -1164,26 +1142,26 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + sha256: d3bbe5553a986e83980916ded2f0b435ef2e1893dfaa29d5a7a790d0eca12180 url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.3" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.3" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.4.0" shared_preferences_linux: dependency: transitive description: @@ -1204,10 +1182,10 @@ packages: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" shared_preferences_windows: dependency: transitive description: @@ -1249,18 +1227,18 @@ packages: dependency: transitive description: name: sqflite - sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.4" stack_trace: dependency: transitive description: @@ -1289,10 +1267,10 @@ packages: dependency: "direct main" description: name: syncfusion_flutter_charts - sha256: "5f868f5a82380ef1b3de416b7812e1ac7acce6a629f9281618adee81d90716cc" + sha256: bdb7cc5814ceb187793cea587f4a5946afcffd96726b219cee79df8460f44b7b url: "https://pub.dev" source: hosted - version: "21.2.10" + version: "21.2.4" syncfusion_flutter_core: dependency: transitive description: @@ -1369,10 +1347,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" timeago: dependency: "direct main" description: @@ -1393,26 +1371,26 @@ packages: dependency: transitive description: name: url_launcher - sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" url: "https://pub.dev" source: hosted - version: "6.2.4" + version: "6.3.0" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 + sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.3" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89" url: "https://pub.dev" source: hosted - version: "6.2.4" + version: "6.3.0" url_launcher_linux: dependency: transitive description: @@ -1425,10 +1403,10 @@ packages: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.0" url_launcher_platform_interface: dependency: transitive description: @@ -1441,10 +1419,10 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" url_launcher_windows: dependency: transitive description: @@ -1497,26 +1475,26 @@ packages: dependency: "direct main" description: name: video_player - sha256: afc65f4b8bcb2c188f64a591f84fb471f4f2e19fc607c65fd8d2f8fedb3dec23 + sha256: aced48e701e24c02b0b7f881a8819e4937794e46b5a5821005e2bf3b40a324cc url: "https://pub.dev" source: hosted - version: "2.8.3" + version: "2.8.7" video_player_android: dependency: transitive description: name: video_player_android - sha256: "4dd9b8b86d70d65eecf3dcabfcdfbb9c9115d244d022654aba49a00336d540c2" + sha256: "9529001630e42988f755772972d5014d30121610700e8e502278a245939f8fc8" url: "https://pub.dev" source: hosted - version: "2.4.12" + version: "2.5.0" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: bc923884640d6dc403050586eb40713cdb8d1d84e6886d8aca50ab04c59124c2 + sha256: d1e9a824f2b324000dc8fb2dcb2a3285b6c1c7c487521c63306cc5b394f68a7c url: "https://pub.dev" source: hosted - version: "2.5.2" + version: "2.6.1" video_player_platform_interface: dependency: transitive description: @@ -1529,10 +1507,10 @@ packages: dependency: transitive description: name: video_player_web - sha256: "34beb3a07d4331a24f7e7b2f75b8e2b103289038e07e65529699a671b6a6e2cb" + sha256: ff4d69a6614b03f055397c27a71c9d3ddea2b2a23d71b2ba0164f59ca32b8fe2 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.1" videoplayerkb: dependency: "direct main" description: @@ -1546,10 +1524,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" wakelock: dependency: transitive description: @@ -1598,6 +1576,7 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.1" + web_socket: dependency: transitive description: @@ -1606,6 +1585,7 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.5" + web_socket_channel: dependency: "direct main" description: @@ -1634,10 +1614,12 @@ packages: dependency: transitive description: name: xml - sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.5.0" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.19.0" + + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" + diff --git a/pubspec.yaml b/pubspec.yaml index 64f4de3..c4e97d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,7 +62,9 @@ dependencies: flutter_inappwebview: ^6.0.0 flutter_branch_sdk: ^7.1.0 socket_io_client: ^2.0.3+1 - web_socket_channel: ^3.0.0 + + web_socket_channel: + google_sign_in: ^6.2.1 firebase_auth: ^4.20.0