From 0503d6ed752ef35fe76b98ac088eae36f9e60f05 Mon Sep 17 00:00:00 2001 From: Sneha Canopas Date: Tue, 3 Dec 2024 11:19:42 +0530 Subject: [PATCH 1/4] Fix pipeline --- .github/workflows/android_build.yml | 12 ++-- .github/workflows/android_deploy.yml | 6 +- lib/style/colors.dart | 6 +- .../apply_leave/widget/picker_card.dart | 64 ++++++++++--------- lib/ui/widget/date_time_picker.dart | 8 ++- 5 files changed, 52 insertions(+), 44 deletions(-) diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index f9797a24..ebb315d2 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -14,10 +14,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 17.0.6 cache: 'gradle' @@ -57,7 +57,7 @@ jobs: APKSIGN_KEY_PASS: ${{ secrets.APKSIGN_KEY_PASS }} - name: Upload APK Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ProjectUnity APK path: ProjectUnity*.apk @@ -70,10 +70,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 17.0.6 cache: 'gradle' @@ -113,7 +113,7 @@ jobs: APKSIGN_KEY_PASS: ${{ secrets.APKSIGN_KEY_PASS }} - name: Upload AAB Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ProjectUnity AAB path: app-release.aab diff --git a/.github/workflows/android_deploy.yml b/.github/workflows/android_deploy.yml index 00a9ed3f..8a43823b 100644 --- a/.github/workflows/android_deploy.yml +++ b/.github/workflows/android_deploy.yml @@ -13,10 +13,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 17.0.6 cache: 'gradle' @@ -27,8 +27,6 @@ jobs: channel: 'stable' cache: true - - uses: actions/checkout@v2 - - name: Set up ruby env uses: ruby/setup-ruby@v1 with: diff --git a/lib/style/colors.dart b/lib/style/colors.dart index 535d91dc..e60e0259 100644 --- a/lib/style/colors.dart +++ b/lib/style/colors.dart @@ -65,17 +65,17 @@ final ThemeData materialThemeDataDark = _materialDarkTheme.copyWith( primaryColor: primaryColor, scaffoldBackgroundColor: surfaceDarkColor, dividerColor: outlineDarkColor, - colorScheme: _materialLightTheme.colorScheme.copyWith( + colorScheme: _materialDarkTheme.colorScheme.copyWith( onPrimary: primaryColor, onSecondary: textSecondaryDarkColor, surface: surfaceDarkColor, onSurface: textPrimaryDarkColor), - appBarTheme: _materialLightTheme.appBarTheme.copyWith( + appBarTheme: _materialDarkTheme.appBarTheme.copyWith( backgroundColor: surfaceDarkColor, titleTextStyle: AppTextStyle.style20, foregroundColor: textPrimaryDarkColor, centerTitle: true), - popupMenuTheme: _materialLightTheme.popupMenuTheme.copyWith( + popupMenuTheme: _materialDarkTheme.popupMenuTheme.copyWith( surfaceTintColor: surfaceDarkColor, color: surfaceDarkColor, ), diff --git a/lib/ui/user/leaves/apply_leave/widget/picker_card.dart b/lib/ui/user/leaves/apply_leave/widget/picker_card.dart index 8ec2a650..7a273417 100644 --- a/lib/ui/user/leaves/apply_leave/widget/picker_card.dart +++ b/lib/ui/user/leaves/apply_leave/widget/picker_card.dart @@ -28,42 +28,46 @@ class DatePickerCard extends StatelessWidget { decoration: BoxDecoration( border: Border( bottom: BorderSide(color: context.colorScheme.containerHigh))), - child: InkWell( - borderRadius: BorderRadius.circular(12), - onTap: onPress, - child: Padding( - padding: const EdgeInsets.all(12), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - SvgPicture.asset( - Assets.images.icCalendar, - colorFilter: ColorFilter.mode( - context.colorScheme.textSecondary, BlendMode.srcIn), - ), - const SizedBox( - width: 10, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Builder( + builder: (context) { + return InkWell( + borderRadius: BorderRadius.circular(12), + onTap: onPress, + child: Padding( + padding: const EdgeInsets.all(12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text( - title, - style: AppTextStyle.style14 - .copyWith(color: context.colorScheme.textSecondary), + SvgPicture.asset( + Assets.images.icCalendar, + colorFilter: ColorFilter.mode( + context.colorScheme.textSecondary, BlendMode.srcIn), ), const SizedBox( - height: 5, + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: AppTextStyle.style14 + .copyWith(color: context.colorScheme.textSecondary), + ), + const SizedBox( + height: 5, + ), + Text(localization.date_format_yMMMd(date), + style: AppTextStyle.style18.copyWith( + color: context.colorScheme.textPrimary, + textBaseline: TextBaseline.alphabetic)), + ], ), - Text(localization.date_format_yMMMd(date), - style: AppTextStyle.style18.copyWith( - color: context.colorScheme.textPrimary, - textBaseline: TextBaseline.alphabetic)), ], ), - ], - ), - ), + ), + ); + } ), )); } diff --git a/lib/ui/widget/date_time_picker.dart b/lib/ui/widget/date_time_picker.dart index 6f544ddc..e7b9703e 100644 --- a/lib/ui/widget/date_time_picker.dart +++ b/lib/ui/widget/date_time_picker.dart @@ -1,10 +1,13 @@ import 'package:flutter/material.dart'; +import 'package:projectunity/data/core/extensions/context_extension.dart'; import 'package:projectunity/data/core/extensions/date_time.dart'; +import 'package:projectunity/ui/admin/forms/create_form/create_form.dart'; Future pickDate( {required BuildContext context, required DateTime initialDate}) async { DateTime? pickDate = await showDatePicker( context: context, + barrierColor: context.colorScheme.surface, initialDate: initialDate, firstDate: DateTime(1990), lastDate: DateTime(DateTime.now().futureDateSelectionYear), @@ -15,6 +18,9 @@ Future pickDate( Future pickTime( {required BuildContext context, required TimeOfDay initialTime}) async { TimeOfDay? time = - await showTimePicker(context: context, initialTime: initialTime); + await showTimePicker( + context: context, initialTime: initialTime, + barrierColor: context.colorScheme.surface, + ); return time; } From 5430112aadc861157706d78f53abf92885f979d6 Mon Sep 17 00:00:00 2001 From: Sneha Canopas Date: Tue, 3 Dec 2024 11:26:30 +0530 Subject: [PATCH 2/4] Fix pipeline --- lib/main.dart | 12 +-- .../apply_leave/widget/picker_card.dart | 78 +++++++++---------- lib/ui/widget/date_time_picker.dart | 11 ++- .../network/network_connection_bloc_test.dart | 6 +- 4 files changed, 53 insertions(+), 54 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index b07794b6..ea115aea 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,13 +31,13 @@ Future main() async { return ErrorScreen(error: error); }; -if(!kIsWeb){ - if(kDebugMode){ - await getIt().setCrashlyticsCollectionEnabled(false); - }else{ - await getIt().setCrashlyticsCollectionEnabled(true); + if (!kIsWeb) { + if (kDebugMode) { + await getIt().setCrashlyticsCollectionEnabled(false); + } else { + await getIt().setCrashlyticsCollectionEnabled(true); + } } -} PlatformDispatcher.instance.onError = (error, stack) { getIt().recordError(error, stack, fatal: true); diff --git a/lib/ui/user/leaves/apply_leave/widget/picker_card.dart b/lib/ui/user/leaves/apply_leave/widget/picker_card.dart index 7a273417..6199d433 100644 --- a/lib/ui/user/leaves/apply_leave/widget/picker_card.dart +++ b/lib/ui/user/leaves/apply_leave/widget/picker_card.dart @@ -28,47 +28,45 @@ class DatePickerCard extends StatelessWidget { decoration: BoxDecoration( border: Border( bottom: BorderSide(color: context.colorScheme.containerHigh))), - child: Builder( - builder: (context) { - return InkWell( - borderRadius: BorderRadius.circular(12), - onTap: onPress, - child: Padding( - padding: const EdgeInsets.all(12), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - SvgPicture.asset( - Assets.images.icCalendar, - colorFilter: ColorFilter.mode( - context.colorScheme.textSecondary, BlendMode.srcIn), - ), - const SizedBox( - width: 10, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: AppTextStyle.style14 - .copyWith(color: context.colorScheme.textSecondary), - ), - const SizedBox( - height: 5, - ), - Text(localization.date_format_yMMMd(date), - style: AppTextStyle.style18.copyWith( - color: context.colorScheme.textPrimary, - textBaseline: TextBaseline.alphabetic)), - ], - ), - ], - ), + child: Builder(builder: (context) { + return InkWell( + borderRadius: BorderRadius.circular(12), + onTap: onPress, + child: Padding( + padding: const EdgeInsets.all(12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SvgPicture.asset( + Assets.images.icCalendar, + colorFilter: ColorFilter.mode( + context.colorScheme.textSecondary, BlendMode.srcIn), + ), + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: AppTextStyle.style14 + .copyWith(color: context.colorScheme.textSecondary), + ), + const SizedBox( + height: 5, + ), + Text(localization.date_format_yMMMd(date), + style: AppTextStyle.style18.copyWith( + color: context.colorScheme.textPrimary, + textBaseline: TextBaseline.alphabetic)), + ], + ), + ], ), - ); - } - ), + ), + ); + }), )); } } diff --git a/lib/ui/widget/date_time_picker.dart b/lib/ui/widget/date_time_picker.dart index e7b9703e..5aed4965 100644 --- a/lib/ui/widget/date_time_picker.dart +++ b/lib/ui/widget/date_time_picker.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:projectunity/data/core/extensions/context_extension.dart'; import 'package:projectunity/data/core/extensions/date_time.dart'; -import 'package:projectunity/ui/admin/forms/create_form/create_form.dart'; Future pickDate( {required BuildContext context, required DateTime initialDate}) async { @@ -17,10 +16,10 @@ Future pickDate( Future pickTime( {required BuildContext context, required TimeOfDay initialTime}) async { - TimeOfDay? time = - await showTimePicker( - context: context, initialTime: initialTime, - barrierColor: context.colorScheme.surface, - ); + TimeOfDay? time = await showTimePicker( + context: context, + initialTime: initialTime, + barrierColor: context.colorScheme.surface, + ); return time; } diff --git a/test/unit_test/bloc/network/network_connection_bloc_test.dart b/test/unit_test/bloc/network/network_connection_bloc_test.dart index 8a896488..4dc1819c 100644 --- a/test/unit_test/bloc/network/network_connection_bloc_test.dart +++ b/test/unit_test/bloc/network/network_connection_bloc_test.dart @@ -39,8 +39,10 @@ void main() { test( 'Emits NetworkConnectionFailureState if device is not connected to mobile or wifi', () { - when(connectivity.onConnectivityChanged).thenAnswer( - (_) => Stream.fromIterable([[ConnectivityResult.ethernet]])); + when(connectivity.onConnectivityChanged) + .thenAnswer((_) => Stream.fromIterable([ + [ConnectivityResult.ethernet] + ])); networkConnectionBloc.add(NetworkConnectionObserveEvent()); expectLater( networkConnectionBloc.stream, emits(NetworkConnectionFailureState())); From 5814e1735e8a52b95fd33aaddaaa0afbc314b699 Mon Sep 17 00:00:00 2001 From: Sneha Canopas Date: Tue, 3 Dec 2024 11:35:05 +0530 Subject: [PATCH 3/4] Show leave by start date --- .../admin/leaves/leave_screen/bloc /admin_leaves_bloc.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ui/admin/leaves/leave_screen/bloc /admin_leaves_bloc.dart b/lib/ui/admin/leaves/leave_screen/bloc /admin_leaves_bloc.dart index 0cd57bfa..08b480fa 100644 --- a/lib/ui/admin/leaves/leave_screen/bloc /admin_leaves_bloc.dart +++ b/lib/ui/admin/leaves/leave_screen/bloc /admin_leaves_bloc.dart @@ -59,7 +59,7 @@ class AdminLeavesBloc extends Bloc { leavesFetchStatus: Status.success, leaveApplicationMap: getLeaveApplicationFromLeaveEmployee( leaves: paginatedData.leaves, members: _members) - .groupByMonth((la) => la.leave.appliedOn))); + .groupByMonth((la) => la.leave.startDate))); } on Exception { _isLoadedMax = true; emit(state.copyWith( @@ -86,7 +86,7 @@ class AdminLeavesBloc extends Bloc { emit(state.copyWith( fetchMoreData: Status.success, leaveApplicationMap: - leaveApplications.groupByMonth((la) => la.leave.appliedOn))); + leaveApplications.groupByMonth((la) => la.leave.startDate))); } on Exception { emit(state.copyWith( error: firestoreFetchDataError, fetchMoreData: Status.error)); @@ -121,7 +121,7 @@ class AdminLeavesBloc extends Bloc { (element) => element.leave.leaveId == leave.leaveId); emit(state.copyWith( leaveApplicationMap: - leaveApplications.groupByMonth((la) => la.leave.appliedOn))); + leaveApplications.groupByMonth((la) => la.leave.startDate))); } } From d9a9b9b51e5ca3ce1b34ec1b6afad3c2936eaa79 Mon Sep 17 00:00:00 2001 From: Sneha Canopas Date: Tue, 3 Dec 2024 11:39:53 +0530 Subject: [PATCH 4/4] Fix unit test --- .../leaves/leave_screen/admin_leaves_test.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/unit_test/admin/leaves/leave_screen/admin_leaves_test.dart b/test/unit_test/admin/leaves/leave_screen/admin_leaves_test.dart index 0d3bbcbd..ef32cf6d 100644 --- a/test/unit_test/admin/leaves/leave_screen/admin_leaves_test.dart +++ b/test/unit_test/admin/leaves/leave_screen/admin_leaves_test.dart @@ -154,7 +154,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)), + ]).groupByMonth((la) => la.leave.startDate)), ])); }); @@ -197,7 +197,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)), + ]).groupByMonth((la) => la.leave.startDate)), AdminLeavesState( members: [joi], selectedMember: joi, @@ -210,7 +210,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)) + ]).groupByMonth((la) => la.leave.startDate)) ])); }); }); @@ -298,7 +298,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)), + ]).groupByMonth((la) => la.leave.startDate)), ])); }); @@ -322,7 +322,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)), + ]).groupByMonth((la) => la.leave.startDate)), AdminLeavesState( fetchMoreData: Status.success, members: [joi, andrew], @@ -336,7 +336,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)), + ]).groupByMonth((la) => la.leave.startDate)), ])); }); @@ -359,7 +359,7 @@ void main() { ], members: [ joi, andrew - ]).groupByMonth((la) => la.leave.appliedOn)))); + ]).groupByMonth((la) => la.leave.startDate)))); }); }); });