Merge branch 'main' into product
This commit is contained in:
@@ -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')),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -38,6 +38,14 @@ class NetworkApiServices {
|
||||
data: response.data,
|
||||
ResponseStatus.SUCCESS,
|
||||
);
|
||||
} else if (response.statusCode == 203) {
|
||||
print(response.data);
|
||||
return ResponseData<dynamic>("validation", ResponseStatus.PRIVATE,
|
||||
data: response.data);
|
||||
} else if (response.statusCode == 202) {
|
||||
print(response.data);
|
||||
return ResponseData<dynamic>("success", ResponseStatus.PRIVATE,
|
||||
data: response.data);
|
||||
} else {
|
||||
try {
|
||||
return ResponseData<dynamic>(
|
||||
@@ -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<dynamic>("success", ResponseStatus.SUCCESS,
|
||||
data: response.data);
|
||||
} else if (response.statusCode == 203) {
|
||||
print(response.data);
|
||||
print(response.data['message'].toString());
|
||||
return ResponseData<dynamic>("validation", ResponseStatus.PRIVATE,
|
||||
data: response.data);
|
||||
data: response.data['message'].toString());
|
||||
} else if (response.statusCode == 202) {
|
||||
print(response.data);
|
||||
return ResponseData<dynamic>("success", ResponseStatus.PRIVATE,
|
||||
|
||||
@@ -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<void> main() async {
|
||||
//smallcase
|
||||
ScgatewayFlutterPlugin.setConfigEnvironment(
|
||||
GatewayEnvironment.PRODUCTION,
|
||||
'pi-advisors',
|
||||
'traderscircuit',
|
||||
false,
|
||||
[],
|
||||
);
|
||||
@@ -89,6 +89,7 @@ class _MyAppState extends State<MyApp> 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<MyApp> 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') &&
|
||||
|
||||
@@ -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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['status_code'] = this.statusCode;
|
||||
data['message'] = this.message;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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 = <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 = <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 = <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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.exploreTheUnseenActiveCalls != null) {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
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<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
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<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['title'] = this.title;
|
||||
data['is_active'] = this.isActive;
|
||||
data['created_at'] = this.createdAt;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['title'] = title;
|
||||
data['is_active'] = isActive;
|
||||
data['created_at'] = createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -334,11 +333,11 @@ class ActionData {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['is_active'] = this.isActive;
|
||||
data['created_at'] = this.createdAt;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
data = json['data'] != null ? new Data1.fromJson(json['data']) : null;
|
||||
data = json['data'] != null ? Data1.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['status'] = status;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
@@ -372,20 +371,20 @@ class Data1 {
|
||||
|
||||
Data1.fromJson(Map<String, dynamic> 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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.nSEINDEXNiftyBank != null) {
|
||||
data['NSE_INDEX:Nifty Bank'] = this.nSEINDEXNiftyBank!.toJson();
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> 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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.ohlc != null) {
|
||||
data['ohlc'] = this.ohlc!.toJson();
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> 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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['open'] = this.open;
|
||||
data['high'] = this.high;
|
||||
data['low'] = this.low;
|
||||
data['close'] = this.close;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> 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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.ohlc != null) {
|
||||
data['ohlc'] = this.ohlc!.toJson();
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
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<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['title'] = this.title;
|
||||
data['created_at'] = this.createdAt;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['title'] = title;
|
||||
data['created_at'] = createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -684,18 +679,28 @@ class ContentByteVideo {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
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<String, dynamic> data = <String, dynamic>{};
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>? 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<String, dynamic> 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<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
statusCode = json['status_code'];
|
||||
message = json['message'];
|
||||
if (json['data'] != null) {
|
||||
data = <Data>[];
|
||||
json['data'].forEach((v) {
|
||||
data!.add(Data.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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<String, dynamic> 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<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
|
||||
@@ -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<HomeScreen> {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
|
||||
RxString userName = "User".obs;
|
||||
|
||||
HomeModel homeModel = HomeModel();
|
||||
@@ -69,9 +62,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
}
|
||||
|
||||
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<HomeScreen> {
|
||||
drawerEnableOpenDragGesture: false,
|
||||
key: _scaffoldKey1,
|
||||
backgroundColor: Colors.black,
|
||||
drawer: Container(child: const SideMenu()),
|
||||
drawer: Container(
|
||||
width: 300,
|
||||
child: const SideMenu(),
|
||||
),
|
||||
extendBody: true,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 70.h,
|
||||
@@ -112,7 +112,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Icon(
|
||||
const Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
@@ -175,7 +175,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
fontFamily: 'hiragino',
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
!homeModel.data!.isUpstoxTokenRefreshed!
|
||||
@@ -186,6 +186,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
commoncontainer(
|
||||
width: 250.w,
|
||||
@@ -207,10 +209,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
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<HomeScreen> {
|
||||
homeModel.data!.indexLiveData!.data!
|
||||
.nSEINDEXNiftyBank!.ohlc!.open!,
|
||||
homeModel.data!.indexLiveData!.data!
|
||||
.nSEINDEXNiftyBank!.lastPrice!,
|
||||
.nSEINDEXNiftyBank!.netChange!,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -283,7 +285,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
'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<HomeScreen> {
|
||||
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
|
||||
|
||||
@@ -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<Holdings> createState() => _HoldingsState();
|
||||
}
|
||||
|
||||
class _HoldingsState extends State<Holdings> {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
|
||||
List<String> 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<bool> _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<Map<String, String>> 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',
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -164,6 +164,8 @@ class _ShortTradeState extends State<ShortTrade> {
|
||||
SizedBox(
|
||||
height: 0.57.sh,
|
||||
child: TabBarView(
|
||||
physics:
|
||||
NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
ActiveCallsTab(productsController
|
||||
.selectedIndex.value ==
|
||||
@@ -460,8 +462,7 @@ class _ShortTradeState extends State<ShortTrade> {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void _unlockbottomsheet() {
|
||||
Get.bottomSheet(
|
||||
|
||||
@@ -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<OptionChainScreen> {
|
||||
Color _indicatorColor = Color(0xff00C236);
|
||||
List<String> containerTexts = [
|
||||
"9 MAY",
|
||||
"10 MAY",
|
||||
@@ -35,6 +32,7 @@ class _OptionChainScreenState extends State<OptionChainScreen> {
|
||||
drawerEnableOpenDragGesture: false,
|
||||
extendBody: true,
|
||||
appBar: const CommonAppbar(
|
||||
height: 50,
|
||||
titleTxt: "",
|
||||
),
|
||||
body: Stack(
|
||||
@@ -54,7 +52,6 @@ class _OptionChainScreenState extends State<OptionChainScreen> {
|
||||
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<OptionChainScreen> {
|
||||
);
|
||||
}),
|
||||
),
|
||||
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<OptionChainScreen> {
|
||||
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<OptionChainScreen> {
|
||||
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>[
|
||||
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<FlSpot> listData(List<num> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,12 +95,12 @@ class _StockDetailsScreenState extends State<StockDetailsScreen> {
|
||||
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<StockDetailsScreen> {
|
||||
}
|
||||
|
||||
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<StockDetailsScreen> {
|
||||
netChange = dynamicData['net_change'].toString();
|
||||
_calculatePercentageChange(
|
||||
stockDetailsModel!.data!.stockData!.ohlc!.open!,
|
||||
stockDetailsModel!.data!.stockData!.lastPrice!);
|
||||
stockDetailsModel!.data!.stockData!.netChange!);
|
||||
isLoading.value = false;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -6,8 +6,10 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
|
||||
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
|
||||
import 'package:traderscircuit/Utils/Common/sized_box.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/Utils/text.dart';
|
||||
import 'package:traderscircuit/resources/routes/route_name.dart';
|
||||
import 'package:traderscircuit/view_model/LogoutApi/logout_api.dart';
|
||||
import 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart';
|
||||
|
||||
import 'webview_subscription.dart';
|
||||
@@ -161,7 +163,7 @@ class _SideMenuState extends State<SideMenu> {
|
||||
title: text18W400('My Subscription'),
|
||||
trailing: Container(
|
||||
height: 35.h,
|
||||
width: 122.w,
|
||||
width: 80.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
color: const Color(0xFF34C759),
|
||||
@@ -221,20 +223,20 @@ class _SideMenuState extends State<SideMenu> {
|
||||
title: text18W400('Update My KYC'),
|
||||
trailing: Container(
|
||||
height: 40.h,
|
||||
width: 122.w,
|
||||
width: 80.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
color: const Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
border: Border.all(color: const Color(0xFF9A0000))),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
text12W400('Pending'),
|
||||
text10W300('Pending'),
|
||||
Container(
|
||||
height: 30.h,
|
||||
width: 30.h,
|
||||
height: 22.h,
|
||||
width: 22.w,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
@@ -272,12 +274,12 @@ class _SideMenuState extends State<SideMenu> {
|
||||
title: text18W400('My Risk Profile'),
|
||||
trailing: Container(
|
||||
height: 35.h,
|
||||
width: 122.w,
|
||||
width: 80.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
color: const Color(0xFF0093FF),
|
||||
),
|
||||
child: Center(child: text14W500('Conservative')),
|
||||
child: Center(child: text10W300('Conservative')),
|
||||
),
|
||||
selected: true,
|
||||
onTap: () {
|
||||
@@ -385,10 +387,11 @@ LogOutdialog(context) {
|
||||
width: 140.w,
|
||||
child: CommonYesNoBtn(
|
||||
yesonTap: () async {
|
||||
SharedPreferences prefs =
|
||||
await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
Get.offNamed(RouteName.loginscreen);
|
||||
_handleLogout();
|
||||
// SharedPreferences prefs =
|
||||
// await SharedPreferences.getInstance();
|
||||
// await prefs.clear();
|
||||
// Get.offNamed(RouteName.loginscreen);
|
||||
},
|
||||
)),
|
||||
SizedBox(
|
||||
@@ -477,7 +480,8 @@ void navigateTo(int index, BuildContext context) {
|
||||
sizedBoxHeight(50.h),
|
||||
CommonYesNoBtn(
|
||||
yesonTap: () {
|
||||
Get.toNamed(RouteName.loginscreen);
|
||||
_handleLogout();
|
||||
// Get.toNamed(RouteName.loginscreen);
|
||||
},
|
||||
noonTap: () {
|
||||
Get.back();
|
||||
@@ -537,3 +541,26 @@ class sideBarTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleLogout() async {
|
||||
// Create an instance of the API with required data
|
||||
var logoutApi = LogoutAPI({
|
||||
// Add any required data here, e.g., user token or ID
|
||||
});
|
||||
|
||||
// Call the logout API
|
||||
final response = await logoutApi.logoutApi();
|
||||
|
||||
// Handle the response
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
// Clear any user-related data here if necessary
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
|
||||
// Navigate to the login screen
|
||||
Get.offAllNamed(RouteName.loginscreen);
|
||||
} else {
|
||||
// Show an error message if logout failed
|
||||
Get.snackbar('Error', response.message ?? 'Logout failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
if (isValid!) {
|
||||
FocusManager.instance.primaryFocus
|
||||
?.unfocus();
|
||||
if (isValid != null && isValid) {
|
||||
if (isValid != null && isValid) {
|
||||
Map<String, String> myLoginData = {
|
||||
"mobile_number": phonecontroller.text,
|
||||
};
|
||||
|
||||
28
lib/view_model/LogoutApi/logout_api.dart
Normal file
28
lib/view_model/LogoutApi/logout_api.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:traderscircuit/Utils/api_urls.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/data/network/network_api_services.dart';
|
||||
|
||||
class LogoutAPI {
|
||||
LogoutAPI(this.data);
|
||||
var data;
|
||||
Future<ResponseData<dynamic>> logoutApi() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices().postApi(
|
||||
data,
|
||||
ApiUrls.logout,
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
Map<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
print("OTP sent successfully");
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
responseData['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,8 @@ class SendOtpBloc extends Bloc<SendOtpEvent, SendOtpState> {
|
||||
|
||||
if (resp.status == ResponseStatus.SUCCESS) {
|
||||
emit(SendOtpState.success);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
emit(SendOtpState.failure);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -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<List<BrokerAccountModel>> 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<BrokerAccountModel>((json) => BrokerAccountModel.fromJson(json))
|
||||
.toList();
|
||||
}
|
||||
|
||||
//delete broker account
|
||||
Future<bool> 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<bool> 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: <String, String>{
|
||||
"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<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<String> fetchAuthToken() async {
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'${ApiUrls.pieBase}api/get_small_case_auth_token/',
|
||||
),
|
||||
//fetch broker accounts
|
||||
Future<List<Data>> 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<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
BrokerAccountModel brokerAccountModel =
|
||||
BrokerAccountModel.fromJson(responseData);
|
||||
|
||||
return brokerAccountModel.data!;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
Future<String> fetchAuthToken() async {
|
||||
final response = await NetworkApiServices().getApi(
|
||||
'${ApiUrls.base}get-small-case-auth-token',
|
||||
);
|
||||
// log(response.data.toString());
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
Map<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
return response.data['data'];
|
||||
} else {
|
||||
return "Failed";
|
||||
}
|
||||
}
|
||||
return "Failed";
|
||||
}
|
||||
|
||||
Future<String> 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<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
return response.data['data']["data"]
|
||||
['transactionId']; // jsonDecode(response.body)
|
||||
} else {
|
||||
return "Failed";
|
||||
}
|
||||
}
|
||||
return "Failed";
|
||||
}
|
||||
|
||||
Future<http.Response> fetchHoldingsImportTxnId(String authToken) async {
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'${ApiUrls.pieBase}api/get_small_case_holding_import_transaction_id/$authToken',
|
||||
),
|
||||
Future<String> 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<String, dynamic> responseData =
|
||||
Map<String, dynamic>.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<Map<String, dynamic>> 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<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
return responseData;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Future<String> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user