465 lines
20 KiB
Dart
465 lines
20 KiB
Dart
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:regroup/Common/CommonButton.dart';
|
|
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
|
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
|
import 'package:regroup/Utils/Common/CommonDropdown.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:intl/intl.dart';
|
|
|
|
class Sessions extends StatefulWidget {
|
|
const Sessions({super.key});
|
|
|
|
@override
|
|
State<Sessions> createState() => _SessionsState();
|
|
}
|
|
|
|
RxBool isChecked = false.obs;
|
|
List<File?> bannerPath = [];
|
|
bool isbannerAdded = false;
|
|
|
|
class _SessionsState extends State<Sessions> {
|
|
DateTime? _selectedDate;
|
|
TimeOfDay? _selectedTime;
|
|
String _formattedDateTime = 'Thu, Jan 20 08:00 pm';
|
|
|
|
Future<TimeOfDay?> showCustomTimePicker(BuildContext context,
|
|
{TimeOfDay? initialTime}) {
|
|
final ThemeData customTheme2 = Theme.of(context).copyWith(
|
|
colorScheme: const ColorScheme.light(
|
|
primary: Color(0xFFD90B2E),
|
|
surfaceTint: Color(0xFF222935),
|
|
surface: Color(0xFF222935),
|
|
onPrimary: Colors.white,
|
|
onSurface: Colors.white,
|
|
),
|
|
textTheme: Theme.of(context).textTheme.copyWith(
|
|
titleLarge: const TextStyle(color: Colors.blue),
|
|
),
|
|
textButtonTheme: TextButtonThemeData(
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: const Color(0xFFD90B2E),
|
|
),
|
|
));
|
|
return showTimePicker(
|
|
context: context,
|
|
initialTime: initialTime ?? TimeOfDay.now(),
|
|
builder: (BuildContext context, Widget? child) {
|
|
return Theme(
|
|
data: customTheme2,
|
|
child: child!,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Future<void> _selectDateTime(BuildContext context) async {
|
|
final ThemeData customTheme2 = Theme.of(context).copyWith(
|
|
colorScheme: const ColorScheme.light(
|
|
primary: Color(0xFFD90B2E),
|
|
surfaceTint: Color(0xFF222935),
|
|
surface: Color(0xFF222935),
|
|
onPrimary: Colors.white,
|
|
onSurface: Colors.white,
|
|
// onSecondary: Colors.red,
|
|
),
|
|
textTheme: Theme.of(context).textTheme.copyWith(
|
|
titleLarge: const TextStyle(color: Colors.blue),
|
|
),
|
|
textButtonTheme: TextButtonThemeData(
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: const Color(0xFFD90B2E),
|
|
),
|
|
),
|
|
);
|
|
|
|
final DateTime? pickedDate = await showDatePicker(
|
|
context: context,
|
|
initialDate: DateTime.now(),
|
|
firstDate: DateTime(2000),
|
|
lastDate: DateTime(2101),
|
|
builder: (BuildContext context, Widget? child) {
|
|
return Theme(
|
|
data: customTheme2,
|
|
child: child!,
|
|
);
|
|
},
|
|
);
|
|
|
|
if (pickedDate != null) {
|
|
final TimeOfDay? pickedTime = await showTimePicker(
|
|
context: context,
|
|
initialTime: TimeOfDay.now(),
|
|
builder: (BuildContext context, Widget? child) {
|
|
return Theme(
|
|
data: customTheme2,
|
|
child: child!,
|
|
);
|
|
},
|
|
);
|
|
|
|
if (pickedTime != null) {
|
|
setState(() {
|
|
_selectedDate = pickedDate;
|
|
_selectedTime = pickedTime;
|
|
|
|
final DateTime selectedDateTime = DateTime(
|
|
_selectedDate!.year,
|
|
_selectedDate!.month,
|
|
_selectedDate!.day,
|
|
_selectedTime!.hour,
|
|
_selectedTime!.minute,
|
|
);
|
|
|
|
_formattedDateTime =
|
|
DateFormat('EEE, MMM d h:mm a').format(selectedDateTime);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
// key: _scaffoldKey1,
|
|
resizeToAvoidBottomInset: false,
|
|
backgroundColor: const Color(0xFF222935),
|
|
extendBody: true,
|
|
appBar: const CommonAppbar(
|
|
titleTxt: "Sessions",
|
|
),
|
|
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: [
|
|
sizedBoxHeight(30.h),
|
|
text16w400_FCFCFC("Session Title"),
|
|
sizedBoxHeight(25.h),
|
|
CustomTextFormField(
|
|
hintText: "",
|
|
leadingIcon: SizedBox(
|
|
height: 20.h,
|
|
width: 20.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/Vector (5)12.png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
Text.rich(
|
|
TextSpan(children: [
|
|
TextSpan(
|
|
text: 'Description ',
|
|
style: TextStyle(
|
|
color: const Color(0xFFFCFCFC),
|
|
fontSize: 16.sp,
|
|
fontFamily: 'Helvetica',
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: '(optional)',
|
|
style: TextStyle(
|
|
color: const Color(0xFFFCFCFC),
|
|
fontSize: 14.sp,
|
|
fontFamily: 'Helvetica',
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
CustomTextFormField2(),
|
|
text16w400_FCFCFC('Type of session'),
|
|
sizedBoxHeight(25.h),
|
|
CustomDropDownRadio(
|
|
header: "",
|
|
title: "",
|
|
listData: const ["hhh"],
|
|
onItemSelected: (p0) {},
|
|
leadingImage: Image.asset(
|
|
"assets/images/png/Vector (5)12.png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
)),
|
|
sizedBoxHeight(25.h),
|
|
text16w400_FCFCFC('Sport'),
|
|
sizedBoxHeight(25.h),
|
|
CustomDropDownRadio(
|
|
header: "",
|
|
title: "",
|
|
listData: const ["hhh"],
|
|
onItemSelected: (p0) {},
|
|
leadingImage: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/Vector (4).png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
),
|
|
)),
|
|
sizedBoxHeight(25.h),
|
|
text16w400_FCFCFC('Starts'),
|
|
sizedBoxHeight(25.h),
|
|
GestureDetector(
|
|
onTap: () {
|
|
_selectDateTime(context);
|
|
},
|
|
child: AbsorbPointer(
|
|
child: CustomTextFormField(
|
|
leadingIcon: SizedBox(
|
|
height: 20.h,
|
|
width: 20.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/clock.png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
),
|
|
)),
|
|
hintText: _formattedDateTime,
|
|
// hintText: "Thu, Jan 20 08:00 pm",
|
|
),
|
|
),
|
|
),
|
|
sizedBoxHeight(10.h),
|
|
Row(
|
|
children: [
|
|
Obx(() {
|
|
return commonGlassContainer(
|
|
border: 1,
|
|
borderradius: 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),
|
|
text16w400_FCFCFC("Location"),
|
|
sizedBoxHeight(20.h),
|
|
CustomTextFormField(
|
|
hintText: "",
|
|
leadingIcon: SizedBox(
|
|
height: 20.h,
|
|
width: 20.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/Group 58645.png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
text16w400_FCFCFC("Post in"),
|
|
sizedBoxHeight(25.h),
|
|
CustomDropDownRadio(
|
|
header: "",
|
|
title: "",
|
|
listData: const ["hryy"],
|
|
onItemSelected: (p0) {},
|
|
leadingImage: Image.asset(
|
|
"assets/images/png/Black.png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
)),
|
|
sizedBoxHeight(25.h),
|
|
text16w400_FCFCFC("Add Users"),
|
|
sizedBoxHeight(25.h),
|
|
CustomTextFormField(
|
|
hintText: "",
|
|
leadingIcon: SizedBox(
|
|
height: 20.h,
|
|
width: 20.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/Group122.png",
|
|
height: 20.h,
|
|
width: 20.w,
|
|
),
|
|
)),
|
|
suffixIcon: SizedBox(
|
|
height: 20.h,
|
|
width: 20.h,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/arrow.png",
|
|
height: 20.h,
|
|
width: 20.h,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
text16w400_FCFCFC("Reminder"),
|
|
sizedBoxHeight(25.h),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
commonGlassContainer(
|
|
height: 50.h,
|
|
width: 127.w,
|
|
borderradius: 30.r,
|
|
border: 1,
|
|
customWidget: Center(
|
|
child: text16400white("2"),
|
|
)),
|
|
commonGlassContainer(
|
|
height: 50.h,
|
|
width: 215.w,
|
|
borderradius: 30.r,
|
|
border: 1,
|
|
customWidget: Center(
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.center,
|
|
children: [
|
|
text16400white("Minutes"),
|
|
sizedBoxWidth(5.w),
|
|
const Icon(
|
|
Icons.keyboard_arrow_down,
|
|
color: Colors.white,
|
|
)
|
|
],
|
|
),
|
|
))
|
|
]),
|
|
sizedBoxHeight(20.h),
|
|
text16w400_FCFCFC("session image"),
|
|
sizedBoxHeight(25.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: commonGlassContainer(
|
|
border: 0,
|
|
width: double.infinity,
|
|
height: 130.h,
|
|
borderradius: 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),
|
|
text14w400_FCFCFC(
|
|
"Upload session image"),
|
|
sizedBoxHeight(8.h),
|
|
text8w400_8A8A8A(
|
|
"Allowed file extensions: jpg, png, gif Max file size: 10 MB"),
|
|
],
|
|
),
|
|
)),
|
|
),
|
|
),
|
|
sizedBoxHeight(25.h),
|
|
CustomDropDownRadio(
|
|
header: "More options",
|
|
title: "",
|
|
listData: const [""],
|
|
onItemSelected: (p0) {},
|
|
leadingImage: const SizedBox()),
|
|
sizedBoxHeight(30.h),
|
|
CommonBtn(text: "Create event"),
|
|
sizedBoxHeight(50.h),
|
|
])))
|
|
]));
|
|
}
|
|
}
|