590 lines
20 KiB
Dart
590 lines
20 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
import 'package:flutter_svg/svg.dart';
|
||
import 'package:get/get.dart';
|
||
import 'package:traderscircuit/Utils/Common/sized_box.dart';
|
||
import 'package:traderscircuit/Utils/text.dart';
|
||
import 'package:traderscircuit/resources/routes/route_name.dart';
|
||
|
||
class SideMenu extends StatefulWidget {
|
||
const SideMenu({super.key});
|
||
|
||
@override
|
||
State<SideMenu> createState() => _SideMenuState();
|
||
}
|
||
|
||
class _SideMenuState extends State<SideMenu> {
|
||
List sideBarData = [
|
||
{
|
||
"imagePath": "assets/images/svg/sidemenu/Faq.svg",
|
||
"text": "FAQ’s",
|
||
},
|
||
{
|
||
"imagePath": "assets/images/svg/sidemenu/contact.svg",
|
||
"text": "Contact Us"
|
||
},
|
||
{
|
||
"imagePath": "assets/images/svg/sidemenu/rate.svg",
|
||
"text": "Rate this app"
|
||
},
|
||
{
|
||
"imagePath": "assets/images/svg/sidemenu/terms.svg",
|
||
"text": "Terms & Conditions"
|
||
},
|
||
{
|
||
"imagePath": "assets/images/svg/sidemenu/privacy.svg",
|
||
"text": "Privacy Policy"
|
||
},
|
||
{"imagePath": "assets/images/svg/sidemenu/about.svg", "text": "About Us"},
|
||
{
|
||
"imagePath": "assets/images/svg/sidemenu/settingmenu.svg",
|
||
"text": "Settings"
|
||
},
|
||
{"imagePath": "assets/images/svg/sidemenu/logout.svg", "text": "Logout"},
|
||
];
|
||
|
||
Color sideBarBackgroundColor = const Color(0xFF1B243D);
|
||
Color whitecolor = Colors.white;
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Scaffold(
|
||
backgroundColor: Colors.black,
|
||
appBar: AppBar(
|
||
toolbarHeight: 60.h,
|
||
elevation: 0,
|
||
backgroundColor: Colors.black,
|
||
leading: Container(
|
||
child: Align(
|
||
alignment: Alignment.bottomCenter,
|
||
child: GestureDetector(
|
||
onTap: () {
|
||
// Get.back();
|
||
Scaffold.of(context).closeDrawer();
|
||
},
|
||
child: Container(
|
||
width: 25.w,
|
||
height: 25.h,
|
||
decoration: const ShapeDecoration(
|
||
color: Colors.black,
|
||
shape: OvalBorder(),
|
||
),
|
||
child: Align(
|
||
alignment: Alignment.center,
|
||
child: SizedBox(
|
||
width: 25.w,
|
||
height: 25.h,
|
||
child: Icon(
|
||
Icons.arrow_back_ios,
|
||
color: Colors.white,
|
||
size: 25.h,
|
||
weight: 25.w,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
body: Stack(
|
||
children: [
|
||
// CommonBlurLeft(),
|
||
// CommonBlurRight(),
|
||
Stack(children: [
|
||
ListView(children: [
|
||
sizedBoxHeight(30.h),
|
||
InkWell(
|
||
onTap: () {
|
||
setState(() {
|
||
// Get.toNamed(RouteName.investorprofile);
|
||
});
|
||
},
|
||
child: Padding(
|
||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||
child: Row(
|
||
mainAxisAlignment: MainAxisAlignment.start,
|
||
children: [
|
||
Container(
|
||
width: 80.w,
|
||
height: 80.h,
|
||
decoration: const ShapeDecoration(
|
||
image: DecorationImage(
|
||
image: AssetImage(
|
||
"assets/images/png/Ellipse 560.png"),
|
||
fit: BoxFit.fill,
|
||
),
|
||
shape: OvalBorder(),
|
||
),
|
||
),
|
||
sizedBoxWidth(20.w),
|
||
Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
text18W400('Afrid Mulla'),
|
||
sizedBoxHeight(4.h),
|
||
text18W400('My Profile'),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
sizedBoxHeight(25.h),
|
||
Container(
|
||
height: 1,
|
||
margin: EdgeInsets.symmetric(vertical: 10.h),
|
||
decoration: const BoxDecoration(
|
||
border: Border(
|
||
bottom: BorderSide(
|
||
color: Color.fromRGBO(176, 176, 176, 0.5),
|
||
width: 1,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
ListTile(
|
||
leading: SizedBox(
|
||
width: 25.w,
|
||
height: 25.h,
|
||
child: SvgPicture.asset(
|
||
'assets/images/svg/sidemenu/sub.svg')),
|
||
title: text18W400('My Subscription'),
|
||
trailing: Container(
|
||
height: 35.h,
|
||
width: 122.w,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(6.r),
|
||
color: const Color(0xFF34C759),
|
||
),
|
||
child: Center(child: text14W500_black('Upgrade')),
|
||
),
|
||
selected: true,
|
||
onTap: () {
|
||
setState(() {
|
||
// Get.toNamed(RouteName.privacypolicy);
|
||
});
|
||
},
|
||
),
|
||
Container(
|
||
height: 1,
|
||
margin: EdgeInsets.symmetric(vertical: 10.h),
|
||
decoration: const BoxDecoration(
|
||
border: Border(
|
||
bottom: BorderSide(
|
||
color: Color.fromRGBO(176, 176, 176, 0.5),
|
||
width: 1,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
ListTile(
|
||
leading: SizedBox(
|
||
width: 25.w,
|
||
height: 25.h,
|
||
child: SvgPicture.asset(
|
||
'assets/images/svg/sidemenu/content.svg')),
|
||
title: text18W400('Content bytes'),
|
||
selected: true,
|
||
onTap: () {
|
||
setState(() {
|
||
// Get.toNamed(RouteName.privacypolicy);
|
||
});
|
||
},
|
||
),
|
||
Container(
|
||
height: 1,
|
||
margin: EdgeInsets.symmetric(vertical: 10.h),
|
||
decoration: const BoxDecoration(
|
||
border: Border(
|
||
bottom: BorderSide(
|
||
color: Color.fromRGBO(176, 176, 176, 0.5),
|
||
width: 1,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
ListTile(
|
||
leading: SizedBox(
|
||
width: 25.w,
|
||
height: 25.h,
|
||
child: SvgPicture.asset(
|
||
'assets/images/svg/sidemenu/sub.svg')),
|
||
title: text18W400('Update My KYC'),
|
||
trailing: Container(
|
||
height: 40.h,
|
||
width: 122.w,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(6.r),
|
||
color: const Color(0xFF3A3A3A).withOpacity(0.6),
|
||
border: Border.all(color: const Color(0xFF9A0000))),
|
||
child: Padding(
|
||
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
||
child: Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
text12W400('Pending'),
|
||
Container(
|
||
height: 30.h,
|
||
width: 30.h,
|
||
decoration: const BoxDecoration(
|
||
image: DecorationImage(
|
||
image: AssetImage(
|
||
'assets/images/png/Ellipse 1498.png',
|
||
),
|
||
fit: BoxFit.cover)),
|
||
child: Center(child: text8W400('40%')),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
selected: true,
|
||
onTap: () {
|
||
Get.toNamed(RouteName.kyc);
|
||
},
|
||
),
|
||
Container(
|
||
height: 1,
|
||
margin: EdgeInsets.symmetric(vertical: 10.h),
|
||
decoration: const BoxDecoration(
|
||
border: Border(
|
||
bottom: BorderSide(
|
||
color: Color.fromRGBO(176, 176, 176, 0.5),
|
||
width: 1,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
ListTile(
|
||
leading: SizedBox(
|
||
width: 25.w,
|
||
height: 25.h,
|
||
child: SvgPicture.asset(
|
||
'assets/images/svg/sidemenu/sub.svg')),
|
||
title: text18W400('My Subscription'),
|
||
trailing: Container(
|
||
height: 35.h,
|
||
width: 122.w,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(6.r),
|
||
color: const Color(0xFF0093FF),
|
||
),
|
||
child: Center(child: text14W500('Conservative')),
|
||
),
|
||
selected: true,
|
||
onTap: () {
|
||
setState(() {
|
||
// Get.toNamed(RouteName.privacypolicy);
|
||
});
|
||
},
|
||
),
|
||
Column(
|
||
children: List.generate(sideBarData.length, (index) {
|
||
return sideBarTile(
|
||
image: sideBarData[index]["imagePath"],
|
||
text: sideBarData[index]["text"],
|
||
onTap: () {
|
||
print(index);
|
||
navigateTo(index, context);
|
||
},
|
||
);
|
||
}),
|
||
),
|
||
// SingleChildScrollView(
|
||
// physics: NeverScrollableScrollPhysics(),
|
||
// child: ListView.builder(
|
||
// shrinkWrap: true,
|
||
// padding: EdgeInsets.zero,
|
||
// itemCount: sideBarData.length,
|
||
// itemBuilder: (_, index) {
|
||
// return sideBarTile(
|
||
// image: sideBarData[index]["imagePath"],
|
||
// text: sideBarData[index]["text"],
|
||
// onTap: () {
|
||
// navigateTo(index, context);
|
||
// },
|
||
// );
|
||
// },
|
||
// ),
|
||
// ),
|
||
sizedBoxHeight(80.h),
|
||
]),
|
||
]),
|
||
],
|
||
));
|
||
}
|
||
}
|
||
|
||
LogOutdialog(context) {
|
||
return showDialog(
|
||
// barrierDismissible: false,
|
||
context: context,
|
||
builder: (context) => Column(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
AlertDialog(
|
||
insetPadding: EdgeInsets.symmetric(horizontal: 16.w),
|
||
backgroundColor:
|
||
Get.isDarkMode ? Colors.black : const Color(0XFF1B243D),
|
||
contentPadding: EdgeInsets.fromLTRB(29.w, 44.h, 29.w, 35.h),
|
||
shape: RoundedRectangleBorder(
|
||
borderRadius: BorderRadius.all(Radius.circular(5.r)),
|
||
),
|
||
content: Column(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
Container(
|
||
height: 87.h,
|
||
width: 80.w,
|
||
decoration: const BoxDecoration(
|
||
shape: BoxShape.circle, color: Color(0xFFC18948)),
|
||
child: Align(
|
||
alignment: Alignment.topLeft,
|
||
child: Container(
|
||
height: 79.h,
|
||
width: 73.w,
|
||
decoration: BoxDecoration(
|
||
shape: BoxShape.circle,
|
||
color: const Color(0xFFE8C69F).withOpacity(0.5),
|
||
),
|
||
child: Center(
|
||
child: SvgPicture.asset(
|
||
'assets/images/svg/apps 1.svg',
|
||
// fit: BoxFit.fill,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
sizedBoxHeight(30.h),
|
||
Text(
|
||
"Are you sure you want to logout ?",
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
fontFamily: "manrope",
|
||
fontWeight: FontWeight.w400,
|
||
fontSize: 20.sp,
|
||
color: const Color(0xFFFFFFFF)),
|
||
),
|
||
sizedBoxHeight(40.h),
|
||
const Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
// SizedBox(
|
||
// width: 140.w,
|
||
// child: CommonBorderNoBtn(
|
||
// text: 'Yes',
|
||
// onTap: () {
|
||
// // prefs.clear();
|
||
// // Get.offNamed(RouteName.loginScreen);
|
||
// },
|
||
// )),
|
||
// SizedBox(
|
||
// width: 140.w,
|
||
// child: CommonYesBtn(
|
||
// text: 'No',
|
||
// onTap: () {
|
||
// Get.back();
|
||
// },
|
||
// ),
|
||
// ),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
|
||
void navigateTo(int index, BuildContext context) {
|
||
switch (index) {
|
||
case 0:
|
||
{
|
||
// Get.toNamed(RouteName.FAQScreen);
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
Get.toNamed(RouteName.contactUsMain);
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
// Get.toNamed(RouteName.settingsScreen);
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
{
|
||
// Get.toNamed(RouteName.contactUsMain);
|
||
}
|
||
break;
|
||
|
||
case 4:
|
||
{
|
||
Get.toNamed(RouteName.termsandcondition);
|
||
}
|
||
break;
|
||
|
||
case 5:
|
||
{
|
||
Get.toNamed(RouteName.privacypolicy);
|
||
}
|
||
break;
|
||
case 6:
|
||
{
|
||
Get.toNamed(RouteName.aboutus);
|
||
}
|
||
break;
|
||
|
||
case 7:
|
||
{
|
||
Get.bottomSheet(
|
||
Column(
|
||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
children: [
|
||
SizedBox(
|
||
width: double.infinity,
|
||
child: SvgPicture.asset('assets/images/svg/logout.svg'),
|
||
),
|
||
Text(
|
||
'Are You Sure You Want To Logout?',
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
fontSize: 20.sp,
|
||
),
|
||
),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
children: [
|
||
InkWell(
|
||
onTap: () {
|
||
Navigator.of(context).pop();
|
||
},
|
||
child: Container(
|
||
width: 150.w,
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(5.r),
|
||
border: Border.all(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
child: Padding(
|
||
padding: const EdgeInsets.all(18.0),
|
||
child: Text(
|
||
'No',
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
fontSize: 16.sp,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
InkWell(
|
||
// onTap: () async {
|
||
// FirebaseAuth auth = FirebaseAuth.instance;
|
||
// final GoogleSignIn googleSignIn = GoogleSignIn();
|
||
|
||
// if (auth.currentUser != null &&
|
||
// auth.currentUser?.providerData.any((userInfo) =>
|
||
// userInfo.providerId == 'google.com') ==
|
||
// true) {
|
||
// await googleSignIn.signOut();
|
||
// Navigator.of(context).pop();
|
||
// Get.back();
|
||
// Get.toNamed(RouteName.login);
|
||
// } else {
|
||
// SharedPreferences prefs =
|
||
// await SharedPreferences.getInstance();
|
||
// prefs.remove('token');
|
||
// Navigator.of(context).pop();
|
||
// Get.back();
|
||
// Get.toNamed(RouteName.login);
|
||
// }
|
||
// },
|
||
onTap: () {
|
||
Get.back();
|
||
// Get.toNamed(RouteName.login);
|
||
},
|
||
child: Container(
|
||
width: 150.w,
|
||
decoration: BoxDecoration(
|
||
color: const Color(0xFF3192D8),
|
||
borderRadius: BorderRadius.circular(5.r),
|
||
),
|
||
child: Padding(
|
||
padding: const EdgeInsets.all(18.0),
|
||
child: Text(
|
||
'Yes',
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 16.sp,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
backgroundColor: Colors.white,
|
||
);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
{
|
||
null;
|
||
}
|
||
}
|
||
}
|
||
|
||
class sideBarTile extends StatelessWidget {
|
||
final String image;
|
||
final String text;
|
||
final void Function()? onTap;
|
||
|
||
sideBarTile({
|
||
required this.image,
|
||
required this.text,
|
||
this.onTap,
|
||
super.key,
|
||
});
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Column(
|
||
children: [
|
||
Container(
|
||
height: 1,
|
||
margin: EdgeInsets.symmetric(vertical: 10.h),
|
||
decoration: const BoxDecoration(
|
||
border: Border(
|
||
bottom: BorderSide(
|
||
color: Color.fromRGBO(176, 176, 176, 0.5),
|
||
width: 1,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
ListTile(
|
||
leading: SvgPicture.asset(image),
|
||
title: text18W400(text),
|
||
selected: true,
|
||
onTap: onTap),
|
||
],
|
||
);
|
||
}
|
||
}
|