import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; import 'logic.dart'; class ActionPage extends GetView { const ActionPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColor.bgLight, body: SafeArea( child: Column( children: [ SizedBox(height: 20), ObxValue((data) { return Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: List.generate(4, (index) { return headerWidget( icon: controller.headersIcons[index], title: controller.headersTitle[index], onTap: () { controller.selectedIndex.value = index; }, isSelected: controller.selectedIndex.value == index, ); }), ); }, controller.selectedIndex), Expanded( child: ObxValue( (index) => switch (index.value) { 0 => profileWidget(), 1 => slidableWidgetTwo(), 2 => slidableWidgetOne(), 3 => slidableWidgetOne(), int() => Placeholder(), }, controller.selectedIndex, ), ), ], ), ), ); } Column profileWidget() { return Column( children: [ slidableWidgetOne(), slidableWidgetOne(), slidableWidgetOne(), slidableWidgetOne(), slidableWidgetOne(), ], ); } Widget headerWidget({ required String icon, required String title, required VoidCallback onTap, bool isSelected = false, }) { return GestureDetector( onTap: onTap, child: Column( spacing: 8, children: [ Container( width: 48, height: 48, padding: EdgeInsets.all(8), decoration: ShapeDecoration( color: isSelected ? AppColor.blueLightActive : AppColor.blueLight, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), child: vecWidget( icon, width: 40, height: 40, color: AppColor.blueNormal, ), ), Text( title, style: AppFonts.yekan12.copyWith( color: isSelected ? AppColor.blueNormalActive : AppColor.blueNormal, ), ), ], ), ); } Widget slidableWidgetOne() { if (controller.showSlideHint) { controller.triggerSlidableAnimation(); } return Padding( padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20), child: Slidable( key: Key('selectedLocationWidget'), controller: controller.slidController.value, endActionPane: ActionPane( motion: StretchMotion(), children: [ CustomSlidableAction( onPressed: (context) {}, backgroundColor: AppColor.redNormal, foregroundColor: Colors.white, padding: EdgeInsets.all(16), borderRadius: BorderRadius.circular(8), autoClose: true, child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24), ), ], ), child: GestureDetector( onTap: () {}, child: Container( height: 62, padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), border: Border.all(width: 1, color: AppColor.blackLightHover), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( spacing: 4, children: [ Text( 'داود خرم مهری پور', style: AppFonts.yekan10.copyWith( color: AppColor.blueNormal, ), ), Text( '03295224154', style: AppFonts.yekan12.copyWith( color: AppColor.darkGreyDarkHover, ), ), ], ), Column( spacing: 4, children: [ Text( 'افزودن کاربر', style: AppFonts.yekan10.copyWith( color: AppColor.blueNormal, ), ), Text( 'ثبت بازرسی', style: AppFonts.yekan12.copyWith( color: AppColor.darkGreyDarkHover, ), ), ], ), Column( spacing: 4, children: [ Text( 'همدان', style: AppFonts.yekan10.copyWith( color: AppColor.blueNormal, ), ), Text( 'همدان', style: AppFonts.yekan12.copyWith( color: AppColor.darkGreyDarkHover, ), ), ], ), ], ), ), ), ), ); } Widget slidableWidgetTwo() { return ObxValue((data) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20), child: GestureDetector( onTap: (){ controller.isExpanded.value = !controller.isExpanded.value; }, child: AnimatedContainer( duration: Duration(milliseconds: 2000), height: data.value ? 370 : 62, child: data.value ? Container(color: Colors.yellow,height: 80,width: 180,) : Slidable( key: Key('selectedLocationWidget'), controller: controller.slidController.value, endActionPane: ActionPane( motion: StretchMotion(), children: [ CustomSlidableAction( onPressed: (context) {}, backgroundColor: AppColor.blueNormal, foregroundColor: Colors.white, padding: EdgeInsets.all(16), borderRadius: BorderRadius.only( topRight: Radius.circular(8), bottomRight: Radius.circular(8), ), autoClose: true, child: vecWidget( Assets.vecEditSvg, width: 24, height: 24, ), ), CustomSlidableAction( onPressed: (context) {}, backgroundColor: AppColor.redNormal, foregroundColor: Colors.white, padding: EdgeInsets.all(16), borderRadius: BorderRadius.only( topLeft: Radius.circular(8), bottomLeft: Radius.circular(8), ), autoClose: true, child: vecWidget( Assets.vecTrashSvg, width: 24, height: 24, ), ), ], ), child: GestureDetector( onTap: () {}, child: Container( height: 62, padding: EdgeInsets.symmetric( horizontal: 20, vertical: 15, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), border: Border.all( width: 1, color: AppColor.blackLightHover, ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( spacing: 4, children: [ Text( 'داود خرم مهری پور', style: AppFonts.yekan10.copyWith( color: AppColor.blueNormal, ), ), Text( '03295224154', style: AppFonts.yekan12.copyWith( color: AppColor.darkGreyDarkHover, ), ), ], ), Column( spacing: 4, children: [ Text( 'افزودن کاربر', style: AppFonts.yekan10.copyWith( color: AppColor.blueNormal, ), ), Text( 'ثبت بازرسی', style: AppFonts.yekan12.copyWith( color: AppColor.darkGreyDarkHover, ), ), ], ), Column( spacing: 4, children: [ Text( 'همدان', style: AppFonts.yekan10.copyWith( color: AppColor.blueNormal, ), ), Text( 'همدان', style: AppFonts.yekan12.copyWith( color: AppColor.darkGreyDarkHover, ), ), ], ), ], ), ), ), ), ), ), ); }, controller.isExpanded); } }