diff --git a/lib/features/reviews/widgets/review_form.dart b/lib/features/reviews/widgets/review_form.dart index 7c8bf19..6ee14f6 100644 --- a/lib/features/reviews/widgets/review_form.dart +++ b/lib/features/reviews/widgets/review_form.dart @@ -23,13 +23,16 @@ class ReviewForm extends StatefulWidget { enum _FormState { idle, loading, success } -class _ReviewFormState extends State { +class _ReviewFormState extends State with SingleTickerProviderStateMixin { int _rating = 0; final _commentController = TextEditingController(); _FormState _state = _FormState.idle; bool _isLoggedIn = false; String? _error; + late final AnimationController _checkController; + late final Animation _checkScale; + @override void initState() { super.initState(); @@ -38,6 +41,8 @@ class _ReviewFormState extends State { _rating = widget.existingReview!.rating; _commentController.text = widget.existingReview!.comment ?? ''; } + _checkController = AnimationController(vsync: this, duration: const Duration(milliseconds: 600)); + _checkScale = CurvedAnimation(parent: _checkController, curve: Curves.elasticOut); } Future _checkAuth() async { @@ -56,6 +61,7 @@ class _ReviewFormState extends State { await widget.onSubmit(_rating, _commentController.text); if (mounted) { setState(() => _state = _FormState.success); + _checkController.forward(from: 0); Future.delayed(const Duration(seconds: 3), () { if (mounted) setState(() => _state = _FormState.idle); }); @@ -68,6 +74,7 @@ class _ReviewFormState extends State { @override void dispose() { _commentController.dispose(); + _checkController.dispose(); super.dispose(); } @@ -106,10 +113,13 @@ class _ReviewFormState extends State { ), child: Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon(Icons.check_circle, color: Color(0xFF10B981), size: 24), - SizedBox(width: 8), - Text('Review submitted!', style: TextStyle(color: Color(0xFF10B981), fontWeight: FontWeight.w600, fontSize: 15)), + children: [ + ScaleTransition( + scale: _checkScale, + child: const Icon(Icons.check_circle, color: Color(0xFF10B981), size: 24), + ), + const SizedBox(width: 8), + const Text('Review submitted!', style: TextStyle(color: Color(0xFF10B981), fontWeight: FontWeight.w600, fontSize: 15)), ], ), )