Merge pull request #163 from WDI-Ideas/RegroupPriyanka

selectTimeslot screen done
This commit is contained in:
priyankahadpad
2024-08-26 19:13:31 +05:30
committed by GitHub
5 changed files with 131 additions and 550 deletions

View File

@@ -1,547 +0,0 @@
import 'dart:io';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:regroup/Common/CommonButton.dart';
import 'package:regroup/Common/CommonDropDown.dart';
import 'package:regroup/Common/CommonGlassmorphism.dart';
import 'package:regroup/Common/CommonWidget.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/ImageUpload.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
class SelectTime extends StatefulWidget {
const SelectTime({super.key});
@override
State<SelectTime> createState() => _SelectTimeState();
}
class _SelectTimeState extends State<SelectTime> {
RxBool isChecked = false.obs;
List<File?> bannerPath = [];
bool isbannerAdded = false;
TextEditingController dateController = TextEditingController();
TextEditingController dateController2 = TextEditingController();
TimeOfDay? starttime = const TimeOfDay(hour: 15, minute: 0);
TimeOfDay? endtime = const TimeOfDay(hour: 15, minute: 0);
String formatTimeOfDay(TimeOfDay time) {
final now = DateTime.now();
final dt = DateTime(now.year, now.month, now.day, time.hour, time.minute);
final format =
MediaQuery.of(context).alwaysUse24HourFormat ? 'HH:mm' : 'h:mm a';
return DateFormat(format).format(dt);
}
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: const Color(0xFF222935),
extendBody: true,
resizeToAvoidBottomInset: false,
appBar: const CommonAppbar(
titleTxt: "",
),
body: Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16400white("Event Title"),
sizedBoxHeight(14.h),
CustomTextFormField(
leadingIcon: SizedBox(
height: 22.h,
width: 18.w,
child: Center(
child: Image.asset(
"assets/images/png/Vector (5)12.png",
fit: BoxFit.cover,
height: 22.h,
width: 18.w,
),
),
),
hintText: "Tri-sport challenge",
),
text16400white("Event image"),
sizedBoxHeight(20.h),
GestureDetector(
onTap: () {
ImageUploadBottomSheet().showModal(
context,
false,
(result) {
var file = File(result);
bannerPath.add(file);
isbannerAdded = true;
setState(() {});
},
);
},
child: DottedBorder(
strokeWidth: 1,
dashPattern: const [7, 4],
borderType: BorderType.RRect,
radius: Radius.circular(14.r),
color: const Color(0xFF434A53),
child: commonGlassUI(
// border: 0,
width: double.infinity,
height: 130.h,
borderRadius: BorderRadius.circular(10.r),
customWidget: bannerPath.isNotEmpty && isbannerAdded
? Stack(children: [
Image.file(
bannerPath[0]!,
fit: BoxFit.cover,
width: double.infinity,
),
Positioned(
right: 5,
bottom: 5,
child: GestureDetector(
onTap: () {
bannerPath.clear();
isbannerAdded = false;
setState(() {});
},
child: Container(
width: 27,
height: 27,
decoration: ShapeDecoration(
color: const Color(0xFF7E7E7E),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5)),
),
child: const Icon(
Icons.delete_outline_outlined,
color: Colors.white,
))),
),
])
: Padding(
padding: EdgeInsets.symmetric(vertical: 16.h),
child: Column(
children: [
Image.asset(
"assets/images/png/bi_download.png",
height: 36.h,
width: 36.w,
),
sizedBoxHeight(10.h),
text14w400white("Upload event image"),
sizedBoxHeight(8.h),
text8w400_8A8A8A(
"Allowed file extensions: jpg, png, gif Max file size: 10 MB"),
],
),
),
),
),
),
sizedBoxHeight(20.h),
commonGlassUI(
width: double.infinity,
height: 60.h,
borderRadius: BorderRadius.circular(10.r),
customWidget: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Row(children: [
Container(
height: 40.h,
width: 40.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.r)),
child: Image.asset(
"assets/images/png/img2.png",
fit: BoxFit.cover,
),
),
sizedBoxWidth(8.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
text14400white("Event1.png"),
sizedBoxHeight(2.h),
text12w400_FCFCFC_blur("10 kb")
],
),
const Spacer(),
Image.asset(
'assets/images/png/cancelicon.png',
height: 20.h,
width: 20.w,
)
]),
),
),
borderwidth: 1),
sizedBoxHeight(20.h),
text16400white("Type of event"),
sizedBoxHeight(14.h),
CommonDropdownBtn(
hint: 'Race',
items: const ['', ''],
leadingImage: SizedBox(
height: 22.h,
width: 18.w,
child: Center(
child: Image.asset(
"assets/images/png/Vector (5)12.png",
),
),
),
),
sizedBoxHeight(20.h),
text16400white("Sport"),
sizedBoxHeight(14.h),
CommonDropdownBtn(
hint: 'Cycling',
items: const [],
leadingImage: SizedBox(
height: 22.h,
width: 18.w,
child: Center(
child: Image.asset(
"assets/images/png/Vector (4).png",
),
),
),
),
sizedBoxHeight(20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16400white("Start date "),
sizedBoxHeight(10.h),
GestureDetector(
onTap: () =>
datePicker(context, dateController),
child: AbsorbPointer(
child: CustomTextFormField(
textEditingController: dateController,
hintText: "1-4-2024",
leadingIcon: SizedBox(
height: 20.h,
width: 20.w,
child: Center(
child: Image.asset(
"assets/images/png/calender.png",
height: 20.h,
width: 20.w,
),
),
),
),
),
)
],
),
),
sizedBoxWidth(10.h),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16400white("End date"),
sizedBoxHeight(10.h),
GestureDetector(
onTap: () =>
datePicker(context, dateController2),
child: AbsorbPointer(
child: CustomTextFormField(
textEditingController: dateController2,
hintText: "4-4-2024",
leadingIcon: SizedBox(
height: 20.h,
width: 20.w,
child: Center(
child: Image.asset(
"assets/images/png/calender.png",
height: 20.h,
width: 20.w,
),
),
),
),
),
),
]))
]),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16400white("Start time"),
sizedBoxHeight(14.h),
GestureDetector(
onTap: () async {
final TimeOfDay? pickedTime =
await showCustomTimePicker(context,
initialTime: starttime);
if (pickedTime != null) {
setState(() {
starttime = pickedTime;
});
}
},
child: commonGlassUI(
width: 174.w,
height: 50.h,
borderRadius: BorderRadius.circular(30.r),
customWidget: Center(
child: Row(children: [
sizedBoxWidth(16.w),
Image.asset(
"assets/images/png/clock.png",
height: 20.h,
width: 20.w,
),
sizedBoxWidth(8.w),
text16w400_white(
formatTimeOfDay(starttime!)),
]),
),
borderwidth: 1),
)
],
),
const Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16400white("End time"),
sizedBoxHeight(14.h),
GestureDetector(
onTap: () async {
final TimeOfDay? pickedTime =
await showCustomTimePicker(context,
initialTime: endtime);
if (pickedTime != null) {
setState(() {
endtime = pickedTime;
});
}
},
child: commonGlassUI(
width: 174.w,
height: 50.h,
borderRadius: BorderRadius.circular(30.r),
customWidget: Center(
child: Row(children: [
sizedBoxWidth(16.w),
Image.asset(
"assets/images/png/clock.png",
height: 20.h,
width: 20.w,
),
sizedBoxWidth(8.w),
text16w400_white(
formatTimeOfDay(endtime!)),
]),
),
borderwidth: 1),
)
],
),
],
),
sizedBoxHeight(8.h),
Row(
children: [
Obx(() {
return commonGlassUI(
borderwidth: 1,
borderRadius: BorderRadius.circular(2),
height: 23.h,
width: 23.w,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Transform.scale(
scale: 1.4,
child: Checkbox(
side:
const BorderSide(color: Color(0xFF434A53)),
value: isChecked.value,
activeColor: Colors.transparent,
checkColor: Colors.white,
onChanged: ((value) {
isChecked.value = value!;
}),
),
),
);
}),
sizedBoxWidth(8.w),
text14w400_FCFCFC("Repeat event")
],
),
sizedBoxHeight(20.h),
text16400white("Post in"),
sizedBoxHeight(14.h),
CommonDropdownBtn(
hint: '',
items: const [],
leadingImage: SizedBox(
height: 22.h,
width: 28.w,
child: Center(
child: Image.asset("assets/images/png/Black.png"),
),
),
),
sizedBoxHeight(20.h),
text16400white("Add Users"),
sizedBoxHeight(14.h),
CustomTextFormField(
onTap: () {
Get.toNamed(RouteName.addUsers);
},
leadingIcon: SizedBox(
height: 22.h,
width: 18.w,
child: Center(
child: Image.asset(
"assets/images/png/Group122.png",
fit: BoxFit.cover,
height: 18.h,
width: 18.w,
),
),
),
hintText: "",
suffixIcon: const Icon(Icons.arrow_forward,
color: Color(0xFFFFFFFF)),
),
sizedBoxHeight(20.h),
containerWidget(
imagePath: "assets/images/png/Ellipse 52.png",
title: "Ryan Dorwart"),
sizedBoxHeight(10.h),
containerWidget(
imagePath: "assets/images/png/Ellipse 52.png",
title: "Ryan Dorwart"),
sizedBoxHeight(10.h),
Align(
alignment: Alignment.center,
child: text14400white("View more")),
sizedBoxHeight(30.h),
text16400white("Location"),
sizedBoxHeight(14.h),
CustomTextFormField(
leadingIcon: SizedBox(
height: 19.h,
width: 15.w,
child: Center(
child: Image.asset(
"assets/images/png/Group 58645.png",
height: 19.h,
width: 15.w,
),
),
),
hintText: "Elm street, London, United kingdom",
),
text16400white("Reminder"),
sizedBoxHeight(14.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
commonGlassUI(
height: 50.h,
width: 127.w,
borderRadius: BorderRadius.circular(30.r),
borderwidth: 1,
customWidget: Center(
child: text16400white("2"),
)),
commonGlassUI(
height: 50.h,
width: 215.w,
borderRadius: BorderRadius.circular(30.r),
borderwidth: 1,
customWidget: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
text16400white("Minutes"),
sizedBoxWidth(5.w),
const Icon(
Icons.keyboard_arrow_down,
color: Colors.white,
)
],
),
))
],
),
sizedBoxHeight(35.h),
CommonBtn(text: "Save"),
sizedBoxHeight(70.h),
]),
),
)
]));
}
Widget containerWidget({
required String imagePath,
required String title,
}) {
return commonGlassUI(
width: double.infinity,
height: 50.h,
borderRadius: BorderRadius.circular(30),
customWidget: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
backgroundImage: AssetImage(imagePath),
),
sizedBoxWidth(8.w),
text16400white(title),
const Spacer(),
Image.asset(
"assets/images/png/cancelicon.png",
height: 20.h,
width: 20.w,
),
],
),
),
),
borderwidth: 1);
}
}

