Files
Regroup/lib/Feed Module/sidemenu/Community/MyCommunity/AddGroups.dart
2024-06-05 11:52:59 +05:30

202 lines
6.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:regroup/Common/CommonButton.dart';
import 'package:regroup/Common/CommonGlassmorphism.dart';
import 'package:regroup/Common/CommonWidget.dart';
import 'package:regroup/Common/controller/CommonTextFormField.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
import 'package:regroup/Utils/Common/blureffect.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
class AddGroup extends StatefulWidget {
const AddGroup({super.key});
@override
State<AddGroup> createState() => _AddGroupState();
}
class _AddGroupState extends State<AddGroup> {
List<bool> isCheckedList = [false, false, false, false];
List groupData = [
{
"imagePath": "assets/images/png/img45.png",
"title": "Iron titans fitness crew",
"subtitle": "Lorem ipsum dummy text",
},
{
"imagePath": "assets/images/png/Rectangle 25.png",
"title": "Body blitz brigade",
"subtitle": "Lorem ipsum dummy text",
},
{
"imagePath": "assets/images/png/img2.png",
"title": "Fit fusion squad",
"subtitle": "Lorem ipsum dummy text",
},
{
"imagePath": "assets/images/png/img2.png",
"title": "Power pulse posse",
"subtitle": "Lorem ipsum dummy text",
},
];
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "Add groups",
),
body: Stack(children: [
const CommonBlurLeftRed(),
const CommonBlurRightRed(),
const CommonBlurLeft(),
const CommonBlurRight(),
Positioned.fill(
child: 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 groups",
),
sizedBoxHeight(25.h),
Row(
children: [
commonGlassContainer(
opacity1: 0.24,
opacity2: 0.24,
width: 50.w,
height: 50.h,
borderradius: 100,
customWidget: Center(
child: Image.asset(
"assets/images/png/Black.png",
height: 30.h,
width: 30.w,
)),
border: 0.5),
sizedBoxWidth(8.w),
text18w400_FCFCFC("Create group"),
Spacer(),
Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.white,
size: 14.sp,
),
],
),
sizedBoxHeight(25.h),
sizedBoxHeight(30.h),
text18w700white("Existing Groups"),
sizedBoxHeight(20.h),
]),
),
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;
});
},
),
commonDivider(),
],
);
},
),
sizedBoxHeight(50.h),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: CommonBtn(
text: "Add",
onTap: () {
Get.toNamed(RouteName.mycommunity);
},
),
),
]),
))
]));
}
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: 20.r,
),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16w400_FCFCFC(title),
sizedBoxHeight(4.h),
text12w400_FCFCFC_blur(subtitle),
],
),
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: BorderSide(color: Color(0xFF434A53)),
value: isChecked,
activeColor: Colors.transparent,
checkColor: Colors.white,
onChanged: onCheckedChanged,
),
),
),
],
),
);
}
}