851 lines
36 KiB
Dart
851 lines
36 KiB
Dart
// 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';
|
|
import 'package:get/get.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.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/controller/contact_us_controller.dart';
|
|
|
|
import 'package:traderscircuit/model/HomeModel/home_model.dart';
|
|
|
|
import 'package:traderscircuit/controller/products_controller.dart';
|
|
|
|
import 'package:traderscircuit/resources/routes/route_name.dart';
|
|
import 'package:traderscircuit/view/MainScreen/ExploreUnseen.dart';
|
|
import 'package:traderscircuit/view/MainScreen/MainScreen.dart';
|
|
import 'package:traderscircuit/view/Sidemenu/ContentByte/PlayerWidget.dart';
|
|
import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart';
|
|
import 'package:traderscircuit/view/Sidemenu/webview_subscription.dart';
|
|
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
|
|
import 'package:traderscircuit/view_model/HomeApi/home_api.dart';
|
|
|
|
import '../../view_model/ProfileAPI/GetProfileApi.dart';
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
State<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
|
|
RxString userName = "User".obs;
|
|
|
|
HomeModel homeModel = HomeModel();
|
|
|
|
RxBool isApiCalling = true.obs;
|
|
|
|
ProductsController productsController = Get.put(ProductsController());
|
|
|
|
ContactUsController contactUsController = Get.put(ContactUsController());
|
|
|
|
@override
|
|
void initState() {
|
|
GetProfile().GetProfileAPI().then((value) {
|
|
userName.value = ProfileObj!.data!.userName ?? "User";
|
|
});
|
|
HomeApi().getHomeData().then((value) async {
|
|
homeModel = HomeModel.fromJson(value.data);
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
await prefs.setString(
|
|
'upstocksAccessToken', homeModel.data!.upstoxAccessToken!);
|
|
await prefs.setString('upstocksApiKey', homeModel.data!.upstoxSecretKey!);
|
|
productsController.isUpstoxTokenNotExpired.value =
|
|
homeModel.data!.isUpstoxTokenRefreshed!;
|
|
isApiCalling.value = false;
|
|
});
|
|
super.initState();
|
|
}
|
|
|
|
String calculatePercentageChange(double openPrice, double currentPrice) {
|
|
final percentageChange = ((currentPrice - openPrice) / openPrice) * 100;
|
|
|
|
|
|
return percentageChange.toStringAsFixed(2);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return WillPopScope(
|
|
onWillPop: () async {
|
|
_onBackButtonPressed(context);
|
|
return true; // Return true to allow the pop action
|
|
},
|
|
child: Scaffold(
|
|
drawerEnableOpenDragGesture: false,
|
|
key: _scaffoldKey1,
|
|
backgroundColor: Colors.black,
|
|
drawer: Container(child: const SideMenu()),
|
|
extendBody: true,
|
|
appBar: AppBar(
|
|
toolbarHeight: 70.h,
|
|
scrolledUnderElevation: 0.0,
|
|
backgroundColor: Colors.black,
|
|
elevation: 0,
|
|
automaticallyImplyLeading: false,
|
|
titleSpacing: 0,
|
|
centerTitle: true,
|
|
title: GestureDetector(
|
|
onTap: () {
|
|
Get.toNamed(RouteName.search);
|
|
},
|
|
child: commonGlassContainer(
|
|
width: 250,
|
|
height: 50,
|
|
borderradius: 8,
|
|
customWidget: Center(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
SizedBox(
|
|
width: 10.w,
|
|
),
|
|
Icon(
|
|
Icons.search,
|
|
color: Colors.white,
|
|
),
|
|
SizedBox(
|
|
width: 15.w,
|
|
),
|
|
text20W400("Search"),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
leading: InkWell(
|
|
onTap: () {
|
|
_scaffoldKey1.currentState?.openDrawer();
|
|
},
|
|
child: Center(
|
|
child: Image.asset(
|
|
'assets/images/png/menu.png',
|
|
height: 15.h,
|
|
width: 20.w,
|
|
),
|
|
),
|
|
),
|
|
actions: [
|
|
InkWell(
|
|
onTap: () {
|
|
Get.toNamed(RouteName.notification);
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.only(right: 14.w),
|
|
child: SvgPicture.asset('assets/images/svg/Group 1897.svg')),
|
|
)
|
|
],
|
|
),
|
|
body: Obx(
|
|
() => Stack(
|
|
children: [
|
|
const CommonBlurLeft(),
|
|
const CommonBlurRight(),
|
|
Stack(children: [
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
child: isApiCalling.value
|
|
? const Center(
|
|
child: CircularProgressIndicator(
|
|
color: Color(0xFF0093FF),
|
|
),
|
|
)
|
|
: ListView(
|
|
physics: const BouncingScrollPhysics(),
|
|
children: [
|
|
sizedBoxHeight(20.h),
|
|
Text(
|
|
"Welcome $userName",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 24.sp,
|
|
fontFamily: 'hiragino',
|
|
fontWeight: FontWeight.w500),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
!homeModel.data!.isUpstoxTokenRefreshed!
|
|
? const SizedBox()
|
|
: sizedBoxHeight(25.h),
|
|
!homeModel.data!.isUpstoxTokenRefreshed!
|
|
? const SizedBox()
|
|
: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
commoncontainer(
|
|
width: 250.w,
|
|
text: homeModel
|
|
.data!
|
|
.indexLiveData!
|
|
.data!
|
|
.nSEINDEXNifty50!
|
|
.instrumentToken!
|
|
.split("NSE_INDEX|")[1],
|
|
amount: homeModel.data!.indexLiveData!
|
|
.data!.nSEINDEXNifty50!.lastPrice!
|
|
.toString(),
|
|
rate: homeModel.data!.indexLiveData!
|
|
.data!.nSEINDEXNifty50!.netChange
|
|
.toString(),
|
|
percentageChange:
|
|
calculatePercentageChange(
|
|
homeModel.data!.indexLiveData!.data!
|
|
.nSEINDEXNifty50!.ohlc!.open!,
|
|
homeModel.data!.indexLiveData!.data!
|
|
.nSEINDEXNifty50!.lastPrice!,
|
|
),
|
|
),
|
|
sizedBoxWidth(10.w),
|
|
commoncontainer(
|
|
width: 250.w,
|
|
text: homeModel
|
|
.data!
|
|
.indexLiveData!
|
|
.data!
|
|
.nSEINDEXNiftyBank!
|
|
.instrumentToken!
|
|
.split("NSE_INDEX|")[1],
|
|
amount: homeModel
|
|
.data!
|
|
.indexLiveData!
|
|
.data!
|
|
.nSEINDEXNiftyBank!
|
|
.lastPrice!
|
|
.toString(),
|
|
rate: homeModel
|
|
.data!
|
|
.indexLiveData!
|
|
.data!
|
|
.nSEINDEXNiftyBank!
|
|
.netChange
|
|
.toString(),
|
|
percentageChange:
|
|
calculatePercentageChange(
|
|
homeModel.data!.indexLiveData!.data!
|
|
.nSEINDEXNiftyBank!.ohlc!.open!,
|
|
homeModel.data!.indexLiveData!.data!
|
|
.nSEINDEXNiftyBank!.lastPrice!,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
!homeModel.data!.isUpstoxTokenRefreshed!
|
|
? const SizedBox()
|
|
: sizedBoxHeight(30.h),
|
|
!homeModel.data!.isUpstoxTokenRefreshed!
|
|
? const SizedBox()
|
|
: Container(
|
|
width: double.infinity,
|
|
height: 1.h,
|
|
color: const Color(0xFF3A3A3A),
|
|
),
|
|
sizedBoxHeight(30.h),
|
|
text22W500('View our products'),
|
|
sizedBoxHeight(30.h),
|
|
SizedBox(
|
|
height: 280,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: homeModel.data!.products!.length,
|
|
itemBuilder: (context, index) {
|
|
return Container(
|
|
margin: const EdgeInsets.only(bottom: 12),
|
|
child: ProductWidget(
|
|
text: homeModel.data!.products!
|
|
.elementAt(index)
|
|
.title!,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SvgPicture.asset(
|
|
'assets/images/svg/Vector (2).svg'),
|
|
sizedBoxWidth(10.w),
|
|
ProfileObj!.data!.isSubscriptionTaken == true
|
|
? SizedBox()
|
|
: InkWell(
|
|
child: text18W500('UNLOCK NOW!'),
|
|
onTap: () async {
|
|
SharedPreferences prefs =
|
|
await SharedPreferences
|
|
.getInstance();
|
|
|
|
Get.to(WebViewSubscription(
|
|
token: prefs
|
|
.getString('accessToken')
|
|
.toString()));
|
|
},
|
|
),
|
|
],
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
Container(
|
|
width: double.infinity,
|
|
height: 1.h,
|
|
color: const Color(0xFF3A3A3A),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
text25W800('Explore The Unseen'),
|
|
sizedBoxHeight(10.h),
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
width: 398,
|
|
height: 55,
|
|
decoration: ShapeDecoration(
|
|
gradient: LinearGradient(
|
|
begin: const Alignment(1.00, 0.02),
|
|
end: const Alignment(-1, -0.02),
|
|
colors: [
|
|
Colors.white
|
|
.withOpacity(0.09000000357627869),
|
|
Colors.white
|
|
.withOpacity(0.0925697460770607),
|
|
Colors.white
|
|
.withOpacity(0.10999999940395355)
|
|
],
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
side: const BorderSide(
|
|
width: 1, color: Color(0x994A73FB)),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
child: Container(
|
|
width: 382,
|
|
height: 40,
|
|
decoration: ShapeDecoration(
|
|
color: const Color(0xFF00C236),
|
|
shape: RoundedRectangleBorder(
|
|
side: const BorderSide(width: 0.80),
|
|
borderRadius: BorderRadius.circular(5),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: text18W500("Long Term"),
|
|
),
|
|
),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
// DefaultTabController(
|
|
// length: 2,
|
|
// child: Column(
|
|
// children: [
|
|
// MyTabBar(),
|
|
// SizedBox(
|
|
// height: 250.h,
|
|
// child: TabBarView(
|
|
// children: [
|
|
// ActiveCallsTab(),
|
|
// ExitedCallsTab(),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
cardcallWidget(
|
|
action: homeModel
|
|
.data!
|
|
.exploreTheUnseenActiveCalls!
|
|
.first
|
|
.recommendationActionsXid ==
|
|
1
|
|
? "Buy"
|
|
: homeModel
|
|
.data!
|
|
.exploreTheUnseenActiveCalls!
|
|
.first
|
|
.recommendationActionsXid ==
|
|
2
|
|
? "Sell"
|
|
: homeModel
|
|
.data!
|
|
.exploreTheUnseenActiveCalls!
|
|
.first
|
|
.recommendationActionsXid ==
|
|
3
|
|
? "Hold"
|
|
: homeModel
|
|
.data!
|
|
.exploreTheUnseenActiveCalls!
|
|
.first
|
|
.recommendationActionsXid ==
|
|
4
|
|
? "Exit"
|
|
: "",
|
|
text: homeModel
|
|
.data!
|
|
.exploreTheUnseenActiveCalls!
|
|
.first
|
|
.stockName!,
|
|
amount:
|
|
"₹ ${homeModel.data!.exploreTheUnseenActiveCalls!.first.buyPrice!}",
|
|
pdfname: 'Download Pdf'),
|
|
sizedBoxHeight(25.h),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
text20W600('Content Bytes'),
|
|
sizedBoxHeight(8.w),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
width: 220.w,
|
|
child: text16W400_DADADA(
|
|
'The Beauty and Power of Video')),
|
|
// sizedBoxWidth(10.w),
|
|
SizedBox(width: 4),
|
|
InkWell(
|
|
onTap: () {
|
|
Get.toNamed(RouteName.contentbytes);
|
|
},
|
|
child: Container(
|
|
width: 105,
|
|
height: 35,
|
|
decoration: ShapeDecoration(
|
|
color: const Color(0xFF0093FF),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius:
|
|
BorderRadius.circular(5)),
|
|
),
|
|
child: Center(
|
|
child: text14W500('View More')),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
sizedBoxHeight(20.h),
|
|
commonGlassContainer(
|
|
borderradius: 8,
|
|
width: double.infinity,
|
|
height: 330.h,
|
|
customWidget: Padding(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 10.h, horizontal: 10.w),
|
|
child: Column(
|
|
children: [
|
|
InkWell(
|
|
onTap: () {
|
|
Get.to(() => const PlayerWidget(),
|
|
arguments: {
|
|
"video_url": homeModel
|
|
.data!
|
|
.contentByteVideo!
|
|
.link ??
|
|
"",
|
|
});
|
|
},
|
|
child: Container(
|
|
height: 200.h,
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(8.r),
|
|
image: DecorationImage(
|
|
image: NetworkImage(homeModel
|
|
.data!
|
|
.contentByteVideo!
|
|
.image ??
|
|
""),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: SvgPicture.asset(
|
|
'assets/images/svg/gridicons_play.svg',
|
|
height: 56.h,
|
|
width: 56.w,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
sizedBoxHeight(20.h),
|
|
Row(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.center,
|
|
children: [
|
|
sizedBoxWidth(10.w),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
text18W500(homeModel
|
|
.data!
|
|
.contentByteVideo!
|
|
.title ??
|
|
""),
|
|
// sizedBoxHeight(10.h),
|
|
text12W400_979797(
|
|
contactUsController
|
|
.timeAgoConverter(
|
|
homeModel
|
|
.data!
|
|
.contentByteVideo!
|
|
.createdAt!)),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
))
|
|
],
|
|
),
|
|
],
|
|
),
|
|
)
|
|
])
|
|
],
|
|
),
|
|
),
|
|
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 ActiveCallsTab() {
|
|
return Column(
|
|
children: [
|
|
sizedBoxHeight(30.h),
|
|
cardcallWidget(
|
|
action: homeModel.data!.exploreTheUnseenActiveCalls!.first
|
|
.recommendationActionsXid ==
|
|
1
|
|
? "Buy"
|
|
: homeModel.data!.exploreTheUnseenActiveCalls!.first
|
|
.recommendationActionsXid ==
|
|
2
|
|
? "Sell"
|
|
: homeModel.data!.exploreTheUnseenActiveCalls!.first
|
|
.recommendationActionsXid ==
|
|
3
|
|
? "Hold"
|
|
: homeModel.data!.exploreTheUnseenActiveCalls!.first
|
|
.recommendationActionsXid ==
|
|
4
|
|
? "Exit"
|
|
: "",
|
|
text: homeModel.data!.exploreTheUnseenActiveCalls!.first.stockName!,
|
|
amount:
|
|
"₹ ${homeModel.data!.exploreTheUnseenActiveCalls!.first.buyPrice!}",
|
|
pdfname: 'Download Pdf'),
|
|
sizedBoxHeight(30.h),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget ExitedCallsTab() {
|
|
return Column(
|
|
children: [
|
|
sizedBoxHeight(30.h),
|
|
homeModel.data!.exploreTheUnseenExitedCalls!.isEmpty ||
|
|
homeModel.data!.exploreTheUnseenExitedCalls == null
|
|
? text14W300("No Data")
|
|
: Column(
|
|
children: List.generate(
|
|
homeModel.data!.exploreTheUnseenExitedCalls!.length,
|
|
(index) {
|
|
return Column(
|
|
children: [
|
|
cardcallWidget(
|
|
action: "Hold",
|
|
text: homeModel.data!.exploreTheUnseenExitedCalls!
|
|
.elementAt(index)
|
|
.stockName ??
|
|
"",
|
|
amount: homeModel.data!.exploreTheUnseenExitedCalls!
|
|
.elementAt(index)
|
|
.buyPrice ??
|
|
"",
|
|
pdfname: "Download Pdf"),
|
|
sizedBoxHeight(20.h)
|
|
],
|
|
);
|
|
}),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
Widget cardcallWidget(
|
|
{required String text,
|
|
required String amount,
|
|
required String pdfname,
|
|
required String action}) {
|
|
return Container(
|
|
width: 398,
|
|
height: 261,
|
|
decoration: ShapeDecoration(
|
|
color: const Color(0x232C79ED),
|
|
shape: RoundedRectangleBorder(
|
|
side: const BorderSide(width: 1, color: Color(0x994A73FB)),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
Positioned(
|
|
right: 0,
|
|
child: SvgPicture.asset("assets/images/svg/card_decoration.svg")),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
text16W700(text),
|
|
Container(
|
|
width: 75.w,
|
|
height: 30.h,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(15.r),
|
|
color: action == "Buy"
|
|
? Colors.green
|
|
: action == "Sell"
|
|
? Colors.red
|
|
: action == "Hold"
|
|
? const Color(0xFFFFAD31)
|
|
: Colors.white,
|
|
),
|
|
child: Center(child: text14W500(action, clr: Colors.black)),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
text14W400_979797('Initial Entry Price'),
|
|
sizedBoxHeight(5.h),
|
|
text15W600(amount),
|
|
sizedBoxHeight(30.w),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Container(
|
|
width: 150,
|
|
height: 52,
|
|
decoration: ShapeDecoration(
|
|
color: const Color(0x332C79ED),
|
|
shape: RoundedRectangleBorder(
|
|
side: const BorderSide(
|
|
width: 1, color: Color(0x994A73FB)),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// SvgPicture.asset('assets/images/svg/pdfsvg.svg'),
|
|
Image.asset(
|
|
'assets/images/png/pdf.png',
|
|
height: 20.h,
|
|
width: 20.w,
|
|
),
|
|
const Gap(5),
|
|
text15W600(pdfname),
|
|
],
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
Get.to(const ExploreUnseen());
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
width: 150,
|
|
decoration: ShapeDecoration(
|
|
color: const Color(0xFF0093FF),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8)),
|
|
),
|
|
child: Center(child: text15W600("View More")),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget ProductWidget({
|
|
required String text,
|
|
}) {
|
|
ProductsController productsController = Get.put(ProductsController());
|
|
return InkWell(
|
|
onTap: () {
|
|
mainController.updateTab(1);
|
|
if (text == "Swing Trade") {
|
|
productsController.selectedIndex.value = 0;
|
|
} else if (text == "Options") {
|
|
productsController.selectedIndex.value = 2;
|
|
} else {
|
|
productsController.selectedIndex.value = 1;
|
|
}
|
|
},
|
|
child: Container(
|
|
padding: const EdgeInsets.only(left: 20),
|
|
width: 398,
|
|
height: 83,
|
|
decoration: ShapeDecoration(
|
|
gradient: const LinearGradient(
|
|
begin: Alignment(0.99, -0.14),
|
|
end: Alignment(-0.99, 0.14),
|
|
colors: [Color(0xFF1538C5), Color(0xFF0B2074), Color(0xFF000D41)],
|
|
),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
text18W600(text),
|
|
// Image.asset(
|
|
// "assets/images/png/swingImage.png",
|
|
// height: 83,
|
|
// )
|
|
SvgPicture.asset(text == "Swing Trade"
|
|
? "assets/images/svg/swing_image.svg"
|
|
: text == "Options"
|
|
? "assets/images/svg/options_image.svg"
|
|
: "assets/images/svg/multibagger_image.svg")
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget commoncontainer({
|
|
required String text,
|
|
required String amount,
|
|
required String rate,
|
|
required double width,
|
|
required String percentageChange,
|
|
}) {
|
|
return Container(
|
|
height: 83,
|
|
decoration: ShapeDecoration(
|
|
color: const Color(0xFF0F2C53),
|
|
shape: RoundedRectangleBorder(
|
|
side: const BorderSide(width: 1, color: Color(0x7F4A73FB)),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 4.w),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
text14W400_979797(text),
|
|
sizedBoxWidth(5.w),
|
|
text16W600(amount),
|
|
sizedBoxWidth(5.w),
|
|
rate.contains("-")
|
|
? SvgPicture.asset(
|
|
'assets/images/svg/Line 587.svg',
|
|
height: 15.h,
|
|
width: 15.w,
|
|
)
|
|
: rate == "0.0"
|
|
? const SizedBox()
|
|
: SvgPicture.asset(
|
|
'assets/images/svg/up_arrow.svg',
|
|
height: 15.h,
|
|
width: 15.w,
|
|
),
|
|
],
|
|
),
|
|
sizedBoxHeight(6.w),
|
|
text14W400(
|
|
rate.contains("-")
|
|
? "$rate ($percentageChange%)"
|
|
: "+$rate ($percentageChange%)",
|
|
clr: rate.contains("-")
|
|
? const Color(0xFFFF0000)
|
|
: rate == "0.0"
|
|
? Colors.grey
|
|
: const Color(0xFF00FF19),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|