Files
Regroup/lib/Feed Module/Main_Screens/CalenderTab/CalenderTab.dart
2024-06-25 20:14:03 +05:30

556 lines
20 KiB
Dart

import 'package:calendar_date_picker2/calendar_date_picker2.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:regroup/Common/CommonBottomNavigationBar.dart';
import 'package:regroup/Common/CommonGlassmorphism.dart';
import 'package:regroup/Common/CommonTabBar.dart';
import 'package:regroup/Common/controller/MainScreen.dart';
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/blureffect.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
class CalenderTab extends StatefulWidget {
const CalenderTab({super.key});
@override
State<CalenderTab> createState() => _CalenderTabState();
}
class _CalenderTabState extends State<CalenderTab> {
List sessionData = [
{
"title": "Attending events",
"imagePath": "assets/images/png/Rectangle299.png",
"names": "Sports challenge"
},
{
"title": "Shown Interest",
"imagePath": "assets/images/png/Rectangle 25.png",
"names": "Ultimate athlete challenge"
},
{
"title": "Not going",
"imagePath": "assets/images/png/Rectangle 24.png",
"names": "Cyclotron challenge"
},
];
List communityData = [
{
"title": "Featured community",
"imagePath": "assets/images/png/Rectangle 24.png",
"names": "Sports challenge"
},
{
"title": "Featured community",
"imagePath": "assets/images/png/Rectangle 24.png",
"names": "Tri-sport challenge"
},
];
DateTime selectedDate = DateTime.now();
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: AppBar(
scrolledUnderElevation: 0.0,
backgroundColor: Color(0xff222935),
elevation: 0,
automaticallyImplyLeading: false,
title: text20700white("Sessions"),
actions: [
InkWell(
onTap: () {
Get.toNamed(RouteName.addEvent);
},
child: Container(
height: 35.h,
width: 35.w,
decoration: BoxDecoration(
color: Color(0xFFD90B2E),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Color(0x40000000),
offset: Offset(0, 6),
blurRadius: 8,
spreadRadius: 0,
),
],
),
child: Icon(Icons.add, color: Colors.white, weight: 2),
),
),
sizedBoxWidth(14.w),
InkWell(
onTap: () {
Get.toNamed(RouteName.setavailabillity);
},
child: Image.asset(
'assets/images/png/calender.png',
height: 22.h,
width: 22.w,
),
),
sizedBoxWidth(14.w),
InkWell(
onTap: () {
Get.toNamed(RouteName.managememberscal);
},
child: Image.asset(
'assets/images/png/Frame 9.png',
height: 25.h,
width: 25.w,
),
),
sizedBoxWidth(16.w),
],
),
body: Stack(children: [
const CommonBlurLeftRed(),
const CommonBlurRightRed(),
const CommonBlurLeft(),
const CommonBlurRight(),
Stack(children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Column(children: [
Expanded(
child: DefaultTabController(
length: 2,
// initialIndex: selectedIndex.value,
child: Column(
children: [
CommonTabBar(tabs: const [
Tab(
text: 'My sessions',
),
Tab(
text: 'Community session',
),
]),
Expanded(
child: TabBarView(
children: [
MySessionsTab(),
ComSessionTab(),
],
),
),
sizedBoxHeight(90.h),
],
),
),
),
]))
])
]),
bottomNavigationBar: bottomnavigationbar(mainController),
);
}
Widget MySessionsTab() {
return SingleChildScrollView(
child: Column(
children: [
sizedBoxHeight(20.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: commonGlassContainer(
width: double.infinity,
height: 136.h,
borderradius: 10.r,
customWidget: Row(
children: [
Padding(
padding: EdgeInsets.only(left: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 171.w,
child: text14w400_FCFCFC(
"Are you looking for resources ? We might have a solution"),
),
sizedBoxHeight(12.h),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.resourcepool);
},
child: text16w700_FCFCFCline("View resources"))
],
),
),
Spacer(),
Image.asset("assets/images/png/Rectangle 45.png")
],
),
border: 1),
),
sizedBoxHeight(25.h),
commonGlassContainer(
width: double.infinity,
height: 314.h,
borderradius: 1,
customWidget: CalendarDatePicker2(
config: CalendarDatePicker2Config(
calendarType: CalendarDatePicker2Type.range,
weekdayLabels: [
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat'
],
selectedYearTextStyle: TextStyle(color: Colors.white),
yearTextStyle: TextStyle(color: Colors.white),
selectedDayHighlightColor: Color(0xFFD90B2E),
controlsTextStyle: TextStyle(color: Colors.white),
dayTextStyle: TextStyle(color: Colors.white),
monthTextStyle: TextStyle(color: Colors.white),
weekdayLabelTextStyle: TextStyle(color: Colors.white),
nextMonthIcon: Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
lastMonthIcon: Icon(
Icons.arrow_back_ios_new,
color: Colors.white,
),
),
value: [selectedDate],
),
border: 0.9),
sizedBoxHeight(25.h),
Column(
children: List.generate(3, (index) {
return sessionCard(
imagePath: sessionData[index]["imagePath"],
names: sessionData[index]["names"],
title: sessionData[index]["title"]);
}),
)
],
),
);
}
Widget sessionCard({
required String title,
required String imagePath,
required String names,
}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18w700_FCFCFC(title),
sizedBoxHeight(25.h),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.eventDetails);
},
child: commonGlassContainer(
width: double.infinity,
height: 300.h,
borderradius: 10.r,
customWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 151.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.r),
topLeft: Radius.circular(10.r))),
child: Image.asset(
imagePath,
fit: BoxFit.cover,
)),
sizedBoxHeight(20.h),
Row(
children: [
sizedBoxWidth(16.w),
Image.asset(
"assets/images/png/calender.png",
color: Colors.white.withOpacity(0.8),
height: 12.h,
width: 12.w,
),
sizedBoxWidth(8.w),
text10w400_FCFCFC_blur("29th april 2024"),
sizedBoxWidth(10.w),
Container(
height: 15,
width: 1,
color: Colors.white.withOpacity(0.8),
),
sizedBoxWidth(10.w),
Image.asset(
"assets/images/png/clock.png",
color: Colors.white.withOpacity(0.8),
height: 12.h,
width: 12.w,
),
sizedBoxWidth(8.w),
text10w400_FCFCFC_blur("3:00 pm"),
sizedBoxWidth(10.w),
Container(
height: 15,
width: 1,
color: Colors.white.withOpacity(0.8),
),
sizedBoxWidth(10.w),
Image.asset(
"assets/images/png/Black.png",
color: Colors.white.withOpacity(0.8),
height: 12.h,
width: 12.w,
),
sizedBoxWidth(8.w),
text10w400_FCFCFC_blur("Iron titans fitness crew"),
],
),
sizedBoxHeight(15.h),
Padding(
padding: EdgeInsets.only(left: 16.w),
child: text18w700_FCFCFC(names),
),
sizedBoxHeight(15.h),
Row(
children: [
sizedBoxWidth(16.w),
CircleAvatar(
radius: 12.r,
backgroundImage:
AssetImage("assets/images/png/Ellipse 52.png"),
),
sizedBoxWidth(8.w),
text14w400_FCFCFC("Ryan dorwat"),
],
)
]),
border: 1),
)
],
),
);
}
Widget ComSessionTab() {
return SingleChildScrollView(
child: Column(
children: [
sizedBoxHeight(20.h),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: CustomTextFormField(
leadingIcon: SizedBox(
height: 23,
width: 23,
child: Center(
child: Image.asset(
"assets/images/png/ion_search-outline.png",
height: 23,
width: 23,
),
),
),
hintText: "Search community sessions",
),
),
sizedBoxHeight(25.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: commonGlassContainer(
width: double.infinity,
height: 136.h,
borderradius: 10.r,
customWidget: Row(
children: [
Padding(
padding: EdgeInsets.only(left: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 171.w,
child: text14w400_FCFCFC(
"Are you looking for resources ? We might have a solution"),
),
sizedBoxHeight(12.h),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.resourcepool);
},
child: text16w700_FCFCFCline("View resources"))
],
),
),
Spacer(),
Image.asset("assets/images/png/Rectangle 45.png")
],
),
border: 1),
),
sizedBoxHeight(25.h),
commonGlassContainer(
width: double.infinity,
height: 314.h,
borderradius: 1,
customWidget: CalendarDatePicker2(
config: CalendarDatePicker2Config(
calendarType: CalendarDatePicker2Type.range,
weekdayLabels: [
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat'
],
selectedYearTextStyle: TextStyle(color: Colors.white),
yearTextStyle: TextStyle(color: Colors.white),
selectedDayHighlightColor: Color(0xFFD90B2E),
controlsTextStyle: TextStyle(color: Colors.white),
dayTextStyle: TextStyle(color: Colors.white),
monthTextStyle: TextStyle(color: Colors.white),
weekdayLabelTextStyle: TextStyle(color: Colors.white),
nextMonthIcon: Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
lastMonthIcon: Icon(
Icons.arrow_back_ios_new,
color: Colors.white,
),
),
value: [selectedDate],
),
border: 0.9),
sizedBoxHeight(25.h),
Column(
children: List.generate(communityData.length, (index) {
return communitysessionCard(
imagePath: communityData[index]["imagePath"],
names: communityData[index]["names"],
title: communityData[index]["title"]);
}),
)
],
),
);
}
}
Widget communitysessionCard({
required String title,
required String imagePath,
required String names,
}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18w700_FCFCFC(title),
sizedBoxHeight(25.h),
commonGlassContainer(
width: double.infinity,
height: 290.h,
borderradius: 10.r,
customWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 151.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.r),
topLeft: Radius.circular(10.r))),
child: Image.asset(
imagePath,
fit: BoxFit.cover,
)),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sizedBoxHeight(16.h),
Row(
children: [
sizedBoxWidth(16.w),
Image.asset(
"assets/images/png/calender.png",
color: Colors.white.withOpacity(0.8),
height: 12.h,
width: 12.w,
),
sizedBoxWidth(8.w),
text10w400_FCFCFC_blur("29th april 2024"),
],
),
sizedBoxHeight(15.h),
Padding(
padding: EdgeInsets.only(left: 16.w),
child: text18w700_FCFCFC(names),
),
sizedBoxHeight(15.h),
Row(
children: [
sizedBoxWidth(16.w),
CircleAvatar(
radius: 12.r,
backgroundImage: AssetImage(
"assets/images/png/Ellipse 52.png"),
),
sizedBoxWidth(8.w),
text14w400_FCFCFC("Ryan dorwat"),
],
),
]),
Spacer(),
Container(
height: 138.h,
width: 143.w,
decoration: BoxDecoration(
color: Color(0xFFD90B2E),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(10.r),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
text25700FCFCFC("14"),
text16w700_FCFCFCblur("April 2024"),
sizedBoxHeight(12.h),
text16w700_FCFCFC("3:00 pm")
],
),
)
],
),
],
),
border: 1)
],
),
);
}