From 6be571c6a9418cdc496457881176d5fddce702e4 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 20 May 2026 17:12:04 +0300 Subject: [PATCH] animation added on dashboard all work order text section --- .../widgets/request_category_fragment.dart | 107 +++++++++++------- 1 file changed, 67 insertions(+), 40 deletions(-) diff --git a/lib/dashboard_latest/widgets/request_category_fragment.dart b/lib/dashboard_latest/widgets/request_category_fragment.dart index af5797a3..18c8d313 100644 --- a/lib/dashboard_latest/widgets/request_category_fragment.dart +++ b/lib/dashboard_latest/widgets/request_category_fragment.dart @@ -25,6 +25,8 @@ class RequestCategoryFragment extends StatefulWidget { class _RequestCategoryFragmentState extends State with SingleTickerProviderStateMixin { bool isAscending = false; late AnimationController _animationController; + late Animation _headerFadeAnimation; + late Animation _headerSlideAnimation; @override void initState() { @@ -33,6 +35,25 @@ class _RequestCategoryFragmentState extends State with duration: const Duration(milliseconds: 1200), vsync: this, ); + + // Header animation (appears first, faster) + _headerFadeAnimation = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: _animationController, + curve: const Interval(0.0, 0.4, curve: Curves.easeOut), + ), + ); + + _headerSlideAnimation = Tween( + begin: const Offset(0.0, -0.3), + end: Offset.zero, + ).animate( + CurvedAnimation( + parent: _animationController, + curve: const Interval(0.0, 0.5, curve: Curves.easeOutCubic), + ), + ); + _animationController.forward(); } @@ -77,46 +98,52 @@ class _RequestCategoryFragmentState extends State with context: context, userType: Provider.of(context, listen: false).user?.type, ), - !isNurse && dashboardProvider.tabs.isNotEmpty && dashboardProvider.tabs[dashboardProvider.currentListIndex].tag == 0 - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // context.translation.allWorkOrder.heading4(context), - // GestureDetector( - // onTap: () { - // dashboardProvider.isShowDashBoardCalendar = !dashboardProvider.isShowDashBoardCalendar; - // }, - // child: dashboardProvider.isShowDashBoardCalendar ? AppAsset.listIcon.toSvgAsset() : AppAsset.calendarIcon.toSvgAsset()) - // ], - // ), - dashboardProvider.isShowDashBoardCalendar - ? Padding( - padding: EdgeInsets.only(top: 12.toScreenHeight), - child: const WeeklyCalendarFragment(), - ) - : const SizedBox(), - ], - ).paddingOnly(start: 14, end: 12) - : Row( - spacing: 16, - children: [ - Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded, - if (!isFMSEngineer) - 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { - Navigator.of(context).pushNamed('/cleaner_search'); - }), - Transform.flip( - flipY: isAscending, - child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { - _toggleSort(dashboardProvider, user?.type); - }), - ) - ], - ).paddingOnly(start: 16, end: 16), + FadeTransition( + opacity: _headerFadeAnimation, + child: SlideTransition( + position: _headerSlideAnimation, + child: !isNurse && dashboardProvider.tabs.isNotEmpty && dashboardProvider.tabs[dashboardProvider.currentListIndex].tag == 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // context.translation.allWorkOrder.heading4(context), + // GestureDetector( + // onTap: () { + // dashboardProvider.isShowDashBoardCalendar = !dashboardProvider.isShowDashBoardCalendar; + // }, + // child: dashboardProvider.isShowDashBoardCalendar ? AppAsset.listIcon.toSvgAsset() : AppAsset.calendarIcon.toSvgAsset()) + // ], + // ), + dashboardProvider.isShowDashBoardCalendar + ? Padding( + padding: EdgeInsets.only(top: 12.toScreenHeight), + child: const WeeklyCalendarFragment(), + ) + : const SizedBox(), + ], + ).paddingOnly(start: 14, end: 12) + : Row( + spacing: 16, + children: [ + Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded, + if (!isFMSEngineer) + 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { + Navigator.of(context).pushNamed('/cleaner_search'); + }), + Transform.flip( + flipY: isAscending, + child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { + _toggleSort(dashboardProvider, user?.type); + }), + ) + ], + ).paddingOnly(start: 16, end: 16), + ), + ), // isFMSEngineer // ? Row(