Files
Regroup/lib/Feed Module/sidemenu/Community/MyCommunity/NewCommunity.dart
2024-06-25 20:14:03 +05:30

241 lines
9.0 KiB
Dart

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:regroup/Common/CommonButton.dart';
import 'package:regroup/Common/CommonDropDown.dart';
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/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/ImageUpload.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 NewCommunity extends StatefulWidget {
const NewCommunity({super.key});
@override
State<NewCommunity> createState() => _NewCommunityState();
}
class _NewCommunityState extends State<NewCommunity> {
List<File?> filePath = [];
List<File?> bannerPath = [];
bool isImageAdded = false;
bool isbannerAdded = false;
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "New community",
),
body: Stack(children: [
const CommonBlurLeftRed(),
const CommonBlurRightRed(),
const CommonBlurLeft(),
const CommonBlurRight(),
Positioned.fill(
child: 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,
true,
(result) {
var file = File(result);
filePath.add(file);
isImageAdded = true;
setState(() {});
},
);
},
child: commonGlassContainer(
width: 95.w,
height: 95.h,
borderradius: 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,
),
),
border: 0.5),
),
),
sizedBoxHeight(20.h),
Center(child: text16w400_white("Add community profile picture")),
sizedBoxHeight(30.h),
text16w400_FCFCFC("Banner image"),
sizedBoxHeight(15.h),
InkWell(
onTap: () {
ImageUploadBottomSheet().showModal(
context,
false,
(result) {
var file = File(result);
bannerPath.add(file);
isbannerAdded = true;
setState(() {});
},
);
},
child: DottedBorder(
strokeWidth: 1,
dashPattern: [7, 4],
borderType: BorderType.RRect,
radius: Radius.circular(14.r),
color: Color(0xFF434A53),
child: commonGlassContainer(
border: 0,
width: double.infinity,
height: 130.h,
borderradius: 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: 16.h),
child: Column(
children: [
Image.asset(
"assets/images/png/bi_download.png",
height: 36.h,
width: 36.w,
),
sizedBoxHeight(10.h),
text14w400white('Upload banner image'),
sizedBoxHeight(8.h),
text8w400_8A8A8A(
"Allowed file extensions: jpg, png, gif Max file size: 10 MB"),
],
),
),
),
),
),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Community name*"),
sizedBoxHeight(15.h),
CustomTextFormField(
validator: (val) {
if (val == null || val.isEmpty) {
return 'Enter Community name';
}
return null;
},
),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Type of community*"),
sizedBoxHeight(15.h),
CustomDropDownRadio(
header: "",
title: "",
listData: ['Public', 'Private', 'Secret'],
onItemSelected: (p0) {},
leadingImage: SizedBox()),
// CommonDropdownradioBtn(
// hint: '',
// items: ['Public', 'Private', 'Secret'],
// showOtherOption: false),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Location*"),
sizedBoxHeight(15.h),
CustomDropDownRadio(
header: "",
title: "",
listData: ['Public', 'Private', 'Secret'],
onItemSelected: (p0) {},
leadingImage: SizedBox()),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Primary activity*"),
sizedBoxHeight(20.h),
CustomDropDownRadio(
header: "",
title: "",
listData: [
'Sports',
'Hobby',
],
showOtherOption: true,
onItemSelected: (p0) {},
leadingImage: SizedBox()),
sizedBoxHeight(25.h),
sizedBoxHeight(25.h),
CommonBtn(
text: "Create community",
onTap: () {
Get.toNamed(RouteName.addgroup);
},
),
sizedBoxHeight(25.h),
sizedBoxHeight(150.h),
]),
)))
]));
}
}