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/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 ResourcePool extends StatefulWidget { const ResourcePool({super.key}); @override State createState() => _ResourcePoolState(); } class _ResourcePoolState extends State { List isCheckedList = [false, false, false, false]; List eventData = [ { "imagePath": "assets/images/png/img45.png", "title": "Super sports fest", }, { "imagePath": "assets/images/png/Rectangle 25.png", "title": "Tri-sport challenge", }, { "imagePath": "assets/images/png/img2.png", "title": "Ultimate athlete challenge", }, { "imagePath": "assets/images/png/img2.png", "title": "Cyclotron challenge", }, ]; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFF222935), extendBody: true, appBar: CommonAppbar( titleTxt: "Resource pool", ), resizeToAvoidBottomInset: false, body: Stack(children: [ Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column(children: [ sizedBoxHeight(10.h), CustomTextFormField( leadingIcon: SizedBox( height: 23, width: 23, child: Center( child: Image.asset( "assets/images/png/ion_search-outline.png", height: 23, width: 23, ), ), ), hintText: "Search community sessions", ), sizedBoxHeight(20.h), Expanded( child: ListView.builder( itemCount: 2, shrinkWrap: true, itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.symmetric(vertical: 16), child: resourceCard(), ); }, ), ) ]), ) ])); } Widget resourceCard() { return commonGlassContainer( width: double.infinity, height: 216.h, borderradius: 10.r, customWidget: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ CircleAvatar( backgroundImage: AssetImage("assets/images/png/Ellipse 52.png"), radius: 25.r, ), sizedBoxWidth(8.w), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ text16w400_FCFCFC("Ryan Dorwart"), sizedBoxHeight(6.h), text12w400_FCFCFC_blur("Row row row your boat") ], ), Spacer(), InkWell( onTap: () { inviteBottomSheet(); }, child: Container( height: 30.h, width: 95.w, decoration: BoxDecoration( color: Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r)), child: Center(child: text14400white("Invite")), ), ) ], ), sizedBoxHeight(14.h), commonDivider(), sizedBoxHeight(14.h), text16w400_FCFCFC("Available for :"), sizedBoxHeight(12.h), Row( children: [ Image.asset( "assets/images/png/calender.png", height: 16.h, width: 16.w, ), sizedBoxWidth(8.w), SizedBox(width: 140.w, child: text14w400_FCFCFC("Race")), sizedBoxWidth(16.w), Image.asset( "assets/images/png/Vector (4).png", height: 16.h, width: 16.w, ), sizedBoxWidth(8.w), SizedBox(width: 120.w, child: text14w400_FCFCFC("Race")), ], ), sizedBoxHeight(12.h), Row( children: [ Image.asset( "assets/images/png/Black.png", height: 16.h, width: 16.w, ), sizedBoxWidth(8.w), SizedBox( width: 140.w, child: text14w400_FCFCFC("Only group events")), sizedBoxWidth(16.w), Image.asset( "assets/images/png/Group122.png", height: 16.h, width: 16.w, ), sizedBoxWidth(8.w), SizedBox(width: 120.w, child: text14w400_FCFCFC("Lorem ipsum")), ], ), ]), ), border: 1); } 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(20.h), text18w400white("Events"), Column( children: List.generate(eventData.length, (index) { return Column( children: [ sizedBoxHeight(10.h), eventWidget( index: index, imagePath: eventData[index]["imagePath"], title: eventData[index]["title"], isChecked: isCheckedList[index], onCheckedChanged: (bool? value) { setState(() { isCheckedList[index] = value ?? false; }); }, ), if (index != eventData.length - 1) commonDivider(), ], ); }), ), sizedBoxHeight(30.h), ], ), ), ); }, ), ); } Widget eventWidget({ required int index, required String imagePath, required String title, required bool isChecked, required ValueChanged onCheckedChanged, }) { return Padding( padding: EdgeInsets.symmetric( vertical: 16.h, ), child: Row( children: [ SizedBox( height: 30.h, width: 30.w, child: ClipRRect( borderRadius: BorderRadius.circular(5.r), child: Image.asset( imagePath, fit: BoxFit.cover, ), ), ), sizedBoxWidth(10.w), text16w400_FCFCFC(title), Spacer(), commonGlassContainer( border: 1, borderradius: 2, height: 23.h, width: 23.w, opacity1: 0.24, opacity2: 0.24, customWidget: Transform.scale( scale: 1.4, child: Checkbox( side: BorderSide(color: Color(0xFF434A53)), value: isChecked, activeColor: Colors.transparent, checkColor: Colors.white, onChanged: onCheckedChanged, ), ), ), ], ), ); } }