Skip to content

Commit

Permalink
Fix Minor UI Issues (#74)
Browse files Browse the repository at this point in the history
* Implement- Show upcoming Events

* Implement- Show upcoming Events

* Add unit test for celebrations bloc

* Fix web ui

* Fix Minor UI Issues
  • Loading branch information
cp-sneha-s authored Mar 14, 2024
1 parent 68ff516 commit 0619f8f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 56 deletions.
11 changes: 6 additions & 5 deletions lib/data/core/utils/date_formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()}!🎉";
}
}

Expand Down
36 changes: 15 additions & 21 deletions lib/ui/admin/home/home_screen/widget/request_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/shared/events/bloc/celebrations_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ class CelebrationsBloc extends Bloc<CelebrationEvent, CelebrationsState> {
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;
Expand Down
58 changes: 31 additions & 27 deletions lib/ui/shared/events/celebrations_event_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ 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:
Border.all(color: context.colorScheme.outlineColor)),
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)),
Expand Down Expand Up @@ -185,22 +185,22 @@ 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,
borderRadius: AppTheme.commonBorderRadius),
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))),
],
Expand All @@ -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),
)
],
)
],
),
),
);
}
Expand Down
5 changes: 4 additions & 1 deletion lib/ui/shared/profile/edit_profile/edit_profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ class _EmployeeEditProfileScreenState extends State<EmployeeEditProfileScreen> {
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
? () {
Expand Down

0 comments on commit 0619f8f

Please sign in to comment.