import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:rasadyar_app/presentation/common/app_color.dart'; import 'package:rasadyar_app/presentation/common/app_fonts.dart'; class RShowMore extends StatefulWidget { const RShowMore({super.key}); @override State createState() => _RShowMoreState(); } class _RShowMoreState extends State with SingleTickerProviderStateMixin { bool _toggled = false; late final AnimationController _controller; late final Animation _iconRotation; @override void initState() { super.initState(); _controller = AnimationController( vsync: this, duration: const Duration(milliseconds: 500), ); _iconRotation = Tween( begin: 0, end: 0.50, ) // 90 degrees (quarter turn) .animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut)); } void _toggle() { setState(() => _toggled = !_toggled); _toggled ? _controller.forward() : _controller.reverse(); } @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return GestureDetector( onTap: _toggle, behavior: HitTestBehavior.opaque, child: Row( mainAxisSize: MainAxisSize.min, spacing: 8, children: [ RotationTransition( turns: _iconRotation, child: const Icon(CupertinoIcons.chevron_down, size: 12,color:AppColor.blueNormal ,), ), AnimatedSwitcher( duration: const Duration(milliseconds: 500), transitionBuilder: (child, animation) => FadeTransition(opacity: animation, child: child), child: Text( _toggled ? 'کمتر' : 'مشاهده بیشتر', key: ValueKey(_toggled), style: AppFonts.yekan10Regular.copyWith(color: AppColor.blueNormal), ), ), SizedBox(height: 50,) ], ), ); } }