Merge pull request #73 from WDI-Ideas/optionchainkishan

Optionchainkishan
This commit is contained in:
Kishan Bhuta
2024-06-11 11:33:20 +05:30
committed by GitHub
10 changed files with 412 additions and 311 deletions

View File

@@ -6,7 +6,6 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission
android:name="android.permission.USE_BIOMETRIC"/>
<application

View File

@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>NSFaceIDUsageDescription</key>
<string>Why is my app authenticating using face id?</string>
<string>for authentication</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
@@ -11,7 +11,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.app.traderscircuit</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

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

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

@@ -71,7 +71,6 @@ class _HomeScreenState extends State<HomeScreen> {
String calculatePercentageChange(double openPrice, double currentPrice) {
final percentageChange = ((currentPrice - openPrice) / openPrice) * 100;
log(percentageChange.toStringAsFixed(2));
return percentageChange.toStringAsFixed(2);
}
@@ -720,7 +719,6 @@ Widget cardcallWidget(
),
GestureDetector(
onTap: () {
log("RUNNING");
Get.to(const ExploreUnseen());
},
child: Container(

View File

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

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

View File

@@ -357,10 +357,10 @@ packages:
dependency: transitive
description:
name: firebase_core_web
sha256: "22fcb352744908224fc7be3caae254836099786acfe5df6e9fe901e9c2575a41"
sha256: c8e1d59385eee98de63c92f961d2a7062c5d9a65e7f45bdc7f1b0b205aab2492
url: "https://pub.dev"
source: hosted
version: "2.17.1"
version: "2.11.5"
firebase_crashlytics:
dependency: "direct main"
description:
@@ -728,30 +728,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.9"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
@@ -828,26 +804,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
version: "0.12.16"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.5.0"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.10.0"
mime:
dependency: transitive
description:
@@ -892,10 +868,10 @@ packages:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.8.3"
path_drawing:
dependency: transitive
description:
@@ -1470,14 +1446,6 @@ packages:
url: "https://github.com/kishan06/videoPlayerKB.git"
source: git
version: "0.0.2"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
wakelock:
dependency: transitive
description:
@@ -1522,26 +1490,18 @@ packages:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.5.1"
web_socket:
dependency: transitive
description:
name: web_socket
sha256: "24301d8c293ce6fe327ffe6f59d8fd8834735f0ec36e4fd383ec7ff8a64aa078"
url: "https://pub.dev"
source: hosted
version: "0.1.5"
version: "0.3.0"
web_socket_channel:
dependency: "direct main"
description:
name: web_socket_channel
sha256: a2d56211ee4d35d9b344d9d4ce60f362e4f5d1aafb988302906bd732bc731276
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "2.4.0"
win32:
dependency: transitive
description:
@@ -1567,5 +1527,5 @@ packages:
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
dart: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0"

View File

@@ -62,7 +62,7 @@ dependencies:
flutter_inappwebview: ^6.0.0
flutter_branch_sdk: ^7.1.0
socket_io_client: ^2.0.3+1
web_socket_channel: ^3.0.0
web_socket_channel:
dev_dependencies: