deep linking and option chain fixes

This commit is contained in:
kishan06
2024-06-09 14:37:53 +05:30
parent 2a4d8922c6
commit 563ab9eea2
7 changed files with 174 additions and 115 deletions

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

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);
}
@@ -718,7 +717,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,122 @@ 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')),
],
),
),
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(
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,
),
),
),
],
),
),
],
),
],
),
),
],
),
),
@@ -148,7 +220,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,11 +236,11 @@ 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', ''),
],
);
}
@@ -235,7 +307,7 @@ class OptionChainTable extends StatelessWidget {
child: Column(
children: [
Table(
columnWidths: {
columnWidths: const {
0: FlexColumnWidth(1),
1: FlexColumnWidth(1),
2: FlexColumnWidth(1),
@@ -246,7 +318,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 +341,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 +368,37 @@ 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;
}
}