Files
Traders_Circuit/lib/view/MainScreen/HomeScreen.dart

587 lines
19 KiB
Dart
Raw Normal View History

2024-03-21 00:32:12 -07:00
// import 'package:flutter/material.dart';
2024-03-19 22:57:32 -07:00
import 'package:flutter/material.dart';
2024-04-16 16:43:11 +05:30
import 'package:flutter/services.dart';
2024-03-19 22:57:32 -07:00
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.dart';
import 'package:traderscircuit/Utils/Common/CommonTabBar.dart';
2024-03-19 22:57:32 -07:00
import 'package:traderscircuit/Utils/Common/MainController.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
2024-03-19 23:09:10 -07:00
import 'package:traderscircuit/Utils/text.dart';
2024-03-19 22:57:32 -07:00
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/MainScreen/MainScreen.dart';
2024-04-04 11:45:15 +05:30
import 'package:traderscircuit/view/Sidemenu/ContentByte/PlayerWidget.dart';
2024-03-19 22:57:32 -07:00
import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
2024-04-16 16:43:11 +05:30
return WillPopScope(
onWillPop: () async {
_onBackButtonPressed(context);
return true; // Return true to allow the pop action
},
child: Scaffold(
drawerEnableOpenDragGesture: false,
key: _scaffoldKey1,
2024-03-19 22:57:32 -07:00
backgroundColor: Colors.black,
2024-04-16 16:43:11 +05:30
drawer: Container(child: SideMenu()),
extendBody: true,
appBar: AppBar(
scrolledUnderElevation: 0.0,
backgroundColor: Colors.black,
elevation: 0,
automaticallyImplyLeading: false,
titleSpacing: 0,
leading: InkWell(
onTap: () {
2024-04-16 16:43:11 +05:30
_scaffoldKey1.currentState?.openDrawer();
},
2024-04-16 16:43:11 +05:30
child: Center(
child: Image.asset(
'assets/images/png/menu.png',
height: 15.h,
width: 20.w,
),
),
2024-03-19 22:57:32 -07:00
),
2024-04-16 16:43:11 +05:30
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: Stack(
children: [
CommonBlurLeft(),
CommonBlurRight(),
Stack(children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: ListView(
physics: BouncingScrollPhysics(),
children: [
sizedBoxHeight(20.h),
Text(
"Welcome Afrid",
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
fontFamily: 'hiragino',
fontWeight: FontWeight.w500),
),
sizedBoxHeight(25.h),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
commoncontainer(
2024-04-26 03:24:36 -07:00
width: 195.w,
2024-04-16 16:43:11 +05:30
text: 'NIFTY',
amount: '22,286.95',
rate: '+304.15 (+1.38%)'),
sizedBoxWidth(10.w),
commoncontainer(
2024-04-26 03:24:36 -07:00
width: 240.w,
2024-04-16 16:43:11 +05:30
text: 'BANKNIFTY',
amount: '22,286.95',
rate: '+896.10 (+1.94%)'),
],
),
),
sizedBoxHeight(30.h),
Container(
width: double.infinity,
height: 1.h,
color: 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,
2024-03-19 22:57:32 -07:00
children: [
2024-04-16 16:43:11 +05:30
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'),
2024-03-19 22:57:32 -07:00
sizedBoxWidth(10.w),
2024-04-16 16:43:11 +05:30
text18W500('UNLOCK NOW!'),
2024-03-19 22:57:32 -07:00
],
),
2024-04-16 16:43:11 +05:30
sizedBoxHeight(25.h),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFF3A3A3A),
),
sizedBoxHeight(25.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
2024-03-19 22:57:32 -07:00
children: [
2024-04-16 16:43:11 +05:30
text22W600('Explore The Unseen'),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.exploreUnseen);
},
child: Container(
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
)),
child: Center(child: text16W500('View More')),
2024-03-19 22:57:32 -07:00
),
),
],
),
2024-04-16 16:43:11 +05:30
sizedBoxHeight(35.h),
DefaultTabController(
length: 2,
child: Column(
children: [
MyTabBar(),
SizedBox(
height: 700.h,
child: TabBarView(
children: [
ActiveCallsTab(),
ExitedCallsTab(),
],
),
),
],
),
),
],
),
)
])
],
),
bottomNavigationBar: bottomnavigationbar(mainController),
2024-03-19 22:57:32 -07:00
),
);
}
2024-04-16 16:43:11 +05:30
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;
}
2024-03-19 22:57:32 -07:00
}
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),
2024-03-29 11:54:08 +05:30
Row(
mainAxisAlignment: MainAxisAlignment.end,
2024-04-26 03:24:36 -07:00
crossAxisAlignment: CrossAxisAlignment.start,
2024-03-29 11:54:08 +05:30
children: [
2024-04-26 03:24:36 -07:00
SizedBox(
width: 240.w,
child: text16W400_DADADA('The Beauty and Power of Video')),
// sizedBoxWidth(10.w),
Spacer(),
2024-03-29 11:54:08 +05:30
Container(
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
),
2024-03-19 22:57:32 -07:00
),
2024-03-29 11:54:08 +05:30
child: Center(
child: InkWell(
onTap: () {
Get.toNamed(RouteName.contentbytes);
},
child: text16W500('View More'),
),
),
),
],
2024-03-19 22:57:32 -07:00
),
sizedBoxHeight(20.h),
commonGlassContainer(
borderradius: 8,
width: double.infinity,
2024-04-26 03:24:36 -07:00
height: 330.h,
2024-03-19 22:57:32 -07:00
customWidget: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
children: [
2024-03-29 17:59:32 +05:30
InkWell(
onTap: () {
2024-04-11 18:53:14 +05:30
Get.to(() => PlayerWidget(), arguments: {
"video_url": "",
});
2024-03-29 17:59:32 +05:30
},
child: Container(
height: 200.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
image: 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,
),
2024-03-19 22:57:32 -07:00
),
),
),
sizedBoxHeight(20.h),
Row(
2024-04-26 03:24:36 -07:00
crossAxisAlignment: CrossAxisAlignment.center,
2024-03-19 22:57:32 -07:00
children: [
CircleAvatar(
radius: 23.r,
backgroundImage:
AssetImage('assets/images/png/Ellipse 1494.png'),
),
sizedBoxWidth(10.w),
2024-04-26 03:24:36 -07:00
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W500('Week of 21st February 2024'),
// sizedBoxHeight(10.h),
text12W400_979797('20k views . 2 days ago'),
],
),
2024-03-19 22:57:32 -07:00
)
],
)
],
),
))
],
),
],
);
}
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(
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)
],
);
}),
),
],
),
2024-03-19 22:57:32 -07:00
);
}
Widget cardcallWidget(
{required String text, required String amount, required String pdfname}) {
return commonGlassContainer(
2024-03-19 22:57:32 -07:00
width: double.infinity,
height: 176.h,
borderradius: 8,
customWidget: Column(
2024-03-19 22:57:32 -07:00
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
GlassmorphicContainer(
width: 47.w,
height: 47.h,
borderRadius: 100,
blur: 10,
alignment: Alignment.center,
border: 0.9,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff3A3A3A),
Color(0xFF3A3A3A),
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color.fromRGBO(70, 5, 1, 0.8),
Color.fromRGBO(102, 102, 102, 0.8),
],
),
child: Center(
child:
Image.asset('assets/images/png/square_TRIDENT_com 1.png'),
),
),
sizedBoxWidth(15.w),
text18W600(text),
Spacer(),
Container(
width: 62.w,
height: 25.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
color: Color(0xFFFFAD31),
),
child: Center(child: text16W400_1B1B1B('Hold')),
)
],
),
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFF3A3A3A),
),
Padding(
padding: const EdgeInsets.all(20),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Initial Entry Price'),
sizedBoxHeight(5.h),
text15W600(amount)
],
),
2024-04-26 03:24:36 -07:00
// sizedBoxWidth(50.w),
Spacer(),
2024-03-19 22:57:32 -07:00
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Report'),
sizedBoxHeight(5.h),
Row(
children: [
// SvgPicture.asset('assets/images/svg/pdfsvg.svg'),
Image.asset(
'assets/images/png/pdf.png',
height: 20.h,
width: 20.w,
),
2024-03-19 22:57:32 -07:00
text15W600(pdfname),
],
)
],
)
],
),
)
],
),
);
}
Widget ProductWidget({required String text, required String subtext}) {
return GlassmorphicContainer(
width: 175.w,
height: 83.h,
borderRadius: 8,
blur: 10,
alignment: Alignment.center,
border: 0.8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff3A3A3A),
Color(0xFF3A3A3A),
],
),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W600(text),
sizedBoxWidth(8.w),
text14W400_979797(subtext),
],
),
),
);
}
Widget commoncontainer(
{required String text,
required String amount,
required String rate,
required double width}) {
return GlassmorphicContainer(
width: width,
height: 83.h,
borderRadius: 8,
blur: 10,
alignment: Alignment.center,
border: 0.8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff3A3A3A),
Color(0xFF3A3A3A),
],
),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
text14W400_979797(text),
sizedBoxWidth(8.w),
text16W600(amount),
sizedBoxWidth(8.w),
SvgPicture.asset(
'assets/images/svg/Line 587.svg',
height: 15.h,
width: 15.w,
),
],
),
sizedBoxHeight(8.w),
text14W400_00FF19(rate)
],
),
),
);
}