option chain ui added,homepage bug fixed

This commit is contained in:
kishan06
2024-06-11 11:30:18 +05:30
parent 563ab9eea2
commit 40c3a60b78
5 changed files with 306 additions and 264 deletions

View File

@@ -174,7 +174,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
fontFamily: 'hiragino',
),
debugShowCheckedModeBanner: false,
initialRoute: RouteName.optionChain,
initialRoute: RouteName.splashScreen,
getPages: AppRoutes.appRoutes(),
),
designSize: const Size(390, 844),

View File

@@ -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;
}
@@ -429,7 +428,7 @@ 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'];
@@ -449,26 +448,26 @@ 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['oi'] = oi;
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,20 +481,30 @@ 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;
}
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
}
}
}
class NSEINDEXNifty50 {
@@ -536,7 +545,7 @@ 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'];
@@ -556,26 +565,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['oi'] = oi;
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 +618,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 +644,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 +693,18 @@ 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;
}
}

View File

@@ -113,75 +113,53 @@ class _OptionChainScreenState extends State<OptionChainScreen> {
],
),
),
Stack(
children: [
SizedBox(
height:
MediaQuery.of(context).size.height - 330,
child: SingleChildScrollView(
child: Table(
border: TableBorder(
horizontalInside: BorderSide(
width: 1,
color: const Color(0xFF4A73FB)
.withOpacity(0.3),
),
),
columnWidths: const {
0: FlexColumnWidth(1),
1: FlexColumnWidth(1),
2: FlexColumnWidth(2),
3: FlexColumnWidth(1),
4: FlexColumnWidth(1),
},
children: [
...List.generate(
15,
(index) => tableRow(index),
),
],
),
),
),
Positioned(
left: 0,
right: 0,
top: 200, // Adjust the position as needed
child: Row(
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: [
Expanded(
child: CustomPaint(
painter: DottedLinePainter(
color: Color(0xFF4A73FB)),
child: Container(
height: 1,
),
),
),
Container(
width: 80, // Adjust width as needed
height: 30,
color: const Color(0xff00295C),
alignment: Alignment.center,
child: Text('22,851.75',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 12.sp)),
),
Expanded(
child: CustomPaint(
painter: DottedLinePainter(
color: Color(0xFF4A73FB)),
child: Container(
height: 1,
),
),
),
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,
);
},
),
),
],
),
@@ -245,29 +223,32 @@ class _OptionChainScreenState extends State<OptionChainScreen> {
);
}
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) {
@@ -299,6 +280,8 @@ List<FlSpot> listData(List<num> data) {
}
class OptionChainTable extends StatelessWidget {
const OptionChainTable({super.key});
@override
Widget build(BuildContext context) {
return Padding(
@@ -402,3 +385,53 @@ class DottedLinePainter extends CustomPainter {
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;
}
}

View File

@@ -100,7 +100,7 @@ class _StockDetailsScreenState extends State<StockDetailsScreen> {
isLoading.value = false;
});
// initializeWebSocket();
// initializeWebSocket();
} else {
isLoading.value = false;
}

View File

@@ -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');