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

771 lines
28 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_reaction_button/flutter_reaction_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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/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 SubGroupInfo extends StatefulWidget {
const SubGroupInfo({super.key});
@override
State<SubGroupInfo> createState() => _SubGroupInfoState();
}
class _SubGroupInfoState extends State<SubGroupInfo> {
List cardtile = [
{
"imagePath": "assets/images/png/Rectangle 29ss.png",
"title": "Cardio crusaders circle"
},
{
"imagePath": "assets/images/png/Rectangle 31ee.png",
"title": "Strength squad syndicate"
},
{
"imagePath": "assets/images/png/Rectangle 30aa.png",
"title": "Flexibility faction force"
},
{
"imagePath": "assets/images/png/Rectangle 29ss.png",
"title": "Cardio crusaders circle"
},
];
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "",
customActionWidget: Row(children: [
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints: BoxConstraints.tightFor(
width: 150.w,
),
offset: Offset(0, 40),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
onTap: () {
Get.toNamed(RouteName.newpost);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: text14w400white("Create post"),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {
Get.toNamed(RouteName.groupevent);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: text14w400white("Create event"),
),
),
],
child: commonGlassContainer(
opacity1: 0.24,
opacity2: 0.24,
width: 40.w,
height: 40.h,
borderradius: 100,
customWidget: Center(
child: Image.asset(
"assets/images/png/Vector536.png",
height: 17.h,
width: 17.w,
),
),
border: 0.5),
),
sizedBoxWidth(16.w),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.editsubgroupinfo);
},
child: commonGlassContainer(
opacity1: 0.24,
opacity2: 0.24,
width: 40.w,
height: 40.h,
borderradius: 100,
customWidget: Center(
child: Image.asset(
"assets/images/png/codicon_account.png",
height: 20.h,
width: 20.w,
),
),
border: 0.5),
),
sizedBoxWidth(16.w),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints: BoxConstraints.tightFor(
width: 230.w,
),
offset: Offset(0, 40),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400white("Add members"),
Spacer(),
Image.asset(
"assets/images/png/uiw_user-add.png",
height: 15.h,
width: 15.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400white("Share"),
Spacer(),
Image.asset(
"assets/images/png/share.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {
// Get.toNamed(RouteName.groupinfo);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400white("Sub -Group info"),
Spacer(),
Image.asset(
"assets/images/png/codicon_account.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400white("Search"),
Spacer(),
Image.asset(
"assets/images/png/Frame 58575.png",
height: 18.h,
width: 18.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400white("Mute Notification"),
Spacer(),
Image.asset(
"assets/images/png/Black1233.png",
height: 16.h,
width: 16.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {
Get.toNamed(RouteName.subgroupsetting);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400white("Edit sub-group settings"),
Spacer(),
Image.asset(
"assets/images/png/setting2.png",
height: 18.h,
width: 18.w,
)
],
),
),
),
],
child: Image.asset(
'assets/images/png/Group 1000004071.png',
height: 20.h,
width: 20.w,
)),
]),
),
body: Stack(children: [
const CommonBlurLeftRed(),
const CommonBlurRightRed(),
const CommonBlurLeft(),
const CommonBlurRight(),
Positioned.fill(
child: SingleChildScrollView(
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
sizedBoxHeight(20.h),
Stack(clipBehavior: Clip.none, children: [
GestureDetector(
onTap: () {},
child: SizedBox(
height: 130.h,
width: double.infinity,
child: Image.asset(
"assets/images/png/group11.png",
fit: BoxFit.cover,
),
),
),
Positioned(
bottom: -35.h,
left: 20.w,
child: Container(
width: 85.r,
height: 85.r,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.white,
width: 2,
),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.25),
blurRadius: 12,
offset: Offset(0, 6),
),
],
),
child: CircleAvatar(
radius: 42.5.r,
foregroundImage:
AssetImage("assets/images/png/group111.png"),
),
))
]),
sizedBoxHeight(60.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text20w700_FCFCFC("Cardio crusaders circle"),
sizedBoxHeight(16.h),
Row(
children: [
commonGlassContainer(
width: 35.w,
height: 35.h,
borderradius: 100,
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(
child: Image.asset("assets/images/png/Black.png",
height: 20.h, width: 20.w),
),
border: 0.5),
sizedBoxWidth(7.w),
text16w400_FCFCFCblur("The athlectic town"),
sizedBoxWidth(20.w),
commonGlassContainer(
width: 35.w,
height: 35.h,
opacity1: 0.24,
opacity2: 0.24,
borderradius: 100,
customWidget: Center(
child: Image.asset("assets/images/png/img12.png",
height: 20.h, width: 20.w),
),
border: 0.5),
sizedBoxWidth(7.w),
text16w400_FCFCFCblur("Public"),
],
),
sizedBoxHeight(35.h),
],
),
),
DefaultTabController(
length: 2,
// initialIndex: selectedIndex.value,
child: Column(
children: [
CommonTabBar(tabs: const [
Tab(
text: 'Posts',
),
Tab(
text: 'Events',
),
]),
SizedBox(
height: 600.h,
child: TabBarView(
// clipBehavior: Clip.none,
children: [
postsTab(),
eventsTab(),
],
),
),
sizedBoxHeight(90.h),
],
),
),
]),
))
]));
}
Widget postsTab() {
return Column(
children: [
sizedBoxHeight(30.h),
normalcardtile(
profileImg: 'assets/images/png/cimg4.png',
title: 'Edward Hackket',
mainImg: 'assets/images/png/img322.png',
containerTitle: [
'Kayaking',
'Marathon',
'Events',
'Marathon',
'Events'
]),
],
);
}
Widget normalcardtile({
required String profileImg,
required String title,
required String mainImg,
required List<String> containerTitle,
}) {
var mainImage = 'assets/images/png/uiw_like-o.png'.obs;
void updateImage(String reaction) {
if (reaction == 'like') {
mainImage.value = 'assets/images/png/f7_hand-thumbsup.png';
} else if (reaction == 'heart') {
mainImage.value = 'assets/images/png/heart 2.png';
} else if (reaction == 'party') {
mainImage.value = 'assets/images/png/party-popper 2.png';
}
}
return commonGlassContainer(
width: double.infinity,
height: 570.h,
border: 0,
borderradius: 1,
customWidget: Column(
children: [
sizedBoxHeight(25.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
foregroundImage: AssetImage(profileImg),
radius: 25.r,
),
sizedBoxWidth(12.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16w400_FCFCFC(title),
sizedBoxHeight(5.h),
Row(
children: [
Image.asset(
'assets/images/png/community 1 (traced).png',
height: 14.w,
width: 14.w,
),
sizedBoxWidth(7.w),
text12w400_FCFCFC('Active alliance network'),
sizedBoxWidth(7.w),
Icon(
Icons.circle,
color: Color(0xFFFCFCFC),
size: 4.sp,
),
sizedBoxWidth(6.w),
text12w400_FCFCFC('1 Hour ago'),
],
)
],
),
Spacer(),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints: BoxConstraints.tightFor(width: 176.w),
offset: Offset(0, 50),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Row(
children: [
Text(
'Report Post',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: FontWeight.w800,
fontFamily: "Nunito Sans",
),
),
Spacer(),
Image.asset(
"assets/images/png/Vector (5).png",
height: 15.h,
width: 15.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Row(
children: [
Text(
'Share post',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: FontWeight.w800,
fontFamily: "Nunito Sans",
),
),
Spacer(),
Image.asset(
"assets/images/png/share.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Row(
children: [
Text(
'Pin',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: FontWeight.w800,
fontFamily: "Nunito Sans",
),
),
Spacer(),
Image.asset(
"assets/images/png/f7_pin-fill (2).png",
height: 25.h,
width: 25.w,
)
],
),
),
),
],
child: Image.asset(
'assets/images/png/Group 1000004071.png',
width: 16.w,
height: 18.h,
),
),
sizedBoxWidth(5.w)
],
),
),
sizedBoxHeight(20.h),
GestureDetector(
onTap: () {
// Get.toNamed(RouteName.postdetailsScreen);
},
child: Container(
height: 163.h,
width: double.infinity,
child: Image.asset(
mainImg,
fit: BoxFit.cover,
),
)),
sizedBoxHeight(20.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(children: [
SizedBox(
height: 30.h,
child: ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: containerTitle.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 12.w),
child: GestureDetector(
onTap: () {
// Get.toNamed(RouteName.cyclescreen);
},
child: containertile(text: containerTitle[index])),
);
},
),
),
sizedBoxHeight(20.h),
text16w400_FCFCFC(
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."),
Row(children: [
InkWell(
onTap: () {
// Get.toNamed(RouteName.reactionview);
},
child: stackReaction(number: '20', containerImages: [
'assets/images/png/f7_hand-thumbsup.png',
'assets/images/png/heart 2.png',
'assets/images/png/party-popper 2.png'
]),
),
Spacer(),
commonGlassContainer(
border: 0.43,
width: 30.w,
height: 30.h,
opacity1: 0.05,
opacity2: 0.06,
borderradius: 100,
customWidget: Center(
child: Image.asset(
'assets/images/png/Frame 1000004088.png',
height: 13.h,
width: 13.w,
),
),
),
sizedBoxWidth(12.w),
text14w400_FCFCFC('20'),
sizedBoxWidth(20.w),
commonGlassContainer(
border: 0.43,
width: 30.w,
height: 30.h,
borderradius: 100,
opacity1: 0.05,
opacity2: 0.06,
customWidget: Center(
child: Image.asset(
'assets/images/png/Vector (1).png',
height: 12.h,
width: 12.w,
),
),
),
sizedBoxWidth(12.w),
text14w400_FCFCFC('10'),
]),
sizedBoxHeight(12.h),
commonDivider(),
sizedBoxHeight(12.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Obx(() {
return ReactionButton<String>(
onReactionChanged: (reaction) {
updateImage(reaction?.value ?? 'like');
debugPrint('Selected value: ${reaction?.value}');
},
reactions: <Reaction<String>?>[
Reaction<String>(
value: 'like',
previewIcon: _buildReactionsPreviewIcon(
'assets/images/png/f7_hand-thumbsup.png'),
icon: _buildReactionsIcon(
'assets/images/png/f7_hand-thumbsup.png'),
),
Reaction<String>(
value: 'heart',
previewIcon: _buildReactionsPreviewIcon(
'assets/images/png/heart 2.png'),
icon: _buildReactionsIcon(
'assets/images/png/heart 2.png'),
),
Reaction<String>(
value: 'party',
previewIcon: _buildReactionsPreviewIcon(
'assets/images/png/party-popper 2.png'),
icon: _buildReactionsIcon(
'assets/images/png/party-popper 2.png'),
),
],
selectedReaction: Reaction<String>(
value: 'like',
icon: _buildReactionsIcon(
'assets/images/png/f7_hand-thumbsup.png'),
),
boxColor: Colors.white,
boxElevation: 9,
boxRadius: 30,
itemsSpacing: 8,
itemScale: 0.4,
itemSize: Size(45, 45),
boxPadding: EdgeInsets.all(8),
boxAnimationDuration: Duration(milliseconds: 200),
itemAnimationDuration: Duration(milliseconds: 500),
hoverDuration: Duration(milliseconds: 700),
// toggle: false,
child: _buildReactionsIcon(mainImage.value),
);
})
],
),
GestureDetector(
onTap: () {
// Get.toNamed(RouteName.postdetailsScreen);
},
child: Column(
children: [
Image.asset(
'assets/images/png/Frame 1000004088.png',
height: 19.h,
width: 19.w,
),
sizedBoxHeight(8.h),
text11w400_FCFCFC('Comment')
],
),
),
Column(
children: [
Image.asset(
'assets/images/png/Frame 1000004089.png',
height: 19.h,
width: 19.w,
),
sizedBoxHeight(8.h),
text11w400_FCFCFC('Save')
],
)
],
),
sizedBoxHeight(12.h),
commonDivider(),
sizedBoxHeight(12.h),
]),
),
],
));
}
Widget _buildReactionsPreviewIcon(String assetPath) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
assetPath,
height: 40.h,
width: 40.w,
),
);
}
Widget _buildReactionsIcon(String assetPath) {
return Column(
children: [
Image.asset(
assetPath,
height: 19.h,
width: 19.w,
),
sizedBoxHeight(8.h),
text11w400_FCFCFC('Like')
],
);
}
Widget containertile({required String text}) {
return commonGlassContainer(
border: 1,
width: 100.w,
height: 30.h,
borderradius: 30.r,
borderColor: Color(0xFFD90B2E),
customWidget: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Center(child: text14w400_FCFCFC(text)),
));
}
Widget eventsTab() {
return Column(
children: [],
);
}
}