From fc5d975837da960db4a7f86d1be97212f1d1d573 Mon Sep 17 00:00:00 2001 From: jayesh Date: Mon, 26 Aug 2024 16:49:46 +0530 Subject: [PATCH 1/4] Calendar UI --- assets/images/png/availabilitycalendar.png | Bin 0 -> 1278 bytes lib/Common/controller/MainController.dart | 5 +- lib/Main_Screens/Calendar/AddUsers.dart | 433 ++++++++++ .../Calendar/AvailabilityRequest.dart | 297 +++++++ lib/Main_Screens/Calendar/Calendar.dart | 792 ++++++++++++++++++ lib/Main_Screens/Calendar/SelectTime.dart | 547 ++++++++++++ lib/resources/routes/route_name.dart | 48 +- lib/resources/routes/routes.dart | 109 +-- 8 files changed, 2135 insertions(+), 96 deletions(-) create mode 100644 assets/images/png/availabilitycalendar.png create mode 100644 lib/Main_Screens/Calendar/AddUsers.dart create mode 100644 lib/Main_Screens/Calendar/AvailabilityRequest.dart create mode 100644 lib/Main_Screens/Calendar/Calendar.dart create mode 100644 lib/Main_Screens/Calendar/SelectTime.dart diff --git a/assets/images/png/availabilitycalendar.png b/assets/images/png/availabilitycalendar.png new file mode 100644 index 0000000000000000000000000000000000000000..f7f6eb5046541995d68451862e166373b419221e GIT binary patch literal 1278 zcmeAS@N?(olHy`uVBq!ia0vp^EiEK=H8=#Ztv*RbQqk%dBDN-8RTOW0Y&Ly8@oVwi-4%pXY~x8Uq5 z^waYYWS6b5g=Oo<7aLyIDnz55h z?TE{nAVy1rc8(>Lawv{Mb0dP=BB2`~u-!n#V};>dg<}6{Te$_342uJ_k~j>q11?RJ zRzJPtq(B5mV=IhMY-3Dpvr$a(l?4v2=JEY`ICvtPTS|mj( z+_}uSIi_rny7P>+at=0v&Z-l2Sp&?CzRqP*QZZ7Top(!ir+rm${KuN<%b%zmIeY5F zm#YdN!i>xRuTf%Bdg**-TDRc)KhGpnY+TOIS?ZHBW%BgP9St5WHXr{9Z{~Qba?Ski z9PZN*;+v+=`X}`FX8k1V=RZ$x=m}L^w(`Xb%YM6syYKILyDWKoTg6AwFOpAHeyQyc z4r_f8xaj#^PyM+69P8^oM@H{-es}Su`L&iAx$|CZd~aYBx9^{#+r28`jh%(RHbwhA zyR@OjRB@kvwUl6#(VqR^K7PObesN{?{vey{9^0>JJ+A&T%&ntf705WH539H6?D%W{?rq3~Gk%X$ zYd`9qQ#ovOEoo+jP2kr(3*0u}`d{-wQ?2g5pnlDtI1Pusx%{aTk-y(R+dV1Km@{u} zTg;lNC6fbl6>DA}I{QC--;XB|Z7U_eZ`1Do8?*F-u})H{+#~L-w^rVX`LTa~y{z1P z*EUDboow9^y#LSMWwn~7x$5zqWeTT<^YhiMEfK?u4-AZ`od7%v%<=is`K7T#nTX-Ouc_y1Qe-&TPBWdJ~^G>s>AP zu8TSM;;_~^uZrC>=Ijp9cb$~ntMfW9%S&K-@vjfN^X|!C(`dZv=5)?Q^{_zZq@Npp zCTx83EbPJ0%~tz2uF$vDU7&X6b=vdBfK^MZ&nG>$jGV#Q{w_oEgwc_SGY(yhPk)!7 z@WDwGkp_XRl-pCRIMNJNEczX)op+bz45?=!C#oYx2*x%w2Uda=~NKLEW8gat{6OB{an^LB{Ts5quoGr literal 0 HcmV?d00001 diff --git a/lib/Common/controller/MainController.dart b/lib/Common/controller/MainController.dart index c6c63da..06a9ded 100644 --- a/lib/Common/controller/MainController.dart +++ b/lib/Common/controller/MainController.dart @@ -1,18 +1,17 @@ import 'package:get/get.dart'; -import 'package:regroup/Main_Screens/CalenderTab/CalenderTab.dart'; +import 'package:regroup/Main_Screens/Calendar/Calendar.dart'; import 'package:regroup/Main_Screens/Chats/View/chatsmainscreen.dart'; import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; import 'package:regroup/Main_Screens/GroupTab/View/GroupTab.dart'; import 'package:regroup/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart'; - class MainController extends GetxController { var selectedIndex = 0.obs; var currentTab = [ const CommunityScreen(), const GroupTab(), - const CalenderTab(), + const Calendar(), const ChatsMainScreen(), const ProfileTab(), ].obs; diff --git a/lib/Main_Screens/Calendar/AddUsers.dart b/lib/Main_Screens/Calendar/AddUsers.dart new file mode 100644 index 0000000..29ef641 --- /dev/null +++ b/lib/Main_Screens/Calendar/AddUsers.dart @@ -0,0 +1,433 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:glassmorphism/glassmorphism.dart'; +import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/CommonTabBar.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/sized_box.dart'; +import 'package:regroup/Utils/texts.dart'; + +class AddUsers extends StatefulWidget { + const AddUsers({super.key}); + + @override + State createState() => _AddUsersState(); +} + +class _AddUsersState extends State { + List groupData = [ + { + "imagePath": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwart", + "subtitle": "Row row row your boat", + }, + { + "imagePath": "assets/images/png/Ellipse 48.png", + "title": "Ahmad Rhiel Madsen", + "subtitle": "Football fever", + }, + { + "imagePath": "assets/images/png/Ellipse 43.png", + "title": "Kaylynn Vaccaro", + "subtitle": "The athletic town", + }, + { + "imagePath": "assets/images/png/cimg4.png", + "title": "Kianna Donin", + "subtitle": "Active alliance network", + }, + { + "imagePath": "assets/images/png/cimg1.png", + "title": "Ahmad Rhiel Madsen", + "subtitle": "Football fever", + }, + { + "imagePath": "assets/images/png/Ellipse 43.png", + "title": "Kaylynn Vaccaro", + "subtitle": "The athletic town", + }, + { + "imagePath": "assets/images/png/cimg4.png", + "title": "Kianna Donin", + "subtitle": "Active alliance network", + }, + ]; + + List isCheckedList = [false, false, false, false, false, false, false]; + + @override + Widget build(BuildContext context) { + return Scaffold( + // key: _scaffoldKey1, + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFF222935), + extendBody: true, + appBar: const CommonAppbar( + titleTxt: "Add users", + ), + body: Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(10.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 users", + ), + ), + sizedBoxHeight(16.h), + DefaultTabController( + length: 3, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + const CommonTabBar(tabs: [ + Tab( + text: 'Group members ', + ), + Tab( + text: 'Subgroups ', + ), + Tab( + text: 'Followers', + ), + ]), + SizedBox( + height: 600.h, + child: TabBarView( + children: [ + groupTab(), + subgroupTab(), + followersTab(), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ); + } + + Widget groupTab() { + return Column( + children: [ + sizedBoxHeight(30.h), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + text18w700_FCFCFC("Group members"), + const Spacer(), + commonGlassUI( + width: 35.w, + height: 35.h, + borderRadius: BorderRadius.circular(100), + customWidget: Center( + child: Image.asset( + "assets/images/png/Vector (5)22.png", + height: 12.h, + width: 12.w, + ), + ), + borderwidth: 0.5), + sizedBoxWidth(14.w), + commonGlassUI( + width: 35.w, + height: 35.h, + borderRadius: BorderRadius.circular(100), + customWidget: Center( + child: Image.asset( + "assets/images/png/bi_filter.png", + height: 22.h, + width: 18.w, + ), + ), + borderwidth: 0.5) + ], + ), + ), + sizedBoxHeight(15.h), + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: groupData.length, + itemBuilder: (context, index) { + return Column( + children: [ + groupWidget( + index: index, + imagePath: groupData[index]["imagePath"], + title: groupData[index]["title"], + subtitle: groupData[index]["subtitle"], + isChecked: isCheckedList[index], + onCheckedChanged: (bool? value) { + setState(() { + isCheckedList[index] = value ?? false; + }); + }, + ), + if (index != groupData.length - 1) commonDivider(), + ], + ); + }, + ), + ), + ], + ); + } + + Widget groupWidget({ + required int index, + required String imagePath, + required String title, + required String subtitle, + required bool isChecked, + required ValueChanged onCheckedChanged, + }) { + return Padding( + padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), + child: Row( + children: [ + CircleAvatar( + backgroundImage: AssetImage(imagePath), + radius: 25.r, + ), + sizedBoxWidth(10.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + text16w400_FCFCFC(title), + sizedBoxWidth(6.w), + InkWell( + onTap: () { + dialogwidget(); + }, + child: Image.asset( + "assets/images/png/calender.png", + height: 14.h, + width: 14.w, + ), + ) + ], + ), + sizedBoxHeight(4.h), + text12w400_FCFCFC_blur(subtitle), + ], + ), + const Spacer(), + 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, + activeColor: Colors.transparent, + checkColor: Colors.white, + onChanged: onCheckedChanged, + ), + ), + ), + ], + ), + ); + } + + dialogwidget() { + Get.dialog(Dialog( + // backgroundColor: Colors.transparent, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.r), + color: const Color(0xFF222935)), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text18w700_FCFCFC("Availability"), + sizedBoxHeight(16.h), + Row( + children: [ + commonGlassUI( + width: 40.w, + height: 40.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center(child: text16w400_FCFCFC("M")), + borderwidth: 0.5), + sizedBoxWidth(15.w), + commonGlassUI( + width: 40.w, + height: 40.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center(child: text16w400_FCFCFC("Tu")), + borderwidth: 0.5), + sizedBoxWidth(15.w), + commonGlassUI( + width: 40.w, + height: 40.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center(child: text16w400_FCFCFC("W")), + borderwidth: 0.5), + const Spacer(), + Row( + children: [ + Image.asset( + "assets/images/png/clock.png", + height: 20.h, + width: 20.w, + ), + sizedBoxWidth(8.w), + text16w400_FCFCFC("4pm - 8pm"), + ], + ) + ], + ), + sizedBoxHeight(20.h), + commonDivider(), + sizedBoxHeight(20.h), + Row( + children: [ + commonGlassUI( + width: 40.w, + height: 40.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center(child: text16w400_FCFCFC("Th")), + borderwidth: 0.5), + sizedBoxWidth(15.w), + commonGlassUI( + width: 40.w, + height: 40.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center(child: text16w400_FCFCFC("F")), + borderwidth: 0.5), + sizedBoxWidth(15.w), + commonGlassUI( + width: 40.w, + height: 40.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center(child: text16w400_FCFCFC("Sa")), + borderwidth: 0.5), + const Spacer(), + Row( + children: [ + Image.asset( + "assets/images/png/clock.png", + height: 20.h, + width: 20.w, + ), + sizedBoxWidth(8.w), + text16w400_FCFCFC("5pm - 9pm"), + ], + ) + ], + ), + sizedBoxHeight(20.h), + commonDivider(), + sizedBoxHeight(20.h), + Row( + children: [ + GlassmorphicContainer( + width: 40.w, + height: 40.h, + borderRadius: 100, + border: 0.5, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFD90B2E).withOpacity(0.18), + const Color(0xFFD90B2E).withOpacity(0.4), + ], + stops: const [ + 0.1, + 1, + ], + ), + borderGradient: const LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + Color(0xffD90B2E), + Color(0xFFD90B2E), + ], + ), + blur: 6, + child: Center(child: text16w400_FCFCFC("Su")), + ), + sizedBoxWidth(8.w), + text16w400_FCFCFC("Not available") + ], + ), + ], + ), + ), + ), + ], + ), + )); + } + + Widget subgroupTab() { + return const Column( + children: [], + ); + } + + Widget followersTab() { + return const Column( + children: [], + ); + } +} diff --git a/lib/Main_Screens/Calendar/AvailabilityRequest.dart b/lib/Main_Screens/Calendar/AvailabilityRequest.dart new file mode 100644 index 0000000..cad02c0 --- /dev/null +++ b/lib/Main_Screens/Calendar/AvailabilityRequest.dart @@ -0,0 +1,297 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.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/sized_box.dart'; +import 'package:regroup/Utils/texts.dart'; + +class AvailabilityRequest extends StatefulWidget { + const AvailabilityRequest({super.key}); + + @override + State createState() => _AvailabilityRequestState(); +} + +class _AvailabilityRequestState extends State { + TextEditingController dateController = TextEditingController(); + TextEditingController dateController2 = TextEditingController(); + + TimeOfDay? slotduration = const TimeOfDay(hour: 15, minute: 0); + bool swichvalue = false; + bool deadline = false; + + 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: "Availability Request", + ), + 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 (optional)"), + sizedBoxHeight(10.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: "", + ), + sizedBoxHeight(25.h), + text16400white("Post in"), + sizedBoxHeight(10.h), + CommonDropdownBtn( + hint: '', + items: const [], + leadingImage: SizedBox( + height: 22.h, + width: 28.w, + child: Center( + child: Image.asset("assets/images/png/Black.png"), + ), + ), + ), + sizedBoxHeight(25.h), + text16400white("Slot Duration"), + sizedBoxHeight(10.h), + GestureDetector( + onTap: () async { + final TimeOfDay? pickedTime = + await showCustomTimePicker(context, + initialTime: slotduration); + if (pickedTime != null) { + setState(() { + slotduration = pickedTime; + }); + } + }, + child: commonGlassUI( + width: double.infinity, + 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(slotduration!)), + ]), + ), + borderwidth: 1), + ), + sizedBoxHeight(25.h), + Row( + children: [ + const Spacer(), + Transform.scale( + scaleY: 1, + child: CupertinoSwitch( + value: swichvalue, + trackColor: Colors.white.withOpacity(0.4), + activeColor: const Color(0xFF34C759), + onChanged: (bool? value) { + setState(() { + swichvalue = value ?? false; + }); + })) + ], + ), + text16400white("Weekly recurrence"), + sizedBoxHeight(10.h), + GestureDetector( + onTap: () => datePicker(context, dateController), + child: AbsorbPointer( + child: CustomTextFormField( + textEditingController: dateController, + hintText: "", + leadingIcon: SizedBox( + height: 20.h, + width: 20.w, + child: Center( + child: Image.asset( + "assets/images/png/calender.png", + height: 20.h, + width: 20.w, + ), + ), + ), + ), + ), + ), + sizedBoxHeight(25.h), + Row( + children: [ + const Spacer(), + Transform.scale( + scaleY: 1, + child: CupertinoSwitch( + value: deadline, + trackColor: Colors.white.withOpacity(0.4), + activeColor: const Color(0xFF34C759), + onChanged: (bool? value) { + setState(() { + deadline = value ?? false; + }); + })) + ], + ), + text16400white("Deadline"), + sizedBoxHeight(10.h), + Row( + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16400white("Date"), + sizedBoxHeight(10.h), + GestureDetector( + onTap: () async { + final TimeOfDay? pickedTime = + await showCustomTimePicker(context, + initialTime: slotduration); + if (pickedTime != null) { + setState(() { + slotduration = pickedTime; + }); + } + }, + child: commonGlassUI( + width: double.infinity, + 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(slotduration!)), + ]), + ), + borderwidth: 1), + ), + ], + ), + ), + sizedBoxWidth(10.h), + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16400white("Time"), + sizedBoxHeight(10.h), + GestureDetector( + onTap: () => + datePicker(context, dateController2), + child: AbsorbPointer( + child: CustomTextFormField( + textEditingController: dateController2, + hintText: "", + leadingIcon: SizedBox( + height: 20.h, + width: 20.w, + child: Center( + child: Image.asset( + "assets/images/png/calender.png", + height: 20.h, + width: 20.w, + ), + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + sizedBoxHeight(25.h), + CommonBtn(text: "Save"), + sizedBoxHeight(50.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); + } +} diff --git a/lib/Main_Screens/Calendar/Calendar.dart b/lib/Main_Screens/Calendar/Calendar.dart new file mode 100644 index 0000000..49fa29b --- /dev/null +++ b/lib/Main_Screens/Calendar/Calendar.dart @@ -0,0 +1,792 @@ +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/CommonTextFormField.dart'; +import 'package:regroup/Common/controller/MainScreen.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/resources/routes/route_name.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; + +class Calendar extends StatefulWidget { + const Calendar({super.key}); + + @override + State createState() => _CalendarState(); +} + +class _CalendarState extends State { + 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" + }, + ]; + + CalendarController? _sessionCalController; + CalendarController? _comCalController; + List? _appointments; + // final List _nameCollection = []; + // final List _userImages = []; + // DateTime? _startDate; + // DateTime? _endDate; + // bool _isRangeSelection = false; + @override + void initState() { + super.initState(); + _sessionCalController = CalendarController(); + _comCalController = CalendarController(); + + _appointments = [ + Appointment( + startTime: DateTime(2024, 6, 26, 9, 0), + endTime: DateTime(2024, 6, 26, 10, 30), + subject: 'Development Meeting', + color: const Color(0XFFFC571D)), + Appointment( + startTime: DateTime(2024, 6, 26, 18, 0), + endTime: DateTime(2024, 6, 26, 18, 30), + subject: 'GeneralMeeting', + color: const Color(0xFF8B1FA9)), + Appointment( + startTime: DateTime(2024, 6, 28, 9, 0), + endTime: DateTime(2024, 6, 28, 10, 30), + subject: 'Lunch', + ), + Appointment( + startTime: DateTime(2024, 6, 25, 10, 0), + endTime: DateTime(2024, 6, 25, 10, 30), + subject: 'Meeting', + ), + Appointment( + startTime: DateTime.now(), + endTime: DateTime.now().add(const Duration(hours: 3)), + subject: 'Match day', + ), + Appointment( + startTime: DateTime.now(), + endTime: DateTime.now().add(const Duration(hours: 3)), + subject: 'Muharram/Ashura', + ), + ]; + } + + DateTime selectedDate = DateTime.now(); + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + // key: _scaffoldKey1, + backgroundColor: const Color(0xFF222935), + extendBody: true, + appBar: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: const Color(0xff222935), + elevation: 0, + automaticallyImplyLeading: false, + title: text20700white("Sessions"), + actions: [ + InkWell( + onTap: () { + Get.toNamed(RouteName.addUser); + }, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 7, + ), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff).withOpacity(0.8), + const Color(0xFFFFFFFF).withOpacity(0.8), + ], + stops: const [0.1, 1], + ), + borderRadius: BorderRadius.circular(30), + border: Border.all( + color: const Color(0xff434A53), + ), + color: const Color(0xFFFFFFFF).withOpacity(0.05), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/png/availabilitycalendar.png', + height: 18.h, + width: 18.w, + ), + SizedBox( + width: 10.w, + ), + text12400white('Availability') + ], + ), + ), + ), + sizedBoxWidth(14.w), + InkWell( + onTap: () { + Get.toNamed(RouteName.addEvent); + }, + child: Container( + height: 30.h, + width: 30.w, + decoration: const BoxDecoration( + color: Color(0xFFD90B2E), + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: Color(0x40000000), + offset: Offset(0, 6), + blurRadius: 8, + spreadRadius: 0, + ), + ], + ), + child: const Icon(Icons.add, color: Colors.white, weight: 2), + ), + ), + 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: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 16), + child: Column(children: [ + Expanded( + child: DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + const CommonTabBar(tabs: [ + Tab( + text: 'My calendar', + ), + Tab( + text: 'Community calendar', + ), + ]), + Expanded( + child: TabBarView( + children: [ + myCalendarTab(), + comCalendarTab(), + ], + ), + ), + sizedBoxHeight(90.h), + ], + ), + ), + ), + ])) + ]), + bottomNavigationBar: bottomnavigationbar(mainController), + ); + } + + Widget myCalendarTab() { + 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 events", + ), + ), + sizedBoxHeight(25.h), + Stack( + children: [ + commonGlassUI( + width: double.infinity, + height: 400.h, + borderRadius: BorderRadius.circular(1), + // borderw: 0, + customWidget: Padding( + padding: const EdgeInsets.all(10), + child: SfCalendar( + view: CalendarView.month, + appointmentTextStyle: const TextStyle(color: Colors.white), + headerStyle: const CalendarHeaderStyle( + textStyle: TextStyle( + color: Color(0xFFD90B2E), + ), + ), + weekNumberStyle: const WeekNumberStyle( + textStyle: TextStyle(color: Colors.red), + ), + viewHeaderStyle: const ViewHeaderStyle( + dateTextStyle: TextStyle(color: Colors.white), + dayTextStyle: TextStyle(color: Colors.white), + ), + backgroundColor: Colors.transparent, + cellBorderColor: Colors.white, + todayHighlightColor: Colors.transparent, + todayTextStyle: const TextStyle( + color: Colors.white, + ), + controller: _sessionCalController, + showNavigationArrow: false, + allowViewNavigation: false, + allowDragAndDrop: true, + showDatePickerButton: true, + viewNavigationMode: ViewNavigationMode.snap, + showCurrentTimeIndicator: true, + dataSource: MeetingDataSource(_appointments!), + timeSlotViewSettings: TimeSlotViewSettings( + timeTextStyle: const TextStyle( + color: Colors.white, + ), + timelineAppointmentHeight: 60.h, + timeIntervalWidth: 70, + ), + monthCellBuilder: (context, details) { + bool isToday = details.date.day == DateTime.now().day && + details.date.month == DateTime.now().month && + details.date.year == DateTime.now().year; + return Center( + child: Container( + width: 40 + .w, // Adjust the width to make the circle smaller + height: 40 + .h, // Adjust the height to make the circle smaller + decoration: BoxDecoration( + color: isToday ? Colors.red : Colors.transparent, + shape: BoxShape.circle, + ), + child: Center( + child: Text( + details.date.day.toString(), + style: const TextStyle( + color: Colors.white, + // Ensure text color is white + ), + ), + ), + ), + ); + }, + resourceViewSettings: const ResourceViewSettings( + displayNameTextStyle: + TextStyle(color: Colors.white, fontSize: 10), + showAvatar: true, + ), + appointmentBuilder: (context, details) { + final Appointment appointment = + details.appointments.first; + return Container( + decoration: BoxDecoration( + color: details.appointments.first.color ?? Colors.red, + borderRadius: BorderRadius.circular(5), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + appointment.subject, + style: TextStyle( + color: Colors.white, fontSize: 8.sp), + ), + ], + ), + ), + ); + }, + ), + ), + ), + ], + ), + sizedBoxHeight(25.h), + ], + ), + ); + } + + 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: commonGlassUI( + width: double.infinity, + height: 300.h, + borderRadius: BorderRadius.circular(10.r), + borderwidth: 1.w, + 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: const AssetImage( + "assets/images/png/Ellipse 52.png"), + ), + sizedBoxWidth(8.w), + text14w400_FCFCFC("Ryan dorwat"), + ], + ) + ]), + ), + ) + ], + ), + ); + } + + Widget comCalendarTab() { + return SingleChildScrollView( + child: Column( + children: [ + sizedBoxHeight(25.h), + + Stack(children: [ + commonGlassUI( + width: double.infinity, + height: 530.h, + borderRadius: BorderRadius.circular(1), + // border: 0, + customWidget: SfCalendar( + view: CalendarView.month, + appointmentTextStyle: const TextStyle(color: Colors.white), + headerStyle: const CalendarHeaderStyle( + textStyle: TextStyle( + color: Color(0xFFD90B2E), + )), + // blackoutDatesTextStyle: TextStyle(color: Colors.white), + + weekNumberStyle: const WeekNumberStyle( + textStyle: TextStyle(color: Colors.white)), + viewHeaderStyle: const ViewHeaderStyle( + // backgroundColor: Colors.amber, + dateTextStyle: TextStyle(color: Colors.white), + dayTextStyle: TextStyle( + color: Color(0xFFD90B2E), + ), + ), + // blackoutDatesTextStyle: TextStyle(color: Colors.white), + // selectionDecoration: BoxDecoration(color: Colors.amber), + backgroundColor: Colors.transparent, + // firstDayOfWeek: 3, + cellBorderColor: Colors.white, + todayHighlightColor: const Color(0xFFD90B2E), + todayTextStyle: const TextStyle(color: Colors.white), + controller: _comCalController, + showNavigationArrow: true, + allowViewNavigation: true, + allowDragAndDrop: true, + showDatePickerButton: true, + monthViewSettings: const MonthViewSettings( + navigationDirection: MonthNavigationDirection.horizontal, + ), + allowedViews: const [ + CalendarView.month, + // CalendarView.day, + CalendarView.schedule, + ], + viewNavigationMode: ViewNavigationMode.snap, + showCurrentTimeIndicator: true, + dataSource: MeetingDataSource(_appointments!), + onTap: calendarTapped, + timeSlotViewSettings: TimeSlotViewSettings( + // minimumAppointmentDuration: Duration(hours: 5), + timeTextStyle: const TextStyle( + color: Colors.white, + ), + timelineAppointmentHeight: 60.h, + // timeIntervalWidth: 100, + + // timeIntervalHeight: 50, + timeIntervalWidth: 70, + ), + monthCellBuilder: (context, details) { + return Container( + decoration: const BoxDecoration( + color: Colors.transparent, + ), + child: Center( + child: Text( + details.date.day.toString(), + style: const TextStyle( + color: Colors.white), // Set text color to white + ), + ), + ); + }, + resourceViewSettings: const ResourceViewSettings( + displayNameTextStyle: + TextStyle(color: Colors.white, fontSize: 10), + showAvatar: true, + ), + scheduleViewSettings: const ScheduleViewSettings( + placeholderTextStyle: TextStyle(color: Colors.white), + dayHeaderSettings: DayHeaderSettings( + dateTextStyle: TextStyle(color: Colors.white), + dayTextStyle: TextStyle(color: Colors.white), + )), + appointmentBuilder: (context, details) { + final Appointment appointment = details.appointments.first; + + return Container( + decoration: BoxDecoration( + color: details.appointments.first.color ?? Colors.blue, + borderRadius: BorderRadius.circular(4), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + appointment.subject, + style: TextStyle( + color: Colors.white, fontSize: 8.sp), + ), + ], + ), + ), + ); + }), + ), + ]), + + // SfCalendar( + // view: CalendarView.month, + // controller: _calendarController, + // onSelectionChanged: (CalendarSelectionDetails details) { + // setState(() { + // _startDate = details.date!; + // _endDate = details.date! + // .add(Duration(days: 6)); // assuming a week range + // }); + // }, + // monthViewSettings: MonthViewSettings( + // showAgenda: true, + // ), + // ), + + // 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), + commonGlassUI( + width: double.infinity, + height: 290.h, + borderRadius: BorderRadius.circular(10.r), + borderwidth: 1, + 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: const AssetImage( + "assets/images/png/Ellipse 52.png"), + ), + sizedBoxWidth(8.w), + text14w400_FCFCFC("Ryan dorwat"), + ], + ), + ]), + const Spacer(), + Container( + height: 138.h, + width: 143.w, + decoration: BoxDecoration( + color: const 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") + ], + ), + ) + ], + ), + ], + ), + ) + ], + ), + ); + } + + void calendarTapped(CalendarTapDetails details) { + if (details.targetElement == CalendarElement.appointment) { + Appointment appointment = details.appointments![0]; + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Event Details'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text('Event: ${appointment.subject}'), + Text('From: ${appointment.startTime}'), + Text('To: ${appointment.endTime}'), + ], + ), + actions: [ + ElevatedButton( + child: const Text('Close'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } + } +} + +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource( + List source, + ) { + appointments = source; + } +} diff --git a/lib/Main_Screens/Calendar/SelectTime.dart b/lib/Main_Screens/Calendar/SelectTime.dart new file mode 100644 index 0000000..0855c39 --- /dev/null +++ b/lib/Main_Screens/Calendar/SelectTime.dart @@ -0,0 +1,547 @@ +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 createState() => _SelectTimeState(); +} + +class _SelectTimeState extends State { + RxBool isChecked = false.obs; + List 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); + } +} diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index 28a6607..c8d0178 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -3,28 +3,22 @@ class RouteName { static const String onboarding1 = '/onboarding1'; static const String loginScreen = '/loginScreen'; static const String nointernet = '/nointernet'; - static const String signupscreen = '/signupscreen'; static const String verifyusercreen = '/verifyuser'; static const String tellusindividualscreen = '/tellusindividualscreen'; static const String tellusbusinessscreen = '/tellusbusinessscreen'; static const String forgotpass = '/forgotpass'; - static const String individualprofilestep1 = '/individualprofilestep1'; static const String individualactivitystep2 = '/individualactivitystep2'; static const String individualgroupstep3 = '/individualgroupstep3'; static const String individualcommunitystep4 = '/individualcommunitystep4'; static const String findcommunitypage = '/findcommunitypage'; - static const String communitycommitscreen = '/communitycommitscreen'; static const String signupendpage = '/signupendpage'; - - static const String bussignupScreen = '/bussignupScreen'; static const String businessletusunderstandstep1 = '/businessletusunderstand'; static const String businessSelectgroupstep2 = '/businessselectgroup'; static const String businessSelectcommunitystep3 = '/businessselectcommunity'; - static const String communityScreen = '/communityScreen'; static const String mainscreen = '/mainscreen'; static const String sidemenu = '/sidemenu'; @@ -39,8 +33,6 @@ class RouteName { static const String announcement = '/announcement'; static const String watchlist = '/watchlist'; static const String requestscreen = '/requestscreen'; - - static const String group = '/group'; static const String communitysetting = '/communitysetting'; static const String editcommunity = '/editcommunity'; @@ -57,17 +49,11 @@ class RouteName { static const String addEvent = '/addEvent'; static const String setavailabillity = '/setavailabillity'; static const String addUsers = '/addUsers'; - static const String newchatpage = '/newchatpage'; static const String newgrouppage = '/newgrouppage'; - static const String userchatpage = '/userchatpage'; - static const String profiletab = '/profiletab'; static const String mynetwork = '/mynetwork'; - - - static const String groupchatpage = '/groupchatpage'; static const String managememberscal = '/managememberscal'; static const String shareProfile = '/shareProfile'; @@ -93,13 +79,9 @@ class RouteName { static const String addtimeline = '/addtimeline'; static const String verifycode = '/verifycode'; static const String newpassword = '/newpassword'; - static const String forgotOtp= '/forgotOtp'; - - + static const String forgotOtp = '/forgotOtp'; static const String availability = '/availability'; - //Group Tab - static const String grouptab = '/grouptab'; static const String requestedgroups = '/requestedgroups'; static const String groupdetail = '/groupdetail'; @@ -111,45 +93,29 @@ class RouteName { static const String connectcommunity = '/connectcommunity'; static const String certificate = '/certificate'; static const String sessions = '/sessions'; - //subgroup static const String subgroups = '/subgroups'; static const String subgroupinfo = '/subgroupinfo'; static const String editsubgroupinfo = '/editsubgroupinfo'; static const String subgroupsetting = '/subgroupsetting'; - //ExploreDesign - static const String explorescreen = '/explorescreen'; static const String searchgroup = '/searchgroup'; static const String detailexplore = '/detailexplore'; - static const String notificaationpage = '/notificationpage'; - static const String verifygoogleapplepage = '/verifygoogleapplepage'; - - //profiletabIndGestUser - static const String profiletabindguest = '/profiletabindguest'; - - //profiletabBusGestUser - + //profiletabBusGestUser static const String profiletabbusguest = '/profiletabbusguest'; - static const String addcertificate = '/addusercertificate'; - static const String viewalltags = '/viewalltags'; - static const String viewallcommunitiespinned = '/viewallcommunitiespinned'; - static const String viewalluserspinned = '/viewallusersspinned'; - static const String communitymembers = '/communitymembers'; - - - - - - + // calendar + static const String calendar = '/calendar'; + static const String availabilityrequest = '/availabilityrequest'; + static const String selecttimeslot = '/selecttimeslot'; + static const String addUser = '/addUser'; } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index e8be143..d1e89d8 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -1,8 +1,13 @@ -import 'package:flutter/material.dart'; import 'package:get/get_navigation/src/routes/get_route.dart'; +import 'package:regroup/Common/controller/MainScreen.dart'; +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/CalenderTab/AddEvent/AddEvent.dart'; import 'package:regroup/Main_Screens/CalenderTab/AddUsers/AddUsers.dart'; -import 'package:regroup/Main_Screens/CalenderTab/Availabillity.dart'; +// import 'package:regroup/Main_Screens/CalenderTab/AddUsers/AddUsers.dart'; import 'package:regroup/Main_Screens/CalenderTab/EventDetails.dart'; import 'package:regroup/Main_Screens/CalenderTab/ManageMenmbers/ManageMembersCal.dart'; import 'package:regroup/Main_Screens/CalenderTab/Resource%20Pool/ResourcePool.dart'; @@ -12,10 +17,10 @@ import 'package:regroup/Main_Screens/Chats/View/newchatpage.dart'; import 'package:regroup/Main_Screens/Chats/View/newgroup.dart'; import 'package:regroup/Main_Screens/Chats/View/userchat.dart'; import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; -import 'package:regroup/Main_Screens/Community_HomePage/TagsdDetailScreen.dart'; import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/View/PostDetailScreen.dart'; import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/View/ReactionView.dart'; import 'package:regroup/Main_Screens/Community_HomePage/PostScreen.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/TagsdDetailScreen.dart'; import 'package:regroup/Main_Screens/ExploreDesign/DetailExplore.dart'; import 'package:regroup/Main_Screens/ExploreDesign/ExploreScreen.dart'; import 'package:regroup/Main_Screens/ExploreDesign/SearchGroup.dart'; @@ -61,45 +66,13 @@ import 'package:regroup/Main_Screens/ProfileTab/Settings/View/BlockedUsers.dart' import 'package:regroup/Main_Screens/ProfileTab/Settings/View/Notification.dart'; import 'package:regroup/Main_Screens/ProfileTab/Share%20profile/ShareProfile.dart'; import 'package:regroup/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart'; - import 'package:regroup/Notifications/notification.dart'; -import 'package:regroup/onboarding/Signup/View/Business/View/busSignupScreen.dart'; - -import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/CommunitySetting.dart'; -import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/EditCommunity/EditCommunity.dart'; -import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageGroup.dart'; -import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/ManageInterest.dart'; -import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/View/NewTag/NewTag.dart'; -import 'package:regroup/sidemenu/Community/Announcements/AnnouncementRequest.dart'; -import 'package:regroup/sidemenu/Community/Announcements/ManageMembers.dart'; -import 'package:regroup/sidemenu/Community/Announcements/NewAnnouncement/NewAnnounceent.dart'; -import 'package:regroup/sidemenu/Community/Members/CommunityMembers.dart'; -import 'package:regroup/sidemenu/Community/MyCommunity/AddGroups.dart'; -import 'package:regroup/sidemenu/Community/MyCommunity/NewCommunity.dart'; -import 'package:regroup/sidemenu/Community/MyCommunity/View/RequestsScreen.dart'; -import 'package:regroup/sidemenu/Community/Watchlist.dart'; - -import 'package:regroup/Login/View/loginscreen.dart'; - -import 'package:regroup/Common/controller/MainScreen.dart'; - -import 'package:regroup/sidemenu/Community/Announcements/View/Announcements.dart'; -import 'package:regroup/sidemenu/Community/Group/view/Group.dart'; -import 'package:regroup/sidemenu/Community/MyCommunity/Community_Info-Page/view/communityInfo.dart'; -import 'package:regroup/sidemenu/Community/MyCommunity/View/CommunityDetails.dart'; -import 'package:regroup/sidemenu/Community/MyCommunity/View/MyCommunity.dart'; -import 'package:regroup/sidemenu/SavedPosts/SavedPosts.dart'; -import 'package:regroup/sidemenu/communities.dart'; -import 'package:regroup/sidemenu/sidemenu.dart'; -import 'package:regroup/Login/View/verifygoogleapple.dart'; - import 'package:regroup/Utils/Common/NoInternet.dart'; import 'package:regroup/onboarding/NewPass/View/NewPass.dart'; +import 'package:regroup/onboarding/Signup/View/Business/View/busSignupScreen.dart'; import 'package:regroup/onboarding/Signup/View/Business/View/step1Letusunderstandbetter.dart'; - import 'package:regroup/onboarding/Signup/View/Business/View/tellusbusiness.dart'; import 'package:regroup/onboarding/Signup/View/Individual/FindCommunityPage.dart'; -import 'package:regroup/onboarding/Signup/View/Individual/step1Selectprofile.dart'; import 'package:regroup/onboarding/Signup/View/Individual/step2Selectactivity.dart'; import 'package:regroup/onboarding/Signup/View/Individual/step3Selectyourgroup.dart'; import 'package:regroup/onboarding/Signup/View/Individual/step4Selectyourcommunity.dart'; @@ -113,6 +86,27 @@ import 'package:regroup/onboarding/forgotPass/View/ForgotPass.dart'; import 'package:regroup/onboarding/onboarding1.dart'; import 'package:regroup/onboarding/splashscreen.dart'; import 'package:regroup/resources/routes/route_name.dart'; +import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/CommunitySetting.dart'; +import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/EditCommunity/EditCommunity.dart'; +import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageGroup.dart'; +import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/ManageInterest.dart'; +import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/View/NewTag/NewTag.dart'; +import 'package:regroup/sidemenu/Community/Announcements/AnnouncementRequest.dart'; +import 'package:regroup/sidemenu/Community/Announcements/ManageMembers.dart'; +import 'package:regroup/sidemenu/Community/Announcements/NewAnnouncement/NewAnnounceent.dart'; +import 'package:regroup/sidemenu/Community/Announcements/View/Announcements.dart'; +import 'package:regroup/sidemenu/Community/Group/view/Group.dart'; +import 'package:regroup/sidemenu/Community/Members/CommunityMembers.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/AddGroups.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/Community_Info-Page/view/communityInfo.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/NewCommunity.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/View/CommunityDetails.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/View/MyCommunity.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/View/RequestsScreen.dart'; +import 'package:regroup/sidemenu/Community/Watchlist.dart'; +import 'package:regroup/sidemenu/SavedPosts/SavedPosts.dart'; +import 'package:regroup/sidemenu/communities.dart'; +import 'package:regroup/sidemenu/sidemenu.dart'; import 'package:regroup/sidemenu/tags.dart'; import 'package:regroup/sidemenu/users.dart'; @@ -306,10 +300,10 @@ class AppRoutes { name: RouteName.setavailabillity, page: () => const SetAvailabillity(), ), - GetPage( - name: RouteName.addUsers, - page: () => const AddUsers(), - ), + // GetPage( + // name: RouteName.addUsers, + // page: () => const AddUsers(), + // ), GetPage( name: RouteName.managememberscal, page: () => const ManageMembersCal(), @@ -478,10 +472,10 @@ class AppRoutes { name: RouteName.certificate, page: () => const Certificate(), ), - GetPage( - name: RouteName.availability, - page: () => const Availability(), - ), + // GetPage( + // name: RouteName.availability, + // page: () => const Availability(), + // ), GetPage( name: RouteName.sessions, page: () => const Sessions(), @@ -526,11 +520,11 @@ class AppRoutes { name: RouteName.addcertificate, page: () => const AddCertificate(), ), - GetPage( + GetPage( name: RouteName.viewalltags, page: () => const Viewtags(), ), - GetPage( + GetPage( name: RouteName.viewallcommunitiespinned, page: () => const Communitiespinned(), ), @@ -538,18 +532,29 @@ class AppRoutes { name: RouteName.viewalluserspinned, page: () => const Viewtusertags(), ), - GetPage( name: RouteName.communitymembers, page: () => const CommunityMembers(), ), - - - GetPage( + GetPage( name: RouteName.requestscreen, page: () => const RequestsScreen(), ), - - + GetPage( + name: RouteName.calendar, + page: () => const Calendar(), + ), + GetPage( + name: RouteName.availabilityrequest, + page: () => const AvailabilityRequest(), + ), + GetPage( + name: RouteName.selecttimeslot, + page: () => const SelectTime(), + ), + GetPage( + name: RouteName.addUser, + page: () => const AddUsers(), + ), ]; } -- 2.34.1 From f328c8d4fbe276aa22e0f8436c4f2270d94ddeb3 Mon Sep 17 00:00:00 2001 From: Dakshesh42 Date: Mon, 26 Aug 2024 17:00:03 +0530 Subject: [PATCH 2/4] pin unpin problem solved in mycommunity screen --- .../Announcements/View/Announcements.dart | 2 +- .../MyCommunity/View/CommunityDetails.dart | 42 +-- .../MyCommunity/View/MyCommunity.dart | 306 +++++++++--------- .../MyCommunity/View/RequestsScreen.dart | 33 +- 4 files changed, 201 insertions(+), 182 deletions(-) diff --git a/lib/sidemenu/Community/Announcements/View/Announcements.dart b/lib/sidemenu/Community/Announcements/View/Announcements.dart index 0973ce2..7b7b82c 100644 --- a/lib/sidemenu/Community/Announcements/View/Announcements.dart +++ b/lib/sidemenu/Community/Announcements/View/Announcements.dart @@ -133,7 +133,7 @@ Widget announcementWidget({ return commonGlassUI( width: double.infinity, height: 120.h, - borderRadius: BorderRadius.circular( 10.r), + borderRadius: BorderRadius.circular(10.r), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), child: Column( diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index cfe0bed..cbd8cc8 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -228,24 +228,8 @@ class _CommunityDetailsState extends State { child: Row( children: [ iscommunitypin == true - ? Text( - 'Unpin', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ) - : Text( - 'Pin', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), + ? text14w400white('Unpin') + : text14w400white('Pin'), const Spacer(), iscommunitypin == true ? Image.asset( @@ -595,7 +579,25 @@ class _CommunityDetailsState extends State { .toList() ?? [], ), - sizedBoxWidth(75.w), + sizedBoxWidth(comdetailobj! + .data! + .userLinkInCommunity! + .totalCommunityMember! == + 1 + ? 5.w + : comdetailobj! + .data! + .userLinkInCommunity! + .totalCommunityMember! == + 2 + ? 30.w + : comdetailobj! + .data! + .userLinkInCommunity! + .totalCommunityMember! == + 3 + ? 40.w + : 75.w), comdetailobj! .data! .userLinkInCommunity! @@ -688,7 +690,7 @@ class _CommunityDetailsState extends State { GestureDetector( onTap: () { // Get.toNamed(RouteName.addgroup); - Get.toNamed(RouteName.group, arguments: { + Get.toNamed(RouteName.announcement, arguments: { 'id': CommunityId, 'iscommunity': true, }); diff --git a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart index 55b2019..7121090 100644 --- a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart @@ -50,149 +50,149 @@ class _MyCommunityState extends State { void refreshData() { setState(() { - myfuture = MyCommunityAPI().getMyCommunity(); + // await MyCommunityAPI().getMyCommunity(); }); } + Future setValues() async { + if (mounted) { + isMuteList.clear(); + isPinList.clear(); + + for (int i = 0; i < myCommunityobj!.data.length; i++) { + isMuteList.add(myCommunityobj!.data[i].isMute!); + if (myCommunityobj!.data[i].joinedAndRequestedCommunity != null) { + isPinList.add(myCommunityobj! + .data[i].joinedAndRequestedCommunity!.isCommunityPinned!); + } + } + } + } + @override Widget build(BuildContext context) { return WillPopScope( - onWillPop: () async { - Get.toNamed(RouteName.mainscreen, arguments: 0); - return true; - }, - child: Scaffold( - // key: _scaffoldKey1, - backgroundColor: const Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: false, - appBar: CommonAppbar( - customBack: true, - titleTxt: "My Communities", - customActionWidget: Row( - children: [ - GestureDetector( - onTap: () async { - var result = await Get.toNamed(RouteName.newcommunity); - if (result != null && result) { - refreshData(); - // CommunityDetail().getCommunityDetail(CommunityId); - print("Updating community details..."); - // setState(() {}); - } - }, - child: Container( - height: 30.h, - width: 30.w, - decoration: const BoxDecoration( - color: Color(0xFFD90B2E), - boxShadow: [ - BoxShadow( - color: Color(0x40000000), - offset: Offset(0, 6), - blurRadius: 8, - spreadRadius: 0, - ), - ], - shape: BoxShape.circle), - child: const Icon( - Icons.add, - color: Colors.white, - ), - ), - ), - sizedBoxWidth(12.w), - Image.asset( - "assets/images/png/Frame 9.png", - height: 22.h, - width: 22.w, - ) - ], - ), - ), - body: FutureBuilder( - future: myfuture, - builder: (ctx, snapshot) { - if (snapshot.data == null) { - return const Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + onWillPop: () async { + Get.back(); + return true; + }, + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: const Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: false, + appBar: CommonAppbar( + customBack: true, + titleTxt: "My Communities", + customActionWidget: Row( children: [ - Center( - child: CircularProgressIndicator( - color: Color(0xFFC18948), + GestureDetector( + onTap: () async { + var result = await Get.toNamed(RouteName.newcommunity); + if (result != null && result) { + refreshData(); + // CommunityDetail().getCommunityDetail(CommunityId); + print("Updating community details..."); + // setState(() {}); + } + }, + child: Container( + height: 30.h, + width: 30.w, + decoration: const BoxDecoration( + color: Color(0xFFD90B2E), + boxShadow: [ + BoxShadow( + color: Color(0x40000000), + offset: Offset(0, 6), + blurRadius: 8, + spreadRadius: 0, + ), + ], + shape: BoxShape.circle), + child: const Icon( + Icons.add, + color: Colors.white, + ), ), + ), + sizedBoxWidth(12.w), + Image.asset( + "assets/images/png/Frame 9.png", + height: 22.h, + width: 22.w, ) ], - ); - } - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occured', - style: TextStyle(fontSize: 18.spMin), - ), - ); - } - } - // for (int i = 0; i < myCommunityobj!.data.length; i++) { - // ismute = myCommunityobj!.data[i].isMute; - // iscommunitypin = myCommunityobj! - // .data[i].joinedAndRequestedCommunity!.isCommunityPinned; - // } - for (int i = 0; i < myCommunityobj!.data.length; i++) { - // Check if the current data item and its joinedAndRequestedCommunity property are not null - - isMuteList.add(myCommunityobj!.data[i].isMute!); - - if (myCommunityobj!.data[i].joinedAndRequestedCommunity != null) { - isPinList.add(myCommunityobj! - .data[i] - .joinedAndRequestedCommunity! - .isCommunityPinned!); // Handle null with a default value if needed - } - } - - return Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column(children: [ - sizedBoxHeight(20.h), - Row( + ), + body: FutureBuilder( + future: MyCommunityAPI().getMyCommunity(), + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Spacer(), - GestureDetector( - onTap: () async { - var result = - await Get.toNamed(RouteName.requestscreen); - if (result != null && result) { - refreshData(); - // CommunityDetail().getCommunityDetail(CommunityId); - print("Updating community details..."); - // setState(() {}); - } - }, - child: - text16w700_FCFCFC_line("Request and Invites")) + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) ], - ), - sizedBoxHeight(20.h), - myCommunityobj!.data!.isEmpty - ? _buildNoDataBody(context) - : _buildBody(context), - ])) - ]); - }, - ), - ), - ); + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + + if (snapshot.hasData) { + setValues(); + + return Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column(children: [ + sizedBoxHeight(20.h), + Row( + children: [ + Spacer(), + GestureDetector( + onTap: () async { + var result = await Get.toNamed( + RouteName.requestscreen); + if (result != null && result) { + refreshData(); + print("Updating community details..."); + // setState(() {}); + } + }, + child: text16w700_FCFCFC_line( + "Request and Invites")) + ], + ), + sizedBoxHeight(20.h), + myCommunityobj!.data!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context), + ])) + ]); + } + return Container(); + }))); } Widget _buildNoDataBody(context) { @@ -235,7 +235,7 @@ class _MyCommunityState extends State { if (result != null && result) { refreshData(); - print("Updating community details..."); + print("Updating community details...$result"); } }, child: commonGlassUI( @@ -484,6 +484,7 @@ class _MyCommunityState extends State { // .joinedAndRequestedCommunity! // .id // .toString()); + Map updata = { "manage_communities_xid": myCommunityobj! @@ -523,28 +524,8 @@ class _MyCommunityState extends State { child: Row( children: [ isPinList[index] == true - ? Text( - 'Unpin ', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: - FontWeight.w800, - fontFamily: - "Nunito Sans", - ), - ) - : Text( - 'Pin ', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: - FontWeight.w800, - fontFamily: - "Nunito Sans", - ), - ), + ? text14w400white('Unpin') + : text14w400white('Pin'), const Spacer(), isPinList[index] == true ? Image.asset( @@ -638,7 +619,24 @@ class _MyCommunityState extends State { .toList() ?? [], ), - sizedBoxWidth(75.w), + sizedBoxWidth(joinnedComData + .totalCommunityMember == + null || + joinnedComData.totalCommunityMember == 1 + ? 5.w + : joinnedComData.totalCommunityMember == + null || + joinnedComData + .totalCommunityMember == + 2 + ? 30.w + : joinnedComData.totalCommunityMember == + null || + joinnedComData + .totalCommunityMember == + 3 + ? 40.w + : 75.w), joinnedComData.totalCommunityMember == null || joinnedComData .totalCommunityMember.isBlank! diff --git a/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart b/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart index ccafb2d..d9b56e8 100644 --- a/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart +++ b/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart @@ -1,6 +1,4 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; @@ -268,7 +266,28 @@ class _RequestedTabState extends State { .toList() ?? [], ), - sizedBoxWidth(75.w), + sizedBoxWidth(requestedComData + .totalCommunityMember == + null || + requestedComData + .totalCommunityMember == + 1 + ? 5.w + : requestedComData + .totalCommunityMember == + null || + requestedComData + .totalCommunityMember == + 2 + ? 30.w + : requestedComData + .totalCommunityMember == + null || + requestedComData + .totalCommunityMember == + 3 + ? 40.w + : 75.w), requestedComData.totalCommunityMember == null || requestedComData @@ -485,8 +504,8 @@ class _RequestedTabState extends State { borderRadius: BorderRadius .circular(30.r), - color: - Color(0xFFD90B2E)), + color: const Color( + 0xFFD90B2E)), child: Center( child: text12w400_FCFCFC( "Cancel request")), @@ -954,8 +973,8 @@ class _InvitedTabState extends State { borderRadius: BorderRadius .circular(30.r), - color: - Color(0xFFD90B2E)), + color: const Color( + 0xFFD90B2E)), child: Center( child: text12w400_FCFCFC( -- 2.34.1 From d003c6a40bb3af4f721fa6592e48241f898c60c2 Mon Sep 17 00:00:00 2001 From: Dakshesh42 Date: Mon, 26 Aug 2024 19:12:48 +0530 Subject: [PATCH 3/4] selectTimeslot screen done --- lib/Main_Screens/Calendar/SelectTime.dart | 547 ------------------ lib/Main_Screens/Calendar/SelectTimeSlot.dart | 121 ++++ lib/main.dart | 2 +- lib/resources/routes/route_name.dart | 1 + lib/resources/routes/routes.dart | 10 +- 5 files changed, 131 insertions(+), 550 deletions(-) delete mode 100644 lib/Main_Screens/Calendar/SelectTime.dart create mode 100644 lib/Main_Screens/Calendar/SelectTimeSlot.dart diff --git a/lib/Main_Screens/Calendar/SelectTime.dart b/lib/Main_Screens/Calendar/SelectTime.dart deleted file mode 100644 index 0855c39..0000000 --- a/lib/Main_Screens/Calendar/SelectTime.dart +++ /dev/null @@ -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 createState() => _SelectTimeState(); -} - -class _SelectTimeState extends State { - RxBool isChecked = false.obs; - List 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); - } -} diff --git a/lib/Main_Screens/Calendar/SelectTimeSlot.dart b/lib/Main_Screens/Calendar/SelectTimeSlot.dart new file mode 100644 index 0000000..83ebffa --- /dev/null +++ b/lib/Main_Screens/Calendar/SelectTimeSlot.dart @@ -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 createState() => _SelectTimeSlotState(); +} + +class _SelectTimeSlotState extends State { + @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 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 + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 171c6cc..6373f88 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -125,7 +125,7 @@ class _MyAppState extends State with WidgetsBindingObserver { debugShowCheckedModeBanner: false, // initialRoute: RouteName.individualactivitystep2, - initialRoute: RouteName.splashScreen, + initialRoute: RouteName.selecttimeslot, getPages: AppRoutes.appRoutes(), ), diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index c8d0178..3a45e8c 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -118,4 +118,5 @@ class RouteName { static const String availabilityrequest = '/availabilityrequest'; static const String selecttimeslot = '/selecttimeslot'; static const String addUser = '/addUser'; + } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index d1e89d8..5b21c93 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -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(), + // ), ]; } -- 2.34.1 From 8b7628d7296944f5aef50a7700c15ac70ad4ed96 Mon Sep 17 00:00:00 2001 From: Shubhamshirva Date: Mon, 26 Aug 2024 20:18:52 +0530 Subject: [PATCH 4/4] create groups api implemnted --- assets/images/png/basil_sort-outline.png | Bin 0 -> 254 bytes assets/images/png/ph_camera-light.png | Bin 0 -> 603 bytes lib/Common/api_urls.dart | 4 + .../Model/groupsAddFollowersModel.dart | 77 ++++ .../GroupTab/View/CreateGroups.dart | 347 ++++++++++++++ .../GroupTab/View/GroupAddfollowers.dart | 422 ++++++++++++++++++ lib/Main_Screens/GroupTab/View/GroupTab.dart | 1 + .../GroupTab/view_model/getmethod.dart | 28 ++ .../GroupTab/view_model/postmethod.dart | 19 + lib/Utils/texts.dart | 13 + lib/resources/routes/route_name.dart | 4 + lib/resources/routes/routes.dart | 12 + 12 files changed, 927 insertions(+) create mode 100644 assets/images/png/basil_sort-outline.png create mode 100644 assets/images/png/ph_camera-light.png create mode 100644 lib/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart create mode 100644 lib/Main_Screens/GroupTab/View/CreateGroups.dart create mode 100644 lib/Main_Screens/GroupTab/View/GroupAddfollowers.dart create mode 100644 lib/Main_Screens/GroupTab/view_model/getmethod.dart create mode 100644 lib/Main_Screens/GroupTab/view_model/postmethod.dart diff --git a/assets/images/png/basil_sort-outline.png b/assets/images/png/basil_sort-outline.png new file mode 100644 index 0000000000000000000000000000000000000000..f15f7364a6b85b1851a74e1749840db4af6e6bae GIT binary patch literal 254 zcmeAS@N?(olHy`uVBq!ia0vp^qChOd!3HFgyvvM%6lZ})WHAE+w=f7ZGR&GI0Tg5` z4sv&5Sa(k5C6L3C?&#~tz_78O`%fY(kU!be#WAFU@$KYX-UbDMHvV)5Wr?F4W&zR? z2i2qwa+z&tG`qm|!>GU4@Y$Y|e~xb6`#AYSfj!@%7Lm23ty4s}Pe|2n?mQZER^rBH z86CYpyMH!schSnvceh&ND3%iHHTU1q9u|iU%9A(GbAIk}X}iix|DZ2%{Ri zgD?<33DQmg-5?vZ8?+lhCrCD+cjD0^!k@8aH4>k6 zIt6Us1E0?(L?a_3+ITdOEXx$Toko{e&-1>>B`h+|^hnrzas>xlmjbIE_Kx-kash%S z2&y#toX{sA8_2YmEH9fS~FksAXg`eLwO;TP20cnD9gPL2jVqCTb zkA0?&fdbcwUdh{a_5P%$kAi>ed?HJ5oK)gf;{P(CE8vDKfEBxBd%z``0V&)v8y{qd zu}G-`?82H`b2h1`FD&$#3^1DRl0bQLd$uVHl8P~9+fcq*rSwE(lhSSycC=HaDxg~0 zBxtuB8rS4ahVXl=&I@pTgP%_{5EGGi@W-}BSU9pF1VihtiAY8H&eNxsCh*Qho;8B{ zr9Rr2h?F|$XC0>+EGj8S>Chd_MC2Ym>d3W2rM)(TMPfmSDYnmQ87dA9l5lWrCPHL7r5;KO6uCM_o0RRI3^3YpB*)km^tZc+umHZ;g%(Y9v@cc;7?{c!x#{Ct zN|vx9vH+{s`Wf^p&Xa8-XXKW~GIsGHhP+D9DW>`lG22M275r_le8#cql(}bHr^jm% pswgiduKpT1y87@N85#L6`~WI^6upSifTI8a002ovPDHLkV1gvV0r~&{ literal 0 HcmV?d00001 diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 05db8dd..d6199d8 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -198,4 +198,8 @@ class ApiUrls { static const postmanageaddgroupscommunity = "${baseUrl}add-groups-in-community"; + static const getgroupsaddfollowers = "${baseUrl}fetch-follower-to-add"; + + static const postcreategroups = "${baseUrl}create-group"; + } diff --git a/lib/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart b/lib/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart new file mode 100644 index 0000000..81b0938 --- /dev/null +++ b/lib/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart @@ -0,0 +1,77 @@ +class GroupsAddfollowersModel { + GroupsAddfollowersModel({ + required this.status, + required this.statusCode, + required this.message, + required this.data, + }); + + final String? status; + final int? statusCode; + final String? message; + final List data; + + factory GroupsAddfollowersModel.fromJson(Map json){ + return GroupsAddfollowersModel( + status: json["status"], + statusCode: json["status_code"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + ); + } + +} + +class Datum { + Datum({ + required this.id, + required this.iamPrincipalXid, + required this.followingIamPrincipalXid, + required this.following, + }); + + final int? id; + final int? iamPrincipalXid; + final int? followingIamPrincipalXid; + final Following? following; + + factory Datum.fromJson(Map json){ + return Datum( + id: json["id"], + iamPrincipalXid: json["iam_principal_xid"], + followingIamPrincipalXid: json["following_iam_principal_xid"], + following: json["following"] == null ? null : Following.fromJson(json["following"]), + ); + } + +} + +class Following { + Following({ + required this.id, + required this.principalTypeXid, + required this.userName, + required this.fullName, + required this.profilePhoto, + required this.isUserPinned, + }); + + final int? id; + final int? principalTypeXid; + final String? userName; + final String? fullName; + final String? profilePhoto; + final bool? isUserPinned; + + factory Following.fromJson(Map json){ + return Following( + id: json["id"], + principalTypeXid: json["principal_type_xid"], + userName: json["user_name"], + fullName: json["full_name"], + profilePhoto: json["profile_photo"], + isUserPinned: json["is_user_pinned"], + ); + } + +} diff --git a/lib/Main_Screens/GroupTab/View/CreateGroups.dart b/lib/Main_Screens/GroupTab/View/CreateGroups.dart new file mode 100644 index 0000000..659b96b --- /dev/null +++ b/lib/Main_Screens/GroupTab/View/CreateGroups.dart @@ -0,0 +1,347 @@ +import 'dart:io'; + +import 'package:dotted_border/dotted_border.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart' hide MultipartFile, FormData; +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/CustomNextButton.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/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/resources/routes/route_name.dart'; +import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; + +class Creategroup extends StatefulWidget { + const Creategroup({super.key}); + + @override + State createState() => _CreategroupState(); +} + +class _CreategroupState extends State { + List filePath = []; + List bannerPath = []; + + bool isImageAdded = false; + bool isbannerAdded = false; + + TextEditingController grouptitlecontroller = TextEditingController(); + TextEditingController groupdescriptioncontroller = TextEditingController(); + + final Map _TypecommunityMap = { + 'Public': 1, + 'Private': 2, + 'Secret': 3, + }; + + String _selectedtypecommunity = ''; + + void _onItemSelected(String value) { + setState(() { + _selectedtypecommunity = value; + }); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + Get.back(result: true); + return true; + }, + child: GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + backgroundColor: Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: true, + appBar: CommonAppbar( + titleTxt: "New group", + customBack: true, + ), + body: Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(20.h), + Center( + child: InkWell( + onTap: () { + ImageUploadBottomSheet().showModal( + context, + false, + (result) { + if (result != null && result.isNotEmpty) { + var file = File(result); + filePath.cast(); + filePath.add(file); + isImageAdded = true; + setState(() {}); + if (Platform.isAndroid) { + Get.back(); + } + } else { + // Handle case where no image is selected + filePath.clear(); + isImageAdded = false; + setState(() {}); + } + }, + ); + }, + child: commonGlassUI( + width: 95.w, + height: 95.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: + filePath.isNotEmpty && isImageAdded + ? ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(47.5.r), + child: Image.file( + filePath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ), + ), + ) + : Center( + child: Image.asset( + "assets/images/png/cameraicon2.png", + height: 30.h, + width: 30.w, + ), + ), + borderwidth: 0.5), + ), + ), + sizedBoxHeight(20.h), + Center( + child: text16w400_white( + "Add group profile picture")), + sizedBoxHeight(30.h), + text16w400_FCFCFC("Group banner image"), + sizedBoxHeight(15.h), + InkWell( + onTap: () { + ImageUploadBottomSheet().showModal( + context, + false, + (result) { + // var file = File(result); + + // bannerPath.add(file); + // isbannerAdded = true; + // setState(() {}); + if (result != null && result.isNotEmpty) { + var file = File(result); + + // Check if the file size exceeds 10 MB + // int fileSizeInBytes = file.lengthSync(); + // double fileSizeInMB = + // fileSizeInBytes / (1024 * 1024); + + // if (fileSizeInMB > 10) { + // // Show toast message if the file size exceeds 10 MB + + // utils.showToast( + // "The selected file is too large. Max file size is 10 MB."); + // } else { + + // Clear the existing image and add the new one + bannerPath.clear(); + bannerPath.add(file); + isbannerAdded = true; + setState(() {}); + // } + } else { + // Handle case where no image is selected + bannerPath.clear(); + isbannerAdded = false; + setState(() {}); + } + if (Platform.isAndroid) { + Get.back(); + } + }, + ); + }, + child: DottedBorder( + strokeWidth: 1, + dashPattern: [7, 4], + borderType: BorderType.RRect, + radius: Radius.circular(14.r), + color: Color(0xFF434A53), + child: commonGlassUI( + borderwidth: 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: Color(0xFF7E7E7E), + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 5)), + ), + child: Icon( + Icons + .delete_outline_outlined, + color: Colors.white, + ))), + ), + ]) + : Padding( + padding: EdgeInsets.symmetric( + vertical: 25.h), + child: Column( + children: [ + Image.asset( + "assets/images/png/ph_camera-light.png", + height: 40.h, + width: 40.w, + ), + sizedBoxHeight(10.h), + text14w400white( + 'Upload banner image'), + sizedBoxHeight(8.h), + ], + ), + ), + ), + ), + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Group title"), + sizedBoxHeight(15.h), + CustomTextFormField( + textEditingController: grouptitlecontroller, + inputFormatters: [ + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')) + ], + hintText: 'Enter group title', + validator: (val) { + if (val == null || val.isEmpty) { + return 'Enter group title'; + } + return null; + }, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Group description"), + sizedBoxHeight(15.h), + CustomTextFormField2( + maxlines: 3, + textEditingController: groupdescriptioncontroller, + inputFormatters: [ + RemoveEmojiInputFormatter(), + // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + hintText: 'Enter group description', + validator: (val) { + if (val == null || val.isEmpty) { + return 'Enter group description'; + } + return null; + }, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Type of group"), + sizedBoxHeight(15.h), + CustomDropDownRadio( + header: "", + title: "", + listData: const ['Public', 'Private', 'Secret'], + onItemSelected: _onItemSelected, + // (p0) {}, + leadingImage: SizedBox()), + sizedBoxHeight(25.h), + sizedBoxHeight(25.h), + CustomButton( + text: "Create group", + onPressed: () { + // Get.toNamed(RouteName.addgroup); + if (filePath.isEmpty) { + utils.showToast( + 'Please add group profile picture'); + } else if (bannerPath.isEmpty) { + utils.showToast('Please add banner image'); + } else if (grouptitlecontroller.text.isEmpty) { + utils.showToast('Please enter group title'); + } else if (groupdescriptioncontroller + .text.isEmpty) { + utils.showToast( + 'Please enter group description'); + } else if (_selectedtypecommunity.isEmpty) { + utils.showToast('Please select type of group'); + } else { + print('done'); + // indiUploadata(); + // Uploadata(); + int groupTypeValue = + _TypecommunityMap[_selectedtypecommunity] ?? + 0; + + Get.toNamed(RouteName.groupaddfollowers, arguments: { + 'groupname': grouptitlecontroller.text, + 'groupdescription': + groupdescriptioncontroller.text, + 'grouptype': groupTypeValue, + 'groupprofilephoto': filePath, + 'groupbannerimage': bannerPath, + }); + } + }, + ), + sizedBoxHeight(25.h), + ], + ))) + ], + ), + ), + ), + ); + } +} diff --git a/lib/Main_Screens/GroupTab/View/GroupAddfollowers.dart b/lib/Main_Screens/GroupTab/View/GroupAddfollowers.dart new file mode 100644 index 0000000..e0791c5 --- /dev/null +++ b/lib/Main_Screens/GroupTab/View/GroupAddfollowers.dart @@ -0,0 +1,422 @@ +import 'dart:async'; +import 'dart:developer'; +import 'dart:io'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart' hide MultipartFile, FormData; +import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/CommonWidget.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart'; +import 'package:regroup/Main_Screens/GroupTab/view_model/getmethod.dart'; +import 'package:regroup/Main_Screens/GroupTab/view_model/postmethod.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/CustomNextButton.dart'; +import 'package:regroup/Utils/Common/CustomTextformfield.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:path/path.dart' as path; + +class GroupAddFollowers extends StatefulWidget { + const GroupAddFollowers({super.key}); + + @override + State createState() => _GroupAddFollowersState(); +} + +class _GroupAddFollowersState extends State { + int grouptype = Get.arguments["grouptype"]; + String groupname = Get.arguments["groupname"]; + String groupdescription = Get.arguments["groupdescription"]; + List filepath = Get.arguments['groupprofilephoto']; + List bannerPath = Get.arguments['groupbannerimage']; + + StreamController searchcontroller = + StreamController(); + + @override + void initState() { + var updata = ""; + Getgroups() + .getGroupsAddfollowersearch(updata, streamController: searchcontroller); + + super.initState(); + } + + @override + void dispose() { + searchcontroller.close(); + super.dispose(); + } + + final List _selectedIndices = []; + + void _onContainerTap(int id) { + setState(() { + if (_selectedIndices.contains(id)) { + _selectedIndices.remove(id); + } else { + _selectedIndices.add(id); + } + }); + } + + Uploadata() async { + utils.loader(); + List bannermedialist = []; + List profielpicturelist = []; + + for (var file in bannerPath.where((file) => file != null)) { + bannermedialist.add( + await MultipartFile.fromFile( + file!.path, + filename: path.basename(file.path), + ), + ); + } + + for (var file in filepath.where((file) => file != null)) { + profielpicturelist.add( + await MultipartFile.fromFile( + file!.path, + filename: path.basename(file.path), + ), + ); + } + + String selectedIndicesString = '[${_selectedIndices.join(',')}]'; + print('Selected Indices: $selectedIndicesString'); + + FormData formdata = FormData.fromMap({ + "manage_group_type_xid": grouptype, + "background_image": bannermedialist[0], + "group_image": profielpicturelist[0], + "title": groupname, + "description": groupdescription, + 'members': selectedIndicesString.isEmpty ? null : selectedIndicesString, + }); + print('updata is ${formdata.toString()}'); + log('log is ${formdata.toString()}'); + final data = await PostMethodGroups().postCreategroups(formdata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + print("groups created"); + // Get.toNamed(RouteName.mycommunity); + Get.back(); + Get.back(result: true); + return utils.showToast(data.message); + } else { + Get.back(); + print("groups not created"); + return utils.showToast(data.message); + } + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + Get.back(); + return true; + }, + child: GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + backgroundColor: Color(0xFF222935), + extendBody: true, + appBar: CommonAppbar( + titleTxt: "Add followers", + ), + resizeToAvoidBottomInset: false, + bottomNavigationBar: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h), + child: CustomButton( + text: "Add", + onPressed: () { + // Get.toNamed(RouteName.mycommunity); + print('selected groups are ${_selectedIndices.toString()}'); + + Uploadata(); + }, + ), + ), + body: Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(20.h), + 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 users", + onInput: (value) { + Getgroups().getGroupsAddfollowersearch( + value, + streamController: searchcontroller); + }, + ), + sizedBoxHeight(25.h), + Row( + children: [ + text18w700_FCFCFC("Select followers"), + Spacer(), + commonGlassUI( + opacity1: 0.24, + opacity2: 0.24, + width: 35.w, + height: 35.h, + borderRadius: + BorderRadius.circular(100), + customWidget: Center( + child: Image.asset( + "assets/images/png/basil_sort-outline.png", + height: 20.h, + width: 20.w, + )), + borderwidth: 0.5), + sizedBoxWidth(18.w), + commonGlassUI( + opacity1: 0.24, + opacity2: 0.24, + width: 35.w, + height: 35.h, + borderRadius: + BorderRadius.circular(100), + customWidget: Center( + child: Image.asset( + "assets/images/png/bi_filter.png", + height: 20.h, + width: 20.w, + )), + borderwidth: 0.5), + ], + ), + sizedBoxHeight(25.h), + // sizedBoxHeight(30.h), + text20w700red("Available"), + sizedBoxHeight(20.h), + ]), + ), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + return const Center( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator(), + ], + ), + ); + } else if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.sp), + ), + ); + } else { + return groupsaddfollowersobj!.data.isEmpty + ? _buildNoDataBody(context) + : ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: + groupsaddfollowersobj!.data.length, + itemBuilder: (context, index) { + final isChecked = _selectedIndices + .contains(groupsaddfollowersobj! + .data[index].following!.id); + return Column( + children: [ + groupWidget( + index: groupsaddfollowersobj! + .data[index].id!, + imagePath: + groupsaddfollowersobj! + .data[index] + .following! + .profilePhoto ?? + '', + title: groupsaddfollowersobj! + .data[index] + .following! + .fullName!, + subtitle: groupsaddfollowersobj! + .data[index] + .following! + .userName!, + isChecked: isChecked, + // isCheckedList[index], + onCheckedChanged: + (bool? value) { + // isCheckedList[index] = value ?? false; + _onContainerTap( + groupsaddfollowersobj! + .data[index] + .following! + .id!); + }, + ), + commonDivider(), + ], + ); + }, + ); + } + }), + sizedBoxHeight(50.h), + ], + ), + ) + ], + )), + )); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No followers found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + Widget groupWidget({ + required int index, + required String? imagePath, + required String? title, + required String? subtitle, + required bool isChecked, + required ValueChanged onCheckedChanged, + }) { + return Padding( + padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), + child: Row( + children: [ + imagePath == null || imagePath.isEmpty + ? CircleAvatar( + backgroundImage: AssetImage('assets/images/png/img2.png'), + radius: 20.r, + ) + : + // CircleAvatar( + // backgroundImage: NetworkImage(imagePath), + // radius: 20.r, + // ), + CircleAvatar( + backgroundImage: CachedNetworkImageProvider(imagePath), + radius: 20.r, + child: CachedNetworkImage( + cacheKey: index.toString(), + maxHeightDiskCache: 100, + maxWidthDiskCache: 100, + imageUrl: imagePath, + placeholder: (context, url) => Container(), + errorWidget: (context, url, error) => Icon(Icons.error), + imageBuilder: (context, imageProvider) => CircleAvatar( + backgroundImage: imageProvider, + radius: 25.r, + ), + ), + ), + sizedBoxWidth(10.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title == null || title.isEmpty + ? text16w400_FCFCFC('ReGroup') + : Text( + title, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + color: const Color(0xFFFCFCFC), + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400), + ), + sizedBoxHeight(4.h), + subtitle == null || subtitle.isEmpty + ? text12w400_FCFCFC_blur('ReGroup') + : Text( + subtitle, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + color: const Color(0xFFFCFCFC).withOpacity(0.8), + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400), + ), + ], + ), + ), + Spacer(), + commonGlassUI( + borderwidth: isChecked ? 1.2 : 0.9, + borderRadius: BorderRadius.circular(2), + height: 23.h, + width: 23.w, + opacity1: 0.24, + opacity2: 0.24, + borderColor: + // isChecked ? Color(0xFFD90B2E) : + Color(0xFF434A53), + customWidget: Transform.scale( + scale: 1, + child: Checkbox( + side: BorderSide(color: Colors.transparent), + value: isChecked, + activeColor: Colors.transparent, + checkColor: + // Color(0xFFD90B2E), + Color(0XFFFFFFFF), + onChanged: onCheckedChanged, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/Main_Screens/GroupTab/View/GroupTab.dart b/lib/Main_Screens/GroupTab/View/GroupTab.dart index 07e3994..824033c 100644 --- a/lib/Main_Screens/GroupTab/View/GroupTab.dart +++ b/lib/Main_Screens/GroupTab/View/GroupTab.dart @@ -54,6 +54,7 @@ class _GroupTabState extends State { InkWell( onTap: () { // Get.toNamed(RouteName.addEvent); + Get.toNamed(RouteName.creategroup); }, child: Container( height: 35.h, diff --git a/lib/Main_Screens/GroupTab/view_model/getmethod.dart b/lib/Main_Screens/GroupTab/view_model/getmethod.dart new file mode 100644 index 0000000..8bd859d --- /dev/null +++ b/lib/Main_Screens/GroupTab/view_model/getmethod.dart @@ -0,0 +1,28 @@ +import 'dart:async'; + +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:regroup/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart'; + + +GroupsAddfollowersModel? groupsaddfollowersobj; + +class Getgroups { + + Future> getGroupsAddfollowersearch(updata, + {required StreamController streamController}) async { + final response = + await NetworkApiServices().getApi( + "${ApiUrls.getgroupsaddfollowers}?search=$updata", + + ); + + if (response.status == ResponseStatus.SUCCESS) { + groupsaddfollowersobj = GroupsAddfollowersModel.fromJson(response.data); + if (!streamController.isClosed) streamController.sink.add(groupsaddfollowersobj!); + } + return response; + } + +} \ No newline at end of file diff --git a/lib/Main_Screens/GroupTab/view_model/postmethod.dart b/lib/Main_Screens/GroupTab/view_model/postmethod.dart new file mode 100644 index 0000000..cd6e004 --- /dev/null +++ b/lib/Main_Screens/GroupTab/view_model/postmethod.dart @@ -0,0 +1,19 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; + +class PostMethodGroups { + PostMethodGroups(); + + Future> postCreategroups(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postcreategroups, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } + +} \ No newline at end of file diff --git a/lib/Utils/texts.dart b/lib/Utils/texts.dart index 147da88..5f795ab 100644 --- a/lib/Utils/texts.dart +++ b/lib/Utils/texts.dart @@ -824,3 +824,16 @@ Widget text8w700_white(String text) { fontWeight: FontWeight.w700), ); } + +Widget text20w700red(String text, {TextAlign? textAlign}) { + return Text( + text, + textAlign: textAlign, + style: TextStyle( + fontSize: 20.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w700, + color: Color(0XFFD90B2E), + ), + ); +} diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index 28a6607..63684ba 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -147,6 +147,10 @@ class RouteName { static const String communitymembers = '/communitymembers'; + static const String creategroup = '/creategroup'; + + static const String groupaddfollowers = '/groupaddfollowers'; + diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index e8be143..0d15c7a 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -19,8 +19,10 @@ import 'package:regroup/Main_Screens/Community_HomePage/PostScreen.dart'; import 'package:regroup/Main_Screens/ExploreDesign/DetailExplore.dart'; import 'package:regroup/Main_Screens/ExploreDesign/ExploreScreen.dart'; import 'package:regroup/Main_Screens/ExploreDesign/SearchGroup.dart'; +import 'package:regroup/Main_Screens/GroupTab/View/CreateGroups.dart'; import 'package:regroup/Main_Screens/GroupTab/View/ConnectCommunity.dart'; import 'package:regroup/Main_Screens/GroupTab/View/GoupSettings.dart'; +import 'package:regroup/Main_Screens/GroupTab/View/GroupAddfollowers.dart'; import 'package:regroup/Main_Screens/GroupTab/View/GroupDetail.dart'; import 'package:regroup/Main_Screens/GroupTab/View/GroupEvent.dart'; import 'package:regroup/Main_Screens/GroupTab/View/GroupInfo.dart'; @@ -550,6 +552,16 @@ class AppRoutes { page: () => const RequestsScreen(), ), + GetPage( + name: RouteName.creategroup, + page: () => const Creategroup(), + ), + + GetPage( + name: RouteName.groupaddfollowers, + page: () => const GroupAddFollowers(), + ), + ]; } -- 2.34.1