animation added on dashboard all work order text section

main_production_RSG
Sikander Saleem 1 month ago
parent 84e36c9d70
commit 6be571c6a9

@ -25,6 +25,8 @@ class RequestCategoryFragment extends StatefulWidget {
class _RequestCategoryFragmentState extends State<RequestCategoryFragment> with SingleTickerProviderStateMixin { class _RequestCategoryFragmentState extends State<RequestCategoryFragment> with SingleTickerProviderStateMixin {
bool isAscending = false; bool isAscending = false;
late AnimationController _animationController; late AnimationController _animationController;
late Animation<double> _headerFadeAnimation;
late Animation<Offset> _headerSlideAnimation;
@override @override
void initState() { void initState() {
@ -33,6 +35,25 @@ class _RequestCategoryFragmentState extends State<RequestCategoryFragment> with
duration: const Duration(milliseconds: 1200), duration: const Duration(milliseconds: 1200),
vsync: this, vsync: this,
); );
// Header animation (appears first, faster)
_headerFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: _animationController,
curve: const Interval(0.0, 0.4, curve: Curves.easeOut),
),
);
_headerSlideAnimation = Tween<Offset>(
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(); _animationController.forward();
} }
@ -77,46 +98,52 @@ class _RequestCategoryFragmentState extends State<RequestCategoryFragment> with
context: context, context: context,
userType: Provider.of<UserProvider>(context, listen: false).user?.type, userType: Provider.of<UserProvider>(context, listen: false).user?.type,
), ),
!isNurse && dashboardProvider.tabs.isNotEmpty && dashboardProvider.tabs[dashboardProvider.currentListIndex].tag == 0 FadeTransition(
? Column( opacity: _headerFadeAnimation,
crossAxisAlignment: CrossAxisAlignment.start, child: SlideTransition(
children: [ position: _headerSlideAnimation,
Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))), child: !isNurse && dashboardProvider.tabs.isNotEmpty && dashboardProvider.tabs[dashboardProvider.currentListIndex].tag == 0
// Row( ? Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
// children: [ children: [
// context.translation.allWorkOrder.heading4(context), Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))),
// GestureDetector( // Row(
// onTap: () { // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// dashboardProvider.isShowDashBoardCalendar = !dashboardProvider.isShowDashBoardCalendar; // children: [
// }, // context.translation.allWorkOrder.heading4(context),
// child: dashboardProvider.isShowDashBoardCalendar ? AppAsset.listIcon.toSvgAsset() : AppAsset.calendarIcon.toSvgAsset()) // GestureDetector(
// ], // onTap: () {
// ), // dashboardProvider.isShowDashBoardCalendar = !dashboardProvider.isShowDashBoardCalendar;
dashboardProvider.isShowDashBoardCalendar // },
? Padding( // child: dashboardProvider.isShowDashBoardCalendar ? AppAsset.listIcon.toSvgAsset() : AppAsset.calendarIcon.toSvgAsset())
padding: EdgeInsets.only(top: 12.toScreenHeight), // ],
child: const WeeklyCalendarFragment(), // ),
) dashboardProvider.isShowDashBoardCalendar
: const SizedBox(), ? Padding(
], padding: EdgeInsets.only(top: 12.toScreenHeight),
).paddingOnly(start: 14, end: 12) child: const WeeklyCalendarFragment(),
: Row( )
spacing: 16, : const SizedBox(),
children: [ ],
Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded, ).paddingOnly(start: 14, end: 12)
if (!isFMSEngineer) : Row(
'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { spacing: 16,
Navigator.of(context).pushNamed('/cleaner_search'); children: [
}), Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded,
Transform.flip( if (!isFMSEngineer)
flipY: isAscending, 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() {
child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { Navigator.of(context).pushNamed('/cleaner_search');
_toggleSort(dashboardProvider, user?.type); }),
}), Transform.flip(
) flipY: isAscending,
], child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() {
).paddingOnly(start: 16, end: 16), _toggleSort(dashboardProvider, user?.type);
}),
)
],
).paddingOnly(start: 16, end: 16),
),
),
// isFMSEngineer // isFMSEngineer
// ? Row( // ? Row(

Loading…
Cancel
Save