Files
Regroup/lib/Feed Module/Main_Screens/Community/PostScreen.dart

245 lines
9.1 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/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/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 PostScreen extends StatefulWidget {
const PostScreen({super.key});
@override
State<PostScreen> createState() => _PostScreenState();
}
class _PostScreenState extends State<PostScreen> {
var selectedContainerIndices = <int>{}.obs;
void toggleSelectedIndex(int index) {
if (selectedContainerIndices.contains(index)) {
selectedContainerIndices.remove(index);
} else {
selectedContainerIndices.add(index);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "Create a post",
),
body: Stack(children: [
const CommonBlurLeftRed(),
const CommonBlurRightRed(),
const CommonBlurLeft(),
const CommonBlurRight(),
Positioned.fill(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sizedBoxHeight(20.h),
text16w400_FCFCFC("Caption"),
sizedBoxHeight(18.h),
CustomTextFormField2(
maxlines: 3,
),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Media"),
sizedBoxHeight(18.h),
commonGlassContainer(
border: 0.9,
width: double.infinity,
height: 130.h,
borderradius: 10.r,
customWidget: 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),
text14w400_FCFCFC("Upload image"),
sizedBoxHeight(8.h),
text8w400_8A8A8A(
"Allowed file extensions: jpg, png, gif Max file size: 10 MB"),
],
),
)),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Tags"),
sizedBoxHeight(18.h),
CustomTextFormField(
suffixIcon: Container(
height: 20.h,
width: 20.w,
child: Center(
child: Image.asset(
"assets/images/png/Frame 58575.png",
height: 20.h,
width: 20.w,
fit: BoxFit.cover,
),
),
)),
sizedBoxHeight(25.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
containerTile(text: "# Race", index: 0),
containerTile(text: "# Swimming", index: 1),
containerTile(text: "# Cycle", index: 2),
],
),
sizedBoxHeight(16.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
containerTile(text: "# Race", index: 3),
containerTile(text: "# Swimming", index: 4),
containerTile(text: "# Cycle", index: 5),
],
),
sizedBoxHeight(30.h),
text16w400_FCFCFC("CTA Title"),
sizedBoxHeight(18.h),
CustomTextFormField(),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Post as"),
sizedBoxHeight(18.h),
CommonDropdownradioBtn(
hint: '', items: ['Individual', 'Anonymous']),
sizedBoxHeight(18.h),
// CommonDropdownBtn(hint: '', items: [
// 'Active alliance network',
// 'Fitfam federation',
// 'The athletic town'
// ]),
sizedBoxHeight(25.h),
text16w400_FCFCFC("Post in"),
sizedBoxHeight(18.h),
CommonDropdownCheckbox(
hint: '',
items: [
'Active alliance network',
'Fitfam federation',
'The athletic town',
'Football fever'
],
images: [
'assets/images/png/Rectangle 65.png',
'assets/images/png/Rectangle 66.png',
'assets/images/png/Rectangle 60.png',
'assets/images/png/Rectangle 68.png'
],
),
sizedBoxHeight(40.h),
CommonBtn(
text: 'Submit post',
onTap: () {
successBottomsheet();
},
),
sizedBoxHeight(150.h),
]),
),
))
]));
}
void successBottomsheet() {
Get.bottomSheet(Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14.r),
color: Color(0xFF222935)),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.w),
child: Column(mainAxisSize: MainAxisSize.min, children: [
sizedBoxHeight(20.h),
Image.asset(
'assets/images/png/Frame 1000004082.png',
width: 199.w,
height: 158.h,
),
sizedBoxHeight(20.h),
text18w500Center_FCFCFC(
'Your post has been succesfully uploaded'),
sizedBoxHeight(20.h),
InkWell(
onTap: () {
Get.toNamed(RouteName.mainscreen);
},
child: Container(
height: 35.h,
width: 216.w,
decoration: BoxDecoration(
border: Border.all(color: Color(0xFF434A53), width: 1),
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color.fromRGBO(255, 255, 255, 0.054),
Color.fromRGBO(255, 255, 255, 0.072),
],
stops: [0.0233, 1.0],
transform: GradientRotation(271.14 *
(3.141592653589793 /
180)), // Converting degrees to radians
),
borderRadius: BorderRadius.circular(30.r),
),
child: Center(child: text14w400_FCFCFC('Check out')),
),
),
sizedBoxHeight(40.h)
]))));
}
Widget containerTile({
required String text,
required int index,
}) {
return Obx(() {
return GestureDetector(
onTap: () {
toggleSelectedIndex(index);
},
child: Container(
height: 35,
decoration: BoxDecoration(
color: selectedContainerIndices.contains(index)
? Color(0xFFD90B2E).withOpacity(0.4)
: Color(0xFFFFFFFF).withOpacity(0.2),
borderRadius: BorderRadius.circular(30),
border: selectedContainerIndices.contains(index)
? Border.all(color: Color(0xFFD90B2E), width: 1)
: null),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Center(child: text14w400_FCFCFC(text)),
),
),
);
});
}
}