View File

@@ -0,0 +1,121 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:regroup/Common/CommonTabBar.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
class SelectTimeSlot extends StatefulWidget {
const SelectTimeSlot({super.key});
@override
State<SelectTimeSlot> createState() => _SelectTimeSlotState();
}
class _SelectTimeSlotState extends State<SelectTimeSlot> {
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFF222935),
extendBody: true,
appBar: const CommonAppbar(
titleTxt: "Select time slot",
),
body: Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
DefaultTabController(
length: 2,
// initialIndex: selectedIndex.value,
child: Column(
children: [
CalendarTabBar(tabs: const [
Tab(
text: 'Week',
),
Tab(
text: 'Day',
),
]),
SizedBox(
height: 600.h,
child: TabBarView(
children: [
groupTab(),
subgroupTab(),
],
),
),
],
),
),
])
]));
}
Widget groupTab() {
return Column(
children: const [],
);
}
Widget subgroupTab() {
return Column(
children: const [],
);
}
}
class CalendarTabBar extends StatelessWidget {
// Set the desired height
final List<Tab> tabs;
CalendarTabBar({
super.key,
required this.tabs,
});
@override
Widget build(BuildContext context) {
return Container(
width: 239.w,
height: 42.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(41.r), // Rounded corners
gradient: LinearGradient(
colors: [
const Color(0xFFFFFFFF)
.withOpacity(0.036), // Start color with opacity
const Color(0xFFFFFFFF)
.withOpacity(0.048), // End color with opacity
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
border: Border.all(
color: const Color(0xFF434A53), // Border color
width: 1.39, // Border width
),
),
child: TabBar(
dividerColor: const Color(0xFFFFFFFF).withOpacity(0.07),
labelStyle: TextStyle(
fontSize: 14.sp,
color: const Color(0xFFFCFCFC),
fontWeight: FontWeight.w400,
fontFamily: 'Helvetica'),
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: const Color(0xFFD90B2E),
indicatorWeight: 2.h,
unselectedLabelColor: const Color(0xFFFCFCFC),
overlayColor: MaterialStateProperty.all(const Color(0xFFD90B2E)),
tabs: tabs, // Your tabs list
),
);
}
}

View File

@@ -125,7 +125,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
debugShowCheckedModeBanner: false,
// initialRoute: RouteName.individualactivitystep2,
initialRoute: RouteName.splashScreen,
initialRoute: RouteName.selecttimeslot,
getPages: AppRoutes.appRoutes(),
),

