From f566564f356350ef6287c26c86d431fc540e336e Mon Sep 17 00:00:00 2001 From: cp-sneha-s Date: Thu, 14 Mar 2024 10:55:13 +0530 Subject: [PATCH] Fix Minor UI Issues --- lib/data/core/utils/date_formatter.dart | 11 ++-- .../home/home_screen/widget/request_list.dart | 36 +++++------- .../shared/events/bloc/celebrations_bloc.dart | 3 +- .../events/celebrations_event_card.dart | 58 ++++++++++--------- .../edit_profile/edit_profile_screen.dart | 5 +- 5 files changed, 57 insertions(+), 56 deletions(-) diff --git a/lib/data/core/utils/date_formatter.dart b/lib/data/core/utils/date_formatter.dart index 44771f76..d9d2134f 100644 --- a/lib/data/core/utils/date_formatter.dart +++ b/lib/data/core/utils/date_formatter.dart @@ -96,14 +96,15 @@ class DateFormatter { } String showAnniversaries( - {required DateTime dateTime, required String name, int? number}) { + {required DateTime dateOfJoining, required String name, int? number}) { final today = DateTime.now().dateOnly; - final difference = dateTime.difference(today); - int yearDifference = (difference.inDays / 365).floor(); - if (dateTime.dateOnly.isAtSameMomentAs(today)) { + final difference = dateOfJoining.difference(today); + int yearDifference = (difference.inDays / 365).floor().abs(); + final upcomingAnniversaryDate = dateOfJoining.convertToUpcomingDay(); + if (upcomingAnniversaryDate.isAtSameMomentAs(today)) { return _localization.present_anniversary_text(name, yearDifference); } else { - return "${_localization.upcoming_anniversary_text(name, yearDifference)} ${getDateRepresentation(dateTime)}!🎉"; + return "${_localization.upcoming_anniversary_text(name, yearDifference)} ${getDateRepresentation(upcomingAnniversaryDate).toLowerCase()}!🎉"; } } diff --git a/lib/ui/admin/home/home_screen/widget/request_list.dart b/lib/ui/admin/home/home_screen/widget/request_list.dart index 5e5a4690..15bb7bb2 100644 --- a/lib/ui/admin/home/home_screen/widget/request_list.dart +++ b/lib/ui/admin/home/home_screen/widget/request_list.dart @@ -26,30 +26,24 @@ class LeaveRequestList extends StatelessWidget { header: Container( margin: const EdgeInsets.symmetric( horizontal: primaryHorizontalSpacing), - padding: const EdgeInsets.symmetric( - horizontal: primaryHorizontalSpacing) - .copyWith(top: primaryHalfSpacing), + padding: const EdgeInsets.only( + top: primaryHalfSpacing, + bottom: primaryHorizontalSpacing), decoration: BoxDecoration(color: context.colorScheme.surface), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - DateFormatter(context.l10n) - .getDateRepresentation(mapEntry.key), - style: AppTextStyle.style20.copyWith( - color: context.colorScheme.textPrimary, - )), - Text( - mapEntry.value.length.toString(), - style: AppTextStyle.style20, - ) - ], - ), - const SizedBox(height: 16), + Text( + DateFormatter(context.l10n) + .getDateRepresentation(mapEntry.key), + style: AppTextStyle.style20.copyWith( + color: context.colorScheme.textPrimary, + )), + Text( + mapEntry.value.length.toString(), + style: AppTextStyle.style20, + ) ], )), content: Padding( diff --git a/lib/ui/shared/events/bloc/celebrations_bloc.dart b/lib/ui/shared/events/bloc/celebrations_bloc.dart index e7b3efc3..f0aa359e 100644 --- a/lib/ui/shared/events/bloc/celebrations_bloc.dart +++ b/lib/ui/shared/events/bloc/celebrations_bloc.dart @@ -42,10 +42,9 @@ class CelebrationsBloc extends Bloc { imageUrl: e.imageUrl); allBirthdayEvents.add(event); } - final joiningDate = e.dateOfJoining.convertToUpcomingDay(); final Event event = Event( name: e.name, - dateTime: DateUtils.dateOnly(joiningDate), + dateTime: DateUtils.dateOnly(e.dateOfJoining), imageUrl: e.imageUrl); allAnniversaryEvents.add(event); return e; diff --git a/lib/ui/shared/events/celebrations_event_card.dart b/lib/ui/shared/events/celebrations_event_card.dart index 104dfb77..2ac6a8f8 100644 --- a/lib/ui/shared/events/celebrations_event_card.dart +++ b/lib/ui/shared/events/celebrations_event_card.dart @@ -121,7 +121,7 @@ class EventsList extends StatelessWidget { fontWeight: FontWeight.w700), ), Container( - padding: const EdgeInsets.all(10), + padding: const EdgeInsets.all(5), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: @@ -129,7 +129,7 @@ class EventsList extends StatelessWidget { child: Row( children: [ Text(context.l10n.view_all_tag, - style: AppTextStyle.style18.copyWith( + style: AppTextStyle.style16.copyWith( color: expanded ? context.colorScheme.textPrimary : context.colorScheme.primary)), @@ -185,7 +185,7 @@ class CurrentWeekEventCard extends StatelessWidget { Widget build(BuildContext context) { return Container( alignment: Alignment.centerLeft, - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16), margin: const EdgeInsets.symmetric(vertical: 8), decoration: BoxDecoration( color: context.colorScheme.containerLow, @@ -193,14 +193,14 @@ class CurrentWeekEventCard extends StatelessWidget { child: Row( children: [ ImageProfile( - radius: 16, + radius: 20, imageUrl: event.imageUrl, ), const SizedBox(width: 10), Expanded( child: Text(isAnniversary ? DateFormatter(context.l10n).showAnniversaries( - dateTime: event.dateTime, name: event.name) + dateOfJoining: event.dateTime, name: event.name) : DateFormatter(context.l10n).showBirthdays( dateTime: event.dateTime, name: event.name))), ], @@ -223,28 +223,32 @@ class AllEventCard extends StatelessWidget { Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Row( - children: [ - ImageProfile(radius: 16, imageUrl: imageUrl), - const SizedBox(width: 10), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - date.toDateWithoutYear(context), - style: AppTextStyle.style16.copyWith( - color: context.colorScheme.textPrimary, - fontWeight: FontWeight.w600, - height: 1.5), - ), - Text( - name, - style: AppTextStyle.style16 - .copyWith(color: context.colorScheme.textSecondary), - ) - ], - ) - ], + child: Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: context.colorScheme.containerLow, + borderRadius: AppTheme.commonBorderRadius), + child: Row( + children: [ + ImageProfile(radius: 20, imageUrl: imageUrl), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + date.toDateWithoutYear(context), + style: AppTextStyle.style16.copyWith( + color: context.colorScheme.textPrimary, height: 1.5), + ), + Text( + name, + style: AppTextStyle.style14 + .copyWith(color: context.colorScheme.textSecondary), + ) + ], + ) + ], + ), ), ); } diff --git a/lib/ui/shared/profile/edit_profile/edit_profile_screen.dart b/lib/ui/shared/profile/edit_profile/edit_profile_screen.dart index a597bdc5..cbbed45c 100644 --- a/lib/ui/shared/profile/edit_profile/edit_profile_screen.dart +++ b/lib/ui/shared/profile/edit_profile/edit_profile_screen.dart @@ -80,7 +80,10 @@ class _EmployeeEditProfileScreenState extends State { previous.status != current.status || previous.isDataValid != current.isDataValid, builder: (context, state) => state.status == Status.loading - ? const AppCircularProgressIndicator(size: 20) + ? const Padding( + padding: EdgeInsets.only(right: 8.0), + child: AppCircularProgressIndicator(size: 20), + ) : TextButton( onPressed: state.isDataValid ? () {