home api
This commit is contained in:
@@ -10,11 +10,13 @@ import 'package:traderscircuit/Utils/Common/CommonTabBar.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/model/HomeModel/home_model.dart';
|
||||
import 'package:traderscircuit/resources/routes/route_name.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/onBoarding/splashScreen1.dart';
|
||||
import 'package:traderscircuit/view_model/HomeApi/home_api.dart';
|
||||
|
||||
import '../../view_model/ProfileAPI/GetProfileApi.dart';
|
||||
|
||||
@@ -28,12 +30,19 @@ class HomeScreen extends StatefulWidget {
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
|
||||
RxString userName = "User".obs;
|
||||
HomeModel homeModel = HomeModel();
|
||||
|
||||
RxBool isApiCalling = true.obs;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
GetProfile().GetProfileAPI().then((value) {
|
||||
userName.value = ProfileObj!.data!.userName ?? "User";
|
||||
});
|
||||
HomeApi().getHomeData().then((value) {
|
||||
homeModel = HomeModel.fromJson(value.data);
|
||||
});
|
||||
isApiCalling.value = false;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -87,126 +96,251 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
child: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
children: [
|
||||
sizedBoxHeight(20.h),
|
||||
Obx(
|
||||
() => Text(
|
||||
"Welcome $userName",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.sp,
|
||||
fontFamily: 'hiragino',
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
child: isApiCalling.value
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
children: [
|
||||
commoncontainer(
|
||||
width: 195.w,
|
||||
text: 'NIFTY',
|
||||
amount: '22,286.95',
|
||||
rate: '+304.15 (+1.38%)'),
|
||||
sizedBoxWidth(10.w),
|
||||
commoncontainer(
|
||||
width: 240.w,
|
||||
text: 'BANKNIFTY',
|
||||
amount: '22,286.95',
|
||||
rate: '+896.10 (+1.94%)'),
|
||||
],
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(30.h),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.h,
|
||||
color: const Color(0xFF3A3A3A),
|
||||
),
|
||||
sizedBoxHeight(30.h),
|
||||
text22W500('View our products'),
|
||||
sizedBoxHeight(30.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ProductWidget(
|
||||
text: 'Options', subtext: 'Recommendation'),
|
||||
ProductWidget(
|
||||
text: 'Multibagger', subtext: 'Recommendation')
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(15.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ProductWidget(
|
||||
text: 'Swing Trade', subtext: 'Recommendation'),
|
||||
ProductWidget(
|
||||
text: 'OP + MB + ST', subtext: 'Recommendation'),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset('assets/images/svg/Vector (2).svg'),
|
||||
sizedBoxWidth(10.w),
|
||||
text18W500('UNLOCK NOW!'),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.h,
|
||||
color: const Color(0xFF3A3A3A),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
text22W600('Explore The Unseen'),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.exploreUnseen);
|
||||
},
|
||||
child: Container(
|
||||
height: 35.h,
|
||||
width: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(5.r),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF3A3A3A),
|
||||
)),
|
||||
child: Center(child: text16W500('View More')),
|
||||
sizedBoxHeight(20.h),
|
||||
Obx(
|
||||
() => Text(
|
||||
"Welcome $userName",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.sp,
|
||||
fontFamily: 'hiragino',
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(35.h),
|
||||
DefaultTabController(
|
||||
length: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
MyTabBar(),
|
||||
SizedBox(
|
||||
height: 700.h,
|
||||
child: TabBarView(
|
||||
sizedBoxHeight(25.h),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
ActiveCallsTab(),
|
||||
ExitedCallsTab(),
|
||||
commoncontainer(
|
||||
width: 195.w,
|
||||
text: 'NIFTY',
|
||||
amount: '22,286.95',
|
||||
rate: '+304.15 (+1.38%)'),
|
||||
sizedBoxWidth(10.w),
|
||||
commoncontainer(
|
||||
width: 240.w,
|
||||
text: 'BANKNIFTY',
|
||||
amount: '22,286.95',
|
||||
rate: '+896.10 (+1.94%)'),
|
||||
],
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(30.h),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.h,
|
||||
color: const Color(0xFF3A3A3A),
|
||||
),
|
||||
sizedBoxHeight(30.h),
|
||||
text22W500('View our products'),
|
||||
sizedBoxHeight(30.h),
|
||||
SizedBox(
|
||||
height: 210,
|
||||
child: GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount:
|
||||
2, // number of items in each row
|
||||
mainAxisSpacing: 8.0, // spacing between rows
|
||||
crossAxisSpacing:
|
||||
8.0, // spacing between columns
|
||||
childAspectRatio: 2.2,
|
||||
),
|
||||
itemCount: homeModel.data!.products!.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ProductWidget(
|
||||
text: homeModel.data!.products!
|
||||
.elementAt(index)
|
||||
.title!,
|
||||
subtext: "recommendation");
|
||||
},
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/images/svg/Vector (2).svg'),
|
||||
sizedBoxWidth(10.w),
|
||||
text18W500('UNLOCK NOW!'),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.h,
|
||||
color: const Color(0xFF3A3A3A),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
text22W600('Explore The Unseen'),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.exploreUnseen);
|
||||
},
|
||||
child: Container(
|
||||
height: 35.h,
|
||||
width: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF3A3A3A)
|
||||
.withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(5.r),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF3A3A3A),
|
||||
)),
|
||||
child: Center(child: text16W500('View More')),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(35.h),
|
||||
DefaultTabController(
|
||||
length: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
MyTabBar(),
|
||||
SizedBox(
|
||||
height: 250.h,
|
||||
child: TabBarView(
|
||||
children: [
|
||||
ActiveCallsTab(),
|
||||
ExitedCallsTab(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
text22W600('Content Bytes'),
|
||||
sizedBoxHeight(8.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 240.w,
|
||||
child: text16W400_DADADA(
|
||||
'The Beauty and Power of Video')),
|
||||
// sizedBoxWidth(10.w),
|
||||
const Spacer(),
|
||||
Container(
|
||||
height: 35.h,
|
||||
width: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF3A3A3A)
|
||||
.withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(5.r),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF3A3A3A),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.contentbytes);
|
||||
},
|
||||
child: text16W500('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": "",
|
||||
});
|
||||
},
|
||||
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: [
|
||||
CircleAvatar(
|
||||
radius: 23.r,
|
||||
backgroundImage: NetworkImage(
|
||||
homeModel
|
||||
.data!
|
||||
.contentByteVideo!
|
||||
.title ??
|
||||
""),
|
||||
),
|
||||
sizedBoxWidth(10.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
text18W500(homeModel
|
||||
.data!
|
||||
.contentByteVideo!
|
||||
.title ??
|
||||
""),
|
||||
// sizedBoxHeight(10.h),
|
||||
text12W400_979797(
|
||||
'20k views . 2 days ago'),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
])
|
||||
],
|
||||
@@ -253,156 +387,77 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
});
|
||||
return exitApp ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
Widget ActiveCallsTab() {
|
||||
return Column(
|
||||
children: [
|
||||
sizedBoxHeight(30.h),
|
||||
cardcallWidget(
|
||||
text: 'Trident Ltd', amount: '₹ 453 - ₹234', pdfname: 'Download Pdf'),
|
||||
sizedBoxHeight(30.h),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
text22W600('Content Bytes'),
|
||||
sizedBoxHeight(8.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 240.w,
|
||||
child: text16W400_DADADA('The Beauty and Power of Video')),
|
||||
// sizedBoxWidth(10.w),
|
||||
const Spacer(),
|
||||
Container(
|
||||
height: 35.h,
|
||||
width: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(5.r),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF3A3A3A),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.contentbytes);
|
||||
},
|
||||
child: text16W500('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": "",
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 200.h,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/images/png/Rectangle 17934.png'))),
|
||||
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: [
|
||||
CircleAvatar(
|
||||
radius: 23.r,
|
||||
backgroundImage: const AssetImage(
|
||||
'assets/images/png/Ellipse 1494.png'),
|
||||
),
|
||||
sizedBoxWidth(10.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
text18W500('Week of 21st February 2024'),
|
||||
// sizedBoxHeight(10.h),
|
||||
text12W400_979797('20k views . 2 days ago'),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget ExitedCallsTab() {
|
||||
List<Map<String, String>> cardcall = [
|
||||
{
|
||||
'text': 'Trident Ltd',
|
||||
'amount': '₹ 453 - ₹234',
|
||||
'pdfname': 'Download Pdf',
|
||||
},
|
||||
{
|
||||
'text': 'Trident Ltd',
|
||||
'amount': '₹ 453 - ₹234',
|
||||
'pdfname': 'Download Pdf',
|
||||
},
|
||||
{
|
||||
'text': 'Trident Ltd',
|
||||
'amount': '₹ 453 - ₹234',
|
||||
'pdfname': 'Download Pdf',
|
||||
},
|
||||
];
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
Widget ActiveCallsTab() {
|
||||
return Column(
|
||||
children: [
|
||||
sizedBoxHeight(30.h),
|
||||
Column(
|
||||
children: List.generate(cardcall.length, (index) {
|
||||
return Column(
|
||||
children: [
|
||||
cardcallWidget(
|
||||
text: cardcall[index]['text']!,
|
||||
amount: cardcall[index]['amount']!,
|
||||
pdfname: cardcall[index]['pdfname']!),
|
||||
sizedBoxHeight(20.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 text,
|
||||
required String amount,
|
||||
required String pdfname,
|
||||
required String action}) {
|
||||
return commonGlassContainer(
|
||||
width: double.infinity,
|
||||
height: 176.h,
|
||||
@@ -449,9 +504,15 @@ Widget cardcallWidget(
|
||||
height: 25.h,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.r),
|
||||
color: const Color(0xFFFFAD31),
|
||||
color: action == "Buy"
|
||||
? Colors.green
|
||||
: action == "Sell"
|
||||
? Colors.red
|
||||
: action == "Hold"
|
||||
? const Color(0xFFFFAD31)
|
||||
: Colors.white,
|
||||
),
|
||||
child: Center(child: text16W400_1B1B1B('Hold')),
|
||||
child: Center(child: text16W400_1B1B1B(action)),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user