View File

@@ -118,4 +118,5 @@ class RouteName {
static const String availabilityrequest = '/availabilityrequest';
static const String selecttimeslot = '/selecttimeslot';
static const String addUser = '/addUser';
}

View File

@@ -4,7 +4,8 @@ import 'package:regroup/Login/View/loginscreen.dart';
import 'package:regroup/Login/View/verifygoogleapple.dart';
import 'package:regroup/Main_Screens/Calendar/AvailabilityRequest.dart';
import 'package:regroup/Main_Screens/Calendar/Calendar.dart';
import 'package:regroup/Main_Screens/Calendar/SelectTime.dart';
import 'package:regroup/Main_Screens/Calendar/SelectTimeSlot.dart';
import 'package:regroup/Main_Screens/CalenderTab/AddEvent/AddEvent.dart';
import 'package:regroup/Main_Screens/CalenderTab/AddUsers/AddUsers.dart';
// import 'package:regroup/Main_Screens/CalenderTab/AddUsers/AddUsers.dart';
@@ -550,11 +551,16 @@ class AppRoutes {
),
GetPage(
name: RouteName.selecttimeslot,
page: () => const SelectTime(),
page: () => const SelectTimeSlot(),
),
GetPage(
name: RouteName.addUser,
page: () => const AddUsers(),
),
// GetPage(
// name: RouteName.addUser,
// page: () => const SelectTimeSlot(),
// ),
];
}