Files
Regroup/lib/Main_Screens/CalenderTab/AddUsers/AddUsers.dart
2024-07-31 16:08:23 +05:30

426 lines
14 KiB
Dart

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<AddUsers> createState() => _AddUsersState();
}
class _AddUsersState extends State<AddUsers> {
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<bool> 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',
),
Tab(
text: 'Sub-group',
),
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(),
commonGlassContainer(
width: 35.w,
height: 35.h,
borderradius: 100,
customWidget: Center(
child: Image.asset(
"assets/images/png/Vector (5)22.png",
height: 12.h,
width: 12.w,
),
),
border: 0.5),
sizedBoxWidth(14.w),
commonGlassContainer(
width: 35.w,
height: 35.h,
borderradius: 100,
customWidget: Center(
child: Image.asset(
"assets/images/png/bi_filter.png",
height: 22.h,
width: 18.w,
),
),
border: 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<bool?> 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(),
commonGlassContainer(
border: 1,
borderradius: 2,
height: 23.h,
width: 23.w,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Transform.scale(
scale: 1.4,
child: Checkbox(
side: const BorderSide(color: Color(0xFF434A53)),
value: isChecked,
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: [
commonGlassContainer(
width: 40.w,
height: 40.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(child: text16w400_FCFCFC("M")),
border: 0.5),
sizedBoxWidth(15.w),
commonGlassContainer(
width: 40.w,
height: 40.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(child: text16w400_FCFCFC("Tu")),
border: 0.5),
sizedBoxWidth(15.w),
commonGlassContainer(
width: 40.w,
height: 40.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(child: text16w400_FCFCFC("W")),
border: 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: [
commonGlassContainer(
width: 40.w,
height: 40.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(child: text16w400_FCFCFC("Th")),
border: 0.5),
sizedBoxWidth(15.w),
commonGlassContainer(
width: 40.w,
height: 40.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(child: text16w400_FCFCFC("F")),
border: 0.5),
sizedBoxWidth(15.w),
commonGlassContainer(
width: 40.w,
height: 40.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(child: text16w400_FCFCFC("Sa")),
border: 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: [],
);
}
}