Files
Regroup/lib/Feed Module/Main_Screens/GroupTab/View/SubGroup/SubgroupSetting.dart
2024-06-25 20:14:03 +05:30

176 lines
5.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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/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 SubGroupSetting extends StatefulWidget {
const SubGroupSetting({super.key});
@override
State<SubGroupSetting> createState() => _SubGroupSettingState();
}
class _SubGroupSettingState extends State<SubGroupSetting> {
var selectedIndex = (-1).obs;
List eventData = [
{
"title": "Open",
},
{
"title": "Invite only",
},
];
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "Subgroup settings",
),
body: Stack(children: [
const CommonBlurLeftRed(),
const CommonBlurRightRed(),
const CommonBlurLeft(),
const CommonBlurRight(),
Positioned.fill(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sizedBoxHeight(30.h),
GestureDetector(
onTap: () {
inviteBottomSheet();
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text18w400_FCFCFC("Group type"),
Spacer(),
Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.white,
size: 18.sp,
)
],
),
),
),
sizedBoxHeight(25.h),
commonDivider(),
sizedBoxHeight(25.h),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.groupmanage);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text18w400_FCFCFC("Manage members"),
Spacer(),
Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.white,
size: 18.sp,
)
],
),
),
),
]))
]));
}
void inviteBottomSheet() {
Get.bottomSheet(
StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.r),
topRight: Radius.circular(30.r),
),
color: Color(0xFF222935),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
sizedBoxHeight(30.h),
text18w400white("Choose"),
Obx(
() => Column(
children: List.generate(eventData.length, (index) {
return Column(
children: [
sizedBoxHeight(10.h),
eventWidget(
index: index,
title: eventData[index]["title"],
isSelected: selectedIndex.value == index,
onSelectedChanged: (int? value) {
selectedIndex.value = value ?? -1;
},
),
if (index != eventData.length - 1) commonDivider(),
],
);
}),
),
),
sizedBoxHeight(30.h),
],
),
),
);
},
),
);
}
Widget eventWidget({
required int index,
required String title,
required bool isSelected,
required ValueChanged<int?> onSelectedChanged,
}) {
return Padding(
padding: EdgeInsets.symmetric(
vertical: 10.h,
),
child: Row(
children: [
Transform.scale(
scale: 1.2,
child: Radio<int>(
value: index,
groupValue: isSelected ? index : null,
onChanged: onSelectedChanged,
activeColor: Colors.white,
fillColor: MaterialStateProperty.resolveWith((states) {
return Colors.white;
}),
),
),
sizedBoxWidth(10.w),
text16w400_FCFCFC(title),
],
),
);
}
}