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/CommonDropDown.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Utils/Common/CommonAppbar.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'; class PostScreen extends StatefulWidget { const PostScreen({super.key}); @override State createState() => _PostScreenState(); } class _PostScreenState extends State { var selectedContainerIndices = {}.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), const 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), CommonDropdownBtn(hint: '', items: [ 'Active alliance network', 'Fitfam federation', 'The athletic town' ]), sizedBoxHeight(25.h), text16w400_FCFCFC("Post in"), sizedBoxHeight(18.h), CommonDropdownBtn(hint: '', items: [ 'Active alliance network', 'Fitfam federation', 'The athletic town' ]), sizedBoxHeight(100.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)), ), ), ); }); } }