diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 000000000..22e8233d7 --- /dev/null +++ b/.fvmrc @@ -0,0 +1,3 @@ +{ + "flutter": "3.16.5" +} \ No newline at end of file diff --git a/.github/workflows/flutter-build-apk.yml b/.github/workflows/flutter-build-apk.yml new file mode 100644 index 000000000..1fa8589df --- /dev/null +++ b/.github/workflows/flutter-build-apk.yml @@ -0,0 +1,79 @@ +name: Build APK Workflow + +on: + push: + branches: ['develop', 'hcmpre-717-github-actions-build-apk'] # This specifies that the workflow will run on any push to the 'main' branch + pull_request: + branches: ['develop', 'hcmpre-717-github-actions-build-apk'] # Optionally, run on pull requests targeting the 'main' branch + +jobs: + build-apk: + runs-on: ubuntu-latest + environment: QA # Reference the QA environment + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' # Specify the Java distribution + + - name: Flutter action + uses: subosito/flutter-action@v2.8.0 + with: + flutter-version: "3.22.2" + + - name: Set up Android SDK + uses: android-actions/setup-android@v2 + with: + api-level: 33 + build-tools: 33.0.2 + + - name: Install Dependencies + run: flutter pub get + + - name: Print Environment Variables + run: | + echo "BASE_URL=${{ vars.BASE_URL }}" + + - name: Create .env file + run: | + echo "BASE_URL=${{ vars.BASE_URL }}" >> apps/health_campaign_field_worker_app/.env + echo "MDMS_API_PATH=${{ vars.MDMS_API_PATH }}" >> apps/health_campaign_field_worker_app/.env + echo "TENANT_ID=${{ vars.TENANT_ID }}" >> apps/health_campaign_field_worker_app/.env + echo "ACTIONS_API_PATH=${{ vars.ACTIONS_API_PATH }}" >> apps/health_campaign_field_worker_app/.env + echo "SYNC_DOWN_RETRY_COUNT=${{ vars.SYNC_DOWN_RETRY_COUNT }}" >> apps/health_campaign_field_worker_app/.env + echo "RETRY_TIME_INTERVAL=${{ vars.RETRY_TIME_INTERVAL }}" >> apps/health_campaign_field_worker_app/.env + echo "CONNECT_TIMEOUT=${{ vars.CONNECT_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env + echo "RECEIVE_TIMEOUT=${{ vars.RECEIVE_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env + echo "SEND_TIMEOUT=${{ vars.SEND_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env + echo "CHECK_BANDWIDTH_API=${{ vars.CHECK_BANDWIDTH_API }}" >> apps/health_campaign_field_worker_app/.env + echo "HIERARCHY_TYPE=${{ vars.HIERARCHY_TYPE }}" >> apps/health_campaign_field_worker_app/.env + echo "ENV_NAME=${{ vars.ENV_NAME }}" >> apps/health_campaign_field_worker_app/.env + + - name: Verify .env file + run: | + ls -l apps/health_campaign_field_worker_app/.env + cat apps/health_campaign_field_worker_app/.env + + - name: Run APK build script + env: + BUILD_CONFIG: release # or profile depending on your choice + run: bash ./tools/generate-apk.sh + + # Archive the APK as a build artifact so it can be downloaded + - name: Upload APKs + uses: actions/upload-artifact@v3 + with: + name: app-release-apk + path: apps/health_campaign_field_worker_app/build/app/outputs/flutter-apk/app-release.apk + + - name: Upload .env as artifact + uses: actions/upload-artifact@v3 + with: + name: env-file + path: apps/health_campaign_field_worker_app/.env + include-hidden-files: true diff --git a/.gitignore b/.gitignore index 9793aec7d..21577b489 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ migrate_working_dir/ *.iws .idea/ - # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. @@ -57,3 +56,7 @@ pubspec_overrides.yaml apps/health_campaign_field_worker_app/.env apps/health_campaign_field_worker_app/libisar.dylib *.properties + +# FVM Version Cache +.fvm/ +.fvmrc \ No newline at end of file diff --git a/README.md b/README.md index b1562afae..99b8c1f4c 100644 --- a/README.md +++ b/README.md @@ -566,7 +566,7 @@ class _ChecklistDataShowcaseData { import '../../../utils/i18_key_constants.dart' as i18; import '../showcase_wrappers.dart'; -part 'checklist_data.dart'; +part 'survey_form_data.dart'; final checklistDataShowcaseData = _ChecklistDataShowcaseData(); ``` diff --git a/apps/health_campaign_field_worker_app/.gitignore b/apps/health_campaign_field_worker_app/.gitignore index ac43765ff..ce6d32b71 100644 --- a/apps/health_campaign_field_worker_app/.gitignore +++ b/apps/health_campaign_field_worker_app/.gitignore @@ -44,3 +44,7 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# FVM Version Cache +.fvm/ +.fvmrc \ No newline at end of file diff --git a/apps/health_campaign_field_worker_app/android/app/build.gradle b/apps/health_campaign_field_worker_app/android/app/build.gradle index 7ed3cf689..106bec514 100644 --- a/apps/health_campaign_field_worker_app/android/app/build.gradle +++ b/apps/health_campaign_field_worker_app/android/app/build.gradle @@ -23,12 +23,23 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' // START: FlutterFire Configuration -apply plugin: 'com.google.gms.google-services' + +if (project.hasProperty('USE_GOOGLE_SERVICES')) { + apply plugin: 'com.google.gms.google-services' +} + // END: FlutterFire Configuration apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { + if (!project.hasProperty('USE_GOOGLE_SERVICES')) { + tasks.whenTaskAdded { task -> + if (task.name.contains("GoogleServices")) { + task.enabled = false + } + } + } compileSdkVersion 34 ndkVersion flutter.ndkVersion diff --git a/apps/health_campaign_field_worker_app/lib/app.dart b/apps/health_campaign_field_worker_app/lib/app.dart index 7d90ae5da..531d0295c 100644 --- a/apps/health_campaign_field_worker_app/lib/app.dart +++ b/apps/health_campaign_field_worker_app/lib/app.dart @@ -1,4 +1,5 @@ import 'package:attendance_management/attendance_management.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:closed_household/blocs/closed_household.dart'; import 'package:closed_household/closed_household.dart'; import 'package:digit_components/digit_components.dart'; @@ -25,6 +26,8 @@ import 'blocs/localization/localization.dart'; import 'blocs/project/project.dart'; import 'data/local_store/app_shared_preferences.dart'; import 'data/network_manager.dart'; +import 'data/remote_client.dart'; +import 'data/repositories/remote/bandwidth_check.dart'; import 'data/repositories/remote/localization.dart'; import 'data/repositories/remote/mdms.dart'; import 'router/app_navigator_observer.dart'; @@ -201,6 +204,11 @@ class MainApplicationState extends State ), BlocProvider( create: (ctx) => ProjectBloc( + bandwidthCheckRepository: BandwidthCheckRepository( + DioClient().dio, + bandwidthPath: + envConfig.variables.checkBandwidthApiPath, + ), mdmsRepository: MdmsRepository(widget.client), dashboardRemoteRepository: DashboardRemoteRepository(widget.client), diff --git a/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart b/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart index 4530ae776..938819889 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart @@ -313,6 +313,7 @@ class MdmsConfig { final List serviceRegistryList; final DashboardConfigSchema? dashboardConfigSchema; + const MdmsConfig( {required this.appConfigs, required this.serviceRegistryList, diff --git a/apps/health_campaign_field_worker_app/lib/blocs/localization/app_localizations_delegate.dart b/apps/health_campaign_field_worker_app/lib/blocs/localization/app_localizations_delegate.dart index 7eaf5b020..9d8b05f12 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/localization/app_localizations_delegate.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/localization/app_localizations_delegate.dart @@ -1,7 +1,6 @@ import 'package:collection/collection.dart'; import 'package:digit_data_model/data/local_store/sql_store/sql_store.dart'; import 'package:flutter/material.dart'; -import 'package:isar/isar.dart'; import '../../data/local_store/no_sql/schema/app_configuration.dart'; import 'app_localization.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/blocs/project/project.dart b/apps/health_campaign_field_worker_app/lib/blocs/project/project.dart index 18e420dea..3be8eec58 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/project/project.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/project/project.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'dart:core'; import 'package:attendance_management/attendance_management.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_data_model/data_model.dart'; @@ -19,10 +20,12 @@ import '../../data/local_store/no_sql/schema/app_configuration.dart'; import '../../data/local_store/no_sql/schema/row_versions.dart'; import '../../data/local_store/no_sql/schema/service_registry.dart'; import '../../data/local_store/secure_store/secure_store.dart'; +import '../../data/repositories/remote/bandwidth_check.dart'; import '../../data/repositories/remote/mdms.dart'; import '../../models/app_config/app_config_model.dart'; import '../../models/auth/auth_model.dart'; import '../../models/entities/roles_type.dart'; +import '../../utils/background_service.dart'; import '../../utils/environment_config.dart'; import '../../utils/utils.dart'; @@ -35,6 +38,8 @@ class ProjectBloc extends Bloc { final Isar isar; final MdmsRepository mdmsRepository; + final BandwidthCheckRepository bandwidthCheckRepository; + /// Project Staff Repositories final RemoteRepository projectStaffRemoteRepository; @@ -76,6 +81,7 @@ class ProjectBloc extends Bloc { final RemoteRepository stockRemoteRepository; final LocalRepository stockLocalRepository; + /// Service Definition Repositories final RemoteRepository serviceDefinitionRemoteRepository; final LocalRepository @@ -103,6 +109,7 @@ class ProjectBloc extends Bloc { ProjectBloc({ LocalSecureStore? localSecureStore, + required this.bandwidthCheckRepository, required this.projectStaffRemoteRepository, required this.projectRemoteRepository, required this.projectStaffLocalRepository, @@ -169,6 +176,7 @@ class ProjectBloc extends Bloc { } FutureOr _loadOnline(ProjectEmitter emit) async { + final batchSize = await _getBatchSize(); final userObject = await localSecureStore.userRequestModel; final uuid = userObject?.uuid; @@ -288,8 +296,11 @@ class ProjectBloc extends Bloc { } if (projects.isNotEmpty) { + + // INFO : Need to add project load functions + try { - await _loadProjectFacilities(projects); + await _loadProjectFacilities(projects, batchSize); } catch (_) { emit( state.copyWith( @@ -360,7 +371,8 @@ class ProjectBloc extends Bloc { ); } - FutureOr _loadProjectFacilities(List projects) async { + FutureOr _loadProjectFacilities( + List projects, int batchSize) async { final projectFacilities = await projectFacilityRemoteRepository.search( ProjectFacilitySearchModel( projectId: projects.map((e) => e.id).toList(), @@ -371,6 +383,7 @@ class ProjectBloc extends Bloc { final facilities = await facilityRemoteRepository.search( FacilitySearchModel(tenantId: envConfig.variables.tenantId), + limit: batchSize, ); await facilityLocalRepository.bulkCreate(facilities); @@ -584,8 +597,6 @@ class ProjectBloc extends Bloc { loading: false, syncError: ProjectSyncErrorType.boundary, )); - - return; } emit(state.copyWith( @@ -594,6 +605,25 @@ class ProjectBloc extends Bloc { syncError: null, )); } + + FutureOr _getBatchSize() async { + try { + final configs = await isar.appConfigurations.where().findAll(); + + final double speed = await bandwidthCheckRepository.pingBandwidthCheck( + bandWidthCheckModel: null, + ); + + int configuredBatchSize = getBatchSizeToBandwidth( + speed, + configs, + isDownSync: true, + ); + return configuredBatchSize; + } catch (e) { + rethrow; + } + } } @freezed diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/entity_mapper.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/entity_mapper.dart index d44596109..60d256cc6 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/entity_mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/entity_mapper.dart @@ -1,4 +1,7 @@ +import 'package:complaints/complaints.dart'; + import 'package:attendance_management/models/entities/attendance_log.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:digit_data_model/data/local_store/no_sql/schema/entity_mapper_listener.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:inventory_management/models/entities/stock.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/data/network_manager.dart b/apps/health_campaign_field_worker_app/lib/data/network_manager.dart index 54188873b..616e5a8c9 100644 --- a/apps/health_campaign_field_worker_app/lib/data/network_manager.dart +++ b/apps/health_campaign_field_worker_app/lib/data/network_manager.dart @@ -105,7 +105,7 @@ class NetworkManager { return isSyncCompleted; } - // + FutureOr writeToEntityDB( Map response, List localRepositories, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/bandwidth_check.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/bandwidth_check.dart index e4cc73938..ece1e04f5 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/bandwidth_check.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/bandwidth_check.dart @@ -27,7 +27,7 @@ class BandwidthCheckRepository { final speed = (((800 / timeconsumed) / 1000)); return speed; - } on DioError catch (e) { + } on DioException catch (e) { rethrow; } } diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart index 748d821d1..35136b342 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart @@ -257,11 +257,11 @@ class MdmsRepository { final List? checklistTypes = element?.checklistTypes.map((e) { - final checklist = ChecklistTypes() + final surveyForm = ChecklistTypes() ..name = e.name ..code = e.code; - return checklist; + return surveyForm; }).toList(); final List? transportTypes = diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/sync/remote_type.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/sync/remote_type.dart index c1217f919..e597bb00a 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/sync/remote_type.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/sync/remote_type.dart @@ -1,7 +1,6 @@ import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; - class RepositoryType { static RemoteRepository getRemoteForType( DataModelType type, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_down.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_down.dart index e8f07d0e4..09d4069a8 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_down.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_down.dart @@ -570,6 +570,7 @@ class PerformSyncDown { .whereNotNull() .toList(), ), + limit: bandwidthModel.batchSize, ); for (var element in operationGroupedEntity.value) { diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_up.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_up.dart index fdf1ab1dd..2a730ad7c 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_up.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/sync/sync_up.dart @@ -1,3 +1,5 @@ +import 'package:complaints/complaints.dart'; + import 'dart:async'; import 'package:collection/collection.dart'; @@ -213,6 +215,7 @@ class PerformSyncUp { final entities = getEntityModel(sublist, local); if (operationGroupedEntity.key == DataOperation.create) { switch (typeGroupedEntity.key) { + case DataModelType.complaints: for (final entity in entities) { if (remote is PgrServiceRemoteRepository && @@ -284,6 +287,7 @@ class PerformSyncUp { } } break; + default: await remote.bulkCreate(entities); } diff --git a/apps/health_campaign_field_worker_app/lib/main.dart b/apps/health_campaign_field_worker_app/lib/main.dart index f46e21059..5fe3d6b17 100644 --- a/apps/health_campaign_field_worker_app/lib/main.dart +++ b/apps/health_campaign_field_worker_app/lib/main.dart @@ -1,4 +1,3 @@ -import 'package:collection/collection.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_data_model/data/local_store/sql_store/sql_store.dart'; import 'package:dio/dio.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart index 1f7baf504..e31240d2e 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart @@ -9,6 +9,7 @@ import 'package:flutter_portal/flutter_portal.dart'; import 'package:isar/isar.dart'; import 'package:location/location.dart'; import 'package:registration_delivery/registration_delivery.dart'; +import 'package:survey_form/survey_form.dart'; import '../blocs/localization/app_localization.dart'; import '../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist.dart b/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist.dart deleted file mode 100644 index b4f053759..000000000 --- a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist.dart +++ /dev/null @@ -1,178 +0,0 @@ -import 'package:digit_components/digit_components.dart'; -import 'package:digit_components/widgets/digit_project_cell.dart'; -import 'package:digit_data_model/data_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import '../../utils/constants.dart'; -import 'package:recase/recase.dart'; - -import '../../blocs/auth/auth.dart'; -import '../../router/app_router.dart'; -import '../../utils/extensions/extensions.dart'; -import '../../utils/i18_key_constants.dart' as i18; -import '../../widgets/action_card/action_card.dart'; -import '../../widgets/header/back_navigation_help_header.dart'; -import '../../widgets/localized.dart'; -import '../../widgets/no_result_card/no_result_card.dart'; - -@RoutePage() -class ChecklistPage extends LocalizedStatefulWidget { - const ChecklistPage({ - Key? key, - super.appLocalizations, - }) : super(key: key); - - @override - State createState() => _ChecklistPageState(); -} - -class _ChecklistPageState extends LocalizedState { - @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - - return Scaffold( - body: ScrollableContent( - header: const Column(children: [ - BackNavigationHelpHeaderWidget(), - ]), - children: [ - BlocBuilder( - builder: (context, state) { - return state.map( - empty: (value) => const Text('No Checklist'), - isloading: (value) => const Center( - child: CircularProgressIndicator(), - ), - serviceDefinitionFetch: - (ServiceDefinitionServiceFetchedState value) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.only(left: 8), - child: Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all( - kPadding, - ), - child: Text( - localizations - .translate(i18.checklist.checklistlabel), - style: theme.textTheme.displayMedium, - ), - ), - ), - ), - BlocBuilder( - builder: (context, authstate) { - return authstate.maybeMap( - orElse: () => const Offstage(), - authenticated: (res) { - List roles = res.userModel.roles - .map((e) => e.code.snakeCase.toUpperCase()) - .toList(); - final values = value.serviceDefinitionList.where( - (item) => - !roles - .indexOf( - item.code!.split('.').lastOrNull!, - ) - .isNegative && - !item.code!.contains(Constants - .healthFacilityChecklistPrefix) && - (item.code ?? '').contains( - context.selectedProject.name)); - - if (values.isEmpty) { - return Column( - children: [ - NoResultCard( - align: Alignment.center, - label: localizations.translate( - i18.common.noResultsFound, - ), - ), - ], - ); - } - - return Column( - children: values - .map((e) => DigitProjectCell( - projectText: localizations - .translate('${e.code}'), - onTap: () { - context - .read() - .add( - ServiceDefinitionSelectionEvent( - serviceDefinition: e, - ), - ); - DigitActionDialog.show( - context, - widget: ActionCard(items: [ - ActionCardModel( - icon: Icons.edit_calendar, - label: localizations.translate(i18 - .checklist - .checklistCreateActionLabel), - action: () { - context.router.push( - ChecklistBoundaryViewRoute(), - ); - Navigator.of( - context, - rootNavigator: true, - ).pop(); - }, - ), - ActionCardModel( - icon: Icons.visibility, - label: localizations.translate(i18 - .checklist - .checklistViewActionLabel), - action: () { - context - .read() - .add( - ServiceSearchEvent( - serviceSearchModel: - ServiceSearchModel( - id: e.id, - ), - ), - ); - context.router.push( - ChecklistPreviewRoute(), - ); - Navigator.of( - context, - rootNavigator: true, - ).pop(); - }, - ), - ]), - ); - }, - )) - .toList(), - ); - }, - ); - }, - ), - ], - ); - }, - ); - }, - ), - ], - ), - ); - } -} diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index 2e6ff96b8..a03062cae 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -2,6 +2,9 @@ import 'dart:async'; import 'package:attendance_management/attendance_management.dart'; import 'package:attendance_management/router/attendance_router.gm.dart'; +import 'package:survey_form/survey_form.dart'; +import 'package:complaints/complaints.dart'; +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:closed_household/closed_household.dart'; import 'package:closed_household/router/closed_household_router.gm.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; @@ -21,10 +24,12 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:health_campaign_field_worker_app/data/local_store/no_sql/schema/service_registry.dart'; import 'package:inventory_management/inventory_management.dart'; import 'package:inventory_management/router/inventory_router.gm.dart'; +import 'package:recase/recase.dart'; import 'package:referral_reconciliation/referral_reconciliation.dart'; import 'package:referral_reconciliation/router/referral_reconciliation_router.gm.dart'; import 'package:registration_delivery/registration_delivery.dart'; import 'package:registration_delivery/router/registration_delivery_router.gm.dart'; +import 'package:survey_form/router/survey_form_router.gm.dart'; import '../blocs/app_initialization/app_initialization.dart'; import '../blocs/auth/auth.dart'; @@ -189,7 +194,7 @@ class _HomePageState extends LocalizedState { state.maybeWhen( orElse: () => null, syncInProgress: () async { - await localSecureStore.setManualSyncTrigger(true); + await localSecureStore.setManualSyncTrigger(false); if (context.mounted) { DigitSyncDialog.show( context, @@ -323,6 +328,16 @@ class _HomePageState extends LocalizedState { final Map homeItemsMap = { // INFO : Need to add home items of package Here + i18.home.fileComplaint: + homeShowcaseData.distributorFileComplaint.buildWith( + child: HomeItemCard( + icon: Icons.announcement, + label: i18.home.fileComplaint, + onPressed: () => + context.router.push(const ComplaintsInboxWrapperRoute()), + ), + ), + i18.home.dashboard: homeShowcaseData.dashBoard.buildWith( child: HomeItemCard( icon: Icons.bar_chart_sharp, @@ -384,24 +399,16 @@ class _HomePageState extends LocalizedState { }, ), ), - i18.home.myCheckList: homeShowcaseData.supervisorMyChecklist.buildWith( + i18.home.mySurveyForm: homeShowcaseData.supervisorMySurveyForm.buildWith( child: HomeItemCard( enableCustomIcon: true, - customIcon: myChecklistSvg, + customIcon: mySurveyFormSvg, icon: Icons.checklist, - label: i18.home.myCheckList, - onPressed: () => context.router.push(ChecklistWrapperRoute()), - ), - ), - i18.home.fileComplaint: - homeShowcaseData.distributorFileComplaint.buildWith( - child: HomeItemCard( - icon: Icons.announcement, - label: i18.home.fileComplaint, - onPressed: () => - context.router.push(const ComplaintsInboxWrapperRoute()), + label: i18.home.mySurveyForm, + onPressed: () => context.router.push(SurveyFormWrapperRoute()), ), ), + i18.home.syncDataLabel: homeShowcaseData.distributorSyncData.buildWith( child: StreamBuilder?>( stream: FlutterBackgroundService().on('serviceRunning'), @@ -502,7 +509,7 @@ class _HomePageState extends LocalizedState { homeShowcaseData.warehouseManagerManageStock.showcaseKey, i18.home.stockReconciliationLabel: homeShowcaseData.wareHouseManagerStockReconciliation.showcaseKey, - i18.home.myCheckList: homeShowcaseData.supervisorMyChecklist.showcaseKey, + i18.home.mySurveyForm: homeShowcaseData.supervisorMySurveyForm.showcaseKey, i18.home.fileComplaint: homeShowcaseData.distributorFileComplaint.showcaseKey, i18.home.syncDataLabel: homeShowcaseData.distributorSyncData.showcaseKey, @@ -523,7 +530,7 @@ class _HomePageState extends LocalizedState { i18.home.closedHouseHoldLabel, i18.home.manageStockLabel, i18.home.stockReconciliationLabel, - i18.home.myCheckList, + i18.home.mySurveyForm, i18.home.fileComplaint, i18.home.syncDataLabel, i18.home.viewReportsLabel, @@ -565,6 +572,9 @@ class _HomePageState extends LocalizedState { userId: context.loggedInUserUuid, localRepositories: [ // INFO : Need to add local repo of package Here + context.read< + LocalRepository>(), + context.read< LocalRepository>(), context.read< @@ -642,6 +652,16 @@ void setPackagesSingleton(BuildContext context) { ) { loadLocalization(context, appConfiguration); // INFO : Need to add singleton of package Here + ComplaintsSingleton().setInitialData( + tenantId: envConfig.variables.tenantId, + loggedInUserUuid: context.loggedInUserUuid, + userMobileNumber: context.loggedInUser.mobileNumber, + loggedInUserName: context.loggedInUser.name, + complaintTypes: + appConfiguration.complaintTypes!.map((e) => e.code).toList(), + userName: context.loggedInUser.name ?? '', + ); + RegistrationDeliverySingleton().setInitialData( loggedInUser: context.loggedInUserModel, loggedInUserUuid: context.loggedInUserUuid, @@ -693,6 +713,22 @@ void setPackagesSingleton(BuildContext context) { appVersion: Constants().version, ); + SurveyFormSingleton().setInitialData( + projectId: context.projectId, + projectName: context.selectedProject.name, + loggedInIndividualId: context.loggedInIndividualId ?? '', + loggedInUserUuid: context.loggedInUserUuid, + appVersion: Constants().version, + isHealthFacilityWorker: context.loggedInUserRoles.where((role) => role.code == RolesType.healthFacilityWorker.toValue()).toList().isNotEmpty, + roles: context.read().state.maybeMap( + orElse: () => const Offstage(), + authenticated: (res) { + return res.userModel.roles + .map((e) => e.code.snakeCase.toUpperCase()) + .toList(); + }), + ); + ReferralReconSingleton().setInitialData( userName: context.loggedInUser.name ?? '', userUUid: context.loggedInUserUuid, diff --git a/apps/health_campaign_field_worker_app/lib/pages/login.dart b/apps/health_campaign_field_worker_app/lib/pages/login.dart index f0912efb5..1a3fdd019 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/login.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/login.dart @@ -1,5 +1,7 @@ import 'package:digit_components/digit_components.dart'; +import 'package:digit_components/models/privacy_notice/privacy_notice_model.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; +import 'package:digit_components/widgets/privacy_notice/privacy_component.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:reactive_forms/reactive_forms.dart'; @@ -11,7 +13,7 @@ import '../router/app_router.dart'; import '../utils/environment_config.dart'; import '../utils/i18_key_constants.dart' as i18; import '../widgets/localized.dart'; -import '../widgets/privacy_notice/privacy_component.dart'; + @RoutePage() class LoginPage extends LocalizedStatefulWidget { @@ -140,7 +142,7 @@ class _LoginPageState extends LocalizedState { form.control(_privacyCheck).setValidators([Validators.requiredTrue]); form.control(_privacyCheck).updateValueAndValidity(); return PrivacyComponent( - privacyPolicy: privacyPolicyJson, + privacyPolicy: convertToPrivacyPolicyModel(privacyPolicyJson), formControlName: _privacyCheck, text: localizations .translate(i18.privacyPolicy.privacyNoticeText), @@ -237,3 +239,27 @@ class _LoginPageState extends LocalizedState { ) }); } + + +// convert to privacy notice model +PrivacyNoticeModel? convertToPrivacyPolicyModel(PrivacyPolicy? privacyPolicy) { + return PrivacyNoticeModel( + header: privacyPolicy?.header ?? '', + module: privacyPolicy?.module ?? '', + active: privacyPolicy?.active, + contents: privacyPolicy?.contents?.map((content) => ContentNoticeModel( + header: content.header, + descriptions: content.descriptions?.map((description) => DescriptionNoticeModel( + text: description.text, + type: description.type, + isBold: description.isBold, + subDescriptions: description.subDescriptions?.map((subDescription) => SubDescriptionNoticeModel( + text: subDescription.text, + type: subDescription.type, + isBold: subDescription.isBold, + isSpaceRequired: subDescription.isSpaceRequired, + )).toList(), + )).toList(), + )).toList(), + ); +} \ No newline at end of file diff --git a/apps/health_campaign_field_worker_app/lib/pages/project_facility_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/project_facility_selection.dart index cab08f048..f10c3625b 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/project_facility_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/project_facility_selection.dart @@ -1,6 +1,6 @@ import 'package:collection/collection.dart'; import 'package:digit_components/digit_components.dart'; -import 'package:digit_data_model/models/entities/project_facility.dart'; +import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; import 'package:reactive_forms/reactive_forms.dart'; @@ -14,9 +14,9 @@ class ProjectFacilitySelectionPage extends StatelessWidget { final List projectFacilities; const ProjectFacilitySelectionPage({ - Key? key, + super.key, required this.projectFacilities, - }) : super(key: key); + }); static const _facilityName = 'facilityKey'; static const _selectedFacility = 'selectedFacilityKey'; diff --git a/apps/health_campaign_field_worker_app/lib/router/app_router.dart b/apps/health_campaign_field_worker_app/lib/router/app_router.dart index 50382946e..c882ac15f 100644 --- a/apps/health_campaign_field_worker_app/lib/router/app_router.dart +++ b/apps/health_campaign_field_worker_app/lib/router/app_router.dart @@ -3,14 +3,18 @@ import 'package:attendance_management/router/attendance_router.gm.dart'; import 'package:auto_route/auto_route.dart'; import 'package:closed_household/router/closed_household_router.dart'; import 'package:closed_household/router/closed_household_router.gm.dart'; -import 'package:digit_data_model/data_model.dart'; +import 'package:complaints/router/complaints_router.dart'; +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:digit_dss/router/dashboard_router.dart'; import 'package:digit_dss/router/dashboard_router.gm.dart'; import 'package:digit_scanner/router/digit_scanner_router.dart'; import 'package:digit_scanner/router/digit_scanner_router.gm.dart'; +import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; import 'package:inventory_management/router/inventory_router.dart'; import 'package:inventory_management/router/inventory_router.gm.dart'; +import 'package:survey_form/router/survey_form_router.dart'; +import 'package:survey_form/router/survey_form_router.gm.dart'; import 'package:referral_reconciliation/router/referral_reconciliation_router.dart'; import 'package:referral_reconciliation/router/referral_reconciliation_router.gm.dart'; import 'package:registration_delivery/router/registration_delivery_router.dart'; @@ -20,22 +24,6 @@ import '../blocs/localization/app_localization.dart'; import '../pages/acknowledgement.dart'; import '../pages/authenticated.dart'; import '../pages/boundary_selection.dart'; -import '../pages/checklist/checklist.dart'; -import '../pages/checklist/checklist_boundary_view.dart'; -import '../pages/checklist/checklist_preview.dart'; -import '../pages/checklist/checklist_view.dart'; -import '../pages/checklist/checklist_wrapper.dart'; -import '../pages/complaints/inbox/complaints_details_view.dart'; -import '../pages/complaints/inbox/complaints_inbox.dart'; -import '../pages/complaints/inbox/complaints_inbox_filter.dart'; -import '../pages/complaints/inbox/complaints_inbox_search.dart'; -import '../pages/complaints/inbox/complaints_inbox_sort.dart'; -import '../pages/complaints/inbox/complaints_inbox_wrapper.dart'; -import '../pages/complaints/registration/complaint_type.dart'; -import '../pages/complaints/registration/complaints_details.dart'; -import '../pages/complaints/registration/complaints_location.dart'; -import '../pages/complaints/registration/complaints_registration_wrapper.dart'; -import '../pages/complaints_acknowledgement.dart'; import '../pages/home.dart'; import '../pages/language_selection.dart'; import '../pages/login.dart'; @@ -59,6 +47,8 @@ part 'app_router.gr.dart'; RegistrationDeliveryRoute, ClosedHouseholdPackageRoute, DashboardRoute, + SurveyFormRoute, + ComplaintsRoute ], ) class AppRouter extends _$AppRouter { @@ -186,7 +176,6 @@ class AppRouter extends _$AppRouter { page: HouseholdAcknowledgementRoute.page, path: 'household-acknowledgement', ), - AutoRoute(page: ChecklistViewRoute.page, path: 'view'), AutoRoute( page: DeliverySummaryRoute.page, path: 'delivery-summary', @@ -213,28 +202,44 @@ class AppRouter extends _$AppRouter { path: 'closed-household-acknowledgement'), ]), + /// close household + AutoRoute( + page: ClosedHouseholdWrapperRoute.page, + path: 'closed-household-wrapper', + children: [ + AutoRoute( + page: ClosedHouseholdDetailsRoute.page, + path: 'closed-household-details', + initial: true, + ), + AutoRoute( + page: ClosedHouseholdSummaryRoute.page, + path: 'closed-household-summary'), + AutoRoute( + page: ClosedHouseholdAcknowledgementRoute.page, + path: 'closed-household-acknowledgement'), + ]), + AutoRoute( - page: ChecklistWrapperRoute.page, - path: 'checklist', + page: SurveyFormWrapperRoute.page, + path: 'surveyForm', children: [ AutoRoute( - page: ChecklistRoute.page, + page: SurveyformRoute.page, path: '', ), AutoRoute( - page: ChecklistBoundaryViewRoute.page, path: 'view-boundary'), - AutoRoute(page: ChecklistViewRoute.page, path: 'view'), - AutoRoute(page: ChecklistPreviewRoute.page, path: 'preview'), + page: SurveyFormBoundaryViewRoute.page, path: 'view-boundary'), + AutoRoute(page: SurveyFormViewRoute.page, path: 'view'), + AutoRoute(page: SurveyFormPreviewRoute.page, path: 'preview'), + AutoRoute(page: SurveyFormAcknowledgementRoute.page, path: 'surveyForm-acknowledgement'), ]), AutoRoute( page: BeneficiaryAcknowledgementRoute.page, path: 'beneficiary-acknowledgement', ), AutoRoute(page: AcknowledgementRoute.page, path: 'acknowledgement'), - AutoRoute( - page: ComplaintsAcknowledgementRoute.page, - path: 'complaints-acknowledgement', - ), + AutoRoute( page: ProjectFacilitySelectionRoute.page, path: 'select-project-facilities', @@ -257,7 +262,7 @@ class AppRouter extends _$AppRouter { path: 'select-boundary', ), - /// Complaints Inbox + // INFO : Need to add Router of package Here AutoRoute( page: ComplaintsInboxWrapperRoute.page, path: 'complaints-inbox', @@ -307,6 +312,12 @@ class AppRouter extends _$AppRouter { ], ), + /// Complaints Acknowledgemnet + AutoRoute( + page: ComplaintsAcknowledgementRoute.page, + path: 'complaints-acknowledgement', + ), + // Attendance Route AutoRoute( page: ManageAttendanceRoute.page, diff --git a/apps/health_campaign_field_worker_app/lib/router/app_router.gr.dart b/apps/health_campaign_field_worker_app/lib/router/app_router.gr.dart index 68d85a6af..2fcad75ee 100644 --- a/apps/health_campaign_field_worker_app/lib/router/app_router.gr.dart +++ b/apps/health_campaign_field_worker_app/lib/router/app_router.gr.dart @@ -55,179 +55,6 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - ChecklistBoundaryViewRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ChecklistBoundaryViewRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ChecklistBoundaryViewPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ChecklistRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ChecklistRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ChecklistPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ChecklistPreviewRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ChecklistPreviewRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ChecklistPreviewPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ChecklistViewRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ChecklistViewRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ChecklistViewPage( - key: args.key, - referralClientRefId: args.referralClientRefId, - appLocalizations: args.appLocalizations, - ), - ); - }, - ChecklistWrapperRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ChecklistWrapperRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: WrappedRoute( - child: ChecklistWrapperPage( - key: args.key, - isEditing: args.isEditing, - )), - ); - }, - ComplaintTypeRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintTypeRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintTypePage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsAcknowledgementRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsAcknowledgementRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsAcknowledgementPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsDetailsRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsDetailsRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsDetailsPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsDetailsViewRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsDetailsViewPage( - key: args.key, - complaint: args.complaint, - ), - ); - }, - ComplaintsInboxFilterRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsInboxFilterRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsInboxFilterPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsInboxRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsInboxRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsInboxPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsInboxSearchRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsInboxSearchRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsInboxSearchPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsInboxSortRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsInboxSortRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsInboxSortPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsInboxWrapperRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ComplaintsInboxWrapperPage(), - ); - }, - ComplaintsLocationRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsLocationRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: ComplaintsLocationPage( - key: args.key, - appLocalizations: args.appLocalizations, - ), - ); - }, - ComplaintsRegistrationWrapperRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const ComplaintsRegistrationWrapperRouteArgs()); - return AutoRoutePage( - routeData: routeData, - child: WrappedRoute( - child: ComplaintsRegistrationWrapperPage( - key: args.key, - pgrServiceModel: args.pgrServiceModel, - )), - ); - }, HomeRoute.name: (routeData) { final args = routeData.argsAs(orElse: () => const HomeRouteArgs()); @@ -312,6 +139,8 @@ abstract class _$AppRouter extends RootStackRouter { ...RegistrationDeliveryRoute().pagesMap, ...ClosedHouseholdPackageRoute().pagesMap, ...DashboardRoute().pagesMap, + ...SurveyFormRoute().pagesMap, + ...ComplaintsRoute().pagesMap, }; } @@ -455,603 +284,6 @@ class BoundarySelectionRouteArgs { } } -/// generated route for -/// [ChecklistBoundaryViewPage] -class ChecklistBoundaryViewRoute - extends PageRouteInfo { - ChecklistBoundaryViewRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ChecklistBoundaryViewRoute.name, - args: ChecklistBoundaryViewRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ChecklistBoundaryViewRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ChecklistBoundaryViewRouteArgs { - const ChecklistBoundaryViewRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ChecklistBoundaryViewRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ChecklistPage] -class ChecklistRoute extends PageRouteInfo { - ChecklistRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ChecklistRoute.name, - args: ChecklistRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ChecklistRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ChecklistRouteArgs { - const ChecklistRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ChecklistRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ChecklistPreviewPage] -class ChecklistPreviewRoute extends PageRouteInfo { - ChecklistPreviewRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ChecklistPreviewRoute.name, - args: ChecklistPreviewRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ChecklistPreviewRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ChecklistPreviewRouteArgs { - const ChecklistPreviewRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ChecklistPreviewRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ChecklistViewPage] -class ChecklistViewRoute extends PageRouteInfo { - ChecklistViewRoute({ - Key? key, - String? referralClientRefId, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ChecklistViewRoute.name, - args: ChecklistViewRouteArgs( - key: key, - referralClientRefId: referralClientRefId, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ChecklistViewRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ChecklistViewRouteArgs { - const ChecklistViewRouteArgs({ - this.key, - this.referralClientRefId, - this.appLocalizations, - }); - - final Key? key; - - final String? referralClientRefId; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ChecklistViewRouteArgs{key: $key, referralClientRefId: $referralClientRefId, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ChecklistWrapperPage] -class ChecklistWrapperRoute extends PageRouteInfo { - ChecklistWrapperRoute({ - Key? key, - bool isEditing = false, - List? children, - }) : super( - ChecklistWrapperRoute.name, - args: ChecklistWrapperRouteArgs( - key: key, - isEditing: isEditing, - ), - initialChildren: children, - ); - - static const String name = 'ChecklistWrapperRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ChecklistWrapperRouteArgs { - const ChecklistWrapperRouteArgs({ - this.key, - this.isEditing = false, - }); - - final Key? key; - - final bool isEditing; - - @override - String toString() { - return 'ChecklistWrapperRouteArgs{key: $key, isEditing: $isEditing}'; - } -} - -/// generated route for -/// [ComplaintTypePage] -class ComplaintTypeRoute extends PageRouteInfo { - ComplaintTypeRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintTypeRoute.name, - args: ComplaintTypeRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintTypeRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintTypeRouteArgs { - const ComplaintTypeRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintTypeRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsAcknowledgementPage] -class ComplaintsAcknowledgementRoute - extends PageRouteInfo { - ComplaintsAcknowledgementRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsAcknowledgementRoute.name, - args: ComplaintsAcknowledgementRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsAcknowledgementRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsAcknowledgementRouteArgs { - const ComplaintsAcknowledgementRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsAcknowledgementRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsDetailsPage] -class ComplaintsDetailsRoute extends PageRouteInfo { - ComplaintsDetailsRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsDetailsRoute.name, - args: ComplaintsDetailsRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsDetailsRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsDetailsRouteArgs { - const ComplaintsDetailsRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsDetailsRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsDetailsViewPage] -class ComplaintsDetailsViewRoute - extends PageRouteInfo { - ComplaintsDetailsViewRoute({ - Key? key, - required PgrServiceModel complaint, - List? children, - }) : super( - ComplaintsDetailsViewRoute.name, - args: ComplaintsDetailsViewRouteArgs( - key: key, - complaint: complaint, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsDetailsViewRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsDetailsViewRouteArgs { - const ComplaintsDetailsViewRouteArgs({ - this.key, - required this.complaint, - }); - - final Key? key; - - final PgrServiceModel complaint; - - @override - String toString() { - return 'ComplaintsDetailsViewRouteArgs{key: $key, complaint: $complaint}'; - } -} - -/// generated route for -/// [ComplaintsInboxFilterPage] -class ComplaintsInboxFilterRoute - extends PageRouteInfo { - ComplaintsInboxFilterRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsInboxFilterRoute.name, - args: ComplaintsInboxFilterRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsInboxFilterRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsInboxFilterRouteArgs { - const ComplaintsInboxFilterRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsInboxFilterRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsInboxPage] -class ComplaintsInboxRoute extends PageRouteInfo { - ComplaintsInboxRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsInboxRoute.name, - args: ComplaintsInboxRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsInboxRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsInboxRouteArgs { - const ComplaintsInboxRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsInboxRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsInboxSearchPage] -class ComplaintsInboxSearchRoute - extends PageRouteInfo { - ComplaintsInboxSearchRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsInboxSearchRoute.name, - args: ComplaintsInboxSearchRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsInboxSearchRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsInboxSearchRouteArgs { - const ComplaintsInboxSearchRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsInboxSearchRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsInboxSortPage] -class ComplaintsInboxSortRoute - extends PageRouteInfo { - ComplaintsInboxSortRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsInboxSortRoute.name, - args: ComplaintsInboxSortRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsInboxSortRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsInboxSortRouteArgs { - const ComplaintsInboxSortRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsInboxSortRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsInboxWrapperPage] -class ComplaintsInboxWrapperRoute extends PageRouteInfo { - const ComplaintsInboxWrapperRoute({List? children}) - : super( - ComplaintsInboxWrapperRoute.name, - initialChildren: children, - ); - - static const String name = 'ComplaintsInboxWrapperRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ComplaintsLocationPage] -class ComplaintsLocationRoute - extends PageRouteInfo { - ComplaintsLocationRoute({ - Key? key, - AppLocalizations? appLocalizations, - List? children, - }) : super( - ComplaintsLocationRoute.name, - args: ComplaintsLocationRouteArgs( - key: key, - appLocalizations: appLocalizations, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsLocationRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsLocationRouteArgs { - const ComplaintsLocationRouteArgs({ - this.key, - this.appLocalizations, - }); - - final Key? key; - - final AppLocalizations? appLocalizations; - - @override - String toString() { - return 'ComplaintsLocationRouteArgs{key: $key, appLocalizations: $appLocalizations}'; - } -} - -/// generated route for -/// [ComplaintsRegistrationWrapperPage] -class ComplaintsRegistrationWrapperRoute - extends PageRouteInfo { - ComplaintsRegistrationWrapperRoute({ - Key? key, - PgrServiceModel? pgrServiceModel, - List? children, - }) : super( - ComplaintsRegistrationWrapperRoute.name, - args: ComplaintsRegistrationWrapperRouteArgs( - key: key, - pgrServiceModel: pgrServiceModel, - ), - initialChildren: children, - ); - - static const String name = 'ComplaintsRegistrationWrapperRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ComplaintsRegistrationWrapperRouteArgs { - const ComplaintsRegistrationWrapperRouteArgs({ - this.key, - this.pgrServiceModel, - }); - - final Key? key; - - final PgrServiceModel? pgrServiceModel; - - @override - String toString() { - return 'ComplaintsRegistrationWrapperRouteArgs{key: $key, pgrServiceModel: $pgrServiceModel}'; - } -} - /// generated route for /// [HomePage] class HomeRoute extends PageRouteInfo { diff --git a/apps/health_campaign_field_worker_app/lib/utils/constants.dart b/apps/health_campaign_field_worker_app/lib/utils/constants.dart index 3d05740b3..e3fb2a5a6 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/constants.dart @@ -1,4 +1,6 @@ +import 'package:complaints/complaints.dart'; import 'package:attendance_management/attendance_management.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:closed_household/utils/utils.dart'; import 'package:collection/collection.dart'; import 'package:digit_components/utils/app_logger.dart'; @@ -74,11 +76,11 @@ class Constants { } static const String localizationApiPath = 'localization/messages/v1/_search'; - static const String checklistPreviewDateFormat = 'dd MMMM yyyy'; + static const String surveyFormPreviewDateFormat = 'dd MMMM yyyy'; static const String defaultDateFormat = 'dd/MM/yyyy'; static const String defaultDateTimeFormat = 'dd/MM/yyyy hh:mm a'; - static const String checklistViewDateFormat = 'dd/MM/yyyy hh:mm a'; - static const String healthFacilityChecklistPrefix = 'HF_RF'; + static const String surveyFormViewDateFormat = 'dd/MM/yyyy hh:mm a'; + static const String healthFacilitySurveyFormPrefix = 'HF_RF'; static const String boundaryLocalizationPath = 'rainmaker-boundary-admin'; @@ -112,10 +114,6 @@ class Constants { sql, BoundaryOpLogManager(isar), ), - PgrServiceLocalRepository( - sql, - PgrServiceOpLogManager(isar), - ), HouseholdMemberLocalRepository(sql, HouseholdMemberOpLogManager(isar)), HouseholdLocalRepository(sql, HouseholdOpLogManager(isar)), ProjectBeneficiaryLocalRepository( @@ -144,6 +142,11 @@ class Constants { sql, HFReferralOpLogManager(isar), ), + + PgrServiceLocalRepository( + sql, + PgrServiceOpLogManager(isar), + ), ]; } @@ -186,8 +189,6 @@ class Constants { remoteRepositories.addAll([ if (value == DataModelType.facility) FacilityRemoteRepository(dio, actionMap: actions), - if (value == DataModelType.complaints) - PgrServiceRemoteRepository(dio, actionMap: actions), if (value == DataModelType.productVariant) ProductVariantRemoteRepository(dio, actionMap: actions), if (value == DataModelType.boundary) @@ -230,6 +231,9 @@ class Constants { AttendanceLogRemoteRepository(dio, actionMap: actions), if (value == DataModelType.hFReferral) HFReferralRemoteRepository(dio, actionMap: actions), + + if (value == DataModelType.complaints) + PgrServiceRemoteRepository(dio, actionMap: actions), ]); } @@ -304,7 +308,7 @@ class Modules { } const String noResultSvg = 'assets/icons/svg/no_result.svg'; -const String myChecklistSvg = 'assets/icons/svg/mychecklist.svg'; +const String mySurveyFormSvg = 'assets/icons/svg/mychecklist.svg'; enum DigitProgressDialogType { inProgress, diff --git a/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart b/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart index 74935a44d..e3fb9323c 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart @@ -104,6 +104,8 @@ extension ContextUtilityExtensions on BuildContext { ClosedHouseholdSingleton().setBoundary(boundary: selectedBoundary); InventorySingleton().setBoundaryName(boundaryName: selectedBoundary.name!); ReferralReconSingleton().setBoundary(boundary: selectedBoundary); + SurveyFormSingleton().setBoundary(boundary: selectedBoundary); + ComplaintsSingleton().setBoundary(boundary: selectedBoundary); return selectedBoundary; } diff --git a/apps/health_campaign_field_worker_app/lib/utils/extensions/extensions.dart b/apps/health_campaign_field_worker_app/lib/utils/extensions/extensions.dart index daa11a867..b21b100c9 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/extensions/extensions.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/extensions/extensions.dart @@ -1,4 +1,7 @@ +import 'package:complaints/utils/utils.dart'; + // Importing necessary packages and files +import 'package:survey_form/utils/utils.dart'; import 'package:closed_household/utils/utils.dart'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart index 18305c911..e930a7a65 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart @@ -7,7 +7,6 @@ const home = Home(); const acknowledgementSuccess = AcknowledgementSuccess(); const adverseEvents = AdverseEvents(); const projectSelection = ProjectSelection(); -const checklist = Checklist(); const complaints = Complaints(); const syncDialog = SyncDialog(); const homeShowcase = HomeShowcase(); @@ -24,12 +23,12 @@ const selectStockShowcase = SelectStockShowcase(); const warehouseDetailsShowcase = WarehouseDetailsShowcase(); const stockDetailsReceiptShowcase = StockDetailsReceiptShowcase(); const stockDetailsIssuedShowcase = StockDetailsIssuedShowcase(); -const selectChecklistShowcase = SelectChecklistShowcase(); +const selectSurveyFormShowcase = SelectSurveyFormShowcase(); const stockDetailsReturnedShowcase = StockDetailsReturnedShowcase(); const stockReconciliationShowcase = StockReconciliationShowcase(); -const checklistDataShowcase = ChecklistDataShowcase(); -const checklistListShowcase = ChecklistListShowcase(); +const surveyFormDataShowcase = SurveyFormDataShowcase(); +const surveyFormListShowcase = SurveyFormListShowcase(); const complaintTypeShowcase = ComplaintTypeShowcase(); const complaintsDetailsShowcase = ComplaintsDetailsShowcase(); const complaintsDetailsViewShowcase = ComplaintsDetailsViewShowcase(); @@ -181,7 +180,7 @@ class HomeShowcase { return 'SUPERVISOR_HOME_SHOWCASE_PROGRESS_BAR'; } - String get supervisorMyChecklist { + String get supervisorMySurveyForm { return 'SUPERVISOR_HOME_SHOWCASE_MY_CHECKLIST'; } @@ -347,16 +346,16 @@ class Login { String get actionLabel => 'LOGIN_ACTION_LABEL'; } -class SelectChecklistShowcase { - const SelectChecklistShowcase(); +class SelectSurveyFormShowcase { + const SelectSurveyFormShowcase(); - String get selectChecklist { + String get selectSurveyForm { return 'SELECT_CHECKLIST_SHOWCASE_SELECT_CHECKLIST'; } } -class ChecklistDataShowcase { - const ChecklistDataShowcase(); +class SurveyFormDataShowcase { + const SurveyFormDataShowcase(); String get date { return 'CHECKLIST_DATA_SHOWCASE_DATE'; @@ -367,8 +366,8 @@ class ChecklistDataShowcase { } } -class ChecklistListShowcase { - const ChecklistListShowcase(); +class SurveyFormListShowcase { + const SurveyFormListShowcase(); String get open { return 'CHECKLIST_LIST_SHOWCASE_OPEN'; @@ -511,47 +510,6 @@ class ComplaintsInboxShowcase { } } -class Checklist { - const Checklist(); - - String get checklist => 'CHECKLIST'; - - String get checklistlabel => 'CHECKLIST_LABEL'; - - String get checklistCreateActionLabel => 'CHECKLIST_CREATE_ACTION_LABEL'; - - String get checklistViewActionLabel => 'CHECKLIST_VIEW_ACTION_LABEL'; - - String get checklistDetailLabel => 'CHECKLIST_DETAILS_LABEL'; - - String get checklistDialogLabel => 'CHECKLIST_DIALOG_LABEL'; - - String get checklistDialogDescription => 'CHECKLIST_DIALOG_DESCRITPTION'; - - String get checklistDialogPrimaryAction => 'CHECKLIST_DIALOG_PRIMARY_ACTION'; - - String get checklistDialogSecondaryAction => - 'CHECKLIST_DIALOG_SECONDARY_ACTION'; - - String get checklistdate => 'CHECKLIST_DATE'; - - String get checklistReasonRequiredError => 'CHECKLIST_REASON_REQUIRED_ERROR'; - - String get notSelectedKey => 'NOT_SELECTED'; - - String get checklistBackDialogLabel => 'CHECKLIST_BACK_DIALOG_LABEL'; - - String get checklistBackDialogDescription => - 'CHECKLIST_BACK_DIALOG_DESCRITPTION'; - - String get checklistBackDialogPrimaryAction => - 'CHECKLIST_BACK_DIALOG_PRIMARY_ACTION'; - - String get checklistBackDialogSecondaryAction => - 'CHECKLIST_BACK_DIALOG_SECONDARY_ACTION'; - - String get noChecklistFound => 'NO_CHECKLISTS_FOUND'; -} class ForgotPassword { const ForgotPassword(); @@ -592,7 +550,7 @@ class Home { String get dataSyncInfoContent => 'DATA_SYNC_INFO_CONTENT'; - String get myCheckList => 'MY_CHECK_LIST_LABEL'; + String get mySurveyForm => 'MY_CHECK_LIST_LABEL'; String get warehouseManagerCheckList => 'WAREHOUSE_MANAGER_CHECK_LIST_LABEL'; diff --git a/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart b/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart index 6e62855fe..2b0d88745 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart @@ -2,6 +2,9 @@ import 'dart:ui'; import 'package:attendance_management/blocs/app_localization.dart' as attendance_localization; +import 'package:survey_form/blocs/app_localization.dart' as survey_form_localization; +import 'package:complaints/blocs/localization/app_localization.dart' + as complaints_localization; import 'package:closed_household/blocs/app_localization.dart' as closed_household_localization; import 'package:digit_data_model/data/local_store/sql_store/sql_store.dart'; @@ -16,6 +19,7 @@ import 'package:referral_reconciliation/blocs/app_localization.dart' as referral_reconciliation_localization; import 'package:registration_delivery/blocs/app_localization.dart' as registration_delivery_localization; +import 'package:digit_components/blocs/localization.dart' as component_localization; import '../blocs/localization/app_localization.dart'; import '../data/local_store/no_sql/schema/app_configuration.dart'; @@ -31,6 +35,9 @@ getAppLocalizationDelegates({ GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, GlobalMaterialLocalizations.delegate, + + // INFO : Need to add package delegates here + referral_reconciliation_localization.ReferralReconLocalization.getDelegate( LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, appConfig.languages!, @@ -43,6 +50,10 @@ getAppLocalizationDelegates({ LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, appConfig.languages!, ), + survey_form_localization.SurveyFormLocalization.getDelegate( + LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, + appConfig.languages!, + ), scanner_localization.ScannerLocalization.getDelegate( LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, appConfig.languages!, @@ -59,6 +70,14 @@ getAppLocalizationDelegates({ digit_dss_localization.DashboardLocalization.getDelegate( LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, appConfig.languages!, - ) + ), + component_localization.ComponentLocalization.getDelegate( + LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, + appConfig.languages!, + ), + complaints_localization.ComplaintsLocalization.getDelegate( + LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, + appConfig.languages!, + ), ]; } diff --git a/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart b/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart index 1ad7ed7d9..9196fc719 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart @@ -21,13 +21,6 @@ typedef ProjectResourceDataRepository = DataRepository; typedef ProjectStaffDataRepository = DataRepository; -typedef ServiceDefinitionDataRepository - = DataRepository; -typedef ServiceDataRepository - = DataRepository; -typedef PgrServiceDataRepository - = DataRepository; - typedef UserDataRepository = DataRepository; typedef StockDataRepository = DataRepository; diff --git a/apps/health_campaign_field_worker_app/lib/utils/utils.dart b/apps/health_campaign_field_worker_app/lib/utils/utils.dart index dfda5e62f..83133506c 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -5,6 +5,8 @@ import 'dart:io'; import 'package:attendance_management/attendance_management.dart' as attendance_mappers; + +import 'package:complaints/complaints.init.dart' as complaints_mappers; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:digit_components/theme/digit_theme.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; @@ -25,6 +27,8 @@ import 'package:referral_reconciliation/referral_reconciliation.dart' as referral_reconciliation_mappers; import 'package:registration_delivery/registration_delivery.init.dart' as registration_delivery_mappers; +import 'package:survey_form/survey_form.init.dart' + as survey_form_mappers; import '../blocs/app_initialization/app_initialization.dart'; import '../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart'; @@ -399,6 +403,8 @@ initializeAllMappers() async { Future(() => data_model_mappers.initializeMappers()), Future(() => registration_delivery_mappers.initializeMappers()), Future(() => dss_mappers.initializeMappers()), + Future(() => survey_form_mappers.initializeMappers()), + Future(() => complaints_mappers.initializeMappers()) ]; await Future.wait(initializations); } @@ -424,6 +430,7 @@ int getSyncCount(List oplogs) { } } else { switch (element.entityType) { + // add syncCount case for package case DataModelType.household: case DataModelType.individual: case DataModelType.householdMember: diff --git a/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart b/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart index 6bd4bf8df..ade5b85af 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart @@ -1,10 +1,12 @@ import 'dart:io'; import 'package:attendance_management/attendance_management.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:inventory_management/inventory_management.dart'; import 'package:registration_delivery/registration_delivery.dart'; import 'package:referral_reconciliation/referral_reconciliation.dart'; + import 'package:digit_components/theme/digit_theme.dart'; import 'package:digit_components/widgets/digit_card.dart'; import 'package:digit_components/widgets/digit_elevated_button.dart'; @@ -23,6 +25,7 @@ import '../data/repositories/oplog.dart'; import '../data/repositories/remote/auth.dart'; import '../data/repositories/remote/downsync.dart'; import '../models/downsync/downsync.dart'; +import 'package:complaints/complaints.dart'; class NetworkManagerProviderWrapper extends StatelessWidget { final LocalSqlDataStore sql; @@ -179,13 +182,7 @@ class NetworkManagerProviderWrapper extends StatelessWidget { BoundaryOpLogManager(isar), ), ), - RepositoryProvider< - LocalRepository>( - create: (_) => PgrServiceLocalRepository( - sql, - PgrServiceOpLogManager(isar), - ), - ), + RepositoryProvider< LocalRepository>( create: (_) => HouseholdMemberLocalRepository( @@ -265,6 +262,14 @@ class NetworkManagerProviderWrapper extends StatelessWidget { ), ), // INFO Need to add packages here + + RepositoryProvider< + LocalRepository>( + create: (_) => PgrServiceLocalRepository( + sql, + PgrServiceOpLogManager(isar), + ), + ), ]; } @@ -386,14 +391,7 @@ class NetworkManagerProviderWrapper extends StatelessWidget { actionMap: actions, ), ), - if (value == DataModelType.complaints) - RepositoryProvider< - RemoteRepository>( - create: (_) => PgrServiceRemoteRepository( - dio, - actionMap: actions, - ), - ), + if (value == DataModelType.user) RepositoryProvider>( create: (_) => UserRemoteRepository( @@ -486,6 +484,15 @@ class NetworkManagerProviderWrapper extends StatelessWidget { StockReconciliationRemoteRepository(dio, actionMap: actions), ), // INFO Need to add packages here + + if (value == DataModelType.complaints) + RepositoryProvider< + RemoteRepository>( + create: (_) => PgrServiceRemoteRepository( + dio, + actionMap: actions, + ), + ), ]); } diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/checklist_data.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/checklist_data.dart deleted file mode 100644 index a81c6c73e..000000000 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/checklist_data.dart +++ /dev/null @@ -1,23 +0,0 @@ -part of 'showcase_constants.dart'; - -class _ChecklistDataShowcaseData { - static final _ChecklistDataShowcaseData _instance = - _ChecklistDataShowcaseData._(); - - _ChecklistDataShowcaseData._(); - - factory _ChecklistDataShowcaseData() => _instance; - - List get showcaseData => [ - date, - administrativeUnit, - ]; - - final date = ShowcaseItemBuilder( - messageLocalizationKey: i18.checklistDataShowcase.date, - ); - - final administrativeUnit = ShowcaseItemBuilder( - messageLocalizationKey: i18.checklistDataShowcase.administrativeUnit, - ); -} diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/checklist_list.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/checklist_list.dart deleted file mode 100644 index da2297571..000000000 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/checklist_list.dart +++ /dev/null @@ -1,16 +0,0 @@ -part of 'showcase_constants.dart'; - -class _ChecklistListShowcaseData { - static final _ChecklistListShowcaseData _instance = - _ChecklistListShowcaseData._(); - - _ChecklistListShowcaseData._(); - - factory _ChecklistListShowcaseData() => _instance; - - List get showcaseData => [open]; - - final open = ShowcaseItemBuilder( - messageLocalizationKey: i18.checklistListShowcase.open, - ); -} diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart index 0d712dc39..c5bc7380e 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart @@ -19,7 +19,7 @@ class _HomePageShowcaseData { warehouseManagerSyncData, inventoryReport, supervisorProgressBar, - supervisorMyChecklist, + supervisorMySurveyForm, supervisorComplaints, supervisorSyncData, deleteAll, @@ -68,8 +68,8 @@ class _HomePageShowcaseData { messageLocalizationKey: i18.homeShowcase.supervisorProgressBar, ); - final supervisorMyChecklist = ShowcaseItemBuilder( - messageLocalizationKey: i18.homeShowcase.supervisorMyChecklist, + final supervisorMySurveyForm = ShowcaseItemBuilder( + messageLocalizationKey: i18.homeShowcase.supervisorMySurveyForm, ); final supervisorComplaints = ShowcaseItemBuilder( diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/select_checklist.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/select_checklist.dart deleted file mode 100644 index 87b725c9f..000000000 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/select_checklist.dart +++ /dev/null @@ -1,18 +0,0 @@ -part of 'showcase_constants.dart'; - -class _SelectChecklistShowcaseData { - static final _SelectChecklistShowcaseData _instance = - _SelectChecklistShowcaseData._(); - - _SelectChecklistShowcaseData._(); - - factory _SelectChecklistShowcaseData() => _instance; - - List get showcaseData => [ - selectChecklist, - ]; - - final selectChecklist = ShowcaseItemBuilder( - messageLocalizationKey: i18.selectChecklistShowcase.selectChecklist, - ); -} diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/select_survey_form.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/select_survey_form.dart new file mode 100644 index 000000000..52c59b8d6 --- /dev/null +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/select_survey_form.dart @@ -0,0 +1,18 @@ +part of 'showcase_constants.dart'; + +class _SelectSurveyFormShowcaseData { + static final _SelectSurveyFormShowcaseData _instance = + _SelectSurveyFormShowcaseData._(); + + _SelectSurveyFormShowcaseData._(); + + factory _SelectSurveyFormShowcaseData() => _instance; + + List get showcaseData => [ + selectSurveyForm, + ]; + + final selectSurveyForm = ShowcaseItemBuilder( + messageLocalizationKey: i18.selectSurveyFormShowcase.selectSurveyForm, + ); +} diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/showcase_constants.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/showcase_constants.dart index 89a6fe8f0..54e64a0d3 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/showcase_constants.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/showcase_constants.dart @@ -1,10 +1,10 @@ import '../../../utils/i18_key_constants.dart' as i18; import '../showcase_wrappers.dart'; -part 'checklist_data.dart'; -part 'checklist_list.dart'; +part 'survey_form_data.dart'; +part 'survey_form_list.dart'; part 'home_showcase.dart'; -part 'select_checklist.dart'; +part 'select_survey_form.dart'; part 'select_stock_showcase.dart'; part 'stock_details.dart'; part 'stock_reconciliation.dart'; @@ -19,9 +19,9 @@ final selectStockShowcaseData = _SelectStockShowcaseData(); final warehouseDetailsShowcaseData = _WarehouseDetailsShowcaseData(); final stockDetailsShowcaseData = _StockDetailsShowcaseData(); final stockReconciliationShowcaseData = _StockReconciliationShowcaseData(); -final selectChecklistShowcaseData = _SelectChecklistShowcaseData(); -final checklistDataShowcaseData = _ChecklistDataShowcaseData(); -final checklistListShowcaseData = _ChecklistListShowcaseData(); +final selectSurveyFormShowcaseData = _SelectSurveyFormShowcaseData(); +final surveyFormDataShowcaseData = _SurveyFormDataShowcaseData(); +final surveyFormListShowcaseData = _SurveyFormListShowcaseData(); final complaintsInboxShowcaseData = _ComplaintsInboxShowcaseData(); final complaintsDetailsViewShowcaseData = _ComplaintsDetailsViewShowcaseData(); final complaintTypeShowcaseData = _ComplaintTypeShowcaseData(); diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/survey_form_data.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/survey_form_data.dart new file mode 100644 index 000000000..0f2bdb86b --- /dev/null +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/survey_form_data.dart @@ -0,0 +1,24 @@ + +part of 'showcase_constants.dart'; + +class _SurveyFormDataShowcaseData { + static final _SurveyFormDataShowcaseData _instance = + _SurveyFormDataShowcaseData._(); + + _SurveyFormDataShowcaseData._(); + + factory _SurveyFormDataShowcaseData() => _instance; + + List get showcaseData => [ + date, + administrativeUnit, + ]; + + final date = ShowcaseItemBuilder( + messageLocalizationKey: i18.surveyFormDataShowcase.date, + ); + + final administrativeUnit = ShowcaseItemBuilder( + messageLocalizationKey: i18.surveyFormDataShowcase.administrativeUnit, + ); +} diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/survey_form_list.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/survey_form_list.dart new file mode 100644 index 000000000..61de98372 --- /dev/null +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/survey_form_list.dart @@ -0,0 +1,16 @@ +part of 'showcase_constants.dart'; + +class _SurveyFormListShowcaseData { + static final _SurveyFormListShowcaseData _instance = + _SurveyFormListShowcaseData._(); + + _SurveyFormListShowcaseData._(); + + factory _SurveyFormListShowcaseData() => _instance; + + List get showcaseData => [open]; + + final open = ShowcaseItemBuilder( + messageLocalizationKey: i18.surveyFormListShowcase.open, + ); +} diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/showcase_button.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/showcase_button.dart index 347693423..79b803f8e 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/showcase_button.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/showcase_button.dart @@ -1,3 +1,4 @@ +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:digit_components/theme/digit_theme.dart'; import 'package:digit_showcase/showcase_widget.dart'; import 'package:flutter/material.dart'; @@ -73,18 +74,6 @@ class _ShowcaseButtonState extends LocalizedState { return stockReconciliationShowcaseData.showcaseData.map( (e) => e.showcaseKey, ); - case ChecklistRoute.name: - return selectChecklistShowcaseData.showcaseData.map( - (e) => e.showcaseKey, - ); - case ChecklistBoundaryViewRoute.name: - return checklistDataShowcaseData.showcaseData.map( - (e) => e.showcaseKey, - ); - case ChecklistPreviewRoute.name: - return checklistListShowcaseData.showcaseData.map( - (e) => e.showcaseKey, - ); case ComplaintTypeRoute.name: return complaintTypeShowcaseData.showcaseData.map( (e) => e.showcaseKey, diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index c96f0b5fd..c6118ca4d 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -37,18 +37,18 @@ packages: dependency: transitive description: name: ansicolor - sha256: "8bf17a8ff6ea17499e40a2d2542c2f481cd7615760c6d34065cb22bfd22e6880" + sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" archive: dependency: transitive description: name: archive - sha256: "6bd38d335f0954f5fad9c79e614604fbf03a0e5b975923dd001b6ea965ef5b4b" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d url: "https://pub.dev" source: hosted - version: "3.6.0" + version: "3.6.1" args: dependency: transitive description: @@ -68,10 +68,9 @@ packages: attendance_management: dependency: "direct main" description: - name: attendance_management - sha256: f1b4373e8d0d9f8227ede0d25d4141f0d16d18ac2525c0347b844098cdab080f - url: "https://pub.dev" - source: hosted + path: "../../packages/attendance_management" + relative: true + source: path version: "1.0.2+1" audioplayers: dependency: "direct main" @@ -157,10 +156,10 @@ packages: dependency: transitive description: name: battery_plus_platform_interface - sha256: "942707f90e2f7481dcb178df02e22a9c6971b3562b848d6a1b8c7cff9f1a1fec" + sha256: e8342c0f32de4b1dfd0223114b6785e48e579bfc398da9471c9179b907fa4910 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" bloc: dependency: transitive description: @@ -285,18 +284,18 @@ packages: dependency: transitive description: name: camera_platform_interface - sha256: a250314a48ea337b35909a4c9d5416a208d736dcb01d0b02c6af122be66660b0 + sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061 url: "https://pub.dev" source: hosted - version: "2.7.4" + version: "2.8.0" camera_web: dependency: transitive description: name: camera_web - sha256: "9e9aba2fbab77ce2472924196ff8ac4dd8f9126c4f9a3096171cd1d870d6b26c" + sha256: b9235ec0a2ce949daec546f1f3d86f05c3921ed31c7d9ab6b7c03214d152fc2d url: "https://pub.dev" source: hosted - version: "0.3.3" + version: "0.3.4" characters: dependency: transitive description: @@ -340,10 +339,9 @@ packages: closed_household: dependency: "direct main" description: - name: closed_household - sha256: d216dbc8e263c9be576e3747ceee9715a6a96e6056a7a812847fb44589f515e8 - url: "https://pub.dev" - source: hosted + path: "../../packages/closed_household" + relative: true + source: path version: "1.0.1+1" code_builder: dependency: transitive @@ -361,6 +359,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + complaints: + dependency: "direct main" + description: + path: "../../packages/complaints" + relative: true + source: path + version: "0.0.1-dev.1" connectivity_plus: dependency: "direct main" description: @@ -430,7 +435,7 @@ packages: description: path: "packages/dart_mappable_builder" ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" + resolved-ref: e3d8ac43f70568b4a17c200cae5cde285050ef23 url: "https://github.com/egovernments/health-campaign-field-worker-app/" source: git version: "4.2.0" @@ -478,10 +483,10 @@ packages: dependency: transitive description: name: device_info_plus_platform_interface - sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" diff_match_patch: dependency: transitive description: @@ -493,26 +498,23 @@ packages: digit_components: dependency: "direct main" description: - name: digit_components - sha256: "9cca4d9a546037080afe02b6ade82fdf01574e11f5656ad12120fd6966578616" - url: "https://pub.dev" - source: hosted - version: "1.0.1+1" + path: "../../packages/digit_components" + relative: true + source: path + version: "1.0.2" digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" - url: "https://pub.dev" - source: hosted + path: "../../packages/digit_data_model" + relative: true + source: path version: "1.0.3+1" digit_dss: dependency: "direct main" description: - name: digit_dss - sha256: "32e2173ae52e7fd9fb53fa435fb21466248029366584f44a0c0f2c6836267a98" - url: "https://pub.dev" - source: hosted + path: "../../packages/digit_dss" + relative: true + source: path version: "1.0.1" digit_firebase_services: dependency: "direct main" @@ -524,27 +526,33 @@ packages: digit_scanner: dependency: "direct main" description: - name: digit_scanner - sha256: "9862c4885465bb1942e36dc9b42596c201648db9b0f5ffb8ad768e2409fc2742" - url: "https://pub.dev" - source: hosted + path: "../../packages/digit_scanner" + relative: true + source: path version: "1.0.3+1" digit_showcase: dependency: "direct main" description: - name: digit_showcase - sha256: "75b67298f1860ad757827b15af752b677f934b5275b887e36b15e25a5285e498" - url: "https://pub.dev" - source: hosted + path: "../../packages/digit_showcase" + relative: true + source: path version: "1.0.0" dio: dependency: "direct main" description: name: dio - sha256: "11e40df547d418cc0c4900a9318b26304e665da6fa4755399a9ff9efd09034b5" + sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" url: "https://pub.dev" source: hosted - version: "5.4.3+1" + version: "5.7.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" + url: "https://pub.dev" + source: hosted + version: "1.0.1" disable_battery_optimization: dependency: "direct main" description: @@ -645,10 +653,10 @@ packages: dependency: transitive description: name: firebase_core_platform_interface - sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.3.0" firebase_core_web: dependency: transitive description: @@ -690,50 +698,50 @@ packages: dependency: "direct main" description: name: flutter_background_service - sha256: "94d9a143852729140e17254a53769383b03738cd92b6e588a8762003e6cd9dd9" + sha256: d32f078ec57647c9cfd6e1a8da9297f7d8f021d4dcc204a35aaad2cdbfe255f0 url: "https://pub.dev" source: hosted - version: "5.0.5" + version: "5.0.10" flutter_background_service_android: dependency: transitive description: name: flutter_background_service_android - sha256: "30863ebafd8214b8e76d5e5c9f27887dc5cc303fcf3e89f71534f621fc486782" + sha256: "39da42dddf877beeef82bc2583130d8bedb4d0765e99ca9e7b4a32e8c6abd239" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.2.7" flutter_background_service_ios: dependency: transitive description: name: flutter_background_service_ios - sha256: ab73657535876e16abc89e40f924df3e92ad3dee83f64d187081417e824709ed + sha256: "6037ffd45c4d019dab0975c7feb1d31012dd697e25edc05505a4a9b0c7dc9fba" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.0.3" flutter_background_service_platform_interface: dependency: transitive description: name: flutter_background_service_platform_interface - sha256: cd5720ff5b051d551a4734fae16683aace779bd0425e8d3f15d84a0cdcc2d8d9 + sha256: ca74aa95789a8304f4d3f57f07ba404faa86bed6e415f83e8edea6ad8b904a41 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.2" flutter_bloc: dependency: "direct main" description: name: flutter_bloc - sha256: f0ecf6e6eb955193ca60af2d5ca39565a86b8a142452c5b24d96fb477428f4d2 + sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a url: "https://pub.dev" source: hosted - version: "8.1.5" + version: "8.1.6" flutter_dotenv: dependency: "direct main" description: name: flutter_dotenv - sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.2.1" flutter_driver: dependency: transitive description: flutter @@ -823,18 +831,18 @@ packages: dependency: transitive description: name: flutter_local_notifications_linux - sha256: "33f741ef47b5f63cc7f78fe75eeeac7e19f171ff3c3df054d84c1e38bedb6a03" + sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af url: "https://pub.dev" source: hosted - version: "4.0.0+1" + version: "4.0.1" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - sha256: "340abf67df238f7f0ef58f4a26d2a83e1ab74c77ab03cd2b2d5018ac64db30b7" + sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" url: "https://pub.dev" source: hosted - version: "7.1.0" + version: "7.2.0" flutter_localizations: dependency: "direct main" description: flutter @@ -966,10 +974,10 @@ packages: dependency: "direct main" description: name: freezed_annotation - sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.4" frontend_server_client: dependency: transitive description: @@ -1035,10 +1043,10 @@ packages: dependency: "direct main" description: name: gs1_barcode_parser - sha256: "9aaff47bdab7177deaf9248cc861ef41cf611d3f828498cb40b64bedcbf53391" + sha256: ff171bc40038de3f7178fbc32eaf9eebc3d35a3c4c00bb0281fe4a976d853a42 url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.1.0" horizontal_data_table: dependency: transitive description: @@ -1051,10 +1059,10 @@ packages: dependency: transitive description: name: hrk_batteries - sha256: "8ecfdee8268d480a700153a006f7c622c922fbfba4d8f576438c8c41ea9efdf2" + sha256: "35bc2be10bb64284b04d3cd944c24eecf304747fc64b34e2d27ef1a3ac75ab49" url: "https://pub.dev" source: hosted - version: "0.9.2" + version: "2.2.0" hrk_flutter_test_batteries: dependency: "direct dev" description: @@ -1067,10 +1075,10 @@ packages: dependency: transitive description: name: hrk_logging - sha256: "7ea3d02ed46f19533a8cae075cafe636757548a300a0e404193f6dd142c024b5" + sha256: "2e6501f4b78439bec4c367a94b14f792fd17fe1c94f18d903086c7b8a48402f5" url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.3.1" http: dependency: transitive description: @@ -1099,10 +1107,10 @@ packages: dependency: transitive description: name: image - sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" + sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8" url: "https://pub.dev" source: hosted - version: "4.1.7" + version: "4.2.0" integration_test: dependency: "direct dev" description: flutter @@ -1119,11 +1127,10 @@ packages: inventory_management: dependency: "direct main" description: - name: inventory_management - sha256: "1a5976ab807666629704f559730d5418e1c723fed898df2cc6e7d9807f813b6f" - url: "https://pub.dev" - source: hosted - version: "1.0.3+2" + path: "../../packages/inventory_management" + relative: true + source: path + version: "1.0.3+4" io: dependency: transitive description: @@ -1264,18 +1271,18 @@ packages: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" mocktail: dependency: "direct dev" description: name: mocktail - sha256: c4b5007d91ca4f67256e720cb1b6d704e79a510183a12fa551021f652577dce6 + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" nested: dependency: "direct main" description: @@ -1352,10 +1359,10 @@ packages: dependency: "direct main" description: name: path_provider - sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" path_provider_android: dependency: transitive description: @@ -1392,10 +1399,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" pedantic: dependency: transitive description: @@ -1456,10 +1463,10 @@ packages: dependency: "direct main" description: name: pretty_dio_logger - sha256: "00b80053063935cf9a6190da344c5373b9d0e92da4c944c878ff2fbef0ef6dc2" + sha256: "36f2101299786d567869493e2f5731de61ce130faa14679473b26905a92b6407" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" process: dependency: transitive description: @@ -1488,10 +1495,10 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.3.0" qr: dependency: transitive description: @@ -1535,18 +1542,16 @@ packages: referral_reconciliation: dependency: "direct main" description: - name: referral_reconciliation - sha256: "80d5b93164e4f8337fa757fcb75a1e85b88ffbb760e731ca24496a0cae2aef38" - url: "https://pub.dev" - source: hosted + path: "../../packages/referral_reconciliation" + relative: true + source: path version: "1.0.2+1" registration_delivery: dependency: "direct main" description: - name: registration_delivery - sha256: a6a88665bbf1fa5dce5b864d66992ff9c885b2a3cd898d37f349f1be03cf4086 - url: "https://pub.dev" - source: hosted + path: "../../packages/registration_delivery" + relative: true + source: path version: "1.0.3+1" remove_emoji_input_formatter: dependency: transitive @@ -1592,18 +1597,18 @@ packages: dependency: transitive description: name: shared_preferences_linux - sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + sha256: "2ba0510d3017f91655b7543e9ee46d48619de2a2af38e5c790423f7007c7ccc1" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_web: dependency: transitive description: @@ -1616,10 +1621,10 @@ packages: dependency: transitive description: name: shared_preferences_windows - sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + sha256: "398084b47b7f92110683cac45c6dc4aae853db47e470e5ddcd52cab7f7196ab2" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" shelf: dependency: transitive description: @@ -1717,10 +1722,10 @@ packages: dependency: transitive description: name: speech_to_text_platform_interface - sha256: a0df1a907091ea09880077dc25aae02af9f79811264e6e97ddb08639b7f771c2 + sha256: a1935847704e41ee468aad83181ddd2423d0833abe55d769c59afca07adb5114 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.0" sqlite3: dependency: transitive description: @@ -1733,10 +1738,10 @@ packages: dependency: "direct main" description: name: sqlite3_flutter_libs - sha256: fb2a106a2ea6042fe57de2c47074cc31539a941819c91e105b864744605da3f5 + sha256: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" url: "https://pub.dev" source: hosted - version: "0.5.21" + version: "0.5.24" sqlparser: dependency: transitive description: @@ -1777,6 +1782,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + survey_form: + dependency: "direct main" + description: + path: "../../packages/survey_form" + relative: true + source: path + version: "0.0.1-dev.1" sync_http: dependency: transitive description: @@ -1837,10 +1849,10 @@ packages: dependency: transitive description: name: timezone - sha256: a6ccda4a69a442098b602c44e61a1e2b4bf6f5516e875bbf0f427d5df14745d5 + sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" url: "https://pub.dev" source: hosted - version: "0.9.3" + version: "0.9.4" timing: dependency: transitive description: @@ -1877,10 +1889,10 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "6ce1e04375be4eed30548f10a315826fd933c1e493206eab82eed01f438c8d2e" + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" url: "https://pub.dev" source: hosted - version: "6.2.6" + version: "6.3.0" url_launcher_android: dependency: transitive description: @@ -1933,10 +1945,10 @@ packages: dependency: transitive description: name: url_launcher_windows - sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" uuid: dependency: "direct main" description: @@ -2069,10 +2081,10 @@ packages: dependency: transitive description: name: xxh3 - sha256: a92b30944a9aeb4e3d4f3c3d4ddb3c7816ca73475cd603682c4f8149690f56d7 + sha256: cbeb0e1d10f4c6bf67b650f395eac0cc689425b5efc2ba0cc3d3e069a0beaeec url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" yaml: dependency: transitive description: @@ -2082,5 +2094,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.3 <3.9.0" + dart: ">=3.2.0 <4.0.0" flutter: ">=3.16.0" diff --git a/apps/health_campaign_field_worker_app/pubspec.yaml b/apps/health_campaign_field_worker_app/pubspec.yaml index c2d6d352d..6deebd4c5 100644 --- a/apps/health_campaign_field_worker_app/pubspec.yaml +++ b/apps/health_campaign_field_worker_app/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sqlite3_flutter_libs: ^0.5.10 path_provider: ^2.0.11 path: ^1.8.2 - digit_components: ^1.0.1+1 + digit_components: ^1.0.2 auto_route: ^7.8.4 flutter_bloc: ^8.1.1 collection: ^1.16.0 @@ -67,13 +67,15 @@ dependencies: camera: ^0.10.5+7 attendance_management: ^1.0.2+1 digit_scanner: ^1.0.3+1 - inventory_management: ^1.0.3+2 + inventory_management: ^1.0.3+4 referral_reconciliation: ^1.0.2+1 - digit_data_model: ^1.0.3+1 + digit_data_model: 1.0.3+1 registration_delivery: ^1.0.3+1 disable_battery_optimization: ^1.1.1 digit_dss: ^1.0.1 closed_household: ^1.0.1+1 + survey_form: ^0.0.1-dev.1 + complaints: ^0.0.1-dev.1 dev_dependencies: flutter_test: @@ -110,7 +112,7 @@ flutter: assets: - ./ - assets/icons/svg/ - + fonts: - family: Roboto fonts: @@ -118,4 +120,4 @@ flutter: - family: RobotoCondensed fonts: - asset: assets/fonts/Roboto/RobotoCondensed-Regular.ttf - uses-material-design: true + uses-material-design: true \ No newline at end of file diff --git a/packages/attendance_management/pubspec.lock b/packages/attendance_management/pubspec.lock index 92c10cb88..4c22c3a97 100644 --- a/packages/attendance_management/pubspec.lock +++ b/packages/attendance_management/pubspec.lock @@ -276,11 +276,9 @@ packages: dart_mappable_builder: dependency: "direct dev" description: - path: "packages/dart_mappable_builder" - ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" - url: "https://github.com/egovernments/health-campaign-field-worker-app/" - source: git + path: "../dart_mappable_builder" + relative: true + source: path version: "4.2.0" dart_style: dependency: transitive @@ -317,18 +315,16 @@ packages: digit_components: dependency: "direct main" description: - name: digit_components - sha256: "9cca4d9a546037080afe02b6ade82fdf01574e11f5656ad12120fd6966578616" - url: "https://pub.dev" - source: hosted - version: "1.0.1+1" + path: "../digit_components" + relative: true + source: path + version: "1.0.2" digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" - url: "https://pub.dev" - source: hosted + path: "../digit_data_model" + relative: true + source: path version: "1.0.3+1" dio: dependency: "direct main" @@ -1263,5 +1259,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <3.9.0" + dart: ">=3.2.0 <4.0.0" flutter: ">=3.16.0" diff --git a/packages/complaints/.gitignore b/packages/complaints/.gitignore new file mode 100644 index 000000000..ac5aa9893 --- /dev/null +++ b/packages/complaints/.gitignore @@ -0,0 +1,29 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +build/ diff --git a/packages/complaints/.metadata b/packages/complaints/.metadata new file mode 100644 index 000000000..b2c661a57 --- /dev/null +++ b/packages/complaints/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4" + channel: "stable" + +project_type: package diff --git a/packages/complaints/CHANGELOG.md b/packages/complaints/CHANGELOG.md new file mode 100644 index 000000000..8cfb47136 --- /dev/null +++ b/packages/complaints/CHANGELOG.md @@ -0,0 +1,6 @@ + +## 0.0.1-dev.1 + +* Moved pgr models, blocs, local remote repository from digit_data_model +* Updated digit_data_model +* PGR Complaints Initial Release \ No newline at end of file diff --git a/packages/complaints/LICENSE b/packages/complaints/LICENSE new file mode 100644 index 000000000..f7d7ac958 --- /dev/null +++ b/packages/complaints/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 eGovernments Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/complaints/README.md b/packages/complaints/README.md new file mode 100644 index 000000000..5593a8162 --- /dev/null +++ b/packages/complaints/README.md @@ -0,0 +1,50 @@ +Complaints package helps people to file complaints , they can provide Complaint type , location and details about the Complaint. + +## Features + +- **Complaints Pages**: The package includes several pages like `complaints_type.dart`, `complaints_location.dart`, `complaints_details.dart` that provide the user interface for Filing Complaint. + + + + + + + +- **Complaints Blocs**: It provides various BLoCs Like `ComplaintsInboxBloc`,`ComplaintsRegistrationBloc` for state management using the BLoC pattern. These BLoCs handle the business logic for Filing Complaints. +- **Complaints Models**: It defines various data models like `PgrAddressModel`, `PgrComplaintModel`, `PgrServiceModel` etc. used in the attendance management process. +- **Complaints Repositories**: The package provides abstract classes for data repositories, `PgrServiceLocalRepository`, `PgrServiceRemoteRepository`, which can be extended to create repositories for different complaint models. + + +## Getting started + +To use this package, add the following dependency to your `pubspec.yaml` file: + +```yaml +dependencies: + complaints: ^any +``` + +## Usage + + +To Navigate to any screens of the package: + +First add complaint_router to your main app router + +Navigate to the required screen using the below code: + +```dart +context.router.push(ComplaintsInboxWrapperRoute()), +``` + +Complaints package requires below data to be passed from main app: + +```dart + String? tenantId; + String? loggedInUserUuid; + String? userMobileNumber; + String? loggedInUserName; + List? complaintTypes; + String? userName; +``` + diff --git a/packages/complaints/analysis_options.yaml b/packages/complaints/analysis_options.yaml new file mode 100644 index 000000000..a5744c1cf --- /dev/null +++ b/packages/complaints/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/complaints/assets/icons/svg/no_result.svg b/packages/complaints/assets/icons/svg/no_result.svg new file mode 100644 index 000000000..df2b14869 --- /dev/null +++ b/packages/complaints/assets/icons/svg/no_result.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/complaints/example/.gitignore b/packages/complaints/example/.gitignore new file mode 100644 index 000000000..29a3a5017 --- /dev/null +++ b/packages/complaints/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/complaints/example/.metadata b/packages/complaints/example/.metadata new file mode 100644 index 000000000..eea2802f1 --- /dev/null +++ b/packages/complaints/example/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: android + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: ios + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: linux + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: macos + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: web + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: windows + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/complaints/example/README.md b/packages/complaints/example/README.md new file mode 100644 index 000000000..2b3fce4c8 --- /dev/null +++ b/packages/complaints/example/README.md @@ -0,0 +1,16 @@ +# example + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/packages/complaints/example/analysis_options.yaml b/packages/complaints/example/analysis_options.yaml new file mode 100644 index 000000000..0d2902135 --- /dev/null +++ b/packages/complaints/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/complaints/example/android/.gitignore b/packages/complaints/example/android/.gitignore new file mode 100644 index 000000000..6f568019d --- /dev/null +++ b/packages/complaints/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/packages/complaints/example/android/app/build.gradle b/packages/complaints/example/android/app/build.gradle new file mode 100644 index 000000000..118ee1d92 --- /dev/null +++ b/packages/complaints/example/android/app/build.gradle @@ -0,0 +1,67 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +android { + namespace "com.example.example" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies {} diff --git a/packages/complaints/example/android/app/src/debug/AndroidManifest.xml b/packages/complaints/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..399f6981d --- /dev/null +++ b/packages/complaints/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/complaints/example/android/app/src/main/AndroidManifest.xml b/packages/complaints/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..19b862ec8 --- /dev/null +++ b/packages/complaints/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/packages/complaints/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/packages/complaints/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 000000000..e793a000d --- /dev/null +++ b/packages/complaints/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/packages/complaints/example/android/app/src/main/res/drawable-v21/launch_background.xml b/packages/complaints/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/packages/complaints/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/complaints/example/android/app/src/main/res/drawable/launch_background.xml b/packages/complaints/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000..304732f88 --- /dev/null +++ b/packages/complaints/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/complaints/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/complaints/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..7eb65cb8d Binary files /dev/null and b/packages/complaints/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/complaints/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/complaints/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..7021b6ace Binary files /dev/null and b/packages/complaints/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/complaints/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/complaints/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..f55918dc1 Binary files /dev/null and b/packages/complaints/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/complaints/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/complaints/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..910eafa1d Binary files /dev/null and b/packages/complaints/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/complaints/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/complaints/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..67b1e5f25 Binary files /dev/null and b/packages/complaints/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/complaints/example/android/app/src/main/res/values-night/styles.xml b/packages/complaints/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..06952be74 --- /dev/null +++ b/packages/complaints/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/complaints/example/android/app/src/main/res/values/styles.xml b/packages/complaints/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..cb1ef8805 --- /dev/null +++ b/packages/complaints/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/complaints/example/android/app/src/profile/AndroidManifest.xml b/packages/complaints/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..399f6981d --- /dev/null +++ b/packages/complaints/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/complaints/example/android/build.gradle b/packages/complaints/example/android/build.gradle new file mode 100644 index 000000000..2a2de2524 --- /dev/null +++ b/packages/complaints/example/android/build.gradle @@ -0,0 +1,30 @@ +buildscript { + ext.kotlin_version = '1.9.0' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/packages/complaints/example/android/settings.gradle b/packages/complaints/example/android/settings.gradle new file mode 100644 index 000000000..7cd712855 --- /dev/null +++ b/packages/complaints/example/android/settings.gradle @@ -0,0 +1,29 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() + + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false +} + +include ":app" diff --git a/packages/complaints/example/ios/.gitignore b/packages/complaints/example/ios/.gitignore new file mode 100644 index 000000000..7a7f9873a --- /dev/null +++ b/packages/complaints/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/complaints/example/ios/Flutter/AppFrameworkInfo.plist b/packages/complaints/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..7c5696400 --- /dev/null +++ b/packages/complaints/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 12.0 + + diff --git a/packages/complaints/example/ios/Flutter/Debug.xcconfig b/packages/complaints/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/packages/complaints/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/packages/complaints/example/ios/Flutter/Release.xcconfig b/packages/complaints/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/packages/complaints/example/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/packages/complaints/example/ios/Runner.xcodeproj/project.pbxproj b/packages/complaints/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..69cdaed8d --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,614 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807E294A63A400263BE5 /* Frameworks */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/complaints/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/complaints/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..87131a09b --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/complaints/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/complaints/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/complaints/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/complaints/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/complaints/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/complaints/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/complaints/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/complaints/example/ios/Runner/AppDelegate.swift b/packages/complaints/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/packages/complaints/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..4def64261 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..56e650ace Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..37eca2b4b Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..0b29a04f1 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..0bd0125e0 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..eaf2dee37 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..3fd69bf85 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..37eca2b4b Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..b7649c3e2 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..44d138309 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png new file mode 100644 index 000000000..9a22b7fc3 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png new file mode 100644 index 000000000..f64ce7730 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png new file mode 100644 index 000000000..72baec5a1 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png new file mode 100644 index 000000000..fd77b7e7a Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..44d138309 Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..41b217a5b Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png new file mode 100644 index 000000000..7eb65cb8d Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png new file mode 100644 index 000000000..910eafa1d Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..b9811544e Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..5047fef8e Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..9fee6d1eb Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/packages/complaints/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/complaints/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/complaints/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/packages/complaints/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/complaints/example/ios/Runner/Base.lproj/Main.storyboard b/packages/complaints/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/packages/complaints/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/complaints/example/ios/Runner/Info.plist b/packages/complaints/example/ios/Runner/Info.plist new file mode 100644 index 000000000..5458fc418 --- /dev/null +++ b/packages/complaints/example/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/packages/complaints/example/ios/Runner/Runner-Bridging-Header.h b/packages/complaints/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..308a2a560 --- /dev/null +++ b/packages/complaints/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/packages/complaints/example/ios/RunnerTests/RunnerTests.swift b/packages/complaints/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 000000000..86a7c3b1b --- /dev/null +++ b/packages/complaints/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/packages/complaints/example/lib/localization_strings.json b/packages/complaints/example/lib/localization_strings.json new file mode 100644 index 000000000..0da33f0ec --- /dev/null +++ b/packages/complaints/example/lib/localization_strings.json @@ -0,0 +1,68 @@ +[ + { + "code": "COMPLAINTS_INBOX_HEADING", + "locale": "en_US", + "message": "Complaints Inbox", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_INBOX_SEARCH_CTA", + "locale": "en_US", + "message": "Search", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_INBOX_FILTER_CTA", + "locale": "en_US", + "message": "Filter", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_INBOX_SORT_CTA", + "locale": "en_US", + "message": "Sort", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_NO_COMPLAINTS_EXIST", + "locale": "en_US", + "message": "No Complaints Exist", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_FILE_COMPLAINT_ACTION", + "locale": "en_MZ", + "message": "File Complaint", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_ACKNOWLEDGEMENT_LABEL", + "locale": "en_MZ", + "message": "File Complaint", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_ACKNOWLEDGEMENT_SUB_LABEL_MAIN", + "locale": "en_MZ", + "message": "Complaint No.", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_ACKNOWLEDGEMENT_SUB_LABEL_SUB", + "locale": "en_MZ", + "message": "(Please sync the data to generate)", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_ACKNOWLEDGEMENT_ACTION", + "locale": "en_MZ", + "message": "Back to Complaints", + "module": "hcm-common" + }, + { + "code": "COMPLAINTS_ACKNOWLEDGEMENT_DESCRIPTION", + "locale": "en_MZ", + "message": "The complaint has been registered successfully and sent to the concerned person.", + "module": "hcm-common" + } +] \ No newline at end of file diff --git a/packages/complaints/example/lib/main.dart b/packages/complaints/example/lib/main.dart new file mode 100644 index 000000000..7642de2f9 --- /dev/null +++ b/packages/complaints/example/lib/main.dart @@ -0,0 +1,123 @@ +import 'dart:convert'; + +import 'package:complaints/blocs/localization/app_localization.dart'; +import 'package:complaints/complaints.dart'; +import 'package:digit_components/digit_components.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +void main() { + runApp(MyApp()); +} +class Language{ + late String label; + late String value; + + Language(this.label,this.value); +} + +class Localization { + late String code; + + late String message; + + late String module; + + late String locale; + +} + +Future loadLocalizedStrings() async{ + final String jsonString = + await rootBundle.loadString('lib/localization_strings.json'); + final decode = json.decode(jsonString); + + + List localizationList; + localizationList = decode.map((e) { + final data = e; + return Localization() + ..code = data['code'] + ..locale = data['locale'] + ..module = data['module'] + ..message = data['message']; + }).toList(); + + return Future.value(localizationList); +} + +class MyApp extends StatelessWidget { + late Future localizedStrings = loadLocalizedStrings(); + MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + useMaterial3: true, + ), + home: MyHomePage(title: "Complaints Package Demo"), + locale: Locale('en','MZ'), + supportedLocales: [const Locale('en','MZ')], + localizationsDelegates: [ + ComplaintsLocalization.getDelegate(loadLocalizedStrings(), [ + Language("English", "en_MZ") + ]), + // Add other localizations delegates if needed + ], + ); + } +} + +class MyHomePage extends StatefulWidget { + final String title; + MyHomePage({super.key, required this.title}); + + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + return Scaffold( + appBar: AppBar( + title: Text("PGR-Complaints Example"), + ), + body: Center( + child :DigitOutLineButton( + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => + ComplaintsAcknowledgementPage(), + ), + ); + }, + label: "Demo Acknowledgemnet", + buttonStyle: OutlinedButton.styleFrom( + shape: const BeveledRectangleBorder(), + padding: const EdgeInsets.all(14), + side: BorderSide( + width: 1.0, + color: theme.colorScheme.primary, + ), + ), + ), + ) + ); + } +} diff --git a/packages/complaints/example/pubspec.lock b/packages/complaints/example/pubspec.lock new file mode 100644 index 000000000..c30d8d54e --- /dev/null +++ b/packages/complaints/example/pubspec.lock @@ -0,0 +1,1073 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" + args: + dependency: transitive + description: + name: args + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + url: "https://pub.dev" + source: hosted + version: "2.5.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + auto_route: + dependency: transitive + description: + name: auto_route + sha256: eb33554581a0a4aa7e6da0f13a44291a55bf71359012f1d9feb41634ff908ff8 + url: "https://pub.dev" + source: hosted + version: "7.9.2" + bloc: + dependency: transitive + description: + name: bloc + sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" + url: "https://pub.dev" + source: hosted + version: "8.1.4" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: transitive + description: + name: build_runner + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" + url: "https://pub.dev" + source: hosted + version: "2.4.9" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + complaints: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1-dev.1" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + dart_mappable: + dependency: transitive + description: + name: dart_mappable + sha256: "47269caf2060533c29b823ff7fa9706502355ffcb61e7f2a374e3a0fb2f2c3f0" + url: "https://pub.dev" + source: hosted + version: "4.2.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + url: "https://pub.dev" + source: hosted + version: "2.3.6" + db_viewer: + dependency: transitive + description: + name: db_viewer + sha256: "5f7e3cfcde9663321797d8f6f0c876f7c13f0825a2e77ec1ef065656797144d9" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + digit_components: + dependency: "direct main" + description: + name: digit_components + sha256: "01320d4c72829045e789d1a56e23ff2bd85dad6a1831d27bd507a1acaceae17e" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + digit_data_model: + dependency: "direct main" + description: + name: digit_data_model + sha256: "14ebea5f17921081025963b379efd5e16d155dd920d5a42ab2f2f392afb649de" + url: "https://pub.dev" + source: hosted + version: "1.0.4-dev.1" + dio: + dependency: transitive + description: + name: dio + sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0" + url: "https://pub.dev" + source: hosted + version: "5.6.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + drift: + dependency: transitive + description: + name: drift + sha256: b50a8342c6ddf05be53bda1d246404cbad101b64dc73e8d6d1ac1090d119b4e2 + url: "https://pub.dev" + source: hosted + version: "2.15.0" + drift_db_viewer: + dependency: transitive + description: + name: drift_db_viewer + sha256: "5ea77858c52b55460a1e8f34ab5f88324621d486717d876fd745765fbc227f3f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + easy_stepper: + dependency: transitive + description: + name: easy_stepper + sha256: "77f3ab4ee3c867b5a2236bf712abb08fed2b1c533cf24cf3fcd46c2821072ffd" + url: "https://pub.dev" + source: hosted + version: "0.5.2+1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a + url: "https://pub.dev" + source: hosted + version: "8.1.6" + flutter_dotenv: + dependency: transitive + description: + name: flutter_dotenv + sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + url: "https://pub.dev" + source: hosted + version: "5.1.0" + flutter_focus_watcher: + dependency: transitive + description: + name: flutter_focus_watcher + sha256: a72ee539ae0237961308a25839887ca93a0b1cb6f87b0d492b139c8fccff8e79 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility: + dependency: transitive + description: + name: flutter_keyboard_visibility + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" + url: "https://pub.dev" + source: hosted + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_platform_interface: + dependency: transitive + description: + name: flutter_keyboard_visibility_platform_interface + sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_web: + dependency: transitive + description: + name: flutter_keyboard_visibility_web + sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: d2696eed13732831414595b98863260e33e8882fc069ee80ec35d4ac9ddb0472 + url: "https://pub.dev" + source: hosted + version: "5.2.1" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + url: "https://pub.dev" + source: hosted + version: "2.0.10+1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_typeahead: + dependency: transitive + description: + name: flutter_typeahead + sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818 + url: "https://pub.dev" + source: hosted + version: "4.8.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: transitive + description: + name: fluttertoast + sha256: "81b68579e23fcbcada2db3d50302813d2371664afe6165bc78148050ab94bf66" + url: "https://pub.dev" + source: hosted + version: "8.2.5" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + url: "https://pub.dev" + source: hosted + version: "2.4.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: "2776c66b3e97c6cdd58d1bd3281548b074b64f1fd5c8f82391f7456e38849567" + url: "https://pub.dev" + source: hosted + version: "4.0.5" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + group_radio_button: + dependency: transitive + description: + name: group_radio_button + sha256: "204de8d16b224be7fc72dade0c3afd410ff5a34417d89f74f0fd8be7a8c2b4d6" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + horizontal_data_table: + dependency: transitive + description: + name: horizontal_data_table + sha256: c8ab5256bbced698a729f3e0ff2cb0e8e97416cdbb082860370eaf883badf722 + url: "https://pub.dev" + source: hosted + version: "4.3.1" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + isar: + dependency: transitive + description: + name: isar + sha256: "99165dadb2cf2329d3140198363a7e7bff9bbd441871898a87e26914d25cf1ea" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + isar_flutter_libs: + dependency: transitive + description: + name: isar_flutter_libs + sha256: bc6768cc4b9c61aabff77152e7f33b4b17d2fc93134f7af1c3dd51500fe8d5e8 + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + location: + dependency: transitive + description: + name: location + sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + location_web: + dependency: transitive + description: + name: location_web + sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b + url: "https://pub.dev" + source: hosted + version: "4.2.0" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + lottie: + dependency: transitive + description: + name: lottie + sha256: a93542cc2d60a7057255405f62252533f8e8956e7e06754955669fd32fb4b216 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" + source: hosted + version: "1.10.0" + mime: + dependency: transitive + description: + name: mime + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + mocktail: + dependency: transitive + description: + name: mocktail + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + overlay_builder: + dependency: transitive + description: + name: overlay_builder + sha256: "58b97bc5f67a2e2bb7006dd88e697ac757dfffc9dbd1e7dfc1917fb510a4b5c8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79" + url: "https://pub.dev" + source: hosted + version: "5.0.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + url: "https://pub.dev" + source: hosted + version: "2.1.4" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d + url: "https://pub.dev" + source: hosted + version: "2.2.4" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + url: "https://pub.dev" + source: hosted + version: "0.9.3+7" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + provider: + dependency: transitive + description: + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" + source: hosted + version: "6.1.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + reactive_flutter_typeahead: + dependency: transitive + description: + name: reactive_flutter_typeahead + sha256: ef91627df8cef70e603e8a6458749d8a99a385b78854332602fd08ad905cdab8 + url: "https://pub.dev" + source: hosted + version: "0.8.1" + reactive_forms: + dependency: transitive + description: + name: reactive_forms + sha256: "5aa9c48a0626c20d00a005e597cb10efbdebbfeecb9c4227b03a5945fbb91ec4" + url: "https://pub.dev" + source: hosted + version: "14.3.0" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + remove_emoji_input_formatter: + dependency: transitive + description: + name: remove_emoji_input_formatter + sha256: "82d195984f890de7a8fea936c698848e78c1a67ccefe18db3baf9f7a3bc0177f" + url: "https://pub.dev" + source: hosted + version: "0.0.1+1" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqlite3_flutter_libs: + dependency: transitive + description: + name: sqlite3_flutter_libs + sha256: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" + url: "https://pub.dev" + source: hosted + version: "0.5.24" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + type_plus: + dependency: transitive + description: + name: type_plus + sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.2.0 <3.9.0" + flutter: ">=3.16.0" diff --git a/packages/complaints/example/pubspec.yaml b/packages/complaints/example/pubspec.yaml new file mode 100644 index 000000000..cfe25864a --- /dev/null +++ b/packages/complaints/example/pubspec.yaml @@ -0,0 +1,100 @@ +name: example +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=3.0.0 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + digit_components: ^1.0.0+2 + digit_data_model: 1.0.4-dev.1 + flutter_bloc: + complaints: + path : ../ + + + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + assets: + - lib/localization_strings.json + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/apps/health_campaign_field_worker_app/lib/blocs/complaints_inbox/complaints_inbox.dart b/packages/complaints/lib/blocs/complaints_inbox/complaints_inbox.dart similarity index 83% rename from apps/health_campaign_field_worker_app/lib/blocs/complaints_inbox/complaints_inbox.dart rename to packages/complaints/lib/blocs/complaints_inbox/complaints_inbox.dart index 9bfb05c5f..689327ddf 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/complaints_inbox/complaints_inbox.dart +++ b/packages/complaints/lib/blocs/complaints_inbox/complaints_inbox.dart @@ -1,26 +1,30 @@ // GENERATED using mason_cli import 'dart:async'; +import 'package:digit_data_model/models/entities/pgr_application_status.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:digit_data_model/data_model.dart'; -import '../../models/complaints/complaints.dart'; -import '../../utils/environment_config.dart'; -import '../../utils/typedefs.dart'; +import '../../data/repositories/local/pgr_service.dart'; +import '../../data/repositories/remote/pgr_service.dart'; +import '../../models/pgr_complaints.dart'; +import '/models/complaints.dart'; +import '/utils/typedefs.dart'; +import '/utils/utils.dart'; part 'complaints_inbox.freezed.dart'; typedef ComplaintsInboxEmitter = Emitter; +/// Complaint inbox Bloc for Loading Complaints, Filtering Complaints, Sorting Complaints and Searching Complaints class ComplaintsInboxBloc extends Bloc { final PgrServiceDataRepository pgrRepository; ComplaintsInboxBloc( - super.initialState, { - required this.pgrRepository, - }) { + super.initialState, { + required this.pgrRepository, + }) { on(_handleLoadComplaints); on(_handleFilterComplaints); on(_handleSortComplaints); @@ -28,9 +32,9 @@ class ComplaintsInboxBloc } FutureOr _handleLoadComplaints( - ComplaintInboxLoadComplaintsEvent event, - ComplaintsInboxEmitter emit, - ) async { + ComplaintInboxLoadComplaintsEvent event, + ComplaintsInboxEmitter emit, + ) async { if (event.updatedModels != null) { emit(state.copyWith( complaints: event.updatedModels!, @@ -45,14 +49,14 @@ class ComplaintsInboxBloc if (pgrRepository is PgrServiceLocalRepository) { complaints = await (pgrRepository as PgrServiceLocalRepository).search( PgrServiceSearchModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId ), event.createdByUserId, ); } else if (pgrRepository is PgrServiceRemoteRepository) { complaints = await pgrRepository.search( PgrServiceSearchModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId ), ); } @@ -65,9 +69,9 @@ class ComplaintsInboxBloc } FutureOr _handleFilterComplaints( - ComplaintInboxFilterComplaintsEvent event, - ComplaintsInboxEmitter emit, - ) async { + ComplaintInboxFilterComplaintsEvent event, + ComplaintsInboxEmitter emit, + ) async { emit(state.copyWith(loading: true)); List complaints = []; @@ -75,7 +79,7 @@ class ComplaintsInboxBloc if (pgrRepository is PgrServiceLocalRepository) { complaints = await (pgrRepository as PgrServiceLocalRepository).search( PgrServiceSearchModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId, complaintAssignedTo: event.complaintAssignedTo, currentUserName: event.currentUserName, complaintStatus: event.complaintStatus, @@ -87,7 +91,7 @@ class ComplaintsInboxBloc } else if (pgrRepository is PgrServiceRemoteRepository) { complaints = await pgrRepository.search( PgrServiceSearchModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId, complaintAssignedTo: event.complaintAssignedTo, currentUserName: event.currentUserName, complaintStatus: event.complaintStatus, @@ -114,16 +118,16 @@ class ComplaintsInboxBloc } FutureOr _handleSortComplaints( - ComplaintInboxSortComplaintsEvent event, - ComplaintsInboxEmitter emit, - ) async { + ComplaintInboxSortComplaintsEvent event, + ComplaintsInboxEmitter emit, + ) async { var listToSort = (state.filteredComplaints.isNotEmpty) ? [...state.filteredComplaints] : [...state.complaints]; if (event.sortOrder == "COMPLAINT_SORT_DATE_ASC") { listToSort.sort( - (a, b) { + (a, b) { final d1 = a.auditDetails?.createdTime ?? 0; final d2 = b.auditDetails?.createdTime ?? 0; @@ -132,7 +136,7 @@ class ComplaintsInboxBloc ); } else { listToSort.sort( - (a, b) { + (a, b) { final d1 = b.auditDetails?.createdTime ?? 0; final d2 = a.auditDetails?.createdTime ?? 0; @@ -149,9 +153,9 @@ class ComplaintsInboxBloc } FutureOr _handleSearchComplaints( - ComplaintInboxSearchComplaintsEvent event, - ComplaintsInboxEmitter emit, - ) async { + ComplaintInboxSearchComplaintsEvent event, + ComplaintsInboxEmitter emit, + ) async { emit(state.copyWith(loading: true)); emit(state.copyWith( @@ -177,7 +181,7 @@ class ComplaintsInboxBloc if (pgrRepository is PgrServiceLocalRepository) { complaints = await (pgrRepository as PgrServiceLocalRepository).search( PgrServiceSearchModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId, complaintNumber: event.complaintNumber, complainantMobileNumber: event.mobileNumber, ), @@ -186,7 +190,7 @@ class ComplaintsInboxBloc } else if (pgrRepository is PgrServiceRemoteRepository) { complaints = await pgrRepository.search( PgrServiceSearchModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId, complaintNumber: event.complaintNumber, complainantMobileNumber: event.mobileNumber, ), diff --git a/apps/health_campaign_field_worker_app/lib/blocs/complaints_inbox/complaints_inbox.freezed.dart b/packages/complaints/lib/blocs/complaints_inbox/complaints_inbox.freezed.dart similarity index 100% rename from apps/health_campaign_field_worker_app/lib/blocs/complaints_inbox/complaints_inbox.freezed.dart rename to packages/complaints/lib/blocs/complaints_inbox/complaints_inbox.freezed.dart diff --git a/apps/health_campaign_field_worker_app/lib/blocs/complaints_registration/complaints_registration.dart b/packages/complaints/lib/blocs/complaints_registration/complaints_registration.dart similarity index 91% rename from apps/health_campaign_field_worker_app/lib/blocs/complaints_registration/complaints_registration.dart rename to packages/complaints/lib/blocs/complaints_registration/complaints_registration.dart index 2f08d9f79..145d775b7 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/complaints_registration/complaints_registration.dart +++ b/packages/complaints/lib/blocs/complaints_registration/complaints_registration.dart @@ -2,18 +2,22 @@ import 'dart:async'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/pgr_application_status.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import '../../models/complaints/complaints.dart'; -import '../../models/entities/additional_fields_type.dart'; -import '../../utils/environment_config.dart'; -import '../../utils/typedefs.dart'; +import '../../models/pgr_address.dart'; +import '../../models/pgr_complaints.dart'; +import '/models/complaints.dart'; +import '/models/entities/additional_fields_type.dart'; +import '/utils/typedefs.dart'; +import '/utils/utils.dart'; part 'complaints_registration.freezed.dart'; typedef ComplaintsRegistrationEmitter = Emitter; +/// Complaints Registration Bloc for managing Complaint state (i.e. complaint type, complaint location and complaint details) class ComplaintsRegistrationBloc extends Bloc { final PgrServiceDataRepository pgrServiceRepository; @@ -28,10 +32,12 @@ class ComplaintsRegistrationBloc on(_handleSubmitComplaints); } + FutureOr _handleSaveComplaintType( ComplaintsRegistrationSaveComplaintTypeEvent event, ComplaintsRegistrationEmitter emit, ) async { + state.maybeMap( orElse: () => throw (const InvalidComplaintsRegistrationStateException()), create: (value) { @@ -83,9 +89,12 @@ class ComplaintsRegistrationBloc ComplaintsRegistrationSubmitComplaintEvent event, ComplaintsRegistrationEmitter emit, ) async { + + await state.maybeMap( orElse: () => throw (const InvalidComplaintsRegistrationStateException()), create: (value) async { + emit(value.copyWith(loading: true)); final serviceCode = value.complaintType; @@ -93,13 +102,14 @@ class ComplaintsRegistrationBloc value.otherComplaintTypeDescription; final complaintDetailsModel = value.complaintsDetailsModel; final address = value.addressModel; - if (serviceCode == null) { throw (const InvalidComplaintsRegistrationStateException( 'Complaint type is not provided', )); } + + if (complaintDetailsModel == null) { throw (const InvalidComplaintsRegistrationStateException( 'Complaint details are not provided', @@ -125,13 +135,15 @@ class ComplaintsRegistrationBloc final pgrServiceModel = PgrServiceModel( clientReferenceId: referenceId, - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId, serviceCode: serviceCode, description: description, + source: AdditionalFieldsType.mobile.toValue(), + /// created Enum for application status in Digit Data model entities and using it here applicationStatus: PgrServiceApplicationStatus.created, user: PgrComplainantModel( - tenantId: envConfig.variables.tenantId, + tenantId: ComplaintsSingleton().tenantId, clientReferenceId: IdGen.i.identifier, complaintClientReferenceId: referenceId, name: complaintDetailsModel.complainantName, diff --git a/apps/health_campaign_field_worker_app/lib/blocs/complaints_registration/complaints_registration.freezed.dart b/packages/complaints/lib/blocs/complaints_registration/complaints_registration.freezed.dart similarity index 100% rename from apps/health_campaign_field_worker_app/lib/blocs/complaints_registration/complaints_registration.freezed.dart rename to packages/complaints/lib/blocs/complaints_registration/complaints_registration.freezed.dart diff --git a/packages/complaints/lib/blocs/localization/app_localization.dart b/packages/complaints/lib/blocs/localization/app_localization.dart new file mode 100644 index 000000000..7d1980c19 --- /dev/null +++ b/packages/complaints/lib/blocs/localization/app_localization.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; + +import '/blocs/localization/complaints_localization_delegate.dart'; + +// Class responsible for handling complaints localization +class ComplaintsLocalization { + final Locale locale; + final Future localizedStrings; + final List languages; + + ComplaintsLocalization(this.locale, this.localizedStrings, this.languages); + + // Method to get the current localization instance from context + static ComplaintsLocalization of(BuildContext context) { + return Localizations.of( + context, ComplaintsLocalization)!; + } + + static final List _localizedStrings = []; + + // Method to get the delegate for localization + static LocalizationsDelegate getDelegate( + Future localizedStrings, List languages) => + ComplaintsLocalizationDelegate(localizedStrings, languages); + + // Method to load localized strings + Future load() async { + _localizedStrings.clear(); + // Iterate over localized strings and filter based on locale + for (var element in await localizedStrings) { + if (element.locale == '${locale.languageCode}_${locale.countryCode}') { + _localizedStrings.add(element); + } + } + + return true; + } + + // Method to translate a given localized value + String translate(String localizedValues) { + if (_localizedStrings.isEmpty) { + return localizedValues; + } else { + final index = _localizedStrings.indexWhere( + (medium) => medium.code == localizedValues, + ); + + return index != -1 ? _localizedStrings[index].message : localizedValues; + } + } +} \ No newline at end of file diff --git a/packages/complaints/lib/blocs/localization/complaints_localization_delegate.dart b/packages/complaints/lib/blocs/localization/complaints_localization_delegate.dart new file mode 100644 index 000000000..cc94a2ad5 --- /dev/null +++ b/packages/complaints/lib/blocs/localization/complaints_localization_delegate.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +import 'app_localization.dart'; + +class ComplaintsLocalizationDelegate + extends LocalizationsDelegate { + final Future localizedStrings; + final List languages; + + const ComplaintsLocalizationDelegate(this.localizedStrings, this.languages); + + @override + bool isSupported(Locale locale) { + return languages.map((e) { + final results = e.value.split('_'); + if (results.isNotEmpty) return results.first; + }).contains(locale.languageCode); + } + + @override + Future load(Locale locale) async { + ComplaintsLocalization localization = + ComplaintsLocalization(locale, localizedStrings, languages); + await localization.load(); + + return localization; + } + + @override + bool shouldReload( + covariant LocalizationsDelegate old) { + return true; + } +} diff --git a/packages/complaints/lib/complaints.dart b/packages/complaints/lib/complaints.dart new file mode 100644 index 000000000..6b79e911e --- /dev/null +++ b/packages/complaints/lib/complaints.dart @@ -0,0 +1,29 @@ +@MappableLib( + generateInitializerForScope: InitializerScope.package, +) + +library complaints; + + +import 'package:dart_mappable/dart_mappable.dart'; +export 'pages/inbox/complaints_inbox_wrapper.dart'; +export 'pages/inbox/complaints_details_view.dart'; +export 'pages/inbox/complaints_inbox.dart'; +export 'pages/inbox/complaints_inbox_filter.dart'; +export 'pages/inbox/complaints_inbox_search.dart'; +export 'pages/inbox/complaints_inbox_sort.dart'; +export 'pages/registration/complaint_type.dart'; +export 'pages/registration/complaints_details.dart'; +export 'pages/registration/complaints_location.dart'; +export 'pages/registration/complaints_registration_wrapper.dart'; +export 'pages/complaints_acknowledgement.dart'; +export 'utils/utils.dart'; +export 'models/complaints.dart'; +export 'models/pgr_complaints.dart'; +export 'models/pgr_address.dart'; +export 'models/pgr_complaints_response.dart'; +export 'data/repositories/local/pgr_service.dart'; +export 'data/repositories/remote/pgr_service.dart'; +export 'data/repositories/oplog/oplog.dart'; +export 'blocs/complaints_inbox/complaints_inbox.dart'; +export 'blocs/complaints_registration/complaints_registration.dart'; \ No newline at end of file diff --git a/packages/complaints/lib/complaints.init.dart b/packages/complaints/lib/complaints.init.dart new file mode 100644 index 000000000..58b0922f9 --- /dev/null +++ b/packages/complaints/lib/complaints.init.dart @@ -0,0 +1,28 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element + +import 'models/entities/additional_fields_type.dart' as p0; +import 'models/pgr_address.dart' as p1; +import 'models/pgr_complaints.dart' as p2; +import 'models/pgr_complaints_response.dart' as p3; + +void initializeMappers() { + p0.AdditionalFieldsTypeMapper.ensureInitialized(); + p1.PgrAddressModelMapper.ensureInitialized(); + p1.GeoLocationMapper.ensureInitialized(); + p2.PgrComplaintModelMapper.ensureInitialized(); + p2.PgrComplainantModelMapper.ensureInitialized(); + p2.PgrRolesModelMapper.ensureInitialized(); + p2.PgrServiceSearchModelMapper.ensureInitialized(); + p2.PgrServiceModelMapper.ensureInitialized(); + p2.PgrWorkflowModelMapper.ensureInitialized(); + p2.PgrFiltersMapper.ensureInitialized(); + p2.PgrSearchKeysMapper.ensureInitialized(); + p2.PgrAdditionalDetailsMapper.ensureInitialized(); + p3.PgrServiceCreateResponseModelMapper.ensureInitialized(); + p3.PgrComplaintResponseModelMapper.ensureInitialized(); + p3.PgrComplainantResponseModelMapper.ensureInitialized(); + p3.PgrServiceResponseModelMapper.ensureInitialized(); +} diff --git a/packages/digit_data_model/lib/data/repositories/local/pgr_service.dart b/packages/complaints/lib/data/repositories/local/pgr_service.dart similarity index 98% rename from packages/digit_data_model/lib/data/repositories/local/pgr_service.dart rename to packages/complaints/lib/data/repositories/local/pgr_service.dart index ecdae8103..5b2283941 100644 --- a/packages/digit_data_model/lib/data/repositories/local/pgr_service.dart +++ b/packages/complaints/lib/data/repositories/local/pgr_service.dart @@ -3,6 +3,10 @@ import 'dart:async'; import 'package:digit_data_model/data_model.dart'; import 'package:drift/drift.dart'; +import '../../../models/pgr_address.dart'; +import '../../../models/pgr_complaints.dart'; + +// This will create , update and search data from local Repository class PgrServiceLocalRepository extends LocalRepository { PgrServiceLocalRepository(super.sql, super.opLogManager); @@ -189,7 +193,6 @@ class PgrServiceLocalRepository code: address.localityBoundaryCode ?? "", ), - /// boundary: address.boundary, geoLocation: GeoLocation( latitude: address.latitude, longitude: address.longitude, diff --git a/packages/complaints/lib/data/repositories/oplog/oplog.dart b/packages/complaints/lib/data/repositories/oplog/oplog.dart new file mode 100644 index 000000000..7e79e9ba6 --- /dev/null +++ b/packages/complaints/lib/data/repositories/oplog/oplog.dart @@ -0,0 +1,96 @@ +import 'dart:async'; + +import 'package:digit_data_model/data_model.dart'; +import 'package:isar/isar.dart'; + + +import '../../../models/pgr_complaints.dart'; + +class PgrServiceOpLogManager extends OpLogManager { + PgrServiceOpLogManager(super.isar); + + @override + PgrServiceModel applyServerGeneratedIdToEntity( + PgrServiceModel entity, + String serverGeneratedId, + int rowVersion, + ) => + entity.copyWith( + serviceRequestId: serverGeneratedId, + rowVersion: rowVersion, + ); + + @override + String getClientReferenceId(PgrServiceModel entity) { + return entity.clientReferenceId; + } + + @override + String? getServerGeneratedId(PgrServiceModel entity) { + return entity.serviceRequestId; + } + + @override + int? getRowVersion(PgrServiceModel entity) => entity.rowVersion; + + @override + bool? getNonRecoverableError(PgrServiceModel entity) => + entity.nonRecoverableError; + + @override + Future>> getPendingUpSync( + DataModelType type, { + required String createdBy, + }) async { + final pendingEntries = await isar.opLogs + .filter() + .entityTypeEqualTo(type) + .operationEqualTo(DataOperation.create) + .serverGeneratedIdIsNull() + .syncedUpEqualTo(false) + .syncedDownEqualTo(false) + .createdByEqualTo(createdBy) + .sortByCreatedAt() + .findAll(); + + final entriesList = pendingEntries.map((e) { + return OpLogEntry.fromOpLog(e); + }).toList(); + + return entriesList; + } + + //Note: PendingDownSync is not required for PGR Create Oplogs. This creates Mapper Exception issue for checking pending downsync entries of complaints type + // @override + // Future>> getPendingDownSync( + // DataModelType type, { + // required String createdBy, + // }) async { + // final pendingEntries = await isar.opLogs + // .filter() + // .entityTypeEqualTo(type) + // .serverGeneratedIdIsNotNull() + // .syncedUpEqualTo(true) + // .syncedDownEqualTo(false) + // .createdByEqualTo(createdBy) + // .sortByCreatedAt() + // .findAll(); + // + // final entriesList = pendingEntries + // .map((e) { + // final entity = e.getEntity(); + // if ([ + // PgrServiceApplicationStatus.created, + // PgrServiceApplicationStatus.pendingAssignment, + // ].contains(entity.applicationStatus)) { + // return OpLogEntry.fromOpLog(e); + // } + // + // return null; + // }) + // .whereNotNull() + // .toList(); + // + // return entriesList; + // } +} diff --git a/packages/digit_data_model/lib/data/repositories/remote/pgr_service.dart b/packages/complaints/lib/data/repositories/remote/pgr_service.dart similarity index 94% rename from packages/digit_data_model/lib/data/repositories/remote/pgr_service.dart rename to packages/complaints/lib/data/repositories/remote/pgr_service.dart index 0e11a5a89..6db675651 100644 --- a/packages/digit_data_model/lib/data/repositories/remote/pgr_service.dart +++ b/packages/complaints/lib/data/repositories/remote/pgr_service.dart @@ -3,6 +3,10 @@ import 'dart:async'; import 'package:digit_data_model/data_model.dart'; import 'package:dio/dio.dart'; +import '../../../models/pgr_complaints.dart'; +import '../../../models/pgr_complaints_response.dart'; + +// This will create , update and search data from remote Repository class PgrServiceRemoteRepository extends RemoteRepository { PgrServiceRemoteRepository( diff --git a/apps/health_campaign_field_worker_app/lib/models/complaints/complaints.dart b/packages/complaints/lib/models/complaints.dart similarity index 100% rename from apps/health_campaign_field_worker_app/lib/models/complaints/complaints.dart rename to packages/complaints/lib/models/complaints.dart diff --git a/apps/health_campaign_field_worker_app/lib/models/complaints/complaints.freezed.dart b/packages/complaints/lib/models/complaints.freezed.dart similarity index 100% rename from apps/health_campaign_field_worker_app/lib/models/complaints/complaints.freezed.dart rename to packages/complaints/lib/models/complaints.freezed.dart diff --git a/apps/health_campaign_field_worker_app/lib/models/complaints/complaints.g.dart b/packages/complaints/lib/models/complaints.g.dart similarity index 100% rename from apps/health_campaign_field_worker_app/lib/models/complaints/complaints.g.dart rename to packages/complaints/lib/models/complaints.g.dart diff --git a/packages/complaints/lib/models/entities/additional_fields_type.dart b/packages/complaints/lib/models/entities/additional_fields_type.dart new file mode 100644 index 000000000..32370f908 --- /dev/null +++ b/packages/complaints/lib/models/entities/additional_fields_type.dart @@ -0,0 +1,10 @@ +// Generated using mason. Do not modify by hand +import 'package:dart_mappable/dart_mappable.dart'; + +part 'additional_fields_type.mapper.dart'; +@MappableEnum(caseStyle: CaseStyle.upperCase) +enum AdditionalFieldsType { + @MappableValue("mobile") mobile, + @MappableValue("EMPLOYEE") employee, + ; +} \ No newline at end of file diff --git a/packages/complaints/lib/models/entities/additional_fields_type.mapper.dart b/packages/complaints/lib/models/entities/additional_fields_type.mapper.dart new file mode 100644 index 000000000..cf6a34c4d --- /dev/null +++ b/packages/complaints/lib/models/entities/additional_fields_type.mapper.dart @@ -0,0 +1,53 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unnecessary_cast +// ignore_for_file: strict_raw_type, inference_failure_on_untyped_parameter + +part of 'additional_fields_type.dart'; + +class AdditionalFieldsTypeMapper extends EnumMapper { + AdditionalFieldsTypeMapper._(); + + static AdditionalFieldsTypeMapper? _instance; + static AdditionalFieldsTypeMapper ensureInitialized() { + if (_instance == null) { + MapperContainer.globals.use(_instance = AdditionalFieldsTypeMapper._()); + } + return _instance!; + } + + static AdditionalFieldsType fromValue(dynamic value) { + ensureInitialized(); + return MapperContainer.globals.fromValue(value); + } + + @override + AdditionalFieldsType decode(dynamic value) { + switch (value) { + case "mobile": + return AdditionalFieldsType.mobile; + case "EMPLOYEE": + return AdditionalFieldsType.employee; + default: + throw MapperException.unknownEnumValue(value); + } + } + + @override + dynamic encode(AdditionalFieldsType self) { + switch (self) { + case AdditionalFieldsType.mobile: + return "mobile"; + case AdditionalFieldsType.employee: + return "EMPLOYEE"; + } + } +} + +extension AdditionalFieldsTypeMapperExtension on AdditionalFieldsType { + dynamic toValue() { + AdditionalFieldsTypeMapper.ensureInitialized(); + return MapperContainer.globals.toValue(this); + } +} diff --git a/packages/complaints/lib/models/entities/complaint_types.dart b/packages/complaints/lib/models/entities/complaint_types.dart new file mode 100644 index 000000000..21b8fb33a --- /dev/null +++ b/packages/complaints/lib/models/entities/complaint_types.dart @@ -0,0 +1,5 @@ + +class ComplaintTypes { + late String name; + late String code; +} diff --git a/packages/digit_data_model/lib/models/pgr_complaints/pgr_address.dart b/packages/complaints/lib/models/pgr_address.dart similarity index 99% rename from packages/digit_data_model/lib/models/pgr_complaints/pgr_address.dart rename to packages/complaints/lib/models/pgr_address.dart index 8ad0b89e3..195b74e08 100644 --- a/packages/digit_data_model/lib/models/pgr_complaints/pgr_address.dart +++ b/packages/complaints/lib/models/pgr_address.dart @@ -49,10 +49,8 @@ class PgrAddressModel extends EntityModel with PgrAddressModelMappable { this.isDeleted, this.rowVersion, super.auditDetails, - }) : super(isDeleted: false); - AddressCompanion get companion { return AddressCompanion( auditCreatedBy: Value(auditDetails?.createdBy), diff --git a/packages/digit_data_model/lib/models/pgr_complaints/pgr_address.mapper.dart b/packages/complaints/lib/models/pgr_address.mapper.dart similarity index 100% rename from packages/digit_data_model/lib/models/pgr_complaints/pgr_address.mapper.dart rename to packages/complaints/lib/models/pgr_address.mapper.dart diff --git a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints.dart b/packages/complaints/lib/models/pgr_complaints.dart similarity index 96% rename from packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints.dart rename to packages/complaints/lib/models/pgr_complaints.dart index a28dbf64f..d061228ab 100644 --- a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints.dart +++ b/packages/complaints/lib/models/pgr_complaints.dart @@ -1,7 +1,9 @@ import 'dart:convert'; +import 'package:complaints/models/pgr_address.dart'; import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/pgr_application_status.dart'; import 'package:drift/drift.dart'; part 'pgr_complaints.mapper.dart'; @@ -204,20 +206,6 @@ class PgrWorkflowModel extends EntityModel with PgrWorkflowModelMappable { }) : super(); } -@MappableEnum() -enum PgrServiceApplicationStatus { - @MappableValue('CREATED') - created, - @MappableValue('PENDING_ASSIGNMENT') - pendingAssignment, - @MappableValue('RESOLVED') - resolved, - @MappableValue('REJECTED') - rejected, - @MappableValue('CANCELLED') - cancelled, -} - @MappableClass(ignoreNull: true) class PgrFilters with PgrFiltersMappable { String? complaintAssignedTo; diff --git a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints.mapper.dart b/packages/complaints/lib/models/pgr_complaints.mapper.dart similarity index 97% rename from packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints.mapper.dart rename to packages/complaints/lib/models/pgr_complaints.mapper.dart index 87d606df4..be32e8224 100644 --- a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints.mapper.dart +++ b/packages/complaints/lib/models/pgr_complaints.mapper.dart @@ -6,67 +6,6 @@ part of 'pgr_complaints.dart'; -class PgrServiceApplicationStatusMapper - extends EnumMapper { - PgrServiceApplicationStatusMapper._(); - - static PgrServiceApplicationStatusMapper? _instance; - static PgrServiceApplicationStatusMapper ensureInitialized() { - if (_instance == null) { - MapperContainer.globals - .use(_instance = PgrServiceApplicationStatusMapper._()); - } - return _instance!; - } - - static PgrServiceApplicationStatus fromValue(dynamic value) { - ensureInitialized(); - return MapperContainer.globals.fromValue(value); - } - - @override - PgrServiceApplicationStatus decode(dynamic value) { - switch (value) { - case 'CREATED': - return PgrServiceApplicationStatus.created; - case 'PENDING_ASSIGNMENT': - return PgrServiceApplicationStatus.pendingAssignment; - case 'RESOLVED': - return PgrServiceApplicationStatus.resolved; - case 'REJECTED': - return PgrServiceApplicationStatus.rejected; - case 'CANCELLED': - return PgrServiceApplicationStatus.cancelled; - default: - throw MapperException.unknownEnumValue(value); - } - } - - @override - dynamic encode(PgrServiceApplicationStatus self) { - switch (self) { - case PgrServiceApplicationStatus.created: - return 'CREATED'; - case PgrServiceApplicationStatus.pendingAssignment: - return 'PENDING_ASSIGNMENT'; - case PgrServiceApplicationStatus.resolved: - return 'RESOLVED'; - case PgrServiceApplicationStatus.rejected: - return 'REJECTED'; - case PgrServiceApplicationStatus.cancelled: - return 'CANCELLED'; - } - } -} - -extension PgrServiceApplicationStatusMapperExtension - on PgrServiceApplicationStatus { - dynamic toValue() { - PgrServiceApplicationStatusMapper.ensureInitialized(); - return MapperContainer.globals.toValue(this); - } -} - class PgrComplaintModelMapper extends ClassMapperBase { PgrComplaintModelMapper._(); diff --git a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints_response.dart b/packages/complaints/lib/models/pgr_complaints_response.dart similarity index 94% rename from packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints_response.dart rename to packages/complaints/lib/models/pgr_complaints_response.dart index dd869dad6..fde4e7c88 100644 --- a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints_response.dart +++ b/packages/complaints/lib/models/pgr_complaints_response.dart @@ -1,6 +1,8 @@ +import 'package:complaints/models/pgr_complaints.dart'; import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/pgr_application_status.dart'; part 'pgr_complaints_response.mapper.dart'; diff --git a/packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints_response.mapper.dart b/packages/complaints/lib/models/pgr_complaints_response.mapper.dart similarity index 100% rename from packages/digit_data_model/lib/models/pgr_complaints/pgr_complaints_response.mapper.dart rename to packages/complaints/lib/models/pgr_complaints_response.mapper.dart diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints_acknowledgement.dart b/packages/complaints/lib/pages/complaints_acknowledgement.dart similarity index 89% rename from apps/health_campaign_field_worker_app/lib/pages/complaints_acknowledgement.dart rename to packages/complaints/lib/pages/complaints_acknowledgement.dart index a51d6eb69..968a452e6 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints_acknowledgement.dart +++ b/packages/complaints/lib/pages/complaints_acknowledgement.dart @@ -1,7 +1,10 @@ + +import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; -import '../router/app_router.dart'; + + import '../utils/i18_key_constants.dart' as i18; import '../widgets/localized.dart'; @@ -14,10 +17,10 @@ class ComplaintsAcknowledgementPage extends LocalizedStatefulWidget { @override State createState() => - _ComplaintsAcknowledgementPageState(); + ComplaintsAcknowledgementPageState(); } -class _ComplaintsAcknowledgementPageState +class ComplaintsAcknowledgementPageState extends LocalizedState { @override Widget build(BuildContext context) { diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_details_view.dart b/packages/complaints/lib/pages/inbox/complaints_details_view.dart similarity index 96% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_details_view.dart rename to packages/complaints/lib/pages/inbox/complaints_details_view.dart index b4c644922..368a8c8df 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_details_view.dart +++ b/packages/complaints/lib/pages/inbox/complaints_details_view.dart @@ -1,14 +1,15 @@ +import 'package:auto_route/annotations.dart'; +import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/widgets/atoms/digit_divider.dart'; import 'package:flutter/material.dart'; import 'package:recase/recase.dart'; -import 'package:digit_data_model/data_model.dart'; -import '../../../blocs/localization/app_localization.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../utils/utils.dart'; -import '../../../widgets/header/back_navigation_help_header.dart'; +import '../../models/pgr_complaints.dart'; +import '/blocs/localization/app_localization.dart'; +import '/utils/i18_key_constants.dart' as i18; +import '/utils/utils.dart'; +import '/widgets/header/back_navigation_help_header.dart'; @RoutePage() class ComplaintsDetailsViewPage extends StatelessWidget { @@ -23,7 +24,7 @@ class ComplaintsDetailsViewPage extends StatelessWidget { Widget build(BuildContext context) { final router = context.router; final theme = Theme.of(context); - final localizations = AppLocalizations.of(context); + final localizations = ComplaintsLocalization.of(context); return Scaffold( body: ScrollableContent( diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox.dart b/packages/complaints/lib/pages/inbox/complaints_inbox.dart similarity index 80% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox.dart rename to packages/complaints/lib/pages/inbox/complaints_inbox.dart index ce0b8f0b6..ed04baa35 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox.dart +++ b/packages/complaints/lib/pages/inbox/complaints_inbox.dart @@ -1,17 +1,19 @@ +import 'package:auto_route/annotations.dart'; +import 'package:auto_route/auto_route.dart'; +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:digit_data_model/data_model.dart'; import 'package:recase/recase.dart'; -import '../../../blocs/complaints_inbox/complaints_inbox.dart'; -import '../../../blocs/localization/app_localization.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../utils/utils.dart'; -import '../../../widgets/header/back_navigation_help_header.dart'; -import '../../../widgets/localized.dart'; -import '../../../widgets/no_result_card/no_result_card.dart'; +import '../../models/pgr_complaints.dart'; +import '/blocs/complaints_inbox/complaints_inbox.dart'; +import '/blocs/localization/app_localization.dart'; +import '/utils/i18_key_constants.dart' as i18; +import '/utils/utils.dart'; +import '/widgets/header/back_navigation_help_header.dart'; +import '/widgets/localized.dart'; +import '/widgets/no_result_card/no_result_card.dart'; @RoutePage() class ComplaintsInboxPage extends LocalizedStatefulWidget { @@ -21,10 +23,10 @@ class ComplaintsInboxPage extends LocalizedStatefulWidget { }); @override - State createState() => _ComplaintsInboxPageState(); + State createState() => ComplaintsInboxPageState(); } -class _ComplaintsInboxPageState extends LocalizedState { +class ComplaintsInboxPageState extends LocalizedState { @override Widget build(BuildContext context) { final theme = Theme.of(context); @@ -50,7 +52,7 @@ class _ComplaintsInboxPageState extends LocalizedState { SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.only( - left: kPadding*2, + left: kPadding * 2, bottom: kPadding, ), child: Text( @@ -69,7 +71,8 @@ class _ComplaintsInboxPageState extends LocalizedState { TextButton( style: TextButton.styleFrom( foregroundColor: theme.colorScheme.secondary, - padding: const EdgeInsets.only(left: kPadding*2), + padding: + const EdgeInsets.only(left: kPadding * 2), ), onPressed: () { router.push(ComplaintsInboxSearchRoute()); @@ -77,7 +80,9 @@ class _ComplaintsInboxPageState extends LocalizedState { child: Row( children: [ const Icon(Icons.search), - const SizedBox(width: 5,), + const SizedBox( + width: 5, + ), Text(localizations.translate( i18.complaints.searchCTA, )), @@ -95,7 +100,9 @@ class _ComplaintsInboxPageState extends LocalizedState { child: Row( children: [ const Icon(Icons.filter_list_alt), - const SizedBox(width: 5,), + const SizedBox( + width: 5, + ), Text(localizations.translate( i18.complaints.filterCTA, )), @@ -105,7 +112,8 @@ class _ComplaintsInboxPageState extends LocalizedState { TextButton( style: TextButton.styleFrom( foregroundColor: theme.colorScheme.secondary, - padding: const EdgeInsets.only(right: kPadding*2), + padding: + const EdgeInsets.only(right: kPadding * 2), ), onPressed: () { router.push(ComplaintsInboxSortRoute()); @@ -113,7 +121,9 @@ class _ComplaintsInboxPageState extends LocalizedState { child: Row( children: [ const Icon(Icons.segment), - const SizedBox(width: 5,), + const SizedBox( + width: 5, + ), Text(localizations.translate( i18.complaints.sortCTA, )), @@ -160,35 +170,36 @@ class _ComplaintsInboxPageState extends LocalizedState { margin: const EdgeInsets.fromLTRB(0, kPadding, 0, 0), padding: const EdgeInsets.fromLTRB(kPadding, 0, kPadding, 0), child: DigitElevatedButton( - onPressed: () async { - var loggedInUserUuid = context.loggedInUserUuid; - final bloc = context.read(); + onPressed: () async { + var loggedInUserUuid = + ComplaintsSingleton().loggedInUserUuid; + final bloc = context.read(); - await router.push( - ComplaintsRegistrationWrapperRoute(), - ); + await router.push( + ComplaintsRegistrationWrapperRoute(), + ); - try { - bloc.add( - ComplaintInboxLoadComplaintsEvent( - createdByUserId: loggedInUserUuid, - ), - ); - } catch (error) { - AppLogger.instance.error( - title: 'Error', - message: 'Error while loading complaints', - ); - } - }, - child: Center( - child: Text( - localizations.translate( - i18.complaints.fileComplaintAction, + try { + bloc.add( + ComplaintInboxLoadComplaintsEvent( + createdByUserId: loggedInUserUuid, ), + ); + } catch (error) { + AppLogger.instance.error( + title: 'Error', + message: 'Error while loading complaints', + ); + } + }, + child: Center( + child: Text( + localizations.translate( + i18.complaints.fileComplaintAction, ), ), ), + ), ), ), ], @@ -200,7 +211,7 @@ class _ComplaintsInboxPageState extends LocalizedState { } class _ComplaintsInboxItem extends StatelessWidget { - final AppLocalizations localizations; + final ComplaintsLocalization localizations; final PgrServiceModel item; const _ComplaintsInboxItem({ @@ -334,7 +345,7 @@ class _ComplaintsInboxItem extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.only(top: kPadding*2), + padding: const EdgeInsets.only(top: kPadding * 2), child: Row( children: [ Expanded( @@ -356,7 +367,11 @@ class _ComplaintsInboxItem extends StatelessWidget { ), child: Text( localizations.translate(i18.searchBeneficiary.iconLabel), - style: DigitTheme.instance.mobileTheme.textTheme.headlineSmall?.apply(color: theme.colorScheme.secondary,), + style: DigitTheme + .instance.mobileTheme.textTheme.headlineSmall + ?.apply( + color: theme.colorScheme.secondary, + ), ), ), ), diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_filter.dart b/packages/complaints/lib/pages/inbox/complaints_inbox_filter.dart similarity index 93% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_filter.dart rename to packages/complaints/lib/pages/inbox/complaints_inbox_filter.dart index 5f27d8a07..64afb6256 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_filter.dart +++ b/packages/complaints/lib/pages/inbox/complaints_inbox_filter.dart @@ -1,20 +1,22 @@ import 'dart:collection'; + +import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/widgets/atoms/digit_checkbox.dart'; -import 'package:digit_data_model/data_model.dart'; + +import 'package:digit_data_model/models/entities/pgr_application_status.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:group_radio_button/group_radio_button.dart'; import 'package:reactive_forms/reactive_forms.dart'; import 'package:recase/recase.dart'; -import '../../../blocs/auth/auth.dart'; -import '../../../blocs/complaints_inbox/complaints_inbox.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../utils/utils.dart'; -import '../../../widgets/localized.dart'; +import '/blocs/complaints_inbox/complaints_inbox.dart'; + +import '/utils/i18_key_constants.dart' as i18; +import '/utils/utils.dart'; +import '/widgets/localized.dart'; @RoutePage() class ComplaintsInboxFilterPage extends LocalizedStatefulWidget { @@ -25,10 +27,10 @@ class ComplaintsInboxFilterPage extends LocalizedStatefulWidget { @override State createState() => - _ComplaintsInboxFilterPageState(); + ComplaintsInboxFilterPageState(); } -class _ComplaintsInboxFilterPageState +class ComplaintsInboxFilterPageState extends LocalizedState { static const _complaintType = "complaintType"; static const _complaintLocality = "complaintLocality"; @@ -132,6 +134,7 @@ class _ComplaintsInboxFilterPageState ), ], ), + enableFixedButton: true, footer: SizedBox( child: DigitCard( margin: const EdgeInsets.fromLTRB(0, kPadding, 0, 0), @@ -168,7 +171,6 @@ class _ComplaintsInboxFilterPageState if (!formGroup.valid) return; final bloc = context.read(); - final userBloc = context.read(); final assignedTo = formGroup .control(_complaintAssignmentType) @@ -185,21 +187,13 @@ class _ComplaintsInboxFilterPageState bloc.add( ComplaintInboxFilterComplaintsEvent( complaintAssignedTo: assignedTo, - currentUserName: userBloc.state.whenOrNull( - authenticated: ( - accessToken, - refreshToken, - userModel, - actions, - individualId, - ) { - return userModel.name; - }, - ), + currentUserName: + ComplaintsSingleton().loggedInUserName, complaintTypeCode: complaintType, locality: locality, complaintStatus: statuses.toList(), - createdByUserId: context.loggedInUserUuid, + createdByUserId: + ComplaintsSingleton().loggedInUserUuid, ), ); diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_search.dart b/packages/complaints/lib/pages/inbox/complaints_inbox_search.dart similarity index 94% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_search.dart rename to packages/complaints/lib/pages/inbox/complaints_inbox_search.dart index bb6d3dcfe..c44542c29 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_search.dart +++ b/packages/complaints/lib/pages/inbox/complaints_inbox_search.dart @@ -1,13 +1,15 @@ + +import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:reactive_forms/reactive_forms.dart'; -import '../../../blocs/complaints_inbox/complaints_inbox.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../utils/utils.dart'; -import '../../../widgets/localized.dart'; +import '/blocs/complaints_inbox/complaints_inbox.dart'; + +import '/utils/i18_key_constants.dart' as i18; +import '/utils/utils.dart'; +import '/widgets/localized.dart'; import 'package:flutter/services.dart'; @RoutePage() @@ -19,10 +21,10 @@ class ComplaintsInboxSearchPage extends LocalizedStatefulWidget { @override State createState() => - _ComplaintsInboxSearchPageState(); + ComplaintsInboxSearchPageState(); } -class _ComplaintsInboxSearchPageState +class ComplaintsInboxSearchPageState extends LocalizedState { static const _complaintNumber = "complaintNumber"; static const _mobileNumber = "mobileNumber"; @@ -106,7 +108,7 @@ class _ComplaintsInboxSearchPageState complaintNumber: complaintNumberValue == "" ? null : complaintNumberValue, - createdByUserId: context.loggedInUserUuid, + createdByUserId: ComplaintsSingleton().loggedInUserUuid, ), ); diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_sort.dart b/packages/complaints/lib/pages/inbox/complaints_inbox_sort.dart similarity index 95% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_sort.dart rename to packages/complaints/lib/pages/inbox/complaints_inbox_sort.dart index 34f35713d..8a512e36e 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_sort.dart +++ b/packages/complaints/lib/pages/inbox/complaints_inbox_sort.dart @@ -1,13 +1,15 @@ + +import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:group_radio_button/group_radio_button.dart'; import 'package:reactive_forms/reactive_forms.dart'; -import '../../../blocs/complaints_inbox/complaints_inbox.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../widgets/localized.dart'; +import '/blocs/complaints_inbox/complaints_inbox.dart'; + +import '/utils/i18_key_constants.dart' as i18; +import '/widgets/localized.dart'; @RoutePage() class ComplaintsInboxSortPage extends LocalizedStatefulWidget { @@ -18,10 +20,10 @@ class ComplaintsInboxSortPage extends LocalizedStatefulWidget { @override State createState() => - _ComplaintsInboxSortPageState(); + ComplaintsInboxSortPageState(); } -class _ComplaintsInboxSortPageState +class ComplaintsInboxSortPageState extends LocalizedState { static const _sortOrder = "sortOrder"; static var sortOrders = [ diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_wrapper.dart b/packages/complaints/lib/pages/inbox/complaints_inbox_wrapper.dart similarity index 58% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_wrapper.dart rename to packages/complaints/lib/pages/inbox/complaints_inbox_wrapper.dart index fd110f711..27253c3a2 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/inbox/complaints_inbox_wrapper.dart +++ b/packages/complaints/lib/pages/inbox/complaints_inbox_wrapper.dart @@ -1,10 +1,10 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:digit_data_model/data_model.dart'; -import '../../../blocs/complaints_inbox/complaints_inbox.dart'; -import '../../../utils/utils.dart'; +import 'package:complaints/blocs/complaints_inbox/complaints_inbox.dart'; +import 'package:complaints/utils/utils.dart'; +import '/models/pgr_complaints.dart'; @RoutePage() class ComplaintsInboxWrapperPage extends StatelessWidget { @@ -17,14 +17,14 @@ class ComplaintsInboxWrapperPage extends StatelessWidget { return BlocProvider( create: (context) => ComplaintsInboxBloc( const ComplaintInboxState.complaints(), - pgrRepository: - context.repository(), + pgrRepository:context.repository(context), )..add( - ComplaintInboxLoadComplaintsEvent( - createdByUserId: context.loggedInUserUuid, - ), + ComplaintInboxLoadComplaintsEvent( + createdByUserId: ComplaintsSingleton().loggedInUserUuid, ), + ), child: const AutoRouter(), ); + } } diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaint_type.dart b/packages/complaints/lib/pages/registration/complaint_type.dart similarity index 67% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaint_type.dart rename to packages/complaints/lib/pages/registration/complaint_type.dart index d1f30f77c..f20cc19f1 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaint_type.dart +++ b/packages/complaints/lib/pages/registration/complaint_type.dart @@ -1,3 +1,7 @@ + +import 'package:auto_route/auto_route.dart'; +import 'package:complaints/complaints.dart'; +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -5,12 +9,12 @@ import 'package:group_radio_button/group_radio_button.dart'; import 'package:reactive_forms/reactive_forms.dart'; import 'package:recase/recase.dart'; -import '../../../blocs/app_initialization/app_initialization.dart'; -import '../../../blocs/complaints_registration/complaints_registration.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../widgets/header/back_navigation_help_header.dart'; -import '../../../widgets/localized.dart'; + + +import '/utils/i18_key_constants.dart' as i18; +import '/widgets/header/back_navigation_help_header.dart'; +import '/widgets/localized.dart'; + @RoutePage() class ComplaintTypePage extends LocalizedStatefulWidget { @@ -20,10 +24,10 @@ class ComplaintTypePage extends LocalizedStatefulWidget { }); @override - State createState() => _ComplaintTypePageState(); + State createState() => ComplaintTypePageState(); } -class _ComplaintTypePageState extends LocalizedState { +class ComplaintTypePageState extends LocalizedState { static const _complaintType = 'complaintType'; static const _otherComplaintType = 'otherComplaintType'; @@ -51,6 +55,7 @@ class _ComplaintTypePageState extends LocalizedState { header: const Column(children: [ BackNavigationHelpHeaderWidget(), ]), + enableFixedButton: true, footer: DigitCard( margin: const EdgeInsets.fromLTRB(0, kPadding, 0, 0), padding: const EdgeInsets.fromLTRB(kPadding, 0, kPadding, 0), @@ -80,12 +85,14 @@ class _ComplaintTypePageState extends LocalizedState { state.whenOrNull( create: ( - loading, - complaintType, - _, - addressModel, - complaintsDetailsModel, - ) { + + loading, + complaintType, + _, + addressModel, + complaintsDetailsModel, + ) { + bloc.add( ComplaintsRegistrationEvent.saveComplaintType( complaintType: form.control(_complaintType).value, @@ -104,8 +111,9 @@ class _ComplaintTypePageState extends LocalizedState { ), ), ), - children: [ - DigitCard( + slivers: [ + SliverToBoxAdapter( + child: DigitCard( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, @@ -123,50 +131,32 @@ class _ComplaintTypePageState extends LocalizedState { label: localizations.translate( i18.complaints.complaintsTypeLabel, ), - child: BlocBuilder( - builder: (context, state) { - return state.maybeWhen( - orElse: () => const Offstage(), - initialized: ( - appConfiguration, - serviceRegistryList, - _, - ) { - var complaintTypes = appConfiguration - .complaintTypes - ?.map((e) => e.code) - .toList(); - - final isDisabled = - form.control(_complaintType).disabled; - - return RadioGroup.builder( - groupValue: - form.control(_complaintType).value ?? "", - onChanged: (changedValue) { - if (isDisabled) return; - - setState(() { - form.control(_complaintType).value = - changedValue; - }); - }, - textStyle: TextStyle( - color: isDisabled - ? theme.colorScheme.shadow - : theme.colorScheme.onBackground, - ), - items: complaintTypes ?? [], - itemBuilder: (item) => RadioButtonBuilder( - localizations.translate( - item.snakeCase.toUpperCase().trim(), - ), - ), - ); - }, - ); - }, + child: RadioGroup.builder( + + groupValue: + form.control(_complaintType).value ?? "", + + onChanged: (changedValue) { + if (form.control(_complaintType).disabled) return; + + setState(() { + + form.control(_complaintType).value = + changedValue; + }); + }, + textStyle: TextStyle( + color: form.control(_complaintType).disabled + ? theme.colorScheme.shadow + : theme.colorScheme.onBackground, + + ), + items: ComplaintsSingleton().complaintTypes ?? [], + itemBuilder: (item) => RadioButtonBuilder( + localizations.translate( + item.snakeCase.toUpperCase().trim(), + ), + ), ), ), if (form.control(_complaintType).value == "Other") ...[ @@ -176,8 +166,9 @@ class _ComplaintTypePageState extends LocalizedState { maxLength: 100, validationMessages: { 'required': (object) => localizations.translate( - i18.complaints.validationRequiredError, - ), + i18.complaints.validationRequiredError, + ), + }, ), ], @@ -205,6 +196,7 @@ class _ComplaintTypePageState extends LocalizedState { ], ), ), + ), ], ); }, diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_details.dart b/packages/complaints/lib/pages/registration/complaints_details.dart similarity index 86% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_details.dart rename to packages/complaints/lib/pages/registration/complaints_details.dart index a1ecebbb9..f0c1d8d5d 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_details.dart +++ b/packages/complaints/lib/pages/registration/complaints_details.dart @@ -1,3 +1,7 @@ + +import 'package:auto_route/auto_route.dart'; + +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; @@ -6,10 +10,10 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:group_radio_button/group_radio_button.dart'; import 'package:reactive_forms/reactive_forms.dart'; -import '../../../blocs/auth/auth.dart'; import '../../../blocs/complaints_registration/complaints_registration.dart'; -import '../../../models/complaints/complaints.dart'; -import '../../../router/app_router.dart'; +import '../../../models/complaints.dart'; + + import '../../../utils/i18_key_constants.dart' as i18; import '../../../utils/utils.dart'; import '../../../widgets/header/back_navigation_help_header.dart'; @@ -23,10 +27,10 @@ class ComplaintsDetailsPage extends LocalizedStatefulWidget { }); @override - State createState() => _ComplaintsDetailsPageState(); + State createState() => ComplaintsDetailsPageState(); } -class _ComplaintsDetailsPageState +class ComplaintsDetailsPageState extends LocalizedState { static const _dateOfComplaint = 'dateOfComplaint'; static const _administrativeArea = 'administrativeArea'; @@ -53,13 +57,15 @@ class _ComplaintsDetailsPageState form: () => bloc.state.map( create: (value) => buildForm(value), persisted: (value) => - throw const InvalidComplaintsRegistrationStateException(), + + throw const InvalidComplaintsRegistrationStateException(), view: (value) => buildForm(value), ), builder: (_, form, __) => BlocListener( listener: (context, state) { - context.navigateTo(HomeRoute()); + context.navigateTo(const ComplaintsInboxWrapperRoute()); }, + child: BlocConsumer( listener: (context, complaintState) { @@ -73,6 +79,7 @@ class _ComplaintsDetailsPageState final isRaisedForSelf = form.control(_complaintRaisedFor).value == i18.complaints.raisedForMyself; + return ScrollableContent( enableFixedButton: true, header: const Column( @@ -84,7 +91,8 @@ class _ComplaintsDetailsPageState child: DigitCard( margin: const EdgeInsets.fromLTRB(0, kPadding, 0, 0), padding: - const EdgeInsets.fromLTRB(kPadding, 0, kPadding, 0), + + const EdgeInsets.fromLTRB(kPadding, 0, kPadding, 0), child: DigitElevatedButton( onPressed: () async { setState(() { @@ -95,58 +103,61 @@ class _ComplaintsDetailsPageState router.parent()?.maybePop(); } - if (!form.valid) return; + if (!form.valid){ + return; + } FocusManager.instance.primaryFocus?.unfocus(); final dateOfComplaint = - form.control(_dateOfComplaint).value as DateTime; + form.control(_dateOfComplaint).value as DateTime; final complaintRaisedFor = - form.control(_complaintRaisedFor).value as String; - - final administrativeArea = - form.control(_administrativeArea).value as String; + form.control(_complaintRaisedFor).value as String; final complainantName = - form.control(_complainantName).value as String; + form.control(_complainantName).value as String; final complainantContactNumber = form .control(_complainantContactNumber) .value as String; final supervisorName = - form.control(_supervisorName).value as String?; + form.control(_supervisorName).value as String?; + final supervisorContactNumber = form .control(_supervisorContactNumber) .value as String?; final complaintDescription = - form.control(_complaintDescription).value as String; + + form.control(_complaintDescription).value as String; + state.whenOrNull( create: ( - loading, - complaintType, - _, - addressModel, - complaintsDetailsModel, - ) { + loading, + complaintType, + _, + addressModel, + complaintsDetailsModel, + ) { bloc.add( ComplaintsRegistrationEvent.saveComplaintDetails( - boundaryModel: context.boundary, + boundaryModel: ComplaintsSingleton().boundary, complaintsDetailsModel: ComplaintsDetailsModel( administrativeArea: - context.boundary.code.toString(), + ComplaintsSingleton().boundary.code.toString(), dateOfComplaint: dateOfComplaint, complaintRaisedFor: complaintRaisedFor, complainantName: complainantName, complainantContactNumber: - complainantContactNumber, + complainantContactNumber, supervisorName: supervisorName, supervisorContactNumber: - supervisorContactNumber, + supervisorContactNumber, + complaintDescription: complaintDescription, ), ), @@ -154,7 +165,9 @@ class _ComplaintsDetailsPageState }, ); - final userId = context.loggedInUserUuid; + + final userId = ComplaintsSingleton().loggedInUserUuid; + final submit = await DigitDialog.show( context, @@ -170,6 +183,7 @@ class _ComplaintsDetailsPageState i18.common.coreCommonSubmit, ), action: (context) { + Navigator.of( context, rootNavigator: true, @@ -181,6 +195,7 @@ class _ComplaintsDetailsPageState i18.common.coreCommonCancel, ), action: (context) { + Navigator.of( context, rootNavigator: true, @@ -192,19 +207,23 @@ class _ComplaintsDetailsPageState if (submit != true) return; + bloc.add( ComplaintsRegistrationSubmitComplaintEvent( userId: userId, ), ); + }, child: Center( child: Text( form.control(_complaintDetailsForm).disabled ? localizations - .translate(i18.complaints.backToInbox) + + .translate(i18.complaints.backToInbox) : localizations - .translate(i18.common.coreCommonSubmit), + .translate(i18.common.coreCommonSubmit), + ), ), ), @@ -254,8 +273,10 @@ class _ComplaintsDetailsPageState children: [ RadioGroup.builder( groupValue: - form.control(_complaintRaisedFor).value ?? - "", + + form.control(_complaintRaisedFor).value ?? + "", + onChanged: (changedValue) { if (form .control(_complaintRaisedFor) @@ -268,6 +289,15 @@ class _ComplaintsDetailsPageState .control(_complainantContactNumber) .value = ""; } + + else{ + form.control(_complainantName).value = + ComplaintsSingleton().userName; + form.control(_complainantContactNumber).value = + ComplaintsSingleton().userMobileNumber; + + } + setState(() { form.control(_complaintRaisedFor).value = changedValue; @@ -275,8 +305,10 @@ class _ComplaintsDetailsPageState }, textStyle: TextStyle( color: form - .control(_complaintRaisedFor) - .disabled + + .control(_complaintRaisedFor) + .disabled + ? theme.colorScheme.shadow : theme.colorScheme.onBackground, ), @@ -310,23 +342,8 @@ class _ComplaintsDetailsPageState ], ), ), - BlocBuilder( - builder: (context, state) { - state.mapOrNull( - authenticated: (value) { - var user = value.userModel; - - if (isRaisedForSelf) { - form.control(_complainantName).value = - user.name; - form - .control(_complainantContactNumber) - .value = user.mobileNumber; - } - }, - ); - return Column( + Column( children: [ DigitTextFormField( formControlName: _complainantName, @@ -341,7 +358,7 @@ class _ComplaintsDetailsPageState .validationRequiredError), 'maxLength': (object) => localizations .translate( - i18.common.maxCharsRequired) + i18.common.maxCharsRequired) .replaceAll('{}', '64'), }, ), @@ -369,14 +386,13 @@ class _ComplaintsDetailsPageState .validationMinLengthError), 'maxLength': (object) => localizations .translate( - i18.common.maxCharsRequired) + i18.common.maxCharsRequired) .replaceAll('{}', '10'), }, ), ], - ); - }, - ), + ), + DigitTextFormField( formControlName: _supervisorName, label: localizations.translate( @@ -420,8 +436,10 @@ class _ComplaintsDetailsPageState isRequired: true, validationMessages: { 'required': (object) => localizations.translate( - i18.complaints.validationRequiredError, - ), + + i18.complaints.validationRequiredError, + ), + 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', '1000'), @@ -454,9 +472,11 @@ class _ComplaintsDetailsPageState validators: [], ), _administrativeArea: FormControl( + value: localizations.translate( - (complaintDetails?.administrativeArea ?? context.boundary.name) + (complaintDetails?.administrativeArea ?? ComplaintsSingleton().boundary.name) .toString()), + disabled: shouldDisableForm, validators: [Validators.required], ), diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_location.dart b/packages/complaints/lib/pages/registration/complaints_location.dart similarity index 95% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_location.dart rename to packages/complaints/lib/pages/registration/complaints_location.dart index f4feece4f..9003d9cf3 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_location.dart +++ b/packages/complaints/lib/pages/registration/complaints_location.dart @@ -1,16 +1,22 @@ + + +import 'package:auto_route/auto_route.dart'; +import 'package:complaints/router/complaints_router.gm.dart'; import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:reactive_forms/reactive_forms.dart'; -import 'package:digit_data_model/data_model.dart'; -import '../../../blocs/complaints_registration/complaints_registration.dart'; -import '../../../router/app_router.dart'; -import '../../../utils/i18_key_constants.dart' as i18; -import '../../../utils/utils.dart'; -import '../../../widgets/header/back_navigation_help_header.dart'; -import '../../../widgets/localized.dart'; + + +import '../../models/pgr_address.dart'; +import '/blocs/complaints_registration/complaints_registration.dart'; +import '/utils/i18_key_constants.dart' as i18; +import '/utils/utils.dart'; +import '/widgets/header/back_navigation_help_header.dart'; +import '/widgets/localized.dart'; + @RoutePage() class ComplaintsLocationPage extends LocalizedStatefulWidget { @@ -20,10 +26,10 @@ class ComplaintsLocationPage extends LocalizedStatefulWidget { }); @override - State createState() => _ComplaintsLocationPageState(); + State createState() => ComplaintsLocationPageState(); } -class _ComplaintsLocationPageState +class ComplaintsLocationPageState extends LocalizedState { static const _addressLine1Key = 'addressLine1'; static const _addressLine2Key = 'addressLine2'; @@ -234,7 +240,9 @@ class _ComplaintsLocationPageState value: addressModel?.buildingName, disabled: shouldDisableForm, validators: [ + CustomValidator.requiredMin, + Validators.maxLength(maxLength), ], ), @@ -242,7 +250,9 @@ class _ComplaintsLocationPageState value: addressModel?.street, disabled: shouldDisableForm, validators: [ + CustomValidator.requiredMin, + Validators.maxLength(maxLength), ], ), @@ -250,7 +260,9 @@ class _ComplaintsLocationPageState value: addressModel?.landmark, disabled: shouldDisableForm, validators: [ + CustomValidator.requiredMin, + Validators.maxLength(maxLength), ], ), @@ -258,14 +270,18 @@ class _ComplaintsLocationPageState value: addressModel?.pincode, disabled: shouldDisableForm, validators: [ + CustomValidator.requiredMin, + Validators.maxLength(6), ], ), _latKey: FormControl( value: addressModel?.geoLocation?.latitude, validators: [ + CustomValidator.requiredMin, + ], ), _lngKey: FormControl( diff --git a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_registration_wrapper.dart b/packages/complaints/lib/pages/registration/complaints_registration_wrapper.dart similarity index 85% rename from apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_registration_wrapper.dart rename to packages/complaints/lib/pages/registration/complaints_registration_wrapper.dart index d5a07a3f5..4e722115d 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/complaints/registration/complaints_registration_wrapper.dart +++ b/packages/complaints/lib/pages/registration/complaints_registration_wrapper.dart @@ -1,14 +1,18 @@ import 'dart:convert'; import 'package:auto_route/auto_route.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:digit_data_model/data_model.dart'; -import '../../../blocs/complaints_registration/complaints_registration.dart'; -import '../../../models/complaints/complaints.dart'; -import '../../../utils/utils.dart'; -import '../../../widgets/boundary_selection_wrapper.dart'; + + +import '../../models/pgr_complaints.dart'; +import '/blocs/complaints_registration/complaints_registration.dart'; +import '/models/complaints.dart'; +import '/utils/utils.dart'; +import '/widgets/boundary_selection_wrapper.dart'; + @RoutePage() class ComplaintsRegistrationWrapperPage extends StatelessWidget @@ -22,7 +26,9 @@ class ComplaintsRegistrationWrapperPage extends StatelessWidget @override Widget build(BuildContext context) { + return const BoundarySelectionWrapper( + child: AutoRouter(), ); } @@ -49,9 +55,11 @@ class ComplaintsRegistrationWrapperPage extends StatelessWidget complainantName: pgrItem.user.name ?? '', complaintDescription: pgrItem.description, complaintRaisedFor: - context.loggedInUser.mobileNumber != pgrItem.user.mobileNumber + + ComplaintsSingleton().userMobileNumber != pgrItem.user.mobileNumber ? 'Another user' : 'Myself', + dateOfComplaint: pgrItem.auditDetails?.createdTime.toDateTime ?? DateTime.now(), supervisorContactNumber: @@ -65,8 +73,10 @@ class ComplaintsRegistrationWrapperPage extends StatelessWidget return ComplaintsRegistrationBloc( initialState, + pgrServiceRepository: - context.repository(), + context.repository(context), + ); }, child: this, diff --git a/packages/complaints/lib/router/complaints_router.dart b/packages/complaints/lib/router/complaints_router.dart new file mode 100644 index 000000000..7df52f8a3 --- /dev/null +++ b/packages/complaints/lib/router/complaints_router.dart @@ -0,0 +1,71 @@ +import 'package:auto_route/auto_route.dart'; + +import 'complaints_router.gm.dart'; + +/// Complaint Inbox and registration Router +@AutoRouterConfig.module() +class ComplaintsRoute extends $ComplaintsRoute { + + RouteType get defaultRouteType => const RouteType.material(); + + + List routes = [ + /// Complaints Inbox + AutoRoute( + page: ComplaintsInboxWrapperRoute.page, + path: 'complaints-inbox', + children: [ + AutoRoute( + page: ComplaintsInboxRoute.page, + path: 'complaints-inbox-items', + initial: true, + ), + AutoRoute( + page: ComplaintsInboxFilterRoute.page, + path: 'complaints-inbox-filter', + ), + AutoRoute( + page: ComplaintsInboxSearchRoute.page, + path: 'complaints-inbox-search', + ), + AutoRoute( + page: ComplaintsInboxSortRoute.page, + path: 'complaints-inbox-sort', + ), + AutoRoute( + page: ComplaintsDetailsViewRoute.page, + path: 'complaints-inbox-view-details', + ), + ], + ), + + /// Complaints registration + AutoRoute( + page: ComplaintsRegistrationWrapperRoute.page, + path: 'complaints-registration', + children: [ + AutoRoute( + page: ComplaintTypeRoute.page, + path: 'complaints-type', + initial: true, + ), + AutoRoute( + page: ComplaintsLocationRoute.page, + path: 'complaints-location', + ), + AutoRoute( + page: ComplaintsDetailsRoute.page, + path: 'complaints-details', + ), + + ], + ), + + /// Complaints Acknowledgement + AutoRoute( + page: ComplaintsAcknowledgementRoute.page, + path: 'complaints-acknowledgement', + ), + + ]; +} diff --git a/packages/complaints/lib/router/complaints_router.gm.dart b/packages/complaints/lib/router/complaints_router.gm.dart new file mode 100644 index 000000000..f5fab4156 --- /dev/null +++ b/packages/complaints/lib/router/complaints_router.gm.dart @@ -0,0 +1,551 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ************************************************************************** +// AutoRouterGenerator +// ************************************************************************** + +// ignore_for_file: type=lint +// coverage:ignore-file + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:auto_route/auto_route.dart' as _i12; +import 'package:complaints/blocs/localization/app_localization.dart' as _i14; +import 'package:complaints/models/pgr_complaints.dart' as _i15; +import 'package:complaints/pages/complaints_acknowledgement.dart' as _i2; +import 'package:complaints/pages/inbox/complaints_details_view.dart' as _i4; +import 'package:complaints/pages/inbox/complaints_inbox.dart' as _i6; +import 'package:complaints/pages/inbox/complaints_inbox_filter.dart' as _i5; +import 'package:complaints/pages/inbox/complaints_inbox_search.dart' as _i7; +import 'package:complaints/pages/inbox/complaints_inbox_sort.dart' as _i8; +import 'package:complaints/pages/inbox/complaints_inbox_wrapper.dart' as _i9; +import 'package:complaints/pages/registration/complaint_type.dart' as _i1; +import 'package:complaints/pages/registration/complaints_details.dart' as _i3; +import 'package:complaints/pages/registration/complaints_location.dart' as _i10; +import 'package:complaints/pages/registration/complaints_registration_wrapper.dart' + as _i11; +import 'package:flutter/material.dart' as _i13; + +abstract class $ComplaintsRoute extends _i12.AutoRouterModule { + @override + final Map pagesMap = { + ComplaintTypeRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintTypeRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i1.ComplaintTypePage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsAcknowledgementRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsAcknowledgementRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i2.ComplaintsAcknowledgementPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsDetailsRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsDetailsRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i3.ComplaintsDetailsPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsDetailsViewRoute.name: (routeData) { + final args = routeData.argsAs(); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i4.ComplaintsDetailsViewPage( + key: args.key, + complaint: args.complaint, + ), + ); + }, + ComplaintsInboxFilterRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsInboxFilterRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i5.ComplaintsInboxFilterPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsInboxRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsInboxRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i6.ComplaintsInboxPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsInboxSearchRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsInboxSearchRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i7.ComplaintsInboxSearchPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsInboxSortRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsInboxSortRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i8.ComplaintsInboxSortPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsInboxWrapperRoute.name: (routeData) { + return _i12.AutoRoutePage( + routeData: routeData, + child: const _i9.ComplaintsInboxWrapperPage(), + ); + }, + ComplaintsLocationRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsLocationRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i10.ComplaintsLocationPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + ComplaintsRegistrationWrapperRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const ComplaintsRegistrationWrapperRouteArgs()); + return _i12.AutoRoutePage( + routeData: routeData, + child: _i12.WrappedRoute( + child: _i11.ComplaintsRegistrationWrapperPage( + key: args.key, + pgrServiceModel: args.pgrServiceModel, + )), + ); + }, + }; +} + +/// generated route for +/// [_i1.ComplaintTypePage] +class ComplaintTypeRoute extends _i12.PageRouteInfo { + ComplaintTypeRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintTypeRoute.name, + args: ComplaintTypeRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintTypeRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintTypeRouteArgs { + const ComplaintTypeRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintTypeRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i2.ComplaintsAcknowledgementPage] +class ComplaintsAcknowledgementRoute + extends _i12.PageRouteInfo { + ComplaintsAcknowledgementRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsAcknowledgementRoute.name, + args: ComplaintsAcknowledgementRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsAcknowledgementRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsAcknowledgementRouteArgs { + const ComplaintsAcknowledgementRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsAcknowledgementRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i3.ComplaintsDetailsPage] +class ComplaintsDetailsRoute + extends _i12.PageRouteInfo { + ComplaintsDetailsRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsDetailsRoute.name, + args: ComplaintsDetailsRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsDetailsRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsDetailsRouteArgs { + const ComplaintsDetailsRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsDetailsRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i4.ComplaintsDetailsViewPage] +class ComplaintsDetailsViewRoute + extends _i12.PageRouteInfo { + ComplaintsDetailsViewRoute({ + _i13.Key? key, + required _i15.PgrServiceModel complaint, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsDetailsViewRoute.name, + args: ComplaintsDetailsViewRouteArgs( + key: key, + complaint: complaint, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsDetailsViewRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsDetailsViewRouteArgs { + const ComplaintsDetailsViewRouteArgs({ + this.key, + required this.complaint, + }); + + final _i13.Key? key; + + final _i15.PgrServiceModel complaint; + + @override + String toString() { + return 'ComplaintsDetailsViewRouteArgs{key: $key, complaint: $complaint}'; + } +} + +/// generated route for +/// [_i5.ComplaintsInboxFilterPage] +class ComplaintsInboxFilterRoute + extends _i12.PageRouteInfo { + ComplaintsInboxFilterRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsInboxFilterRoute.name, + args: ComplaintsInboxFilterRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsInboxFilterRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsInboxFilterRouteArgs { + const ComplaintsInboxFilterRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsInboxFilterRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i6.ComplaintsInboxPage] +class ComplaintsInboxRoute + extends _i12.PageRouteInfo { + ComplaintsInboxRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsInboxRoute.name, + args: ComplaintsInboxRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsInboxRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsInboxRouteArgs { + const ComplaintsInboxRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsInboxRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i7.ComplaintsInboxSearchPage] +class ComplaintsInboxSearchRoute + extends _i12.PageRouteInfo { + ComplaintsInboxSearchRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsInboxSearchRoute.name, + args: ComplaintsInboxSearchRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsInboxSearchRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsInboxSearchRouteArgs { + const ComplaintsInboxSearchRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsInboxSearchRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i8.ComplaintsInboxSortPage] +class ComplaintsInboxSortRoute + extends _i12.PageRouteInfo { + ComplaintsInboxSortRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsInboxSortRoute.name, + args: ComplaintsInboxSortRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsInboxSortRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsInboxSortRouteArgs { + const ComplaintsInboxSortRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsInboxSortRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i9.ComplaintsInboxWrapperPage] +class ComplaintsInboxWrapperRoute extends _i12.PageRouteInfo { + const ComplaintsInboxWrapperRoute({List<_i12.PageRouteInfo>? children}) + : super( + ComplaintsInboxWrapperRoute.name, + initialChildren: children, + ); + + static const String name = 'ComplaintsInboxWrapperRoute'; + + static const _i12.PageInfo page = _i12.PageInfo(name); +} + +/// generated route for +/// [_i10.ComplaintsLocationPage] +class ComplaintsLocationRoute + extends _i12.PageRouteInfo { + ComplaintsLocationRoute({ + _i13.Key? key, + _i14.ComplaintsLocalization? appLocalizations, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsLocationRoute.name, + args: ComplaintsLocationRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsLocationRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsLocationRouteArgs { + const ComplaintsLocationRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i13.Key? key; + + final _i14.ComplaintsLocalization? appLocalizations; + + @override + String toString() { + return 'ComplaintsLocationRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i11.ComplaintsRegistrationWrapperPage] +class ComplaintsRegistrationWrapperRoute + extends _i12.PageRouteInfo { + ComplaintsRegistrationWrapperRoute({ + _i13.Key? key, + _i15.PgrServiceModel? pgrServiceModel, + List<_i12.PageRouteInfo>? children, + }) : super( + ComplaintsRegistrationWrapperRoute.name, + args: ComplaintsRegistrationWrapperRouteArgs( + key: key, + pgrServiceModel: pgrServiceModel, + ), + initialChildren: children, + ); + + static const String name = 'ComplaintsRegistrationWrapperRoute'; + + static const _i12.PageInfo page = + _i12.PageInfo(name); +} + +class ComplaintsRegistrationWrapperRouteArgs { + const ComplaintsRegistrationWrapperRouteArgs({ + this.key, + this.pgrServiceModel, + }); + + final _i13.Key? key; + + final _i15.PgrServiceModel? pgrServiceModel; + + @override + String toString() { + return 'ComplaintsRegistrationWrapperRouteArgs{key: $key, pgrServiceModel: $pgrServiceModel}'; + } +} diff --git a/packages/complaints/lib/utils/constants.dart b/packages/complaints/lib/utils/constants.dart new file mode 100644 index 000000000..3186df232 --- /dev/null +++ b/packages/complaints/lib/utils/constants.dart @@ -0,0 +1,3 @@ + + +const String noResultSvg = 'assets/icons/svg/no_result.svg'; \ No newline at end of file diff --git a/packages/complaints/lib/utils/extensions/context_utility.dart b/packages/complaints/lib/utils/extensions/context_utility.dart new file mode 100644 index 000000000..0a64c331f --- /dev/null +++ b/packages/complaints/lib/utils/extensions/context_utility.dart @@ -0,0 +1,22 @@ +part of 'extensions.dart'; + +extension ContextUtilityExtensions on BuildContext { + int millisecondsSinceEpoch([DateTime? dateTime]) { + return (dateTime ?? DateTime.now()).millisecondsSinceEpoch; + } + + DataRepository + repository( + BuildContext context, + ) { + switch (ComplaintsSingleton().persistenceConfiguration) { + case PersistenceConfiguration.offlineFirst: + return context.read>(); + case PersistenceConfiguration.onlineOnly: + return context.read>(); + default: + return context.read>(); + } + } + +} \ No newline at end of file diff --git a/packages/complaints/lib/utils/extensions/extensions.dart b/packages/complaints/lib/utils/extensions/extensions.dart new file mode 100644 index 000000000..cee3aa97f --- /dev/null +++ b/packages/complaints/lib/utils/extensions/extensions.dart @@ -0,0 +1,24 @@ +import 'package:digit_data_model/data_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:intl/intl.dart'; + + +import '/utils/utils.dart'; + +part 'context_utility.dart'; + +// Extension to convert an integer (epoch) to a DateTime object. +extension EpochToDateTime on int? { + DateTime? get toDateTime { + return this == null ? null : DateTime.fromMillisecondsSinceEpoch(this!); + } +} + +extension DateTimeExtension on DateTime? { + String? getFormattedDate([String format = 'dd-MM-yyyy']) { + if (this == null) return null; + + return DateFormat(format).format(this!); + } +} diff --git a/packages/complaints/lib/utils/i18_key_constants.dart b/packages/complaints/lib/utils/i18_key_constants.dart new file mode 100644 index 000000000..632aa53de --- /dev/null +++ b/packages/complaints/lib/utils/i18_key_constants.dart @@ -0,0 +1,450 @@ +const common = Common(); +const complaints = Complaints(); +const complaintTypeShowcase = ComplaintTypeShowcase(); +const complaintsDetailsShowcase = ComplaintsDetailsShowcase(); +const complaintsDetailsViewShowcase = ComplaintsDetailsViewShowcase(); +const complaintsInboxShowcase = ComplaintsInboxShowcase(); + +const householdLocation = HouseholdLocation(); + +const searchBeneficiary = SearchBeneficiary(); + +const individualDetails = IndividualDetails(); + +class Common { + const Common(); + + String get coreCommonContinue => 'CORE_COMMON_CONTINUE'; + + String get coreCommonAge => 'CORE_COMMON_AGE'; + + String get coreCommonName => 'CORE_COMMON_NAME'; + + String get coreCommonEmailId => 'CORE_COMMON_EMAIL_ID'; + + String get coreCommonGender => 'CORE_COMMON_GENDER'; + + String get coreCommonMobileNumber => 'CORE_COMMON_MOBILE_NUMBER'; + + String get coreCommonSubmit => 'CORE_COMMON_SUBMIT'; + + String get coreCommonSave => 'CORE_COMMON_SAVE'; + + String get coreCommonCancel => 'CORE_COMMON_CANCEL'; + + String get corecommonRequired => 'CORE_COMMON_REQUIRED'; + + String get coreCommonReasonRequired => 'CORE_COMMON_REASON_REQUIRED'; + + String get corecommonclose => 'CORE_COMMON_CLOSE'; + + String get coreCommonOk => 'CORE_COMMON_OK'; + + String get coreCommonNA => 'CORE_COMMON_NA'; + + String get coreCommonProfile => 'CORE_COMMON_PROFILE'; + + String get coreCommonLogout => 'CORE_COMMON_LOGOUT'; + + String get coreCommonBack => 'CORE_COMMON_BACK'; + + String get coreCommonHelp => 'CORE_COMMON_HELP'; + + String get coreCommonHome => 'CORE_COMMON_HOME'; + + String get coreCommonViewDownloadedData => 'CORE_COMMON_VIEW_DOWNLOADED_DATA'; + + String get coreCommonlanguage => 'CORE_COMMON_LANGUAGE'; + + String get coreCommonSyncProgress => 'CORE_COMMON_SYNC_PROGRESS'; + + String get coreCommonDataSynced => 'CORE_COMMON_DATA_SYNCED'; + + String get coreCommonDataSyncFailed => 'CORE_COMMON_DATA_SYNC_FAILED'; + + String get coreCommonDataSyncRetry => 'CORE_COMMON_DATA_SYNC_RETRY'; + + String get connectionLabel => 'CORE_COMMON_CONNECTION_LABEL'; + + String get connectionContent => 'CORE_COMMON_CONNECTION_CONTENT'; + + String get coreCommonSkip => 'CORE_COMMON_SKIP'; + + String get coreCommonNext => 'CORE_COMMON_NEXT'; + + String get coreCommonYes => 'CORE_COMMON_YES'; + + String get coreCommonNo => 'CORE_COMMON_NO'; + String get coreCommonGoback => 'CORE_COMMON_GO_BACK'; + + String get coreCommonRequiredItems => 'CORE_COMMON_REQUIRED_ITEMS'; + + String get min2CharsRequired => 'MIN_2_CHARS_REQUIRED'; + + String get maxCharsRequired => 'MAX_CHARS_ALLOWED'; + + String get maxValue => 'MAX_VALUE_ALLOWED'; + String get minValue => 'MIN_VALUE_ALLOWED'; + + String get noResultsFound => 'NO_RESULTS_FOUND'; + + String get coreCommonSyncInProgress => 'CORE_COMMON_SYNC_IN_PROGRESS'; + + String get facilitySearchHeaderLabel => 'FACILITY_SEARCH_HEADER_LABEL'; + String get projectFacilitySearchHeaderLabel => + 'PROJECT_FACILITY_SEARCH_HEADER_LABEL'; + + String get coreCommonDownload => 'CORE_COMMON_DOWNLOAD'; + + String get coreCommonDownloadFailed => 'CORE_COMMON_DOWNLOAD_FAILED'; + + String get noMatchFound => 'CORE_COMMON_NO_MATCH_FOUND'; + + String get scanBales => 'CORE_COMMON_SCAN_BALES'; + String get ageInMonths => 'AGE_IN_MONTHS_LABEL'; + + String get profileUpdateSuccess => 'PROFILE_UPDATE_SUCCESS'; +} + +class Complaints { + const Complaints(); + + String get complaintsTypeHeading => 'COMPLAINTS_TYPE_HEADING'; + + String get complaintsTypeLabel => 'COMPLAINTS_TYPE_LABEL'; + + String get actionLabel => 'HOUSEHOLD_LOCATION_ACTION_LABEL'; + + String get complaintsLocationLabel => 'COMPLAINTS_LOCATION_LABEL'; + + String get complaintsDetailsLabel => 'COMPLAINTS_DETAILS_LABEL'; + + String get dateOfComplaint => 'COMPLAINTS_DATE'; + + String get complainantTypeQuestion => 'COMPLAINTS_COMPLAINANT_TYPE_QUESTION'; + + String get complainantName => 'COMPLAINTS_COMPLAINANT_NAME'; + + String get complainantContactNumber => + 'COMPLAINTS_COMPLAINANT_CONTACT_NUMBER'; + + String get supervisorName => 'COMPLAINTS_SUPERVISOR_NAME'; + + String get supervisorContactNumber => 'COMPLAINTS_SUPERVISOR_CONTACT_NUMBER'; + + String get complaintDescription => 'COMPLAINTS_DESCRIPTION'; + + String get dialogTitle => 'COMPLAINTS_DIALOG_TITLE'; + + String get dialogContent => 'COMPLAINTS_DIALOG_MESSAGE'; + + String get fileComplaintAction => 'COMPLAINTS_FILE_COMPLAINT_ACTION'; + + String get inboxHeading => 'COMPLAINTS_INBOX_HEADING'; + + String get searchCTA => 'COMPLAINTS_INBOX_SEARCH_CTA'; + + String get filterCTA => 'COMPLAINTS_INBOX_FILTER_CTA'; + + String get sortCTA => 'COMPLAINTS_INBOX_SORT_CTA'; + + String get complaintInboxFilterHeading => 'COMPLAINTS_INBOX_FILTER_HEADING'; + + String get complaintsFilterClearAll => 'COMPLAINTS_FILTER_CLEAR_ALL'; + + String get complaintInboxSearchHeading => 'COMPLAINTS_INBOX_SEARCH_HEADING'; + + String get complaintInboxSortHeading => 'COMPLAINTS_INBOX_SORT_HEADING'; + + String get complaintsSortDateAsc => 'COMPLAINT_SORT_DATE_ASC'; + + String get complaintsSortDateDesc => 'COMPLAINT_SORT_DATE_DESC'; + + String get assignedToAll => 'COMPLAINTS_ASSIGNED_TO_ALL'; + + String get assignedToSelf => 'COMPLAINTS_ASSIGNED_TO_SELF'; + + String get noComplaintsExist => 'COMPLAINTS_NO_COMPLAINTS_EXIST'; + + String get validationRequiredError => 'COMPLAINTS_VALIDATION_REQUIRED_ERROR'; + + String get inboxDateLabel => 'COMPLAINTS_INBOX_DATE_LABEL'; + + String get inboxNumberLabel => 'COMPLAINTS_INBOX_NUMBER_LABEL'; + + String get inboxTypeLabel => 'COMPLAINTS_INBOX_TYPE_LABEL'; + + String get inboxAreaLabel => 'COMPLAINTS_INBOX_AREA_LABEL'; + + String get inboxStatusLabel => 'COMPLAINTS_INBOX_STATUS_LABEL'; + + String get inboxNotGeneratedLabel => 'COMPLAINTS_INBOX_NOT_GENERATED_LABEL'; + + String get inboxSyncRequiredLabel => 'COMPLAINTS_INBOX_SYNC_REQUIRED_LABEL'; + + String get raisedForMyself => 'COMPLAINTS_RAISED_FOR_MYSELF'; + String get validationMinLengthError => + 'COMPLAINTS_VALIDATION_MINLENGTH_ERROR'; + + String get raisedForAnotherUser => 'COMPLAINTS_RAISED_FOR_ANOTHER_USER'; + + String get locality => 'COMPLAINTS_LOCALITY'; + + String get backToInbox => 'COMPLAINTS_BACK_TO_INBOX'; + + String get acknowledgementAction => 'COMPLAINTS_ACKNOWLEDGEMENT_ACTION'; + + String get acknowledgementDescription => + 'COMPLAINTS_ACKNOWLEDGEMENT_DESCRIPTION'; + + String get acknowledgementLabel => 'COMPLAINTS_ACKNOWLEDGEMENT_LABEL'; + + String get acknowledgementSubLabelMain => + 'COMPLAINTS_ACKNOWLEDGEMENT_SUB_LABEL_MAIN'; + + String get acknowledgementSubLabelSub => + 'COMPLAINTS_ACKNOWLEDGEMENT_SUB_LABEL_SUB'; + + String get complaintsError => 'COMPLAINTS_VALIDATION_REQUIRED_ERROR'; + + String get validationRadioRequiredError => + 'COMPLAINTS_VALIDATION_RADIO_REQUIRED_ERROR'; +} + +class ComplaintTypeShowcase { + const ComplaintTypeShowcase(); + + String get complaintType { + return 'COMPLAINT_TYPE_SHOWCASE_COMPLAINT_TYPE'; + } + + String get complaintTypeNext { + return 'COMPLAINT_TYPE_SHOWCASE_COMPLAINT_TYPE_NEXT'; + } +} + +class ComplaintsDetailsShowcase { + const ComplaintsDetailsShowcase(); + + String get complaintDate { + return 'COMPLAINT_DETAILS_SHOWCASE_DATE'; + } + + String get complaintOrganizationUnit { + return 'COMPLAINT_DETAILS_SHOWCASE_ORGANIZATION_UNIT'; + } + + String get complaintSelfOrOther { + return 'COMPLAINT_DETAILS_SHOWCASE_SELF_OR_OTHER'; + } + + String get complaintName { + return 'COMPLAINT_DETAILS_SHOWCASE_NAME'; + } + + String get complaintContact { + return 'COMPLAINT_DETAILS_SHOWCASE_CONTACT'; + } + + String get complaintSupervisorName { + return 'COMPLAINT_DETAILS_SHOWCASE_SUPERVISOR_NAME'; + } + + String get complaintSupervisorContact { + return 'COMPLAINT_DETAILS_SHOWCASE_SUPERVISOR_CONTACT'; + } + + String get complaintDescription { + return 'COMPLAINT_DETAILS_SHOWCASE_DESCRIPTION'; + } + + String get complaintSubmit { + return 'COMPLAINT_DETAILS_SHOWCASE_SUBMIT'; + } +} + +class ComplaintsDetailsViewShowcase { + const ComplaintsDetailsViewShowcase(); + + String get complaintNumber { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_NUMBER'; + } + + String get complaintType { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_TYPE'; + } + + String get complaintDate { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_DATE'; + } + + String get complaintName { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_NAME'; + } + + String get complaintArea { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_AREA'; + } + + String get complaintContact { + return 'COMPLAINT_DETAILS_VIEW_CONTACT'; + } + + String get complaintStatus { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_STATUS'; + } + + String get complaintDescription { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_DESCRIPTION'; + } + + String get complaintClose { + return 'COMPLAINT_DETAILS_VIEW_SHOWCASE_CLOSE'; + } +} + +class ComplaintsInboxShowcase { + const ComplaintsInboxShowcase(); + + String get complaintSearch { + return 'COMPLAINT_INBOX_SHOWCASE_SEARCH'; + } + + String get complaintFilter { + return 'COMPLAINT_INBOX_SHOWCASE_FILTER'; + } + + String get complaintSort { + return 'COMPLAINT_INBOX_SHOWCASE_SORT'; + } + + String get complaintNumber { + return 'COMPLAINT_INBOX_SHOWCASE_NUMBER'; + } + + String get complaintType { + return 'COMPLAINT_INBOX_SHOWCASE_TYPE'; + } + + String get complaintDate { + return 'COMPLAINT_INBOX_SHOWCASE_DATE'; + } + + String get complaintArea { + return 'COMPLAINT_INBOX_SHOWCASE_AREA'; + } + + String get complaintStatus { + return 'COMPLAINT_INBOX_SHOWCASE_STATUS'; + } + + String get complaintOpen { + return 'COMPLAINT_INBOX_SHOWCASE_OPEN'; + } + + String get complaintCreate { + return 'COMPLAINT_INBOX_SHOWCASE_CREATE'; + } +} + +class HouseholdLocation { + const HouseholdLocation(); + + String get householdLocationLabelText => 'HOUSEHOLD_LOCATION_LABEL_TEXT'; + + String get administrationAreaFormLabel => 'ADMINISTRATION_AREA_FORM_LABEL'; + + String get administrationAreaRequiredValidation => + 'HOUSEHOLD_LOCATION_ADMINISTRATION_AREA_REQUIRED_VALIDATION'; + + String get householdAddressLine1LabelText => + 'HOUSEHOLD_ADDRESS_LINE_1_FORM_LABEL'; + + String get landmarkFormLabel => 'LANDMARK_FORM_LABEL'; + + String get householdAddressLine2LabelText => + 'HOUSEHOLD_ADDRESS_LINE_2_FORM_LABEL'; + + String get postalCodeFormLabel => 'POSTAL_CODE_FORM_LABEL'; + + String get actionLabel => 'HOUSEHOLD_LOCATION_ACTION_LABEL'; +} + +class IndividualDetails { + const IndividualDetails(); + + String get individualsDetailsLabelText => 'INDIVIDUAL_LABEL_TEXT'; + + String get nameLabelText => 'INDIVIDUAL_NAME_LABEL_TEXT'; + + String get checkboxLabelText => 'HEAD_OF_HOUSEHOLD_LABEL_TEXT'; + + String get idTypeLabelText => 'ID_TYPE_LABEL_TEXT'; + + String get idNumberLabelText => 'ID_NUMBER_LABEL_TEXT'; + + String get idNumberSuggestionText => 'ID_NUMBER_SUGGESTION_TEXT'; + + String get dobLabelText => 'DOB_LABEL_TEXT'; + + String get ageLabelText => 'AGE_LABEL_TEXT'; + + String get separatorLabelText => 'SEPARATOR_LABEL_TEXT'; + + String get genderLabelText => 'GENDER_LABEL_TEXT'; + + String get dobErrorText => 'DOB_ERROR_MESSAGE'; + + String get mobileNumberLabelText => 'MOBILE_NUMBER_LABEL_TEXT'; + + String get heightLabelText => 'HEIGHT_LABEL_TEXT'; + + String get submitButtonLabelText => 'INDIVIDUAL_DETAILS_SUBMIT'; + + String get mobileNumberInvalidFormatValidationMessage => + 'INDIVIDUAL_DETAILS_INVALID_MOBILE_NUMBER'; + + String get yearsHintText => 'YEARS_HINT_TEXT'; + String get monthsHintText => 'MONTHS_HINT_TEXT'; + + String get yearsErrorText => 'ERR_YEARS'; + + String get monthsErrorText => 'ERR_MONTHS'; + + String get yearsAndMonthsErrorText => 'ERR_YEARS_AND_MONTHS'; + + String get linkVoucherToIndividual => 'LINK_VOUCHER_TO_INDIVIDUAL'; +} + +class SearchBeneficiary { + const SearchBeneficiary(); + + String get statisticsLabelText => 'BENEFICIARY_STATISTICS_LABEL_TEXT'; + + String get searchIndividualLabelText => + 'BENEFICIARY_STATISTICS_SEARCH_INDIVIDUAL_LABEL'; + + String get noOfHouseholdsRegistered => 'NO_OF_HOUSEHOLDS_REGISTERED'; + + String get noOfResourcesDelivered => 'NO_OF_RESOURCES_DELIVERED'; + + String get beneficiarySearchHintText => 'BENEFICIARY_SEARCH_HINT_TEXT'; + + String get beneficiaryIndividualSearchHintText => + 'BENEFICIARY_INDIVIDUAL_SEARCH_HINT_TEXT'; + + String get beneficiaryInfoDescription => 'BENEFICIARY_INFO_DESCRIPTION'; + + String get beneficiaryInfoTitle => 'BENEFICIARY_INFO_TITLE'; + + String get beneficiaryAddActionLabel => 'BENEFICIARY_ADD_ACTION_LABEL'; + + String get iconLabel => 'ICON_LABEL'; + + String get yearsAbbr => 'YEARS_ABBR'; + + String get monthsAbbr => 'MONTHS_ABBR'; + + String get proximityLabel => 'PROXIMITY_LABEL'; +} + diff --git a/packages/complaints/lib/utils/typedefs.dart b/packages/complaints/lib/utils/typedefs.dart new file mode 100644 index 000000000..9e1a900e3 --- /dev/null +++ b/packages/complaints/lib/utils/typedefs.dart @@ -0,0 +1,6 @@ +import 'package:digit_data_model/data_model.dart'; + +import '../models/pgr_complaints.dart'; + +typedef PgrServiceDataRepository += DataRepository; \ No newline at end of file diff --git a/packages/complaints/lib/utils/utils.dart b/packages/complaints/lib/utils/utils.dart new file mode 100644 index 000000000..3f12f1df0 --- /dev/null +++ b/packages/complaints/lib/utils/utils.dart @@ -0,0 +1,105 @@ +import 'package:digit_data_model/data_model.dart'; +import 'package:reactive_forms/reactive_forms.dart'; + + + +export 'extensions/extensions.dart'; + +//singleton class for complaints operations +class ComplaintsSingleton { + static final ComplaintsSingleton _singleton = ComplaintsSingleton._internal(); + + // Factory constructor that returns the singleton instance. + factory ComplaintsSingleton() { + return _singleton; + } + + //Private constructor for the singleton pattern + ComplaintsSingleton._internal(); + + //various properties related to the Complaints + String? _tenantId = ''; + String? _loggedInUserUuid = ''; + String? _userMobileNumber = ''; + String? _loggedInUserName = ''; + + List? _complaintTypes; + BoundaryModel? _boundaryModel; + String? _userName =''; + + PersistenceConfiguration _persistenceConfiguration = PersistenceConfiguration + .offlineFirst; // Default to offline first persistence configuration + + void setInitialData({ + String? tenantId, + String? loggedInUserUuid, + String? userMobileNumber, + String? loggedInUserName, + + List? complaintTypes, + String? userName, + }){ + + _tenantId = tenantId; + _loggedInUserUuid = loggedInUserUuid; + _userMobileNumber = userMobileNumber; + _loggedInUserName = loggedInUserName; + + _complaintTypes = complaintTypes; + _userName = userName; + + } + + void setPersistenceConfiguration(PersistenceConfiguration configuration) { + _persistenceConfiguration = configuration; + } + + void setTenantId({required String tenantId}) { + _tenantId = tenantId; + } + + void setBoundary({required BoundaryModel boundary}) { + _boundaryModel = boundary; + } + + get tenantId => _tenantId; + get loggedInUserUuid => _loggedInUserUuid; + get userMobileNumber => _userMobileNumber; + get loggedInUserName => _loggedInUserName; + get complaintTypes => _complaintTypes; + get persistenceConfiguration => _persistenceConfiguration; + + get boundary => _boundaryModel; + get userName => _userName; + + +} + +class CustomValidator { + /// Validates that control's value must be `true` + static Map? requiredMin( + AbstractControl control, + ) { + return control.value == null || + control.value.toString().length >= 2 || + control.value.toString().trim().isEmpty + ? null + : {'required': true}; + } + + static Map? validMobileNumber( + AbstractControl control, + ) { + if (control.value == null || control.value.toString().isEmpty) { + return null; + } + + const pattern = r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$'; + + if (RegExp(pattern).hasMatch(control.value.toString())) return null; + + if (control.value.toString().length < 10) return {'mobileNumber': true}; + + return {'mobileNumber': true}; + } +} diff --git a/packages/complaints/lib/widgets/boundary_selection_wrapper.dart b/packages/complaints/lib/widgets/boundary_selection_wrapper.dart new file mode 100644 index 000000000..5489b088f --- /dev/null +++ b/packages/complaints/lib/widgets/boundary_selection_wrapper.dart @@ -0,0 +1,37 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:complaints/router/complaints_router.gm.dart'; +import 'package:digit_components/digit_components.dart'; +import 'package:digit_data_model/blocs/boundary/boundary.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + + +/// Wraps the [child] widget with a [BlocListener] that listens to +/// [BoundaryState] changes and navigates to [HomeRoute] when submitted. +class BoundarySelectionWrapper extends StatelessWidget { + final Widget child; + + const BoundarySelectionWrapper({ + Key? key, + required this.child, + }) : super(key: key); + + @override + Widget build(BuildContext context) => + BlocListener( + listener: (context, state) { + if (state.hasSubmitted) { + context.navigateTo( + const ComplaintsInboxWrapperRoute(), + onFailure: (failure) { + AppLogger.instance.error( + title: 'BoundarySelectionWrapper', + message: failure.toString(), + ); + }, + ); + } + }, + child: child, + ); +} diff --git a/packages/complaints/lib/widgets/header/back_navigation_help_header.dart b/packages/complaints/lib/widgets/header/back_navigation_help_header.dart new file mode 100644 index 000000000..3bb5b41c3 --- /dev/null +++ b/packages/complaints/lib/widgets/header/back_navigation_help_header.dart @@ -0,0 +1,80 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:digit_components/digit_components.dart'; +import 'package:flutter/material.dart'; + +import '/blocs/localization/app_localization.dart'; +import '/utils/i18_key_constants.dart' as i18; + +class BackNavigationHelpHeaderWidget extends StatelessWidget { + final bool showHelp; + final bool showBackNavigation; + final bool showLogoutCTA; + final VoidCallback? helpClicked; + final VoidCallback? handleBack; + + const BackNavigationHelpHeaderWidget({ + super.key, + this.showHelp = false, //hiding help + this.showBackNavigation = true, + this.showLogoutCTA = false, + this.helpClicked, + this.handleBack, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Padding( + padding: const EdgeInsets.all(kPadding / 2), + child: Row( + children: [ + Expanded( + child: Row( + children: [ + if (showBackNavigation) + Flexible( + child: TextButton.icon( + style: TextButton.styleFrom( + foregroundColor: theme.colorScheme.onSurface, + padding: EdgeInsets.zero, + ), + onPressed: () { + context.router.maybePop(); + handleBack != null ? handleBack!() : null; + }, + icon: const Icon(Icons.arrow_left_sharp), + label: Text( + ComplaintsLocalization.of(context).translate( + i18.common.coreCommonBack, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ), + ), + SizedBox(width: showHelp ? kPadding * 2 : 0), + if (showHelp) + TextButton( + style: TextButton.styleFrom(padding: EdgeInsets.zero), + onPressed: helpClicked, + child: Row( + children: [ + Text( + ComplaintsLocalization.of(context) + .translate(i18.common.coreCommonHelp), + overflow: TextOverflow.ellipsis, + ), + const Icon( + Icons.help_outline_outlined, + ), // Add the icon to the right + ], + ), + ), + ], + ), + ); + } +} diff --git a/packages/complaints/lib/widgets/localized.dart b/packages/complaints/lib/widgets/localized.dart new file mode 100644 index 000000000..c2a9e1ba1 --- /dev/null +++ b/packages/complaints/lib/widgets/localized.dart @@ -0,0 +1,34 @@ +import 'package:flutter/cupertino.dart'; + +import '/blocs/localization/app_localization.dart'; + +abstract class LocalizedStatefulWidget extends StatefulWidget { + final ComplaintsLocalization? appLocalizations; + + const LocalizedStatefulWidget({ + super.key, + this.appLocalizations, + }); +} + +abstract class LocalizedState + extends State { + late ComplaintsLocalization _localizations; + + ComplaintsLocalization get localizations => _localizations; + + set localizations(ComplaintsLocalization localizations) { + if (mounted) { + setState(() { + _localizations = localizations; + }); + } + } + + @override + @mustCallSuper + void didChangeDependencies() { + _localizations = widget.appLocalizations ?? ComplaintsLocalization.of(context); + super.didChangeDependencies(); + } +} diff --git a/packages/complaints/lib/widgets/no_result_card/no_result_card.dart b/packages/complaints/lib/widgets/no_result_card/no_result_card.dart new file mode 100644 index 000000000..fc7d52119 --- /dev/null +++ b/packages/complaints/lib/widgets/no_result_card/no_result_card.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +import '/utils/constants.dart'; + +class NoResultCard extends StatelessWidget { + final AlignmentGeometry align; + final String? label; + const NoResultCard({ + super.key, + this.align = Alignment.centerLeft, + this.label, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Align( + alignment: align, + child: Padding( + padding: const EdgeInsets.only(top: 100, bottom: 10, right: 8), + child: Column( + children: [ + SvgPicture.asset( + noResultSvg, + width: 340, + height: 200, + ), + const SizedBox(height: 20), + Text( + label ?? '', + style: theme.textTheme.bodyMedium, + ), + ], + ), + ), + ); + } +} diff --git a/packages/complaints/pubspec.yaml b/packages/complaints/pubspec.yaml new file mode 100644 index 000000000..070b3a346 --- /dev/null +++ b/packages/complaints/pubspec.yaml @@ -0,0 +1,85 @@ +name: complaints +description: This package offers filing complaints features, allowing users to file complaints. +version: 0.0.1-dev.1 +homepage: + +environment: + sdk: '>=3.0.0 <4.0.0' + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + digit_components: ^1.0.0+2 + flutter_bloc: ^8.1.1 + freezed_annotation: ^2.1.0 + build_runner: ^2.2.1 + auto_route: ^7.8.4 + digit_data_model: 1.0.4-dev.1 + dart_mappable: ^4.2.0 + group_radio_button: ^1.3.0 + reactive_forms: ^14.1.0 + recase: ^4.1.0 + flutter_dotenv: ^5.0.2 + flutter_svg: ^2.0.8 + path_provider: ^2.0.11 + intl: ^0.18.0 + drift: ^2.0.0 + dio: ^5.1.2 + isar: ^3.0.5 + + + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + auto_route_generator: ^7.3.2 + freezed: ^2.1.0+1 + json_serializable: ^6.4.0 + dart_mappable_builder: + git: + url: https://github.com/egovernments/health-campaign-field-worker-app/ + ref: master + path: ./packages/dart_mappable_builder + bloc_test: ^9.1.0 + mocktail: ^1.0.2 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + assets: + - assets/icons/svg/ + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/complaints/test/complaints_inbox_bloc_test.dart b/packages/complaints/test/complaints_inbox_bloc_test.dart new file mode 100644 index 000000000..7f0f06a11 --- /dev/null +++ b/packages/complaints/test/complaints_inbox_bloc_test.dart @@ -0,0 +1,55 @@ +import 'package:complaints/blocs/complaints_inbox/complaints_inbox.dart'; +import 'package:complaints/utils/typedefs.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:bloc_test/bloc_test.dart'; + +import 'package:complaints/complaints.dart'; + +import 'constants/test_constants.dart'; + + +class MockPgrServiceDataRepository extends Mock implements + PgrServiceDataRepository {} + +void main(){ + //Define a test group for the Complaints Inbox Bloc + group('ComplaintsInboxBloc', () { + //Declare a variable for complaint inbox bloc + late ComplaintsInboxBloc complaintsInboxBloc; + + //Mock the required repositories + late MockPgrServiceDataRepository pgrServiceDataRepository; + + setUp((){ + pgrServiceDataRepository = MockPgrServiceDataRepository(); + complaintsInboxBloc = ComplaintsInboxBloc( + const ComplaintInboxState.complaints(), + pgrRepository: pgrServiceDataRepository + ); + }); + + + //Test case for _handleLoadComplaints + blocTest( + 'emits [ComplaintsInboxState with isFiltered false] when ComplaintInboxLoadComplaintEvent is added', + build: (){ + return complaintsInboxBloc; + }, + act: (bloc){ + bloc.add( + ComplaintInboxLoadComplaintsEvent( + updatedModels: [ComplaintsConstants.mockPgrServiceModel], + createdByUserId: ComplaintsConstants.createdByUserId)); + }, + expect: ()=>[ + ComplaintInboxState.complaints( + loading: false, + complaints: [ComplaintsConstants.mockPgrServiceModel], + isFiltered: false, + ), + ] + ); + + }); +} \ No newline at end of file diff --git a/packages/complaints/test/complaints_registration_bloc_test.dart b/packages/complaints/test/complaints_registration_bloc_test.dart new file mode 100644 index 000000000..139a48def --- /dev/null +++ b/packages/complaints/test/complaints_registration_bloc_test.dart @@ -0,0 +1,122 @@ +// Import necessary packages for Flutter testing and mocktail. +import 'package:complaints/blocs/complaints_registration/complaints_registration.dart'; +import 'package:complaints/utils/typedefs.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:complaints/complaints.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:bloc_test/bloc_test.dart'; + +import 'constants/test_constants.dart'; + +class MockPgrServiceDataRepository extends Mock + implements PgrServiceDataRepository {} + + +void main() { + // Define a test group for the ComplaintsRegistrationBloc + group('ComplaintRegistrationBloc', () + { + late ComplaintsRegistrationBloc + complaintsRegistrationBloc; // Declare a variable for the ComplaintsRegistrationBloc. + // Mock the required repositories + final pgrServiceDataRepository = MockPgrServiceDataRepository(); + + // Set up the test environment before each test. + setUp(() { + complaintsRegistrationBloc = ComplaintsRegistrationBloc( + const ComplaintsRegistrationState.create(), + pgrServiceRepository: pgrServiceDataRepository + ); + }); + + setUpAll(() { + registerFallbackValue(ComplaintsConstants.mockPgrServiceModel); + }); + + // Test the initial state of the ComplaintsRegistrationBloc. + test('Initial state is correct', () { + expect( + complaintsRegistrationBloc.state, + equals(const ComplaintsRegistrationState + .create())); // Ensure that the initial state matches the expected state. + }); + + //Test case for _handleSaveComplaintType in create state + blocTest( + 'emits [ComplaintsRegistrationState with complaintType] when _handleSaveComplaintType is called in create state', + build: () => complaintsRegistrationBloc, + act: (bloc) { + bloc.add(const ComplaintsRegistrationSaveComplaintTypeEvent( + complaintType: ComplaintsConstants.complaintType, + )); + }, + expect: ()=> [ + const ComplaintsRegistrationState.create( + complaintType: ComplaintsConstants.complaintType, + ), + ], + ); + + //Test case for _handleSaveAddress in create state + blocTest( + 'emits [ComplaintsRegistrationState with complaintAddress] when _handleSaveAddress is called in create state', + build: ()=>complaintsRegistrationBloc, + act: (bloc){ + bloc.add(ComplaintsRegistrationSaveAddressEvent( + addressModel: ComplaintsConstants.addressModel, + )); + }, + expect: ()=>[ + ComplaintsRegistrationState.create( + addressModel: ComplaintsConstants.addressModel, + ), + ], + ); + + //Test case for _handleComplaintDetails in create state + blocTest( + 'emits [ComplaintsRegistrationState with complaintsDetails] when _handleComplaintDetails is called in create state', + build: ()=>complaintsRegistrationBloc, + act: (bloc){ + bloc.add( + ComplaintsRegistrationSaveComplaintDetailsEvent( + complaintsDetailsModel: ComplaintsConstants.complaintsDetailsModel, + boundaryModel: ComplaintsConstants.boundaryModel, + ) + ); + }, + expect: ()=>[ + ComplaintsRegistrationState.create( + complaintsDetailsModel: ComplaintsConstants.complaintsDetailsModel, + ), + ], + ); + + //Test case for _handleSubmitComplaints in create state + blocTest( + 'emits [ComplaintsRegistrationPersistedState] when _handleSubmitComplaints is called', + build: () { + when(()=>pgrServiceDataRepository.create(any())) + .thenAnswer((_) async => ComplaintsConstants.mockPgrServiceModel); + return complaintsRegistrationBloc; + }, + + act: (bloc){ + bloc.emit(ComplaintsRegistrationState.create( + complaintType: ComplaintsConstants.complaintType, + addressModel: ComplaintsConstants.addressModel, + complaintsDetailsModel: ComplaintsConstants.complaintsDetailsModel, + )); + }, + expect: ()=>[ + ComplaintsRegistrationState.create( + complaintType: ComplaintsConstants.complaintType, + addressModel: ComplaintsConstants.addressModel, + complaintsDetailsModel: ComplaintsConstants.complaintsDetailsModel, + loading: false, + ), + ], + ); + + }); +} diff --git a/packages/complaints/test/constants/test_constants.dart b/packages/complaints/test/constants/test_constants.dart new file mode 100644 index 000000000..9f489b38d --- /dev/null +++ b/packages/complaints/test/constants/test_constants.dart @@ -0,0 +1,41 @@ +import 'package:complaints/complaints.dart'; +import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/pgr_application_status.dart'; + +class ComplaintsConstants{ + static final ComplaintsDetailsModel complaintsDetailsModel = ComplaintsDetailsModel( + dateOfComplaint: DateTime(2024), + administrativeArea: "Settlement 1", + complaintRaisedFor: "myself", + complainantName: "Security Issues", + complainantContactNumber: "9192939495", + complaintDescription: "test complaint" + ); + + static final BoundaryModel boundaryModel = BoundaryModel( + latitude: "76", + longitude: "88", + ); + + static const String complaintType = "Security Issues"; + + static final PgrAddressModel addressModel = PgrAddressModel( + street: "Jane", + city: "NY", + ); + static const String createdByUserId = "123456789"; + + static var mockPgrServiceModel = PgrServiceModel( + clientReferenceId: '123', + tenantId: 'mz', + serviceCode: complaintType, + description: 'test-complaint', + applicationStatus: PgrServiceApplicationStatus.created, + user: const PgrComplainantModel( + clientReferenceId: '123', + complaintClientReferenceId: '123', + tenantId: 'mz', + ), + address: addressModel + ); +} \ No newline at end of file diff --git a/packages/digit_components/CHANGELOG.md b/packages/digit_components/CHANGELOG.md index 7270235e4..a62b6ecf2 100644 --- a/packages/digit_components/CHANGELOG.md +++ b/packages/digit_components/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.2 +* Added privacy notice component + ## 1.0.1+1 * Changed similar dialogs to a common hideDialog diff --git a/packages/digit_components/example/pubspec.lock b/packages/digit_components/example/pubspec.lock index 5f036b9d0..87767b83c 100644 --- a/packages/digit_components/example/pubspec.lock +++ b/packages/digit_components/example/pubspec.lock @@ -231,7 +231,7 @@ packages: path: ".." relative: true source: path - version: "1.0.1+1" + version: "1.0.2" easy_stepper: dependency: transitive description: diff --git a/packages/digit_components/lib/blocs/localization.dart b/packages/digit_components/lib/blocs/localization.dart new file mode 100644 index 000000000..d393cfefa --- /dev/null +++ b/packages/digit_components/lib/blocs/localization.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +import 'localization_delegates.dart'; + + +// Class responsible for handling component localization +class ComponentLocalization { + final Locale locale; + final Future localizedStrings; + final List languages; + + ComponentLocalization(this.locale, this.localizedStrings, this.languages); + + // Method to get the current localization instance from context + static ComponentLocalization of(BuildContext context) { + return Localizations.of(context, ComponentLocalization)!; + } + + static final List _localizedStrings = []; + + // Method to get the delegate for localization + static LocalizationsDelegate getDelegate( + Future localizedStrings, List languages) => + ComponentLocalizationDelegate(localizedStrings, languages); + + // Method to load localized strings + Future load() async { + _localizedStrings.clear(); + // Iterate over localized strings and filter based on locale + for (var element in await localizedStrings) { + if (element.locale == '${locale.languageCode}_${locale.countryCode}') { + _localizedStrings.add(element); + } + } + + return true; + } + + // Method to translate a given localized value + String translate(String localizedValues) { + + if (_localizedStrings.isEmpty) { + return localizedValues; + } else { + final index = _localizedStrings.indexWhere( + (medium) => medium.code == localizedValues, + ); + + return index != -1 ? _localizedStrings[index].message : localizedValues; + } + } +} \ No newline at end of file diff --git a/packages/digit_components/lib/blocs/localization_delegates.dart b/packages/digit_components/lib/blocs/localization_delegates.dart new file mode 100644 index 000000000..3d2e2dd16 --- /dev/null +++ b/packages/digit_components/lib/blocs/localization_delegates.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; + +import 'localization.dart'; + + +class ComponentLocalizationDelegate + extends LocalizationsDelegate { + final Future localizedStrings; + final List languages; + + const ComponentLocalizationDelegate(this.localizedStrings, this.languages); + + @override + bool isSupported(Locale locale) { + return languages.map((e) { + final results = e.value.split('_'); + if (results.isNotEmpty) return results.first; + }).contains(locale.languageCode); + } + + @override + Future load(Locale locale) async { + ComponentLocalization localization = + ComponentLocalization(locale, localizedStrings, languages); + await localization.load(); + return localization; + } + + @override + bool shouldReload(covariant LocalizationsDelegate old) { + return true; + } +} \ No newline at end of file diff --git a/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.dart b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.dart new file mode 100644 index 000000000..f2d1f896c --- /dev/null +++ b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.dart @@ -0,0 +1,50 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'privacy_notice_model.freezed.dart'; +part 'privacy_notice_model.g.dart'; + +@freezed +class PrivacyNoticeModel with _$PrivacyNoticeModel { + const factory PrivacyNoticeModel({ + required String header, + required String module, + bool? active, + List? contents, + }) = _PrivacyNoticeModel; + + factory PrivacyNoticeModel.fromJson(Map json) => _$PrivacyNoticeModelFromJson(json); +} + +@freezed +class ContentNoticeModel with _$ContentNoticeModel { + const factory ContentNoticeModel({ + String? header, + List? descriptions, + }) = _ContentNoticeModel; + + factory ContentNoticeModel.fromJson(Map json) => _$ContentNoticeModelFromJson(json); +} + +@freezed +class DescriptionNoticeModel with _$DescriptionNoticeModel { + const factory DescriptionNoticeModel({ + String? text, + String? type, + bool? isBold, + List? subDescriptions, + }) = _DescriptionNoticeModel; + + factory DescriptionNoticeModel.fromJson(Map json) => _$DescriptionNoticeModelFromJson(json); +} + +@freezed +class SubDescriptionNoticeModel with _$SubDescriptionNoticeModel { + const factory SubDescriptionNoticeModel({ + String? text, + String? type, + bool? isBold, + bool? isSpaceRequired, + }) = _SubDescriptionNoticeModel; + + factory SubDescriptionNoticeModel.fromJson(Map json) => _$SubDescriptionNoticeModelFromJson(json); +} diff --git a/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.freezed.dart b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.freezed.dart new file mode 100644 index 000000000..2090ee866 --- /dev/null +++ b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.freezed.dart @@ -0,0 +1,808 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'privacy_notice_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +PrivacyNoticeModel _$PrivacyNoticeModelFromJson(Map json) { + return _PrivacyNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$PrivacyNoticeModel { + String get header => throw _privateConstructorUsedError; + String get module => throw _privateConstructorUsedError; + bool? get active => throw _privateConstructorUsedError; + List? get contents => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PrivacyNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PrivacyNoticeModelCopyWith<$Res> { + factory $PrivacyNoticeModelCopyWith( + PrivacyNoticeModel value, $Res Function(PrivacyNoticeModel) then) = + _$PrivacyNoticeModelCopyWithImpl<$Res, PrivacyNoticeModel>; + @useResult + $Res call( + {String header, + String module, + bool? active, + List? contents}); +} + +/// @nodoc +class _$PrivacyNoticeModelCopyWithImpl<$Res, $Val extends PrivacyNoticeModel> + implements $PrivacyNoticeModelCopyWith<$Res> { + _$PrivacyNoticeModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? header = null, + Object? module = null, + Object? active = freezed, + Object? contents = freezed, + }) { + return _then(_value.copyWith( + header: null == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String, + module: null == module + ? _value.module + : module // ignore: cast_nullable_to_non_nullable + as String, + active: freezed == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + contents: freezed == contents + ? _value.contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PrivacyNoticeModelImplCopyWith<$Res> + implements $PrivacyNoticeModelCopyWith<$Res> { + factory _$$PrivacyNoticeModelImplCopyWith(_$PrivacyNoticeModelImpl value, + $Res Function(_$PrivacyNoticeModelImpl) then) = + __$$PrivacyNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String header, + String module, + bool? active, + List? contents}); +} + +/// @nodoc +class __$$PrivacyNoticeModelImplCopyWithImpl<$Res> + extends _$PrivacyNoticeModelCopyWithImpl<$Res, _$PrivacyNoticeModelImpl> + implements _$$PrivacyNoticeModelImplCopyWith<$Res> { + __$$PrivacyNoticeModelImplCopyWithImpl(_$PrivacyNoticeModelImpl _value, + $Res Function(_$PrivacyNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? header = null, + Object? module = null, + Object? active = freezed, + Object? contents = freezed, + }) { + return _then(_$PrivacyNoticeModelImpl( + header: null == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String, + module: null == module + ? _value.module + : module // ignore: cast_nullable_to_non_nullable + as String, + active: freezed == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + contents: freezed == contents + ? _value._contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PrivacyNoticeModelImpl implements _PrivacyNoticeModel { + const _$PrivacyNoticeModelImpl( + {required this.header, + required this.module, + this.active, + final List? contents}) + : _contents = contents; + + factory _$PrivacyNoticeModelImpl.fromJson(Map json) => + _$$PrivacyNoticeModelImplFromJson(json); + + @override + final String header; + @override + final String module; + @override + final bool? active; + final List? _contents; + @override + List? get contents { + final value = _contents; + if (value == null) return null; + if (_contents is EqualUnmodifiableListView) return _contents; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'PrivacyNoticeModel(header: $header, module: $module, active: $active, contents: $contents)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PrivacyNoticeModelImpl && + (identical(other.header, header) || other.header == header) && + (identical(other.module, module) || other.module == module) && + (identical(other.active, active) || other.active == active) && + const DeepCollectionEquality().equals(other._contents, _contents)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, header, module, active, + const DeepCollectionEquality().hash(_contents)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PrivacyNoticeModelImplCopyWith<_$PrivacyNoticeModelImpl> get copyWith => + __$$PrivacyNoticeModelImplCopyWithImpl<_$PrivacyNoticeModelImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PrivacyNoticeModelImplToJson( + this, + ); + } +} + +abstract class _PrivacyNoticeModel implements PrivacyNoticeModel { + const factory _PrivacyNoticeModel( + {required final String header, + required final String module, + final bool? active, + final List? contents}) = _$PrivacyNoticeModelImpl; + + factory _PrivacyNoticeModel.fromJson(Map json) = + _$PrivacyNoticeModelImpl.fromJson; + + @override + String get header; + @override + String get module; + @override + bool? get active; + @override + List? get contents; + @override + @JsonKey(ignore: true) + _$$PrivacyNoticeModelImplCopyWith<_$PrivacyNoticeModelImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ContentNoticeModel _$ContentNoticeModelFromJson(Map json) { + return _ContentNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$ContentNoticeModel { + String? get header => throw _privateConstructorUsedError; + List? get descriptions => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ContentNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ContentNoticeModelCopyWith<$Res> { + factory $ContentNoticeModelCopyWith( + ContentNoticeModel value, $Res Function(ContentNoticeModel) then) = + _$ContentNoticeModelCopyWithImpl<$Res, ContentNoticeModel>; + @useResult + $Res call({String? header, List? descriptions}); +} + +/// @nodoc +class _$ContentNoticeModelCopyWithImpl<$Res, $Val extends ContentNoticeModel> + implements $ContentNoticeModelCopyWith<$Res> { + _$ContentNoticeModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? header = freezed, + Object? descriptions = freezed, + }) { + return _then(_value.copyWith( + header: freezed == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String?, + descriptions: freezed == descriptions + ? _value.descriptions + : descriptions // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ContentNoticeModelImplCopyWith<$Res> + implements $ContentNoticeModelCopyWith<$Res> { + factory _$$ContentNoticeModelImplCopyWith(_$ContentNoticeModelImpl value, + $Res Function(_$ContentNoticeModelImpl) then) = + __$$ContentNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? header, List? descriptions}); +} + +/// @nodoc +class __$$ContentNoticeModelImplCopyWithImpl<$Res> + extends _$ContentNoticeModelCopyWithImpl<$Res, _$ContentNoticeModelImpl> + implements _$$ContentNoticeModelImplCopyWith<$Res> { + __$$ContentNoticeModelImplCopyWithImpl(_$ContentNoticeModelImpl _value, + $Res Function(_$ContentNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? header = freezed, + Object? descriptions = freezed, + }) { + return _then(_$ContentNoticeModelImpl( + header: freezed == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String?, + descriptions: freezed == descriptions + ? _value._descriptions + : descriptions // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ContentNoticeModelImpl implements _ContentNoticeModel { + const _$ContentNoticeModelImpl( + {this.header, final List? descriptions}) + : _descriptions = descriptions; + + factory _$ContentNoticeModelImpl.fromJson(Map json) => + _$$ContentNoticeModelImplFromJson(json); + + @override + final String? header; + final List? _descriptions; + @override + List? get descriptions { + final value = _descriptions; + if (value == null) return null; + if (_descriptions is EqualUnmodifiableListView) return _descriptions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'ContentNoticeModel(header: $header, descriptions: $descriptions)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ContentNoticeModelImpl && + (identical(other.header, header) || other.header == header) && + const DeepCollectionEquality() + .equals(other._descriptions, _descriptions)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, header, const DeepCollectionEquality().hash(_descriptions)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ContentNoticeModelImplCopyWith<_$ContentNoticeModelImpl> get copyWith => + __$$ContentNoticeModelImplCopyWithImpl<_$ContentNoticeModelImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ContentNoticeModelImplToJson( + this, + ); + } +} + +abstract class _ContentNoticeModel implements ContentNoticeModel { + const factory _ContentNoticeModel( + {final String? header, + final List? descriptions}) = + _$ContentNoticeModelImpl; + + factory _ContentNoticeModel.fromJson(Map json) = + _$ContentNoticeModelImpl.fromJson; + + @override + String? get header; + @override + List? get descriptions; + @override + @JsonKey(ignore: true) + _$$ContentNoticeModelImplCopyWith<_$ContentNoticeModelImpl> get copyWith => + throw _privateConstructorUsedError; +} + +DescriptionNoticeModel _$DescriptionNoticeModelFromJson( + Map json) { + return _DescriptionNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$DescriptionNoticeModel { + String? get text => throw _privateConstructorUsedError; + String? get type => throw _privateConstructorUsedError; + bool? get isBold => throw _privateConstructorUsedError; + List? get subDescriptions => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $DescriptionNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DescriptionNoticeModelCopyWith<$Res> { + factory $DescriptionNoticeModelCopyWith(DescriptionNoticeModel value, + $Res Function(DescriptionNoticeModel) then) = + _$DescriptionNoticeModelCopyWithImpl<$Res, DescriptionNoticeModel>; + @useResult + $Res call( + {String? text, + String? type, + bool? isBold, + List? subDescriptions}); +} + +/// @nodoc +class _$DescriptionNoticeModelCopyWithImpl<$Res, + $Val extends DescriptionNoticeModel> + implements $DescriptionNoticeModelCopyWith<$Res> { + _$DescriptionNoticeModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? subDescriptions = freezed, + }) { + return _then(_value.copyWith( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + subDescriptions: freezed == subDescriptions + ? _value.subDescriptions + : subDescriptions // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$DescriptionNoticeModelImplCopyWith<$Res> + implements $DescriptionNoticeModelCopyWith<$Res> { + factory _$$DescriptionNoticeModelImplCopyWith( + _$DescriptionNoticeModelImpl value, + $Res Function(_$DescriptionNoticeModelImpl) then) = + __$$DescriptionNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String? text, + String? type, + bool? isBold, + List? subDescriptions}); +} + +/// @nodoc +class __$$DescriptionNoticeModelImplCopyWithImpl<$Res> + extends _$DescriptionNoticeModelCopyWithImpl<$Res, + _$DescriptionNoticeModelImpl> + implements _$$DescriptionNoticeModelImplCopyWith<$Res> { + __$$DescriptionNoticeModelImplCopyWithImpl( + _$DescriptionNoticeModelImpl _value, + $Res Function(_$DescriptionNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? subDescriptions = freezed, + }) { + return _then(_$DescriptionNoticeModelImpl( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + subDescriptions: freezed == subDescriptions + ? _value._subDescriptions + : subDescriptions // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$DescriptionNoticeModelImpl implements _DescriptionNoticeModel { + const _$DescriptionNoticeModelImpl( + {this.text, + this.type, + this.isBold, + final List? subDescriptions}) + : _subDescriptions = subDescriptions; + + factory _$DescriptionNoticeModelImpl.fromJson(Map json) => + _$$DescriptionNoticeModelImplFromJson(json); + + @override + final String? text; + @override + final String? type; + @override + final bool? isBold; + final List? _subDescriptions; + @override + List? get subDescriptions { + final value = _subDescriptions; + if (value == null) return null; + if (_subDescriptions is EqualUnmodifiableListView) return _subDescriptions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'DescriptionNoticeModel(text: $text, type: $type, isBold: $isBold, subDescriptions: $subDescriptions)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptionNoticeModelImpl && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.isBold, isBold) || other.isBold == isBold) && + const DeepCollectionEquality() + .equals(other._subDescriptions, _subDescriptions)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, text, type, isBold, + const DeepCollectionEquality().hash(_subDescriptions)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptionNoticeModelImplCopyWith<_$DescriptionNoticeModelImpl> + get copyWith => __$$DescriptionNoticeModelImplCopyWithImpl< + _$DescriptionNoticeModelImpl>(this, _$identity); + + @override + Map toJson() { + return _$$DescriptionNoticeModelImplToJson( + this, + ); + } +} + +abstract class _DescriptionNoticeModel implements DescriptionNoticeModel { + const factory _DescriptionNoticeModel( + {final String? text, + final String? type, + final bool? isBold, + final List? subDescriptions}) = + _$DescriptionNoticeModelImpl; + + factory _DescriptionNoticeModel.fromJson(Map json) = + _$DescriptionNoticeModelImpl.fromJson; + + @override + String? get text; + @override + String? get type; + @override + bool? get isBold; + @override + List? get subDescriptions; + @override + @JsonKey(ignore: true) + _$$DescriptionNoticeModelImplCopyWith<_$DescriptionNoticeModelImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SubDescriptionNoticeModel _$SubDescriptionNoticeModelFromJson( + Map json) { + return _SubDescriptionNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$SubDescriptionNoticeModel { + String? get text => throw _privateConstructorUsedError; + String? get type => throw _privateConstructorUsedError; + bool? get isBold => throw _privateConstructorUsedError; + bool? get isSpaceRequired => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SubDescriptionNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SubDescriptionNoticeModelCopyWith<$Res> { + factory $SubDescriptionNoticeModelCopyWith(SubDescriptionNoticeModel value, + $Res Function(SubDescriptionNoticeModel) then) = + _$SubDescriptionNoticeModelCopyWithImpl<$Res, SubDescriptionNoticeModel>; + @useResult + $Res call({String? text, String? type, bool? isBold, bool? isSpaceRequired}); +} + +/// @nodoc +class _$SubDescriptionNoticeModelCopyWithImpl<$Res, + $Val extends SubDescriptionNoticeModel> + implements $SubDescriptionNoticeModelCopyWith<$Res> { + _$SubDescriptionNoticeModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? isSpaceRequired = freezed, + }) { + return _then(_value.copyWith( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + isSpaceRequired: freezed == isSpaceRequired + ? _value.isSpaceRequired + : isSpaceRequired // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SubDescriptionNoticeModelImplCopyWith<$Res> + implements $SubDescriptionNoticeModelCopyWith<$Res> { + factory _$$SubDescriptionNoticeModelImplCopyWith( + _$SubDescriptionNoticeModelImpl value, + $Res Function(_$SubDescriptionNoticeModelImpl) then) = + __$$SubDescriptionNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? text, String? type, bool? isBold, bool? isSpaceRequired}); +} + +/// @nodoc +class __$$SubDescriptionNoticeModelImplCopyWithImpl<$Res> + extends _$SubDescriptionNoticeModelCopyWithImpl<$Res, + _$SubDescriptionNoticeModelImpl> + implements _$$SubDescriptionNoticeModelImplCopyWith<$Res> { + __$$SubDescriptionNoticeModelImplCopyWithImpl( + _$SubDescriptionNoticeModelImpl _value, + $Res Function(_$SubDescriptionNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? isSpaceRequired = freezed, + }) { + return _then(_$SubDescriptionNoticeModelImpl( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + isSpaceRequired: freezed == isSpaceRequired + ? _value.isSpaceRequired + : isSpaceRequired // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SubDescriptionNoticeModelImpl implements _SubDescriptionNoticeModel { + const _$SubDescriptionNoticeModelImpl( + {this.text, this.type, this.isBold, this.isSpaceRequired}); + + factory _$SubDescriptionNoticeModelImpl.fromJson(Map json) => + _$$SubDescriptionNoticeModelImplFromJson(json); + + @override + final String? text; + @override + final String? type; + @override + final bool? isBold; + @override + final bool? isSpaceRequired; + + @override + String toString() { + return 'SubDescriptionNoticeModel(text: $text, type: $type, isBold: $isBold, isSpaceRequired: $isSpaceRequired)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SubDescriptionNoticeModelImpl && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.isBold, isBold) || other.isBold == isBold) && + (identical(other.isSpaceRequired, isSpaceRequired) || + other.isSpaceRequired == isSpaceRequired)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, text, type, isBold, isSpaceRequired); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SubDescriptionNoticeModelImplCopyWith<_$SubDescriptionNoticeModelImpl> + get copyWith => __$$SubDescriptionNoticeModelImplCopyWithImpl< + _$SubDescriptionNoticeModelImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SubDescriptionNoticeModelImplToJson( + this, + ); + } +} + +abstract class _SubDescriptionNoticeModel implements SubDescriptionNoticeModel { + const factory _SubDescriptionNoticeModel( + {final String? text, + final String? type, + final bool? isBold, + final bool? isSpaceRequired}) = _$SubDescriptionNoticeModelImpl; + + factory _SubDescriptionNoticeModel.fromJson(Map json) = + _$SubDescriptionNoticeModelImpl.fromJson; + + @override + String? get text; + @override + String? get type; + @override + bool? get isBold; + @override + bool? get isSpaceRequired; + @override + @JsonKey(ignore: true) + _$$SubDescriptionNoticeModelImplCopyWith<_$SubDescriptionNoticeModelImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.g.dart b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.g.dart new file mode 100644 index 000000000..2e10758a5 --- /dev/null +++ b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.g.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'privacy_notice_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$PrivacyNoticeModelImpl _$$PrivacyNoticeModelImplFromJson( + Map json) => + _$PrivacyNoticeModelImpl( + header: json['header'] as String, + module: json['module'] as String, + active: json['active'] as bool?, + contents: (json['contents'] as List?) + ?.map((e) => ContentNoticeModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$PrivacyNoticeModelImplToJson( + _$PrivacyNoticeModelImpl instance) => + { + 'header': instance.header, + 'module': instance.module, + 'active': instance.active, + 'contents': instance.contents, + }; + +_$ContentNoticeModelImpl _$$ContentNoticeModelImplFromJson( + Map json) => + _$ContentNoticeModelImpl( + header: json['header'] as String?, + descriptions: (json['descriptions'] as List?) + ?.map( + (e) => DescriptionNoticeModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$ContentNoticeModelImplToJson( + _$ContentNoticeModelImpl instance) => + { + 'header': instance.header, + 'descriptions': instance.descriptions, + }; + +_$DescriptionNoticeModelImpl _$$DescriptionNoticeModelImplFromJson( + Map json) => + _$DescriptionNoticeModelImpl( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + subDescriptions: (json['subDescriptions'] as List?) + ?.map((e) => + SubDescriptionNoticeModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$DescriptionNoticeModelImplToJson( + _$DescriptionNoticeModelImpl instance) => + { + 'text': instance.text, + 'type': instance.type, + 'isBold': instance.isBold, + 'subDescriptions': instance.subDescriptions, + }; + +_$SubDescriptionNoticeModelImpl _$$SubDescriptionNoticeModelImplFromJson( + Map json) => + _$SubDescriptionNoticeModelImpl( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + isSpaceRequired: json['isSpaceRequired'] as bool?, + ); + +Map _$$SubDescriptionNoticeModelImplToJson( + _$SubDescriptionNoticeModelImpl instance) => + { + 'text': instance.text, + 'type': instance.type, + 'isBold': instance.isBold, + 'isSpaceRequired': instance.isSpaceRequired, + }; diff --git a/packages/digit_components/lib/models/privacy_policy_model.dart b/packages/digit_components/lib/models/privacy_policy_model.dart new file mode 100644 index 000000000..834e44c60 --- /dev/null +++ b/packages/digit_components/lib/models/privacy_policy_model.dart @@ -0,0 +1,95 @@ +class PrivacyPolicy { + final String? header; // Changed to nullable + final String? module; // Changed to nullable + final bool? active; + final List? contents; + + PrivacyPolicy({ + this.header, + this.module, + this.active, + this.contents, + }); + + // Factory constructor to create PrivacyPolicy from JSON + factory PrivacyPolicy.fromJson(Map json) { + return PrivacyPolicy( + header: json['header'] as String?, + module: json['module'] as String?, + active: json['active'] as bool?, + contents: (json['contents'] as List?) + ?.map((item) => Content.fromJson(item as Map)) + .toList(), + ); + } +} + +class Content { + final String? header; // Changed to nullable + final List? descriptions; + + Content({ + this.header, + this.descriptions, + }); + + // Factory constructor to create Content from JSON + factory Content.fromJson(Map json) { + return Content( + header: json['header'] as String?, + descriptions: (json['descriptions'] as List?) + ?.map((item) => Description.fromJson(item as Map)) + .toList(), + ); + } +} + +class Description { + final String? text; // Changed to nullable + final String? type; // Changed to nullable + final bool? isBold; + final List? subDescriptions; + + Description({ + this.text, + this.type, + this.isBold, + this.subDescriptions, + }); + + // Factory constructor to create Description from JSON + factory Description.fromJson(Map json) { + return Description( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + subDescriptions: (json['subDescriptions'] as List?) + ?.map((item) => SubDescription.fromJson(item as Map)) + .toList(), + ); + } +} + +class SubDescription { + final String? text; // Changed to nullable + final String? type; // Changed to nullable + final bool? isBold; + final bool? isSpaceRequired; + + SubDescription({ + this.text, + this.type, + this.isBold, + this.isSpaceRequired, + }); + + // Factory constructor to create SubDescription from JSON + factory SubDescription.fromJson(Map json) { + return SubDescription( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + isSpaceRequired: json['isSpaceRequired'] as bool?, + ); + } +} diff --git a/packages/digit_components/lib/utils/i18_key_constants.dart b/packages/digit_components/lib/utils/i18_key_constants.dart new file mode 100644 index 000000000..1d7e1fcca --- /dev/null +++ b/packages/digit_components/lib/utils/i18_key_constants.dart @@ -0,0 +1,20 @@ +library i18; + +const privacyPolicy = PrivacyPolicy(); + +class PrivacyPolicy { + const PrivacyPolicy(); + + String get acceptText { + return 'PRIVACY_POLICY_ACCEPT_TEXT'; + } + + String get declineText { + return 'PRIVACY_POLICY_DECLINE_TEXT'; + } + + String get privacyNoticeText => 'PRIVACY_POLICY_TEXT'; + String get privacyPolicyLinkText => 'PRIVACY_POLICY_LINK_TEXT'; + String get privacyPolicyValidationText => 'PRIVACY_POLICY_VALIDATION_TEXT'; + +} \ No newline at end of file diff --git a/packages/digit_components/lib/widgets/atoms/selection_card.dart b/packages/digit_components/lib/widgets/atoms/selection_card.dart index 1a9191c2f..3c1e256b5 100644 --- a/packages/digit_components/lib/widgets/atoms/selection_card.dart +++ b/packages/digit_components/lib/widgets/atoms/selection_card.dart @@ -43,7 +43,9 @@ class _SelectionBoxState extends State> { } if (widget.equalWidthOptions) { + WidgetsBinding.instance.addPostFrameCallback((_) { _calculateMaxOptionWidth(); + }); } } @@ -51,7 +53,9 @@ class _SelectionBoxState extends State> { void didChangeDependencies() { super.didChangeDependencies(); if (widget.equalWidthOptions) { + WidgetsBinding.instance.addPostFrameCallback((_) { _calculateMaxOptionWidth(); + }); } } @override diff --git a/packages/digit_components/lib/widgets/localized.dart b/packages/digit_components/lib/widgets/localized.dart new file mode 100644 index 000000000..2d3d6a479 --- /dev/null +++ b/packages/digit_components/lib/widgets/localized.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import '../blocs/localization.dart'; + +abstract class LocalizedStatefulWidget extends StatefulWidget { + final ComponentLocalization? appLocalizations; + + const LocalizedStatefulWidget({ + super.key, + this.appLocalizations, + }); +} + +abstract class LocalizedState + extends State { + late ComponentLocalization _localizations; + + ComponentLocalization get localizations => _localizations; + + set localizations(ComponentLocalization localizations) { + if (mounted) { + setState(() { + _localizations = localizations; + }); + } + } + + @override + @mustCallSuper + void didChangeDependencies() { + _localizations = widget.appLocalizations ?? ComponentLocalization.of(context); + super.didChangeDependencies(); + } +} \ No newline at end of file diff --git a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_component.dart b/packages/digit_components/lib/widgets/privacy_notice/privacy_component.dart similarity index 96% rename from apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_component.dart rename to packages/digit_components/lib/widgets/privacy_notice/privacy_component.dart index e246dc30a..f2d9aa0f0 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_component.dart +++ b/packages/digit_components/lib/widgets/privacy_notice/privacy_component.dart @@ -1,7 +1,7 @@ import 'package:digit_components/digit_components.dart'; +import 'package:digit_components/models/privacy_notice/privacy_notice_model.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import '../../data/local_store/no_sql/schema/app_configuration.dart'; import '../localized.dart'; import 'privacy_notice_dialog.dart'; import 'package:reactive_forms/reactive_forms.dart'; @@ -10,7 +10,7 @@ class PrivacyComponent extends LocalizedStatefulWidget { final String formControlName; final String text; final String linkText; - final PrivacyPolicy? privacyPolicy; + final PrivacyNoticeModel? privacyPolicy; final String? trailingText; final String validationMessage; @@ -21,7 +21,7 @@ class PrivacyComponent extends LocalizedStatefulWidget { required this.text, required this.linkText, this.trailingText, - this.privacyPolicy, + this.privacyPolicy, required this.validationMessage, }); @@ -54,6 +54,7 @@ class _PrivacyComponentState extends LocalizedState { return ValueListenableBuilder( valueListenable: checkboxStateNotifier, builder: (context, value, child) { + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -120,7 +121,7 @@ class _PrivacyComponentState extends LocalizedState { builder: (context) { return FullPageDialog( - privacyPolicy: widget.privacyPolicy ?? PrivacyPolicy(), + privacyPolicy: widget.privacyPolicy ?? const PrivacyNoticeModel(header: '', module: ''), onAccept: () { checkboxStateNotifier.value = true; field.didChange(true); diff --git a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_dialog.dart b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_dialog.dart similarity index 93% rename from apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_dialog.dart rename to packages/digit_components/lib/widgets/privacy_notice/privacy_notice_dialog.dart index 55421cfc2..696b2c681 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_dialog.dart +++ b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_dialog.dart @@ -1,17 +1,17 @@ +import 'package:digit_components/models/privacy_notice/privacy_notice_model.dart'; import 'package:digit_components/theme/colors.dart'; import 'package:digit_components/widgets/digit_card.dart'; import 'package:digit_components/widgets/digit_elevated_button.dart'; import 'package:digit_components/widgets/digit_outline_button.dart'; import 'package:flutter/material.dart'; -import '../../data/local_store/no_sql/schema/app_configuration.dart'; +import '../../theme/digit_theme.dart'; import '../localized.dart'; import 'privacy_notice_expand_component.dart'; import '../../utils/i18_key_constants.dart' as i18; -import '../../models/privacy_notice/privacy_notice_model.dart'; -import '../showcase/showcase_wrappers.dart'; + class FullPageDialog extends LocalizedStatefulWidget { - final PrivacyPolicy privacyPolicy; + final PrivacyNoticeModel privacyPolicy; final VoidCallback onAccept; final VoidCallback onDecline; @@ -24,10 +24,10 @@ class FullPageDialog extends LocalizedStatefulWidget { }); @override - _FullPageDialogState createState() => _FullPageDialogState(); + FullPageDialogState createState() => FullPageDialogState(); } -class _FullPageDialogState extends LocalizedState { +class FullPageDialogState extends LocalizedState { @override Widget build(BuildContext context) { return Dialog.fullscreen( @@ -49,7 +49,7 @@ class _FullPageDialogState extends LocalizedState { Padding( padding: const EdgeInsets.only(top: kPadding*3, left: 0), child: Text( - localizations.translate(widget.privacyPolicy.header), + localizations.translate(widget.privacyPolicy.header ?? ''), maxLines: 3, style: Theme.of(context).textTheme.displayMedium?.copyWith( color: const DigitColors().woodsmokeBlack, diff --git a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_expand_component.dart b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_expand_component.dart similarity index 91% rename from apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_expand_component.dart rename to packages/digit_components/lib/widgets/privacy_notice/privacy_notice_expand_component.dart index 6f3f6006a..50bf2eb05 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_expand_component.dart +++ b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_expand_component.dart @@ -1,11 +1,11 @@ -import 'package:closed_household/widgets/showcase/showcase_wrappers.dart'; import 'package:digit_components/theme/colors.dart'; import 'package:flutter/material.dart'; -import '../../data/local_store/no_sql/schema/app_configuration.dart'; +import '../../models/privacy_notice/privacy_notice_model.dart'; +import '../../theme/digit_theme.dart'; import '../localized.dart'; class ExpandableSection extends LocalizedStatefulWidget { - final Content content; + final ContentNoticeModel content; const ExpandableSection({ super.key, @@ -14,10 +14,10 @@ class ExpandableSection extends LocalizedStatefulWidget { }); @override - _ExpandableSectionState createState() => _ExpandableSectionState(); + ExpandableSectionState createState() => ExpandableSectionState(); } -class _ExpandableSectionState extends LocalizedState { +class ExpandableSectionState extends LocalizedState { bool _isExpanded = false; @override @@ -75,7 +75,7 @@ class _ExpandableSectionState extends LocalizedState { children: widget.content.descriptions!.asMap().entries.map((entry) { int index = entry.key; - Description desc = entry.value; + DescriptionNoticeModel desc = entry.value; int? stepNumber = desc.type == 'step' ? index + 1 : null; return DescriptionWidget( description: desc, @@ -91,7 +91,7 @@ class _ExpandableSectionState extends LocalizedState { } class DescriptionWidget extends LocalizedStatefulWidget { - final Description description; + final DescriptionNoticeModel description; final int? stepNumber; const DescriptionWidget({ @@ -102,10 +102,10 @@ class DescriptionWidget extends LocalizedStatefulWidget { }); @override - _DescriptionWidgetState createState() => _DescriptionWidgetState(); + DescriptionWidgetState createState() => DescriptionWidgetState(); } -class _DescriptionWidgetState extends LocalizedState { +class DescriptionWidgetState extends LocalizedState { @override Widget build(BuildContext context) { final descriptionText = widget.description.text ?? ''; @@ -201,7 +201,7 @@ class _DescriptionWidgetState extends LocalizedState { } class SubDescriptionWidget extends LocalizedStatefulWidget { - final SubDescription subDescription; + final SubDescriptionNoticeModel subDescription; final int? stepNumber; const SubDescriptionWidget({ @@ -212,10 +212,10 @@ class SubDescriptionWidget extends LocalizedStatefulWidget { }); @override - _SubDescriptionWidgetState createState() => _SubDescriptionWidgetState(); + SubDescriptionWidgetState createState() => SubDescriptionWidgetState(); } -class _SubDescriptionWidgetState extends LocalizedState { +class SubDescriptionWidgetState extends LocalizedState { @override Widget build(BuildContext context) { final subDescriptionText = widget.subDescription.text ?? ''; diff --git a/packages/digit_components/pubspec.lock b/packages/digit_components/pubspec.lock index 7c84c45c4..328678755 100644 --- a/packages/digit_components/pubspec.lock +++ b/packages/digit_components/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.2.0" + ansicolor: + dependency: transitive + description: + name: ansicolor + sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" + url: "https://pub.dev" + source: hosted + version: "2.0.3" archive: dependency: transitive description: @@ -201,6 +209,21 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + dart_mappable: + dependency: transitive + description: + name: dart_mappable + sha256: "47269caf2060533c29b823ff7fa9706502355ffcb61e7f2a374e3a0fb2f2c3f0" + url: "https://pub.dev" + source: hosted + version: "4.2.2" + dart_mappable_builder: + dependency: "direct overridden" + description: + path: "../dart_mappable_builder" + relative: true + source: path + version: "4.2.0" dart_style: dependency: transitive description: @@ -488,6 +511,30 @@ packages: url: "https://pub.dev" source: hosted version: "6.8.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -540,26 +587,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.0" mime: dependency: transitive description: @@ -628,10 +675,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_provider: dependency: transitive description: @@ -881,26 +928,26 @@ packages: dependency: transitive description: name: test - sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" url: "https://pub.dev" source: hosted - version: "1.24.9" + version: "1.25.2" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" test_core: dependency: transitive description: name: test_core - sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" url: "https://pub.dev" source: hosted - version: "0.5.9" + version: "0.6.0" timing: dependency: transitive description: @@ -909,6 +956,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + type_plus: + dependency: transitive + description: + name: type_plus + sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 + url: "https://pub.dev" + source: hosted + version: "2.1.1" typed_data: dependency: transitive description: @@ -929,10 +984,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" watcher: dependency: transitive description: @@ -990,5 +1045,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <3.9.0" - flutter: ">=3.16.0" + dart: ">=3.3.0 <3.9.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/digit_components/pubspec.yaml b/packages/digit_components/pubspec.yaml index 901f6c61c..f693b4a82 100644 --- a/packages/digit_components/pubspec.yaml +++ b/packages/digit_components/pubspec.yaml @@ -1,6 +1,6 @@ name: digit_components description: Digit UI Design specification Flutter widgets. Import this package by adding digit_components in respective pubspec.yaml dependencies. -version: 1.0.1+1 +version: 1.0.2 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/digit_components repository: https://github.com/egovernments/health-campaign-field-worker-app diff --git a/packages/digit_data_model/CHANGELOG.md b/packages/digit_data_model/CHANGELOG.md index 49f954173..949ee91e7 100644 --- a/packages/digit_data_model/CHANGELOG.md +++ b/packages/digit_data_model/CHANGELOG.md @@ -1,12 +1,30 @@ +## 1.0.4-dev.5 + +* Merged pgr and checklist changes + ## 1.0.3+1 * Updated oplog transactions to synchronous - fix for write transaction lock +## 1.0.4-dev.4 + +* synced with 1.0.4-dev.3 changes + ## 1.0.4-dev.3 * Updated oplog transactions to synchronous - fix for write transaction lock * Same change in 1.0.3-hotfix, 1.0.4-dev.3 +## 1.0.4-dev.2 + +* Removed Service and Service Definition models + - Removed Service repositories and Service blocs to integrate in checklist package + +## 1.0.4-dev.1 + +* Separated PGR Package +* Moved Models, Bloc, Repositories related to PGR Package + ## 1.0.3 * Added localization table diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart index 5ac28bd5d..3bb9ed6c1 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart @@ -11,7 +11,7 @@ import '../../../models/entities/address_type.dart'; import '../../../models/entities/beneficiary_type.dart'; import '../../../models/entities/blood_group.dart'; import '../../../models/entities/gender.dart'; -import '../../../models/pgr_complaints/pgr_complaints.dart'; +import '../../../models/entities/pgr_application_status.dart'; import 'tables/address.dart'; import 'tables/attributes.dart'; import 'tables/boundary.dart'; diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/pgr_service.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/pgr_service.dart index d6934513b..abaa3745c 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/pgr_service.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/pgr_service.dart @@ -1,6 +1,6 @@ import 'package:drift/drift.dart'; -import '../../../../models/pgr_complaints/pgr_complaints.dart'; +import '/models/entities/pgr_application_status.dart'; class PgrService extends Table { diff --git a/packages/digit_data_model/lib/data/oplog/oplog.dart b/packages/digit_data_model/lib/data/oplog/oplog.dart index c22c3ede1..6ea7b7ba9 100644 --- a/packages/digit_data_model/lib/data/oplog/oplog.dart +++ b/packages/digit_data_model/lib/data/oplog/oplog.dart @@ -163,59 +163,6 @@ class ProjectOpLogManager extends OpLogManager { entity.nonRecoverableError; } -class ServiceDefinitionOpLogManager - extends OpLogManager { - ServiceDefinitionOpLogManager(super.isar); - - @override - ServiceDefinitionModel applyServerGeneratedIdToEntity( - ServiceDefinitionModel entity, - String serverGeneratedId, - int rowVersion, - ) => - entity.copyWith(id: serverGeneratedId, rowVersion: rowVersion); - - @override - String getClientReferenceId(ServiceDefinitionModel entity) { - throw UnimplementedError(); - } - - @override - String? getServerGeneratedId(ServiceDefinitionModel entity) => entity.id; - - @override - int? getRowVersion(ServiceDefinitionModel entity) => entity.rowVersion; - - @override - bool? getNonRecoverableError(ServiceDefinitionModel entity) => - entity.nonRecoverableError; -} - -class ServiceOpLogManager extends OpLogManager { - ServiceOpLogManager(super.isar); - - @override - ServiceModel applyServerGeneratedIdToEntity( - ServiceModel entity, - String serverGeneratedId, - int rowVersion, - ) => - entity.copyWith(id: serverGeneratedId, rowVersion: rowVersion); - - @override - String getClientReferenceId(ServiceModel entity) => entity.clientId; - - @override - String? getServerGeneratedId(ServiceModel entity) => entity.id; - - @override - int? getRowVersion(ServiceModel entity) => entity.rowVersion; - - @override - bool? getNonRecoverableError(ServiceModel entity) => - entity.nonRecoverableError; -} - class ProjectResourceOpLogManager extends OpLogManager { ProjectResourceOpLogManager(super.isar); @@ -292,92 +239,3 @@ class BoundaryOpLogManager extends OpLogManager { bool? getNonRecoverableError(BoundaryModel entity) => throw UnimplementedError(); } - -class PgrServiceOpLogManager extends OpLogManager { - PgrServiceOpLogManager(super.isar); - - @override - PgrServiceModel applyServerGeneratedIdToEntity( - PgrServiceModel entity, - String serverGeneratedId, - int rowVersion, - ) => - entity.copyWith( - serviceRequestId: serverGeneratedId, - rowVersion: rowVersion, - ); - - @override - String getClientReferenceId(PgrServiceModel entity) { - return entity.clientReferenceId; - } - - @override - String? getServerGeneratedId(PgrServiceModel entity) { - return entity.serviceRequestId; - } - - @override - int? getRowVersion(PgrServiceModel entity) => entity.rowVersion; - - @override - bool? getNonRecoverableError(PgrServiceModel entity) => - entity.nonRecoverableError; - - @override - Future>> getPendingUpSync( - DataModelType type, { - required String createdBy, - }) async { - final pendingEntries = await isar.opLogs - .filter() - .entityTypeEqualTo(type) - .operationEqualTo(DataOperation.create) - .serverGeneratedIdIsNull() - .syncedUpEqualTo(false) - .syncedDownEqualTo(false) - .createdByEqualTo(createdBy) - .sortByCreatedAt() - .findAll(); - - final entriesList = pendingEntries.map((e) { - return OpLogEntry.fromOpLog(e); - }).toList(); - - return entriesList; - } - - //Note: PendingDownSync is not required for PGR Create Oplogs. This creates Mapper Exception issue for checking pending downsync entries of complaints type - // @override - // Future>> getPendingDownSync( - // DataModelType type, { - // required String createdBy, - // }) async { - // final pendingEntries = await isar.opLogs - // .filter() - // .entityTypeEqualTo(type) - // .serverGeneratedIdIsNotNull() - // .syncedUpEqualTo(true) - // .syncedDownEqualTo(false) - // .createdByEqualTo(createdBy) - // .sortByCreatedAt() - // .findAll(); - // - // final entriesList = pendingEntries - // .map((e) { - // final entity = e.getEntity(); - // if ([ - // PgrServiceApplicationStatus.created, - // PgrServiceApplicationStatus.pendingAssignment, - // ].contains(entity.applicationStatus)) { - // return OpLogEntry.fromOpLog(e); - // } - // - // return null; - // }) - // .whereNotNull() - // .toList(); - // - // return entriesList; - // } -} diff --git a/packages/digit_data_model/lib/data/repositories/local/base/service_attributes_base.dart b/packages/digit_data_model/lib/data/repositories/local/base/service_attributes_base.dart deleted file mode 100644 index 038ba41fd..000000000 --- a/packages/digit_data_model/lib/data/repositories/local/base/service_attributes_base.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:digit_data_model/data_model.dart'; -import 'package:drift/drift.dart'; - -abstract class ServiceAttributesLocalBaseRepository - extends LocalRepository { - const ServiceAttributesLocalBaseRepository(super.sql, super.opLogManager); - - @override - DataModelType get type => DataModelType.serviceAttributes; - - TableInfo get table => sql.serviceAttributes; -} diff --git a/packages/digit_data_model/lib/data/repositories/local/base/service_base.dart b/packages/digit_data_model/lib/data/repositories/local/base/service_base.dart deleted file mode 100644 index 0b0d19dac..000000000 --- a/packages/digit_data_model/lib/data/repositories/local/base/service_base.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:digit_data_model/data_model.dart'; -import 'package:drift/drift.dart'; - -abstract class ServiceLocalBaseRepository - extends LocalRepository { - const ServiceLocalBaseRepository(super.sql, super.opLogManager); - - @override - DataModelType get type => DataModelType.service; - - TableInfo get table => sql.service; -} \ No newline at end of file diff --git a/packages/digit_data_model/lib/data/repositories/local/base/service_definition_base.dart b/packages/digit_data_model/lib/data/repositories/local/base/service_definition_base.dart deleted file mode 100644 index 9a5e0043b..000000000 --- a/packages/digit_data_model/lib/data/repositories/local/base/service_definition_base.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:digit_data_model/data_model.dart'; -import 'package:drift/drift.dart'; - - -abstract class ServiceDefinitionLocalBaseRepository - extends LocalRepository { - const ServiceDefinitionLocalBaseRepository(super.sql, super.opLogManager); - - @override - DataModelType get type => DataModelType.serviceDefinition; - - TableInfo get table => sql.serviceDefinition; -} diff --git a/packages/digit_data_model/lib/data/repositories/remote/facility.dart b/packages/digit_data_model/lib/data/repositories/remote/facility.dart index 3703e1198..1c4635243 100644 --- a/packages/digit_data_model/lib/data/repositories/remote/facility.dart +++ b/packages/digit_data_model/lib/data/repositories/remote/facility.dart @@ -6,8 +6,8 @@ import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:dio/dio.dart'; - -class FacilityRemoteRepository extends RemoteRepository { +class FacilityRemoteRepository + extends RemoteRepository { FacilityRemoteRepository( super.dio, { required super.actionMap, @@ -17,20 +17,25 @@ class FacilityRemoteRepository extends RemoteRepository> search( - FacilitySearchModel query, { - int? offSet, - int? limit, - }) async { + FacilitySearchModel query, { + int? offSet, + int? limit, + }) async { int defaultBatchSize = limit ?? 100; // Default batch size for fetching data int currentOffset = offSet ?? 0; List allResults = []; - bool hasMoreData = true; - List>? lastResponse; - while (hasMoreData) { + //To fetch the totalCount from the first Response + bool flag = true; + + //Total number of records + var totalCount = 0; + + do { Response response; + //Execute the request try { response = await executeFuture( future: () async { @@ -42,17 +47,9 @@ class FacilityRemoteRepository extends RemoteRepository>().toList(); - - if (lastResponse != null && lastResponse.toString() == entityList.toString()) { - // If the last response is equal to the current response, stop fetching more data - break; - } + final entityList = + entityResponse.whereType>().toList(); List currentBatch; try { - currentBatch = entityList.map((e) => MapperContainer.globals.fromMap(e)).toList(); + currentBatch = entityList + .map((e) => MapperContainer.globals.fromMap(e)) + .toList(); } catch (e) { rethrow; } - if (currentBatch.isEmpty) { - hasMoreData = false; // if no more data stop fetching - } else { - allResults.addAll(currentBatch); - currentOffset += defaultBatchSize; - lastResponse = entityList; // Update lastResponse to the current response - } - } + allResults.addAll(currentBatch); + currentOffset += defaultBatchSize; + totalCount -= defaultBatchSize; + + //If remaining record is less than defaultBatchSize, adjust the Batch size + if (totalCount < defaultBatchSize) defaultBatchSize = totalCount; + } while (totalCount > 0); return allResults; } diff --git a/packages/digit_data_model/lib/data_model.dart b/packages/digit_data_model/lib/data_model.dart index 15e7ae7be..9524a38d3 100644 --- a/packages/digit_data_model/lib/data_model.dart +++ b/packages/digit_data_model/lib/data_model.dart @@ -18,8 +18,6 @@ export 'blocs/product_variant/product_variant.dart'; export 'blocs/project_facility/project_facility.dart'; export 'blocs/user/user.dart'; export 'blocs/boundary/boundary.dart'; -export 'blocs/service/service.dart'; -export 'blocs/service_definition/service_definition.dart'; export 'data/data_repository.dart'; export 'data/local_store/no_sql/schema/oplog.dart' hide AdditionalId; export 'data/local_store/sql_store/sql_store.dart'; @@ -34,27 +32,20 @@ export 'data/repositories/local/base/project_facility_base.dart'; export 'data/repositories/local/base/project_product_variant_base.dart'; export 'data/repositories/local/base/project_resource_base.dart'; export 'data/repositories/local/base/project_staff_base.dart'; -export 'data/repositories/local/base/service_attributes_base.dart'; -export 'data/repositories/local/base/service_base.dart'; -export 'data/repositories/local/base/service_definition_base.dart'; export 'data/repositories/local/base/user_base.dart'; export 'data/repositories/local/boundary.dart'; export 'data/repositories/local/facility.dart'; export 'data/repositories/local/individual.dart'; -export 'data/repositories/local/pgr_service.dart'; export 'data/repositories/local/product_variant.dart'; export 'data/repositories/local/project.dart'; export 'data/repositories/local/project_facility.dart'; export 'data/repositories/local/project_resource.dart'; export 'data/repositories/local/project_staff.dart'; -export 'data/repositories/local/service.dart'; -export 'data/repositories/local/service_definition.dart'; export 'data/repositories/oplog/oplog.dart'; export 'data/repositories/remote/attributes.dart'; export 'data/repositories/remote/boundary.dart'; export 'data/repositories/remote/facility.dart'; export 'data/repositories/remote/individual.dart'; -export 'data/repositories/remote/pgr_service.dart'; export 'data/repositories/remote/product.dart'; export 'data/repositories/remote/product_variant.dart'; export 'data/repositories/remote/project.dart'; @@ -62,9 +53,6 @@ export 'data/repositories/remote/project_facility.dart'; export 'data/repositories/remote/project_product_variant.dart'; export 'data/repositories/remote/project_resource.dart'; export 'data/repositories/remote/project_staff.dart'; -export 'data/repositories/remote/service.dart'; -export 'data/repositories/remote/service_attributes.dart'; -export 'data/repositories/remote/service_definition.dart'; export 'data/repositories/remote/user.dart'; export 'models/entities/address.dart'; export 'models/entities/attributes.dart'; @@ -87,16 +75,10 @@ export 'models/entities/project_product_variant.dart'; export 'models/entities/project_resource.dart'; export 'models/entities/project_staff.dart'; export 'models/entities/project_type.dart'; -export 'models/entities/service.dart'; -export 'models/entities/service_attributes.dart'; -export 'models/entities/service_definition.dart'; export 'models/entities/target.dart'; export 'models/entities/user.dart'; export 'models/oplog/oplog_entry.dart' show OpLogEntry; export 'models/oplog/oplog_entry.dart'; -export 'models/pgr_complaints/pgr_address.dart'; -export 'models/pgr_complaints/pgr_complaints.dart'; -export 'models/pgr_complaints/pgr_complaints_response.dart'; export 'models/project_type/project_type_model.dart'; export 'utils/constants.dart' hide EntityPlurals; export 'utils/utils.dart'; diff --git a/packages/digit_data_model/lib/data_model.init.dart b/packages/digit_data_model/lib/data_model.init.dart index 3abdaf1ed..65238f663 100644 --- a/packages/digit_data_model/lib/data_model.init.dart +++ b/packages/digit_data_model/lib/data_model.init.dart @@ -17,23 +17,18 @@ import 'models/entities/identifier.dart' as p10; import 'models/entities/individual.dart' as p11; import 'models/entities/locality.dart' as p12; import 'models/entities/name.dart' as p13; -import 'models/entities/product.dart' as p14; -import 'models/entities/product_variant.dart' as p15; -import 'models/entities/project.dart' as p16; -import 'models/entities/project_facility.dart' as p17; -import 'models/entities/project_product_variant.dart' as p18; -import 'models/entities/project_resource.dart' as p19; -import 'models/entities/project_staff.dart' as p20; -import 'models/entities/project_type.dart' as p21; -import 'models/entities/service.dart' as p22; -import 'models/entities/service_attributes.dart' as p23; -import 'models/entities/service_definition.dart' as p24; -import 'models/entities/target.dart' as p25; -import 'models/entities/user.dart' as p26; -import 'models/oplog/oplog_entry.dart' as p27; -import 'models/pgr_complaints/pgr_address.dart' as p28; -import 'models/pgr_complaints/pgr_complaints.dart' as p29; -import 'models/pgr_complaints/pgr_complaints_response.dart' as p30; +import 'models/entities/pgr_application_status.dart' as p14; +import 'models/entities/product.dart' as p15; +import 'models/entities/product_variant.dart' as p16; +import 'models/entities/project.dart' as p17; +import 'models/entities/project_facility.dart' as p18; +import 'models/entities/project_product_variant.dart' as p19; +import 'models/entities/project_resource.dart' as p20; +import 'models/entities/project_staff.dart' as p21; +import 'models/entities/project_type.dart' as p22; +import 'models/entities/target.dart' as p23; +import 'models/entities/user.dart' as p24; +import 'models/oplog/oplog_entry.dart' as p25; void initializeMappers() { p0.EntityModelMapper.ensureInitialized(); @@ -72,67 +67,43 @@ void initializeMappers() { p13.NameSearchModelMapper.ensureInitialized(); p13.NameModelMapper.ensureInitialized(); p13.NameAdditionalFieldsMapper.ensureInitialized(); - p14.ProductSearchModelMapper.ensureInitialized(); - p14.ProductModelMapper.ensureInitialized(); - p14.ProductAdditionalFieldsMapper.ensureInitialized(); - p15.ProductVariantSearchModelMapper.ensureInitialized(); - p15.ProductVariantModelMapper.ensureInitialized(); - p15.ProductVariantAdditionalFieldsMapper.ensureInitialized(); - p16.ProjectSearchModelMapper.ensureInitialized(); - p16.ProjectModelMapper.ensureInitialized(); - p16.ProjectAdditionalFieldsMapper.ensureInitialized(); - p16.ProjectAdditionalDetailsMapper.ensureInitialized(); - p17.ProjectFacilitySearchModelMapper.ensureInitialized(); - p17.ProjectFacilityModelMapper.ensureInitialized(); - p17.ProjectFacilityAdditionalFieldsMapper.ensureInitialized(); - p18.ProjectProductVariantSearchModelMapper.ensureInitialized(); - p18.ProjectProductVariantModelMapper.ensureInitialized(); - p18.ProjectProductVariantAdditionalFieldsMapper.ensureInitialized(); - p19.ProjectResourceSearchModelMapper.ensureInitialized(); - p19.ProjectResourceModelMapper.ensureInitialized(); - p19.ProjectResourceAdditionalFieldsMapper.ensureInitialized(); - p20.ProjectStaffSearchModelMapper.ensureInitialized(); - p20.ProjectStaffModelMapper.ensureInitialized(); - p20.ProjectStaffAdditionalFieldsMapper.ensureInitialized(); - p21.ProjectTypeModelMapper.ensureInitialized(); - p21.ProjectTypeAdditionalFieldsMapper.ensureInitialized(); - p21.ProjectCycleMapper.ensureInitialized(); - p21.ProjectCycleDeliveryMapper.ensureInitialized(); - p21.DeliveryDoseCriteriaMapper.ensureInitialized(); - p21.DeliveryProductVariantMapper.ensureInitialized(); - p22.ServiceSearchModelMapper.ensureInitialized(); - p22.ServiceModelMapper.ensureInitialized(); - p22.ServiceAdditionalFieldsMapper.ensureInitialized(); - p23.ServiceAttributesSearchModelMapper.ensureInitialized(); - p23.ServiceAttributesModelMapper.ensureInitialized(); - p23.ServiceAttributesAdditionalFieldsMapper.ensureInitialized(); - p24.ServiceDefinitionSearchModelMapper.ensureInitialized(); - p24.ServiceDefinitionModelMapper.ensureInitialized(); - p24.ServiceDefinitionAdditionalFieldsMapper.ensureInitialized(); - p25.TargetSearchModelMapper.ensureInitialized(); - p25.TargetModelMapper.ensureInitialized(); - p25.TargetAdditionalFieldsMapper.ensureInitialized(); - p26.UserSearchModelMapper.ensureInitialized(); - p26.UserModelMapper.ensureInitialized(); - p26.UserAdditionalFieldsMapper.ensureInitialized(); - p27.OpLogEntryMapper.ensureInitialized(); - p27.AdditionalIdMapper.ensureInitialized(); - p27.DataOperationMapper.ensureInitialized(); - p27.ApiOperationMapper.ensureInitialized(); - p28.PgrAddressModelMapper.ensureInitialized(); - p28.GeoLocationMapper.ensureInitialized(); - p29.PgrComplaintModelMapper.ensureInitialized(); - p29.PgrComplainantModelMapper.ensureInitialized(); - p29.PgrRolesModelMapper.ensureInitialized(); - p29.PgrServiceSearchModelMapper.ensureInitialized(); - p29.PgrServiceModelMapper.ensureInitialized(); - p29.PgrWorkflowModelMapper.ensureInitialized(); - p29.PgrFiltersMapper.ensureInitialized(); - p29.PgrSearchKeysMapper.ensureInitialized(); - p29.PgrAdditionalDetailsMapper.ensureInitialized(); - p29.PgrServiceApplicationStatusMapper.ensureInitialized(); - p30.PgrServiceCreateResponseModelMapper.ensureInitialized(); - p30.PgrComplaintResponseModelMapper.ensureInitialized(); - p30.PgrComplainantResponseModelMapper.ensureInitialized(); - p30.PgrServiceResponseModelMapper.ensureInitialized(); + p14.PgrServiceApplicationStatusMapper.ensureInitialized(); + p15.ProductSearchModelMapper.ensureInitialized(); + p15.ProductModelMapper.ensureInitialized(); + p15.ProductAdditionalFieldsMapper.ensureInitialized(); + p16.ProductVariantSearchModelMapper.ensureInitialized(); + p16.ProductVariantModelMapper.ensureInitialized(); + p16.ProductVariantAdditionalFieldsMapper.ensureInitialized(); + p17.ProjectSearchModelMapper.ensureInitialized(); + p17.ProjectModelMapper.ensureInitialized(); + p17.ProjectAdditionalFieldsMapper.ensureInitialized(); + p17.ProjectAdditionalDetailsMapper.ensureInitialized(); + p18.ProjectFacilitySearchModelMapper.ensureInitialized(); + p18.ProjectFacilityModelMapper.ensureInitialized(); + p18.ProjectFacilityAdditionalFieldsMapper.ensureInitialized(); + p19.ProjectProductVariantSearchModelMapper.ensureInitialized(); + p19.ProjectProductVariantModelMapper.ensureInitialized(); + p19.ProjectProductVariantAdditionalFieldsMapper.ensureInitialized(); + p20.ProjectResourceSearchModelMapper.ensureInitialized(); + p20.ProjectResourceModelMapper.ensureInitialized(); + p20.ProjectResourceAdditionalFieldsMapper.ensureInitialized(); + p21.ProjectStaffSearchModelMapper.ensureInitialized(); + p21.ProjectStaffModelMapper.ensureInitialized(); + p21.ProjectStaffAdditionalFieldsMapper.ensureInitialized(); + p22.ProjectTypeModelMapper.ensureInitialized(); + p22.ProjectTypeAdditionalFieldsMapper.ensureInitialized(); + p22.ProjectCycleMapper.ensureInitialized(); + p22.ProjectCycleDeliveryMapper.ensureInitialized(); + p22.DeliveryDoseCriteriaMapper.ensureInitialized(); + p22.DeliveryProductVariantMapper.ensureInitialized(); + p23.TargetSearchModelMapper.ensureInitialized(); + p23.TargetModelMapper.ensureInitialized(); + p23.TargetAdditionalFieldsMapper.ensureInitialized(); + p24.UserSearchModelMapper.ensureInitialized(); + p24.UserModelMapper.ensureInitialized(); + p24.UserAdditionalFieldsMapper.ensureInitialized(); + p25.OpLogEntryMapper.ensureInitialized(); + p25.AdditionalIdMapper.ensureInitialized(); + p25.DataOperationMapper.ensureInitialized(); + p25.ApiOperationMapper.ensureInitialized(); } diff --git a/packages/digit_data_model/lib/models/entities/pgr_application_status.dart b/packages/digit_data_model/lib/models/entities/pgr_application_status.dart new file mode 100644 index 000000000..444a4c5a3 --- /dev/null +++ b/packages/digit_data_model/lib/models/entities/pgr_application_status.dart @@ -0,0 +1,17 @@ +import 'package:dart_mappable/dart_mappable.dart'; + +part 'pgr_application_status.mapper.dart'; + +@MappableEnum() +enum PgrServiceApplicationStatus { + @MappableValue('CREATED') + created, + @MappableValue('PENDING_ASSIGNMENT') + pendingAssignment, + @MappableValue('RESOLVED') + resolved, + @MappableValue('REJECTED') + rejected, + @MappableValue('CANCELLED') + cancelled, +} \ No newline at end of file diff --git a/packages/digit_data_model/lib/models/entities/pgr_application_status.mapper.dart b/packages/digit_data_model/lib/models/entities/pgr_application_status.mapper.dart new file mode 100644 index 000000000..34759f6df --- /dev/null +++ b/packages/digit_data_model/lib/models/entities/pgr_application_status.mapper.dart @@ -0,0 +1,68 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unnecessary_cast +// ignore_for_file: strict_raw_type, inference_failure_on_untyped_parameter + +part of 'pgr_application_status.dart'; + +class PgrServiceApplicationStatusMapper + extends EnumMapper { + PgrServiceApplicationStatusMapper._(); + + static PgrServiceApplicationStatusMapper? _instance; + static PgrServiceApplicationStatusMapper ensureInitialized() { + if (_instance == null) { + MapperContainer.globals + .use(_instance = PgrServiceApplicationStatusMapper._()); + } + return _instance!; + } + + static PgrServiceApplicationStatus fromValue(dynamic value) { + ensureInitialized(); + return MapperContainer.globals.fromValue(value); + } + + @override + PgrServiceApplicationStatus decode(dynamic value) { + switch (value) { + case 'CREATED': + return PgrServiceApplicationStatus.created; + case 'PENDING_ASSIGNMENT': + return PgrServiceApplicationStatus.pendingAssignment; + case 'RESOLVED': + return PgrServiceApplicationStatus.resolved; + case 'REJECTED': + return PgrServiceApplicationStatus.rejected; + case 'CANCELLED': + return PgrServiceApplicationStatus.cancelled; + default: + throw MapperException.unknownEnumValue(value); + } + } + + @override + dynamic encode(PgrServiceApplicationStatus self) { + switch (self) { + case PgrServiceApplicationStatus.created: + return 'CREATED'; + case PgrServiceApplicationStatus.pendingAssignment: + return 'PENDING_ASSIGNMENT'; + case PgrServiceApplicationStatus.resolved: + return 'RESOLVED'; + case PgrServiceApplicationStatus.rejected: + return 'REJECTED'; + case PgrServiceApplicationStatus.cancelled: + return 'CANCELLED'; + } + } +} + +extension PgrServiceApplicationStatusMapperExtension + on PgrServiceApplicationStatus { + dynamic toValue() { + PgrServiceApplicationStatusMapper.ensureInitialized(); + return MapperContainer.globals.toValue(this); + } +} diff --git a/packages/digit_data_model/lib/utils/typedefs.dart b/packages/digit_data_model/lib/utils/typedefs.dart index 995fdfff0..d6d547030 100644 --- a/packages/digit_data_model/lib/utils/typedefs.dart +++ b/packages/digit_data_model/lib/utils/typedefs.dart @@ -6,8 +6,6 @@ import '../models/entities/individual.dart'; import '../models/entities/product_variant.dart'; import '../models/entities/project_facility.dart'; import '../models/entities/project_resource.dart'; -import '../models/entities/service.dart'; -import '../models/entities/service_definition.dart'; /// `FacilityDataRepository` is a type alias for a `DataRepository` that works with `FacilityModel` and `FacilitySearchModel`. typedef FacilityDataRepository @@ -33,7 +31,3 @@ typedef ProductVariantDataRepository typedef BoundaryDataRepository = DataRepository; -typedef ServiceDataRepository - = DataRepository; -typedef ServiceDefinitionDataRepository - = DataRepository; diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index a2f7c5b49..3f0249b33 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -252,11 +252,9 @@ packages: dart_mappable_builder: dependency: "direct dev" description: - path: "packages/dart_mappable_builder" - ref: master - resolved-ref: "145091c3b5f05ccea22ec7520f5b9f4e50ff6106" - url: "https://github.com/egovernments/health-campaign-field-worker-app/" - source: git + path: "../dart_mappable_builder" + relative: true + source: path version: "4.2.0" dart_style: dependency: transitive diff --git a/packages/digit_data_model/pubspec.yaml b/packages/digit_data_model/pubspec.yaml index 96cf93b28..22502860d 100644 --- a/packages/digit_data_model/pubspec.yaml +++ b/packages/digit_data_model/pubspec.yaml @@ -1,6 +1,6 @@ name: digit_data_model description: The digit_data_model package is a data modeling library. It defines various classes, enums, and functions. -version: 1.0.3+1 +version: 1.0.4-dev.5 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/digit_data_model repository: https://github.com/egovernments/health-campaign-field-worker-app diff --git a/packages/digit_dss/pubspec.yaml b/packages/digit_dss/pubspec.yaml index a5496ae33..05d3d0979 100644 --- a/packages/digit_dss/pubspec.yaml +++ b/packages/digit_dss/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/ repository: https://github.com/egovernments/health-campaign-field-worker-app environment: - sdk: '>=3.2.3 <4.0.0' + sdk: '>=3.2.0 <4.0.0' flutter: ">=1.17.0" dependencies: diff --git a/packages/digit_firebase_services/pubspec.lock b/packages/digit_firebase_services/pubspec.lock index 20c7bd06b..53794071c 100644 --- a/packages/digit_firebase_services/pubspec.lock +++ b/packages/digit_firebase_services/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" _flutterfire_internals: dependency: transitive description: @@ -9,6 +17,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.25" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + ansicolor: + dependency: transitive + description: + name: ansicolor + sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" + url: "https://pub.dev" + source: hosted + version: "2.0.3" + args: + dependency: transitive + description: + name: args + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + url: "https://pub.dev" + source: hosted + version: "2.5.0" async: dependency: transitive description: @@ -25,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" characters: dependency: transitive description: @@ -49,6 +89,45 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + dart_mappable: + dependency: transitive + description: + name: dart_mappable + sha256: "47269caf2060533c29b823ff7fa9706502355ffcb61e7f2a374e3a0fb2f2c3f0" + url: "https://pub.dev" + source: hosted + version: "4.2.2" + dart_mappable_builder: + dependency: "direct overridden" + description: + path: "../dart_mappable_builder" + relative: true + source: path + version: "4.2.0" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + url: "https://pub.dev" + source: hosted + version: "2.3.6" fake_async: dependency: transitive description: @@ -57,6 +136,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" firebase_core: dependency: "direct main" description: @@ -120,6 +207,14 @@ packages: description: flutter source: sdk version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" js: dependency: transitive description: @@ -128,6 +223,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -136,38 +255,54 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted version: "1.10.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" plugin_platform_interface: dependency: transitive description: @@ -176,11 +311,27 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" source_span: dependency: transitive description: @@ -225,10 +376,26 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted version: "0.6.1" + type_plus: + dependency: transitive + description: + name: type_plus + sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" vector_math: dependency: transitive description: @@ -237,6 +404,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" web: dependency: transitive description: @@ -245,6 +420,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/digit_scanner/example/pubspec.lock b/packages/digit_scanner/example/pubspec.lock index 600e45214..75da90ebe 100644 --- a/packages/digit_scanner/example/pubspec.lock +++ b/packages/digit_scanner/example/pubspec.lock @@ -1093,5 +1093,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.3 <3.9.0" + dart: ">=3.2.0 <3.9.0" flutter: ">=3.16.0" diff --git a/packages/digit_scanner/example/pubspec.yaml b/packages/digit_scanner/example/pubspec.yaml index 4cecc309b..a61d03b65 100644 --- a/packages/digit_scanner/example/pubspec.yaml +++ b/packages/digit_scanner/example/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=3.2.3 <4.0.0' + sdk: '>=3.2.0 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/packages/digit_scanner/pubspec.lock b/packages/digit_scanner/pubspec.lock index 465d76a5f..fb7bda2d2 100644 --- a/packages/digit_scanner/pubspec.lock +++ b/packages/digit_scanner/pubspec.lock @@ -321,14 +321,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" - dart_mappable: - dependency: transitive - description: - name: dart_mappable - sha256: "47269caf2060533c29b823ff7fa9706502355ffcb61e7f2a374e3a0fb2f2c3f0" - url: "https://pub.dev" - source: hosted - version: "4.2.2" dart_style: dependency: transitive description: @@ -337,14 +329,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.6" - db_viewer: - dependency: transitive - description: - name: db_viewer - sha256: "5f7e3cfcde9663321797d8f6f0c876f7c13f0825a2e77ec1ef065656797144d9" - url: "https://pub.dev" - source: hosted - version: "1.1.0" diff_match_patch: dependency: transitive description: @@ -356,49 +340,11 @@ packages: digit_components: dependency: "direct main" description: - path: "../digit_components" - relative: true - source: path - version: "1.0.1+1" - digit_data_model: - dependency: "direct overridden" - description: - path: "../digit_data_model" - relative: true - source: path - version: "1.0.3+1" - dio: - dependency: transitive - description: - name: dio - sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0" - url: "https://pub.dev" - source: hosted - version: "5.6.0" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - drift: - dependency: transitive - description: - name: drift - sha256: b50a8342c6ddf05be53bda1d246404cbad101b64dc73e8d6d1ac1090d119b4e2 + name: digit_components + sha256: dcdab9542149022cb66241c3c379ca96916f8b6116e585f4799748d859a2ca49 url: "https://pub.dev" source: hosted - version: "2.15.0" - drift_db_viewer: - dependency: transitive - description: - name: drift_db_viewer - sha256: "5ea77858c52b55460a1e8f34ab5f88324621d486717d876fd745765fbc227f3f" - url: "https://pub.dev" - source: hosted - version: "2.1.0" + version: "1.0.2" easy_stepper: dependency: transitive description: @@ -686,22 +632,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - isar: - dependency: transitive - description: - name: isar - sha256: "99165dadb2cf2329d3140198363a7e7bff9bbd441871898a87e26914d25cf1ea" - url: "https://pub.dev" - source: hosted - version: "3.1.0+1" - isar_flutter_libs: - dependency: transitive - description: - name: isar_flutter_libs - sha256: bc6768cc4b9c61aabff77152e7f33b4b17d2fc93134f7af1c3dd51500fe8d5e8 - url: "https://pub.dev" - source: hosted - version: "3.1.0+1" js: dependency: transitive description: @@ -1006,14 +936,6 @@ packages: url: "https://pub.dev" source: hosted version: "14.3.0" - recase: - dependency: transitive - description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.dev" - source: hosted - version: "4.1.0" remove_emoji_input_formatter: dependency: transitive description: @@ -1099,22 +1021,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" - sqlite3: - dependency: transitive - description: - name: sqlite3 - sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - sqlite3_flutter_libs: - dependency: transitive - description: - name: sqlite3_flutter_libs - sha256: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" - url: "https://pub.dev" - source: hosted - version: "0.5.24" stack_trace: dependency: transitive description: @@ -1195,14 +1101,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - type_plus: - dependency: transitive - description: - name: type_plus - sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 - url: "https://pub.dev" - source: hosted - version: "2.1.1" typed_data: dependency: transitive description: diff --git a/packages/forms_engine/pubspec.lock b/packages/forms_engine/pubspec.lock index 1fbd7a910..a52776731 100644 --- a/packages/forms_engine/pubspec.lock +++ b/packages/forms_engine/pubspec.lock @@ -504,6 +504,30 @@ packages: url: "https://pub.dev" source: hosted version: "6.7.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -556,26 +580,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.0" mime: dependency: transitive description: @@ -644,10 +668,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_provider: dependency: transitive description: @@ -905,26 +929,26 @@ packages: dependency: transitive description: name: test - sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" url: "https://pub.dev" source: hosted - version: "1.24.9" + version: "1.25.2" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" test_core: dependency: transitive description: name: test_core - sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" url: "https://pub.dev" source: hosted - version: "0.5.9" + version: "0.6.0" timing: dependency: transitive description: @@ -953,10 +977,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" watcher: dependency: transitive description: @@ -1014,5 +1038,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <3.9.0" - flutter: ">=3.16.0" + dart: ">=3.3.0 <3.9.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/inventory_management/CHANGELOG.md b/packages/inventory_management/CHANGELOG.md index 930c5526b..392d9a00c 100644 --- a/packages/inventory_management/CHANGELOG.md +++ b/packages/inventory_management/CHANGELOG.md @@ -1,4 +1,13 @@ -## 1.0.3+1 +## 1.0.3+4 + +* Updated wayBillNumber validation + +## 1.0.3+3 + +* Updated key name of waybillNumber to wayBillNumber +* Return transaction type logic change in stock_details and report_details bloc + +## 1.0.3+2 * Updated digit_scanner package, digit_components, digit_data_model diff --git a/packages/inventory_management/lib/blocs/inventory_report.dart b/packages/inventory_management/lib/blocs/inventory_report.dart index 29c2bdf7f..9221d2c02 100644 --- a/packages/inventory_management/lib/blocs/inventory_report.dart +++ b/packages/inventory_management/lib/blocs/inventory_report.dart @@ -67,8 +67,8 @@ class InventoryReportBloc } else if (reportType == InventoryReportType.returned) { transactionType = [TransactionType.received.toValue()]; transactionReason = [TransactionReason.returned.toValue()]; - receiverId = null; - senderId = facilityId; + receiverId = facilityId; + senderId = null; } else if (reportType == InventoryReportType.damage) { transactionType = [TransactionType.dispatched.toValue()]; transactionReason = [ diff --git a/packages/inventory_management/lib/data/repositories/local/stock.dart b/packages/inventory_management/lib/data/repositories/local/stock.dart index b50043d79..7a04099fe 100644 --- a/packages/inventory_management/lib/data/repositories/local/stock.dart +++ b/packages/inventory_management/lib/data/repositories/local/stock.dart @@ -89,7 +89,7 @@ class StockLocalRepository transactingPartyId: data.transactingPartyId, transactingPartyType: data.transactingPartyType, quantity: data.quantity, - waybillNumber: data.waybillNumber, + wayBillNumber: data.waybillNumber, clientReferenceId: data.clientReferenceId, isDeleted: data.isDeleted, rowVersion: data.rowVersion, diff --git a/packages/inventory_management/lib/data/repositories/remote/stock.dart b/packages/inventory_management/lib/data/repositories/remote/stock.dart index e592cf4f1..c1589f904 100644 --- a/packages/inventory_management/lib/data/repositories/remote/stock.dart +++ b/packages/inventory_management/lib/data/repositories/remote/stock.dart @@ -1,15 +1,126 @@ // Generated using mason. Do not modify by hand +import 'dart:async'; + +import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; -import 'package:inventory_management/models/entities/stock.dart'; +import 'package:dio/dio.dart'; + +import '../../../models/entities/stock.dart'; -class StockRemoteRepository extends RemoteRepository { +class StockRemoteRepository + extends RemoteRepository { StockRemoteRepository( - super.dio, { - required super.actionMap, - super.entityName = 'Stock', - }); + super.dio, { + required super.actionMap, + super.entityName = 'Stock', + }); @override DataModelType get type => DataModelType.stock; -} \ No newline at end of file + + @override + FutureOr> search( + StockSearchModel query, { + int? offSet, + int? limit, + }) async { + int defaultBatchSize = limit ?? 100; // Default batch size for fetching data + int currentOffset = offSet ?? 0; + + List allResults = []; + + //To fetch the totalCount from the first Response + bool flag = true; + + //Total count of stock + var totalCount = 0; + + do { + Response response; + + //Execute the request + try { + response = await executeFuture( + future: () async { + return await dio.post( + searchPath, + queryParameters: { + 'offset': currentOffset, + 'limit': defaultBatchSize, + 'tenantId': DigitDataModelSingleton().tenantId, + if (query.isDeleted ?? false) 'includeDeleted': query.isDeleted, + }, + data: { + isPlural ? entityNamePlural : entityName: + isPlural ? [query.toMap()] : query.toMap(), + }, + ); + }, + ); + } catch (error) { + break; // Break out of the loop if an error occurs + } + + final responseMap = response.data; + + if (responseMap is! Map) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + String key = (isSearchResponsePlural) ? entityNamePlural : entityName; + + //Check whether the response contains valid key and totalCount + if (!responseMap.containsKey(key) || + (flag && !responseMap.containsKey('TotalCount'))) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + //Fetch the totalCount of records only from the first response + if (flag && responseMap.containsKey('TotalCount')) { + totalCount = responseMap['TotalCount']; + flag = false; + } + + final entityResponse = await responseMap[key]; + + if (entityResponse is! List) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + final entityList = + entityResponse.whereType>().toList(); + + List currentBatch; + + try { + currentBatch = entityList + .map((e) => MapperContainer.globals.fromMap(e)) + .toList(); + } catch (e) { + rethrow; + } + + allResults.addAll(currentBatch); + currentOffset += defaultBatchSize; + totalCount -= defaultBatchSize; + + //If remaining record is less than defaultBatchSize, adjust the Batch size + if (totalCount < defaultBatchSize) defaultBatchSize = totalCount; + } while (totalCount > 0); + + return allResults; + } +} diff --git a/packages/inventory_management/lib/models/entities/stock.dart b/packages/inventory_management/lib/models/entities/stock.dart index ea66c3e19..66f9882b2 100644 --- a/packages/inventory_management/lib/models/entities/stock.dart +++ b/packages/inventory_management/lib/models/entities/stock.dart @@ -77,7 +77,7 @@ class StockModel extends EntityModel with StockModelMappable { final String? transactingPartyId; final String? transactingPartyType; final String? quantity; - final String? waybillNumber; + final String? wayBillNumber; final String? receiverId; final String? receiverType; final String? senderId; @@ -100,7 +100,7 @@ class StockModel extends EntityModel with StockModelMappable { this.transactingPartyId, this.transactingPartyType, this.quantity, - this.waybillNumber, + this.wayBillNumber, this.receiverId, this.receiverType, this.senderId, @@ -136,7 +136,7 @@ class StockModel extends EntityModel with StockModelMappable { transactingPartyId: Value(transactingPartyId), transactingPartyType: Value(transactingPartyType), quantity: Value(quantity), - waybillNumber: Value(waybillNumber), + waybillNumber: Value(wayBillNumber), receiverId: Value(receiverId), receiverType: Value(receiverType), senderId: Value(senderId), diff --git a/packages/inventory_management/lib/models/entities/stock.mapper.dart b/packages/inventory_management/lib/models/entities/stock.mapper.dart index c34205004..8c4738857 100644 --- a/packages/inventory_management/lib/models/entities/stock.mapper.dart +++ b/packages/inventory_management/lib/models/entities/stock.mapper.dart @@ -361,9 +361,9 @@ class StockModelMapper extends SubClassMapperBase { static String? _$quantity(StockModel v) => v.quantity; static const Field _f$quantity = Field('quantity', _$quantity, opt: true); - static String? _$waybillNumber(StockModel v) => v.waybillNumber; - static const Field _f$waybillNumber = - Field('waybillNumber', _$waybillNumber, opt: true); + static String? _$wayBillNumber(StockModel v) => v.wayBillNumber; + static const Field _f$wayBillNumber = + Field('wayBillNumber', _$wayBillNumber, opt: true); static String? _$receiverId(StockModel v) => v.receiverId; static const Field _f$receiverId = Field('receiverId', _$receiverId, opt: true); @@ -415,7 +415,7 @@ class StockModelMapper extends SubClassMapperBase { #transactingPartyId: _f$transactingPartyId, #transactingPartyType: _f$transactingPartyType, #quantity: _f$quantity, - #waybillNumber: _f$waybillNumber, + #wayBillNumber: _f$wayBillNumber, #receiverId: _f$receiverId, #receiverType: _f$receiverType, #senderId: _f$senderId, @@ -452,7 +452,7 @@ class StockModelMapper extends SubClassMapperBase { transactingPartyId: data.dec(_f$transactingPartyId), transactingPartyType: data.dec(_f$transactingPartyType), quantity: data.dec(_f$quantity), - waybillNumber: data.dec(_f$waybillNumber), + wayBillNumber: data.dec(_f$wayBillNumber), receiverId: data.dec(_f$receiverId), receiverType: data.dec(_f$receiverType), senderId: data.dec(_f$senderId), @@ -539,7 +539,7 @@ abstract class StockModelCopyWith<$R, $In extends StockModel, $Out> String? transactingPartyId, String? transactingPartyType, String? quantity, - String? waybillNumber, + String? wayBillNumber, String? receiverId, String? receiverType, String? senderId, @@ -587,7 +587,7 @@ class _StockModelCopyWithImpl<$R, $Out> Object? transactingPartyId = $none, Object? transactingPartyType = $none, Object? quantity = $none, - Object? waybillNumber = $none, + Object? wayBillNumber = $none, Object? receiverId = $none, Object? receiverType = $none, Object? senderId = $none, @@ -613,7 +613,7 @@ class _StockModelCopyWithImpl<$R, $Out> if (transactingPartyType != $none) #transactingPartyType: transactingPartyType, if (quantity != $none) #quantity: quantity, - if (waybillNumber != $none) #waybillNumber: waybillNumber, + if (wayBillNumber != $none) #wayBillNumber: wayBillNumber, if (receiverId != $none) #receiverId: receiverId, if (receiverType != $none) #receiverType: receiverType, if (senderId != $none) #senderId: senderId, @@ -645,7 +645,7 @@ class _StockModelCopyWithImpl<$R, $Out> transactingPartyType: data.get(#transactingPartyType, or: $value.transactingPartyType), quantity: data.get(#quantity, or: $value.quantity), - waybillNumber: data.get(#waybillNumber, or: $value.waybillNumber), + wayBillNumber: data.get(#wayBillNumber, or: $value.wayBillNumber), receiverId: data.get(#receiverId, or: $value.receiverId), receiverType: data.get(#receiverType, or: $value.receiverType), senderId: data.get(#senderId, or: $value.senderId), diff --git a/packages/inventory_management/lib/pages/record_stock/stock_details.dart b/packages/inventory_management/lib/pages/record_stock/stock_details.dart index ac1373925..be040e8e4 100644 --- a/packages/inventory_management/lib/pages/record_stock/stock_details.dart +++ b/packages/inventory_management/lib/pages/record_stock/stock_details.dart @@ -60,7 +60,9 @@ class StockDetailsPageState extends LocalizedState { Validators.max(10000), ]), _transactionReasonKey: FormControl(), - _waybillNumberKey: FormControl(), + _waybillNumberKey: FormControl( + validators: [Validators.minLength(2), Validators.maxLength(200)], + ), _waybillQuantityKey: FormControl(), _vehicleNumberKey: FormControl(), _typeOfTransportKey: FormControl(), @@ -385,6 +387,7 @@ class StockDetailsPageState extends LocalizedState { case StockRecordEntryType.receipt: case StockRecordEntryType.loss: case StockRecordEntryType.damaged: + case StockRecordEntryType.returned: if (deliveryTeamSelected) { senderId = deliveryTeamName; senderType = "STAFF"; @@ -397,7 +400,6 @@ class StockDetailsPageState extends LocalizedState { break; case StockRecordEntryType.dispatch: - case StockRecordEntryType.returned: if (deliveryTeamSelected) { receiverId = deliveryTeamName; receiverType = "STAFF"; @@ -420,7 +422,7 @@ class StockDetailsPageState extends LocalizedState { referenceId: stockState.projectId, referenceIdType: 'PROJECT', quantity: quantity.toString(), - waybillNumber: waybillNumber, + wayBillNumber: waybillNumber, receiverId: receiverId, receiverType: receiverType, senderId: senderId, @@ -834,16 +836,25 @@ class StockDetailsPageState extends LocalizedState { ), if (isWareHouseMgr) DigitTextFormField( - key: const Key(_waybillNumberKey), - label: localizations.translate( - i18.stockDetails.waybillNumberLabel, - ), - formControlName: _waybillNumberKey, - keyboardType: - const TextInputType.numberWithOptions( - decimal: true, - ), - ), + key: const Key(_waybillNumberKey), + label: localizations.translate( + i18.stockDetails.waybillNumberLabel, + ), + formControlName: _waybillNumberKey, + keyboardType: + const TextInputType.numberWithOptions( + decimal: true, + ), + validationMessages: { + 'maxLength': (object) => localizations + .translate( + i18.common.maxCharsRequired) + .replaceAll('{}', '200'), + 'minLength': (object) => localizations + .translate( + i18.common.min2CharsRequired) + .replaceAll('{}', ''), + }), if (isWareHouseMgr) DigitTextFormField( label: localizations.translate( diff --git a/packages/inventory_management/lib/pages/reports/report_details.dart b/packages/inventory_management/lib/pages/reports/report_details.dart index 19b1aef9d..1cefbb72c 100644 --- a/packages/inventory_management/lib/pages/reports/report_details.dart +++ b/packages/inventory_management/lib/pages/reports/report_details.dart @@ -458,9 +458,9 @@ class InventoryReportDetailsPageState DigitGridCell( key: waybillKey, value: model - .waybillNumber ?? + .wayBillNumber ?? model - .waybillNumber ?? + .wayBillNumber ?? '', ), DigitGridCell( diff --git a/packages/inventory_management/pubspec.lock b/packages/inventory_management/pubspec.lock index 8135fff11..a7dc9d34b 100644 --- a/packages/inventory_management/pubspec.lock +++ b/packages/inventory_management/pubspec.lock @@ -388,11 +388,9 @@ packages: dart_mappable_builder: dependency: "direct dev" description: - path: "packages/dart_mappable_builder" - ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" - url: "https://github.com/egovernments/health-campaign-field-worker-app/" - source: git + path: "../dart_mappable_builder" + relative: true + source: path version: "4.2.0" dart_style: dependency: transitive diff --git a/packages/inventory_management/pubspec.yaml b/packages/inventory_management/pubspec.yaml index 29c0c7f95..acb691200 100644 --- a/packages/inventory_management/pubspec.yaml +++ b/packages/inventory_management/pubspec.yaml @@ -1,6 +1,6 @@ name: inventory_management description: This package offers inventory management features, allowing users to view stock reports and perform inventory resource reconciliation. -version: 1.0.3+2 +version: 1.0.3+4 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/inventory_management repository: https://github.com/egovernments/health-campaign-field-worker-app diff --git a/packages/referral_reconciliation/CHANGELOG.md b/packages/referral_reconciliation/CHANGELOG.md index 00372f19e..afa55e0e8 100644 --- a/packages/referral_reconciliation/CHANGELOG.md +++ b/packages/referral_reconciliation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.3-dev.1 + +* Integrated with survey_form package + ## 1.0.2+1 * Updated digit_scanner package, digit_components, digit_data_model diff --git a/packages/referral_reconciliation/lib/blocs/referral_recon_service_definition.dart b/packages/referral_reconciliation/lib/blocs/referral_recon_service_definition.dart index 74bcc987f..60150794f 100644 --- a/packages/referral_reconciliation/lib/blocs/referral_recon_service_definition.dart +++ b/packages/referral_reconciliation/lib/blocs/referral_recon_service_definition.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:referral_reconciliation/utils/typedefs.dart'; diff --git a/packages/referral_reconciliation/lib/pages/create_referral/create_hf_referral_wrapper.dart b/packages/referral_reconciliation/lib/pages/create_referral/create_hf_referral_wrapper.dart index c0c2c108a..7b8436f96 100644 --- a/packages/referral_reconciliation/lib/pages/create_referral/create_hf_referral_wrapper.dart +++ b/packages/referral_reconciliation/lib/pages/create_referral/create_hf_referral_wrapper.dart @@ -1,5 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:referral_reconciliation/blocs/app_localization.dart'; diff --git a/packages/referral_reconciliation/lib/pages/create_referral/reason_checklist_preview.dart b/packages/referral_reconciliation/lib/pages/create_referral/reason_checklist_preview.dart index 02ca9eb26..88c7b6847 100644 --- a/packages/referral_reconciliation/lib/pages/create_referral/reason_checklist_preview.dart +++ b/packages/referral_reconciliation/lib/pages/create_referral/reason_checklist_preview.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/widgets/atoms/digit_divider.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart b/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart index 5a5303e09..9433e2655 100644 --- a/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart +++ b/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart @@ -2,6 +2,7 @@ import 'dart:math'; import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:digit_components/utils/date_utils.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; @@ -45,7 +46,7 @@ class _ReferralReasonChecklistPageState @override void initState() { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: Random().nextInt(100).toString(), submitTriggered: true, ), @@ -93,7 +94,7 @@ class _ReferralReasonChecklistPageState submitTriggered = true; context.read().add( - const ServiceChecklistEvent( + const ServiceSurveyFormEvent( value: '', submitTriggered: true, ), @@ -338,7 +339,7 @@ class _ReferralReasonChecklistPageState context .read() .add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: e.toString(), submitTriggered: submitTriggered, @@ -447,7 +448,7 @@ class _ReferralReasonChecklistPageState groupValue: controller[index].text.trim(), onChanged: (value) { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: Random().nextInt(100).toString(), submitTriggered: submitTriggered, ), @@ -625,7 +626,7 @@ class _ReferralReasonChecklistPageState value: controller[index].text.split('.').contains(e), onChanged: (value) { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: e.toString(), submitTriggered: submitTriggered, ), diff --git a/packages/referral_reconciliation/lib/pages/create_referral/record_referral_details.dart b/packages/referral_reconciliation/lib/pages/create_referral/record_referral_details.dart index f80e23055..d281a5f81 100644 --- a/packages/referral_reconciliation/lib/pages/create_referral/record_referral_details.dart +++ b/packages/referral_reconciliation/lib/pages/create_referral/record_referral_details.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/widgets/atoms/digit_radio_button_list.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; diff --git a/packages/referral_reconciliation/lib/pages/search_referral_reconciliations.dart b/packages/referral_reconciliation/lib/pages/search_referral_reconciliations.dart index 51b1f0c13..d6bceeb6c 100644 --- a/packages/referral_reconciliation/lib/pages/search_referral_reconciliations.dart +++ b/packages/referral_reconciliation/lib/pages/search_referral_reconciliations.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:digit_scanner/blocs/scanner.dart'; diff --git a/packages/referral_reconciliation/lib/utils/typedefs.dart b/packages/referral_reconciliation/lib/utils/typedefs.dart index 00ce8a627..638b1a60b 100644 --- a/packages/referral_reconciliation/lib/utils/typedefs.dart +++ b/packages/referral_reconciliation/lib/utils/typedefs.dart @@ -1,5 +1,6 @@ import 'package:digit_data_model/data_model.dart'; import 'package:referral_reconciliation/models/entities/hf_referral.dart'; +import 'package:survey_form/survey_form.dart'; typedef HFReferralDataRepository = DataRepository; diff --git a/packages/referral_reconciliation/pubspec.lock b/packages/referral_reconciliation/pubspec.lock index 60830a342..e6a925144 100644 --- a/packages/referral_reconciliation/pubspec.lock +++ b/packages/referral_reconciliation/pubspec.lock @@ -388,11 +388,9 @@ packages: dart_mappable_builder: dependency: "direct dev" description: - path: "packages/dart_mappable_builder" - ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" - url: "https://github.com/egovernments/health-campaign-field-worker-app/" - source: git + path: "../dart_mappable_builder" + relative: true + source: path version: "4.2.0" dart_style: dependency: transitive @@ -421,26 +419,23 @@ packages: digit_components: dependency: "direct main" description: - name: digit_components - sha256: "9cca4d9a546037080afe02b6ade82fdf01574e11f5656ad12120fd6966578616" - url: "https://pub.dev" - source: hosted - version: "1.0.1+1" + path: "../digit_components" + relative: true + source: path + version: "1.0.2" digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" - url: "https://pub.dev" - source: hosted + path: "../digit_data_model" + relative: true + source: path version: "1.0.3+1" digit_scanner: dependency: "direct main" description: - name: digit_scanner - sha256: "9862c4885465bb1942e36dc9b42596c201648db9b0f5ffb8ad768e2409fc2742" - url: "https://pub.dev" - source: hosted + path: "../digit_scanner" + relative: true + source: path version: "1.0.3+1" dio: dependency: transitive @@ -1278,6 +1273,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + survey_form: + dependency: "direct main" + description: + path: "../survey_form" + relative: true + source: path + version: "0.0.1-dev.1" synchronized: dependency: transitive description: diff --git a/packages/referral_reconciliation/pubspec.yaml b/packages/referral_reconciliation/pubspec.yaml index 4813ae9df..c8a2c3ca7 100644 --- a/packages/referral_reconciliation/pubspec.yaml +++ b/packages/referral_reconciliation/pubspec.yaml @@ -1,6 +1,6 @@ name: referral_reconciliation description: "This module will enable the health facility supervisors to track referrals made by on-field health workers to different health facilities digitally via the Digit HCM app" -version: 1.0.2+1 +version: 1.0.3-dev.1 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/referral_reconciliation repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -35,6 +35,7 @@ dependencies: collection: ^1.16.0 digit_data_model: ^1.0.3+1 stream_transform: ^2.1.0 + survey_form: ^0.0.1-dev.1 dev_dependencies: flutter_test: diff --git a/packages/referral_reconciliation/test/blocs/referral_recon_service_definition_test.dart b/packages/referral_reconciliation/test/blocs/referral_recon_service_definition_test.dart index 638c25ec9..d47d6d7db 100644 --- a/packages/referral_reconciliation/test/blocs/referral_recon_service_definition_test.dart +++ b/packages/referral_reconciliation/test/blocs/referral_recon_service_definition_test.dart @@ -1,6 +1,7 @@ // Importing necessary packages and modules import 'package:bloc_test/bloc_test.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mocktail/mocktail.dart'; import 'package:referral_reconciliation/blocs/referral_recon_service_definition.dart'; @@ -91,7 +92,7 @@ void main() { // Description of the test 'emits [ReferralReconServiceDefinitionServiceFetchedState] when getServiceDefinitionsList returns non-null List', build: () { - // Mock the method getServiceDefinitions to return a saved checklist + // Mock the method getServiceDefinitions to return a saved survey_form when(() => serviceDefinitionDataRepository.search(any())).thenAnswer( (_) async => [ ServiceDefinitionModel( diff --git a/packages/referral_reconciliation/test/constants/test_constants.dart b/packages/referral_reconciliation/test/constants/test_constants.dart index 18ab284e4..bec892985 100644 --- a/packages/referral_reconciliation/test/constants/test_constants.dart +++ b/packages/referral_reconciliation/test/constants/test_constants.dart @@ -1,5 +1,6 @@ import 'package:digit_data_model/data_model.dart'; import 'package:referral_reconciliation/models/entities/hf_referral.dart'; +import 'package:survey_form/survey_form.dart'; class ReferralReconTestConstants { final String projectId = '11891de8-02a2-4844-80ff-a080b7b40b70'; diff --git a/packages/registration_delivery/CHANGELOG.md b/packages/registration_delivery/CHANGELOG.md index 10e985d7e..a74c879d5 100644 --- a/packages/registration_delivery/CHANGELOG.md +++ b/packages/registration_delivery/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.4-dev.1 + +* Integrated survey_form package + ## 1.0.3+1 * Bug Fixes - diff --git a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart index 8a1980d7a..046d85347 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart @@ -4,6 +4,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/utils/date_utils.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:digit_components/widgets/atoms/selection_card.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; @@ -48,7 +49,7 @@ class _BeneficiaryChecklistPageState @override void initState() { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: Random().nextInt(100).toString(), submitTriggered: true, ), @@ -111,7 +112,7 @@ class _BeneficiaryChecklistPageState submitTriggered = true; context.read().add( - const ServiceChecklistEvent( + const ServiceSurveyFormEvent( value: '', submitTriggered: true, ), @@ -364,7 +365,7 @@ class _BeneficiaryChecklistPageState context .read() .add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: e.toString(), submitTriggered: submitTriggered, @@ -454,7 +455,7 @@ class _BeneficiaryChecklistPageState context .read() .add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: curValue .toString(), submitTriggered: diff --git a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart index c8fe2c357..9b2c4b080 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart @@ -3,6 +3,7 @@ import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:registration_delivery/utils/utils.dart'; +import 'package:survey_form/survey_form.dart'; import '../../blocs/delivery_intervention/deliver_intervention.dart'; import '../../blocs/household_overview/household_overview.dart'; diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 61ca961b9..819405a0e 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -4,6 +4,7 @@ import 'package:digit_components/digit_components.dart'; import 'package:digit_components/utils/date_utils.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../../blocs/beneficiary_registration/beneficiary_registration.dart'; diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index 34ea6c862..ec37fdfeb 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -95,7 +95,6 @@ class IndividualDetailsPageState extends LocalizedState { ); }, builder: (context, state) { - // context. return ScrollableContent( enableFixedButton: true, header: const Column(children: [ diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index 95488a9b0..66c037a2c 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -388,11 +388,9 @@ packages: dart_mappable_builder: dependency: "direct dev" description: - path: "packages/dart_mappable_builder" - ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" - url: "https://github.com/egovernments/health-campaign-field-worker-app/" - source: git + path: "../dart_mappable_builder" + relative: true + source: path version: "4.2.0" dart_style: dependency: transitive @@ -430,10 +428,10 @@ packages: dependency: "direct main" description: name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" + sha256: "30f77f39977fabc3ef0cb7ed84b7377f987a309982b996096cb4bb8227fd363c" url: "https://pub.dev" source: hosted - version: "1.0.3+1" + version: "1.0.4-dev.4" digit_scanner: dependency: "direct main" description: @@ -729,6 +727,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + group_radio_button: + dependency: transitive + description: + name: group_radio_button + sha256: "204de8d16b224be7fc72dade0c3afd410ff5a34417d89f74f0fd8be7a8c2b4d6" + url: "https://pub.dev" + source: hosted + version: "1.3.0" gs1_barcode_parser: dependency: "direct main" description: @@ -1294,6 +1300,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + survey_form: + dependency: "direct main" + description: + path: "../survey_form" + relative: true + source: path + version: "0.0.1-dev.1" synchronized: dependency: transitive description: diff --git a/packages/registration_delivery/pubspec.yaml b/packages/registration_delivery/pubspec.yaml index b88722f63..61ed53f30 100644 --- a/packages/registration_delivery/pubspec.yaml +++ b/packages/registration_delivery/pubspec.yaml @@ -1,6 +1,6 @@ name: registration_delivery description: This package enables health facility workers to register a household and individual members and deliver the resources. -version: 1.0.3+1 +version: 1.0.4-dev.1 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/registration_delivery repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -40,6 +40,7 @@ dependencies: stream_transform: ^2.1.0 async: ^2.11.0 formula_parser: ^2.0.1 + survey_form: ^0.0.1-dev.1 dev_dependencies: flutter_test: diff --git a/packages/survey_form/.gitignore b/packages/survey_form/.gitignore new file mode 100644 index 000000000..ac5aa9893 --- /dev/null +++ b/packages/survey_form/.gitignore @@ -0,0 +1,29 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +build/ diff --git a/packages/survey_form/.metadata b/packages/survey_form/.metadata new file mode 100644 index 000000000..88ae5644c --- /dev/null +++ b/packages/survey_form/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "b0850beeb25f6d5b10426284f506557f66181b36" + channel: "stable" + +project_type: package diff --git a/packages/survey_form/CHANGELOG.md b/packages/survey_form/CHANGELOG.md new file mode 100644 index 000000000..61d573b4a --- /dev/null +++ b/packages/survey_form/CHANGELOG.md @@ -0,0 +1,4 @@ +## 0.0.1-dev.1 + +* Removed survey_form models, blocs and repositories from digit_data_model +* Added imports for survey_form package in registration_delivery and referral_reconciliation diff --git a/packages/survey_form/LICENSE b/packages/survey_form/LICENSE new file mode 100644 index 000000000..f7d7ac958 --- /dev/null +++ b/packages/survey_form/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 eGovernments Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/survey_form/README.md b/packages/survey_form/README.md new file mode 100644 index 000000000..80275d629 --- /dev/null +++ b/packages/survey_form/README.md @@ -0,0 +1,52 @@ +# survey_form Package + +The `survey_form` package is a comprehensive solution for creating survey forms. + +## Features + +- **Survey form Pages**: The package includes several pages like `survey_form.dart`, `survey_form_boundary_view.dart`, and `survey_form_view.dart` that provide the user interface for creating survey forms. + + + + + + +- **SurveyForm Blocs**: It provides various BLoCs for state management using the BLoC pattern. These BLoCs handle the business logic for the SurveyForm. +- **SurveyForm Models**: It defines various data models like `ServiceModel`, `ServiceDefinitionModel`, etc. used in the SurveyForm creation process. +- **SurveyForm Repositories**: The package provides abstract classes for data repositories, `ServiceDefinitionLocalRepository`, `ServiceLocalRepository`, `ServiceDefinitionRemoteRepository`, and `ServiceRemoteRepository` which can be extended to create repositories for different Service models. It also includes error handling with `InvalidApiResponseException`. + +## Getting Started + +To use this package, add the following dependency to your `pubspec.yaml` file: + +```yaml +dependencies: + survey_form: ^any +``` + +## Usage + +To Navigate to any screens of the package: + +First add survey_form_router to your main app router + +Navigate to the required screen using the below code: + +```dart +context.router.push(SurveyFormWrapperRoute()); +``` + +SurveyForm package requires below data to be passed from main app: + +```dart + String _projectId = ''; + String _projectName=''; + String _loggedInIndividualId = ''; + String _loggedInUserUuid = ''; + String _appVersion = ''; + String _tenantId = ''; + Object _roles; + bool _isHealthFacilityWorker; + BoundaryModel? _boundaryModel; + PersistenceConfiguration _persistenceConfiguration; +``` \ No newline at end of file diff --git a/packages/survey_form/analysis_options.yaml b/packages/survey_form/analysis_options.yaml new file mode 100644 index 000000000..a5744c1cf --- /dev/null +++ b/packages/survey_form/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/survey_form/example/.gitignore b/packages/survey_form/example/.gitignore new file mode 100644 index 000000000..29a3a5017 --- /dev/null +++ b/packages/survey_form/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/survey_form/example/.metadata b/packages/survey_form/example/.metadata new file mode 100644 index 000000000..d22992edb --- /dev/null +++ b/packages/survey_form/example/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + - platform: android + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + - platform: ios + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + - platform: linux + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + - platform: macos + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + - platform: web + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + - platform: windows + create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/survey_form/example/README.md b/packages/survey_form/example/README.md new file mode 100644 index 000000000..2b3fce4c8 --- /dev/null +++ b/packages/survey_form/example/README.md @@ -0,0 +1,16 @@ +# example + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/packages/survey_form/example/analysis_options.yaml b/packages/survey_form/example/analysis_options.yaml new file mode 100644 index 000000000..0d2902135 --- /dev/null +++ b/packages/survey_form/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/survey_form/example/android/.gitignore b/packages/survey_form/example/android/.gitignore new file mode 100644 index 000000000..6f568019d --- /dev/null +++ b/packages/survey_form/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/packages/survey_form/example/android/app/build.gradle b/packages/survey_form/example/android/app/build.gradle new file mode 100644 index 000000000..118ee1d92 --- /dev/null +++ b/packages/survey_form/example/android/app/build.gradle @@ -0,0 +1,67 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +android { + namespace "com.example.example" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies {} diff --git a/packages/survey_form/example/android/app/src/debug/AndroidManifest.xml b/packages/survey_form/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..399f6981d --- /dev/null +++ b/packages/survey_form/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/survey_form/example/android/app/src/main/AndroidManifest.xml b/packages/survey_form/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..19b862ec8 --- /dev/null +++ b/packages/survey_form/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/packages/survey_form/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/packages/survey_form/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 000000000..e793a000d --- /dev/null +++ b/packages/survey_form/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/packages/survey_form/example/android/app/src/main/res/drawable-v21/launch_background.xml b/packages/survey_form/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/packages/survey_form/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/survey_form/example/android/app/src/main/res/drawable/launch_background.xml b/packages/survey_form/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000..304732f88 --- /dev/null +++ b/packages/survey_form/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/survey_form/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/survey_form/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..7eb65cb8d Binary files /dev/null and b/packages/survey_form/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/survey_form/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/survey_form/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..7021b6ace Binary files /dev/null and b/packages/survey_form/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/survey_form/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/survey_form/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..f55918dc1 Binary files /dev/null and b/packages/survey_form/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/survey_form/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/survey_form/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..910eafa1d Binary files /dev/null and b/packages/survey_form/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/survey_form/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/survey_form/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..67b1e5f25 Binary files /dev/null and b/packages/survey_form/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/survey_form/example/android/app/src/main/res/values-night/styles.xml b/packages/survey_form/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..06952be74 --- /dev/null +++ b/packages/survey_form/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/survey_form/example/android/app/src/main/res/values/styles.xml b/packages/survey_form/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..cb1ef8805 --- /dev/null +++ b/packages/survey_form/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/survey_form/example/android/app/src/profile/AndroidManifest.xml b/packages/survey_form/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..399f6981d --- /dev/null +++ b/packages/survey_form/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/survey_form/example/android/build.gradle b/packages/survey_form/example/android/build.gradle new file mode 100644 index 000000000..6c103613c --- /dev/null +++ b/packages/survey_form/example/android/build.gradle @@ -0,0 +1,30 @@ +buildscript { + ext.kotlin_version = '1.8.22' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/packages/survey_form/example/android/settings.gradle b/packages/survey_form/example/android/settings.gradle new file mode 100644 index 000000000..7cd712855 --- /dev/null +++ b/packages/survey_form/example/android/settings.gradle @@ -0,0 +1,29 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() + + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false +} + +include ":app" diff --git a/packages/survey_form/example/ios/.gitignore b/packages/survey_form/example/ios/.gitignore new file mode 100644 index 000000000..7a7f9873a --- /dev/null +++ b/packages/survey_form/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/survey_form/example/ios/Flutter/AppFrameworkInfo.plist b/packages/survey_form/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..9625e105d --- /dev/null +++ b/packages/survey_form/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 + + diff --git a/packages/survey_form/example/ios/Flutter/Debug.xcconfig b/packages/survey_form/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/packages/survey_form/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/packages/survey_form/example/ios/Flutter/Release.xcconfig b/packages/survey_form/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/packages/survey_form/example/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/packages/survey_form/example/ios/Runner.xcodeproj/project.pbxproj b/packages/survey_form/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..75c0e507d --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,614 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807E294A63A400263BE5 /* Frameworks */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/survey_form/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/survey_form/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..87131a09b --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/survey_form/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/survey_form/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/survey_form/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/survey_form/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/survey_form/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/survey_form/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/survey_form/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/survey_form/example/ios/Runner/AppDelegate.swift b/packages/survey_form/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/packages/survey_form/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..4def64261 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..56e650ace Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..37eca2b4b Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..0b29a04f1 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..0bd0125e0 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..eaf2dee37 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..3fd69bf85 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..37eca2b4b Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..b7649c3e2 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..44d138309 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png new file mode 100644 index 000000000..9a22b7fc3 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png new file mode 100644 index 000000000..f64ce7730 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png new file mode 100644 index 000000000..72baec5a1 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png new file mode 100644 index 000000000..fd77b7e7a Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..44d138309 Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..41b217a5b Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png new file mode 100644 index 000000000..7eb65cb8d Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png new file mode 100644 index 000000000..910eafa1d Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..b9811544e Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..5047fef8e Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..9fee6d1eb Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/survey_form/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/survey_form/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/survey_form/example/ios/Runner/Base.lproj/Main.storyboard b/packages/survey_form/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/survey_form/example/ios/Runner/Info.plist b/packages/survey_form/example/ios/Runner/Info.plist new file mode 100644 index 000000000..5458fc418 --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/packages/survey_form/example/ios/Runner/Runner-Bridging-Header.h b/packages/survey_form/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..308a2a560 --- /dev/null +++ b/packages/survey_form/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/packages/survey_form/example/ios/RunnerTests/RunnerTests.swift b/packages/survey_form/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 000000000..86a7c3b1b --- /dev/null +++ b/packages/survey_form/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/packages/survey_form/example/lib/data.json b/packages/survey_form/example/lib/data.json new file mode 100644 index 000000000..caff05901 --- /dev/null +++ b/packages/survey_form/example/lib/data.json @@ -0,0 +1,20 @@ +[ + { + "code": "ACKNOWLEDGEMENT_SUCCESS_ACTION_LABEL_TEXT", + "locale": "en_MZ", + "message": "Go Back", + "module": "hcm-acknowledgement" + }, + { + "code": "ACKNOWLEDGEMENT_SUCCESS_DESCRIPTION_TEXT", + "locale": "en_MZ", + "message": "The data has been recorded successfully.", + "module": "hcm-acknowledgement" + }, + { + "code": "ACKNOWLEDGEMENT_SUCCESS_LABEL_TEXT", + "locale": "en_MZ", + "message": "Data recorded successfully", + "module": "hcm-acknowledgement" + } +] \ No newline at end of file diff --git a/packages/survey_form/example/lib/localizedString.dart b/packages/survey_form/example/lib/localizedString.dart new file mode 100644 index 000000000..e573a6ae6 --- /dev/null +++ b/packages/survey_form/example/lib/localizedString.dart @@ -0,0 +1,34 @@ +class LocalizedString { + final String code; + final String locale; + final String message; + final String module; + + // Constructor + LocalizedString({ + required this.code, + required this.locale, + required this.message, + required this.module, + }); + + // Factory constructor to create an instance from JSON + factory LocalizedString.fromJson(Map json) { + return LocalizedString( + code: json['code'] as String, + locale: json['locale'] as String, + message: json['message'] as String, + module: json['module'] as String, + ); + } + + // Optional: Method to convert an instance back to JSON + Map toJson() { + return { + 'code': code, + 'locale': locale, + 'message': message, + 'module': module, + }; + } +} diff --git a/packages/survey_form/example/lib/main.dart b/packages/survey_form/example/lib/main.dart new file mode 100644 index 000000000..b017e1dc9 --- /dev/null +++ b/packages/survey_form/example/lib/main.dart @@ -0,0 +1,106 @@ +import 'dart:convert'; + +import 'package:survey_form/blocs/app_localization.dart'; +import 'package:survey_form/blocs/survey_form_localization_delegate.dart'; +import 'package:digit_components/widgets/digit_elevated_button.dart'; +import 'package:flutter/material.dart'; +import 'package:survey_form/pages/acknowledgement.dart'; +import 'package:flutter/services.dart'; + +import 'localizedString.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + useMaterial3: true, + ), + home: const MyHomePage(title: 'Survey Form Package Example'), + ); + } +} + +Future loadLocalizedStrings() async{ + String jsonString = await rootBundle.loadString('lib/data.json'); + // Decode the JSON string + List jsonList = jsonDecode(jsonString); + + // Convert the dynamic list to a list of LocalizedString objects + return jsonList.map((jsonItem) => LocalizedString.fromJson(jsonItem)).toList(); +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({super.key, required this.title}); + + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + late Future localizedStrings; + final languages=[ + { + "label":"PORTUGUÊS", + "value":"pt_MZ" + }, + { + "label":"FRENCH", + "value":"fr_MZ" + }, + { + "label":"ENGLISH", + "value":"en_MZ" + } + ]; + + @override + void initState() { + super.initState(); + localizedStrings = loadLocalizedStrings(); + + SurveyFormLocalizationDelegate delegate = SurveyFormLocalizationDelegate(localizedStrings, languages); + delegate.load(const Locale("en","MZ")); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.inversePrimary, + title: Text(widget.title), + ), + body: Center( + child:Container( + width: 300, + child: DigitElevatedButton( + child: const Text("Acknowledgement Page"), + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => SurveyFormAcknowledgementPage( + appLocalizations: SurveyFormLocalization( + const Locale("en","MZ"), + localizedStrings, + languages + ), + )) + ); + }, + ), + ), + ), + ); + } +} diff --git a/packages/survey_form/example/pubspec.lock b/packages/survey_form/example/pubspec.lock new file mode 100644 index 000000000..b325ac022 --- /dev/null +++ b/packages/survey_form/example/pubspec.lock @@ -0,0 +1,1067 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" + args: + dependency: transitive + description: + name: args + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + url: "https://pub.dev" + source: hosted + version: "2.5.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + auto_route: + dependency: transitive + description: + name: auto_route + sha256: eb33554581a0a4aa7e6da0f13a44291a55bf71359012f1d9feb41634ff908ff8 + url: "https://pub.dev" + source: hosted + version: "7.9.2" + bloc: + dependency: transitive + description: + name: bloc + sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" + url: "https://pub.dev" + source: hosted + version: "8.1.4" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: transitive + description: + name: build_runner + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" + url: "https://pub.dev" + source: hosted + version: "2.4.9" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + dart_mappable: + dependency: transitive + description: + name: dart_mappable + sha256: "47269caf2060533c29b823ff7fa9706502355ffcb61e7f2a374e3a0fb2f2c3f0" + url: "https://pub.dev" + source: hosted + version: "4.2.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + url: "https://pub.dev" + source: hosted + version: "2.3.6" + db_viewer: + dependency: transitive + description: + name: db_viewer + sha256: "5f7e3cfcde9663321797d8f6f0c876f7c13f0825a2e77ec1ef065656797144d9" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + digit_components: + dependency: "direct main" + description: + name: digit_components + sha256: "01320d4c72829045e789d1a56e23ff2bd85dad6a1831d27bd507a1acaceae17e" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + digit_data_model: + dependency: transitive + description: + name: digit_data_model + sha256: "058168c32c198f7c76ff8765f56827812f9c71cd269d5cb792afd77302b766ab" + url: "https://pub.dev" + source: hosted + version: "1.0.4-dev.3" + dio: + dependency: transitive + description: + name: dio + sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0" + url: "https://pub.dev" + source: hosted + version: "5.6.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + drift: + dependency: transitive + description: + name: drift + sha256: b50a8342c6ddf05be53bda1d246404cbad101b64dc73e8d6d1ac1090d119b4e2 + url: "https://pub.dev" + source: hosted + version: "2.15.0" + drift_db_viewer: + dependency: transitive + description: + name: drift_db_viewer + sha256: "5ea77858c52b55460a1e8f34ab5f88324621d486717d876fd745765fbc227f3f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + easy_stepper: + dependency: transitive + description: + name: easy_stepper + sha256: "77f3ab4ee3c867b5a2236bf712abb08fed2b1c533cf24cf3fcd46c2821072ffd" + url: "https://pub.dev" + source: hosted + version: "0.5.2+1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: transitive + description: + name: flutter_bloc + sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a + url: "https://pub.dev" + source: hosted + version: "8.1.6" + flutter_focus_watcher: + dependency: transitive + description: + name: flutter_focus_watcher + sha256: a72ee539ae0237961308a25839887ca93a0b1cb6f87b0d492b139c8fccff8e79 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility: + dependency: transitive + description: + name: flutter_keyboard_visibility + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" + url: "https://pub.dev" + source: hosted + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_platform_interface: + dependency: transitive + description: + name: flutter_keyboard_visibility_platform_interface + sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_web: + dependency: transitive + description: + name: flutter_keyboard_visibility_web + sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: d2696eed13732831414595b98863260e33e8882fc069ee80ec35d4ac9ddb0472 + url: "https://pub.dev" + source: hosted + version: "5.2.1" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + url: "https://pub.dev" + source: hosted + version: "2.0.10+1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_typeahead: + dependency: transitive + description: + name: flutter_typeahead + sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818 + url: "https://pub.dev" + source: hosted + version: "4.8.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: transitive + description: + name: fluttertoast + sha256: "81b68579e23fcbcada2db3d50302813d2371664afe6165bc78148050ab94bf66" + url: "https://pub.dev" + source: hosted + version: "8.2.5" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + url: "https://pub.dev" + source: hosted + version: "2.4.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: "2776c66b3e97c6cdd58d1bd3281548b074b64f1fd5c8f82391f7456e38849567" + url: "https://pub.dev" + source: hosted + version: "4.0.5" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + group_radio_button: + dependency: transitive + description: + name: group_radio_button + sha256: "204de8d16b224be7fc72dade0c3afd410ff5a34417d89f74f0fd8be7a8c2b4d6" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + horizontal_data_table: + dependency: transitive + description: + name: horizontal_data_table + sha256: c8ab5256bbced698a729f3e0ff2cb0e8e97416cdbb082860370eaf883badf722 + url: "https://pub.dev" + source: hosted + version: "4.3.1" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + isar: + dependency: transitive + description: + name: isar + sha256: "99165dadb2cf2329d3140198363a7e7bff9bbd441871898a87e26914d25cf1ea" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + isar_flutter_libs: + dependency: transitive + description: + name: isar_flutter_libs + sha256: bc6768cc4b9c61aabff77152e7f33b4b17d2fc93134f7af1c3dd51500fe8d5e8 + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + location: + dependency: transitive + description: + name: location + sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + location_web: + dependency: transitive + description: + name: location_web + sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b + url: "https://pub.dev" + source: hosted + version: "4.2.0" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + lottie: + dependency: transitive + description: + name: lottie + sha256: a93542cc2d60a7057255405f62252533f8e8956e7e06754955669fd32fb4b216 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" + source: hosted + version: "1.10.0" + mime: + dependency: transitive + description: + name: mime + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + url: "https://pub.dev" + source: hosted + version: "1.0.6" + mocktail: + dependency: transitive + description: + name: mocktail + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + overlay_builder: + dependency: transitive + description: + name: overlay_builder + sha256: "58b97bc5f67a2e2bb7006dd88e697ac757dfffc9dbd1e7dfc1917fb510a4b5c8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79" + url: "https://pub.dev" + source: hosted + version: "5.0.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + url: "https://pub.dev" + source: hosted + version: "2.1.4" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d + url: "https://pub.dev" + source: hosted + version: "2.2.4" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + url: "https://pub.dev" + source: hosted + version: "0.9.3+7" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + provider: + dependency: transitive + description: + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" + source: hosted + version: "6.1.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + reactive_flutter_typeahead: + dependency: transitive + description: + name: reactive_flutter_typeahead + sha256: ef91627df8cef70e603e8a6458749d8a99a385b78854332602fd08ad905cdab8 + url: "https://pub.dev" + source: hosted + version: "0.8.1" + reactive_forms: + dependency: transitive + description: + name: reactive_forms + sha256: "5aa9c48a0626c20d00a005e597cb10efbdebbfeecb9c4227b03a5945fbb91ec4" + url: "https://pub.dev" + source: hosted + version: "14.3.0" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + remove_emoji_input_formatter: + dependency: transitive + description: + name: remove_emoji_input_formatter + sha256: "82d195984f890de7a8fea936c698848e78c1a67ccefe18db3baf9f7a3bc0177f" + url: "https://pub.dev" + source: hosted + version: "0.0.1+1" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqlite3_flutter_libs: + dependency: transitive + description: + name: sqlite3_flutter_libs + sha256: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" + url: "https://pub.dev" + source: hosted + version: "0.5.24" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + survey_form: + dependency: "direct main" + description: + path: "packages/survey_form" + ref: checklist-package + resolved-ref: bbac302cdb35f380fb369faf3bc778ee0cbf1bbf + url: "https://github.com/egovernments/health-campaign-field-worker-app" + source: git + version: "0.0.1-dev.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + type_plus: + dependency: transitive + description: + name: type_plus + sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.2.0 <3.9.0" + flutter: ">=3.16.0" diff --git a/packages/survey_form/example/pubspec.yaml b/packages/survey_form/example/pubspec.yaml new file mode 100644 index 000000000..bfd25c882 --- /dev/null +++ b/packages/survey_form/example/pubspec.yaml @@ -0,0 +1,96 @@ +name: example +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=3.2.0 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + digit_components: ^1.0.0+2 + survey_form: + git: + url: https://github.com/egovernments/health-campaign-field-worker-app + ref: checklist-package + path: ./packages/survey_form + + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - lib/data.json + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/survey_form/lib/blocs/app_localization.dart b/packages/survey_form/lib/blocs/app_localization.dart new file mode 100644 index 000000000..5cbb3c195 --- /dev/null +++ b/packages/survey_form/lib/blocs/app_localization.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; + +import 'survey_form_localization_delegate.dart'; + +// Class responsible for handling survey_form localization +class SurveyFormLocalization { + final Locale locale; + final Future localizedStrings; + final List languages; + + SurveyFormLocalization(this.locale, this.localizedStrings, this.languages); + + // Method to get the current localization instance from context + static SurveyFormLocalization of(BuildContext context) { + return Localizations.of(context, SurveyFormLocalization)!; + } + + static final List _localizedStrings = []; + + // Method to get the delegate for localization + static LocalizationsDelegate getDelegate( + Future localizedStrings, List languages) { + return SurveyFormLocalizationDelegate(localizedStrings, languages); + } + + // Method to load localized strings + Future load() async { + _localizedStrings.clear(); + // Iterate over localized strings and filter based on locale + for (var element in await localizedStrings) { + if (element.locale == '${locale.languageCode}_${locale.countryCode}') { + _localizedStrings.add(element); + } + } + + return true; + } + + // Method to translate a given localized value + String translate(String localizedValues) { + if (_localizedStrings.isEmpty) { + return localizedValues; + } else { + final index = _localizedStrings.indexWhere( + (medium) => medium.code == localizedValues, + ); + + return index != -1 ? _localizedStrings[index].message : localizedValues; + } + } +} diff --git a/packages/digit_data_model/lib/blocs/service/service.dart b/packages/survey_form/lib/blocs/service.dart similarity index 70% rename from packages/digit_data_model/lib/blocs/service/service.dart rename to packages/survey_form/lib/blocs/service.dart index 367872d28..a0fe9e36f 100644 --- a/packages/digit_data_model/lib/blocs/service/service.dart +++ b/packages/survey_form/lib/blocs/service.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/survey_form.dart'; import '../../utils/typedefs.dart'; @@ -14,56 +14,58 @@ class ServiceBloc extends Bloc { final ServiceDataRepository serviceDataRepository; ServiceBloc( - super.initialState, { - required this.serviceDataRepository, - }) { + super.initialState, { + required this.serviceDataRepository, + }) { on(_handleCreate); - on(_multichecklistChanged); + on(_multiSurveyFormChanged); on(_handleSearch); on(_handlereset); on(_handleSelect); } - FutureOr _multichecklistChanged( - ServiceChecklistEvent event, - ServiceEmitter emit, - ) async { - emit(ServiceState.multichecklistChanged( + FutureOr _multiSurveyFormChanged( + ServiceSurveyFormEvent event, + ServiceEmitter emit, + ) async { + emit(ServiceState.multiSurveyFormChanged( value: event.value, submitTriggered: event.submitTriggered, )); } FutureOr _handleCreate( - ServiceCreateEvent event, - ServiceEmitter emit, - ) async { + ServiceCreateEvent event, + ServiceEmitter emit, + ) async { await serviceDataRepository.create(event.serviceModel); } FutureOr _handlereset( - ServiceResetEvent event, - ServiceEmitter emit, - ) async { + ServiceResetEvent event, + ServiceEmitter emit, + ) async { emit(ServiceSearchState( selectedService: null, serviceList: event.serviceList, )); } + //Handles the service search calls from local DB FutureOr _handleSearch( - ServiceSearchEvent event, - ServiceEmitter emit, - ) async { + ServiceSearchEvent event, + ServiceEmitter emit, + ) async { final results = - await serviceDataRepository.search(event.serviceSearchModel); + await serviceDataRepository.search(event.serviceSearchModel); emit(ServiceSearchState(serviceList: results)); } + // FutureOr _handleSelect( - ServiceSelectionEvent event, - ServiceEmitter emit, - ) async { + ServiceSelectionEvent event, + ServiceEmitter emit, + ) async { state.mapOrNull( serviceSearch: (value) => emit(value.copyWith( selectedService: event.service, @@ -75,16 +77,16 @@ class ServiceBloc extends Bloc { @freezed class ServiceEvent with _$ServiceEvent { const factory ServiceEvent.create({required ServiceModel serviceModel}) = - ServiceCreateEvent; + ServiceCreateEvent; const factory ServiceEvent.search({ required ServiceSearchModel serviceSearchModel, }) = ServiceSearchEvent; - const factory ServiceEvent.multichecklistChanged({ + const factory ServiceEvent.multiSurveyFormChanged({ required String value, required bool submitTriggered, - }) = ServiceChecklistEvent; + }) = ServiceSurveyFormEvent; const factory ServiceEvent.selectService({ required ServiceModel service, }) = ServiceSelectionEvent; @@ -100,10 +102,10 @@ class ServiceState with _$ServiceState { const factory ServiceState.isloading() = ServiceIsloadingState; - const factory ServiceState.multichecklistChanged({ + const factory ServiceState.multiSurveyFormChanged({ @Default('') String value, @Default(false) bool submitTriggered, - }) = ServiceMultichecklistChangedState; + }) = ServiceMultiSurveyFormChangedState; const factory ServiceState.serviceCreate({ required ServiceModel serviceList, diff --git a/packages/digit_data_model/lib/blocs/service/service.freezed.dart b/packages/survey_form/lib/blocs/service.freezed.dart similarity index 86% rename from packages/digit_data_model/lib/blocs/service/service.freezed.dart rename to packages/survey_form/lib/blocs/service.freezed.dart index 4dfeff427..8d099d19d 100644 --- a/packages/digit_data_model/lib/blocs/service/service.freezed.dart +++ b/packages/survey_form/lib/blocs/service.freezed.dart @@ -21,7 +21,7 @@ mixin _$ServiceEvent { required TResult Function(ServiceModel serviceModel) create, required TResult Function(ServiceSearchModel serviceSearchModel) search, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel service) selectService, required TResult Function(List serviceList) resetSelected, }) => @@ -31,7 +31,7 @@ mixin _$ServiceEvent { TResult? Function(ServiceModel serviceModel)? create, TResult? Function(ServiceSearchModel serviceSearchModel)? search, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel service)? selectService, TResult? Function(List serviceList)? resetSelected, }) => @@ -40,7 +40,8 @@ mixin _$ServiceEvent { TResult maybeWhen({ TResult Function(ServiceModel serviceModel)? create, TResult Function(ServiceSearchModel serviceSearchModel)? search, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel service)? selectService, TResult Function(List serviceList)? resetSelected, required TResult orElse(), @@ -50,8 +51,8 @@ mixin _$ServiceEvent { TResult map({ required TResult Function(ServiceCreateEvent value) create, required TResult Function(ServiceSearchEvent value) search, - required TResult Function(ServiceChecklistEvent value) - multichecklistChanged, + required TResult Function(ServiceSurveyFormEvent value) + multiSurveyFormChanged, required TResult Function(ServiceSelectionEvent value) selectService, required TResult Function(ServiceResetEvent value) resetSelected, }) => @@ -60,7 +61,7 @@ mixin _$ServiceEvent { TResult? mapOrNull({ TResult? Function(ServiceCreateEvent value)? create, TResult? Function(ServiceSearchEvent value)? search, - TResult? Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult? Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult? Function(ServiceSelectionEvent value)? selectService, TResult? Function(ServiceResetEvent value)? resetSelected, }) => @@ -69,7 +70,7 @@ mixin _$ServiceEvent { TResult maybeMap({ TResult Function(ServiceCreateEvent value)? create, TResult Function(ServiceSearchEvent value)? search, - TResult Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult Function(ServiceSelectionEvent value)? selectService, TResult Function(ServiceResetEvent value)? resetSelected, required TResult orElse(), @@ -164,7 +165,7 @@ class _$ServiceCreateEventImpl implements ServiceCreateEvent { required TResult Function(ServiceModel serviceModel) create, required TResult Function(ServiceSearchModel serviceSearchModel) search, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel service) selectService, required TResult Function(List serviceList) resetSelected, }) { @@ -177,7 +178,7 @@ class _$ServiceCreateEventImpl implements ServiceCreateEvent { TResult? Function(ServiceModel serviceModel)? create, TResult? Function(ServiceSearchModel serviceSearchModel)? search, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel service)? selectService, TResult? Function(List serviceList)? resetSelected, }) { @@ -189,7 +190,8 @@ class _$ServiceCreateEventImpl implements ServiceCreateEvent { TResult maybeWhen({ TResult Function(ServiceModel serviceModel)? create, TResult Function(ServiceSearchModel serviceSearchModel)? search, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel service)? selectService, TResult Function(List serviceList)? resetSelected, required TResult orElse(), @@ -205,8 +207,8 @@ class _$ServiceCreateEventImpl implements ServiceCreateEvent { TResult map({ required TResult Function(ServiceCreateEvent value) create, required TResult Function(ServiceSearchEvent value) search, - required TResult Function(ServiceChecklistEvent value) - multichecklistChanged, + required TResult Function(ServiceSurveyFormEvent value) + multiSurveyFormChanged, required TResult Function(ServiceSelectionEvent value) selectService, required TResult Function(ServiceResetEvent value) resetSelected, }) { @@ -218,7 +220,7 @@ class _$ServiceCreateEventImpl implements ServiceCreateEvent { TResult? mapOrNull({ TResult? Function(ServiceCreateEvent value)? create, TResult? Function(ServiceSearchEvent value)? search, - TResult? Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult? Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult? Function(ServiceSelectionEvent value)? selectService, TResult? Function(ServiceResetEvent value)? resetSelected, }) { @@ -230,7 +232,7 @@ class _$ServiceCreateEventImpl implements ServiceCreateEvent { TResult maybeMap({ TResult Function(ServiceCreateEvent value)? create, TResult Function(ServiceSearchEvent value)? search, - TResult Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult Function(ServiceSelectionEvent value)? selectService, TResult Function(ServiceResetEvent value)? resetSelected, required TResult orElse(), @@ -321,7 +323,7 @@ class _$ServiceSearchEventImpl implements ServiceSearchEvent { required TResult Function(ServiceModel serviceModel) create, required TResult Function(ServiceSearchModel serviceSearchModel) search, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel service) selectService, required TResult Function(List serviceList) resetSelected, }) { @@ -334,7 +336,7 @@ class _$ServiceSearchEventImpl implements ServiceSearchEvent { TResult? Function(ServiceModel serviceModel)? create, TResult? Function(ServiceSearchModel serviceSearchModel)? search, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel service)? selectService, TResult? Function(List serviceList)? resetSelected, }) { @@ -346,7 +348,8 @@ class _$ServiceSearchEventImpl implements ServiceSearchEvent { TResult maybeWhen({ TResult Function(ServiceModel serviceModel)? create, TResult Function(ServiceSearchModel serviceSearchModel)? search, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel service)? selectService, TResult Function(List serviceList)? resetSelected, required TResult orElse(), @@ -362,8 +365,8 @@ class _$ServiceSearchEventImpl implements ServiceSearchEvent { TResult map({ required TResult Function(ServiceCreateEvent value) create, required TResult Function(ServiceSearchEvent value) search, - required TResult Function(ServiceChecklistEvent value) - multichecklistChanged, + required TResult Function(ServiceSurveyFormEvent value) + multiSurveyFormChanged, required TResult Function(ServiceSelectionEvent value) selectService, required TResult Function(ServiceResetEvent value) resetSelected, }) { @@ -375,7 +378,7 @@ class _$ServiceSearchEventImpl implements ServiceSearchEvent { TResult? mapOrNull({ TResult? Function(ServiceCreateEvent value)? create, TResult? Function(ServiceSearchEvent value)? search, - TResult? Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult? Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult? Function(ServiceSelectionEvent value)? selectService, TResult? Function(ServiceResetEvent value)? resetSelected, }) { @@ -387,7 +390,7 @@ class _$ServiceSearchEventImpl implements ServiceSearchEvent { TResult maybeMap({ TResult Function(ServiceCreateEvent value)? create, TResult Function(ServiceSearchEvent value)? search, - TResult Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult Function(ServiceSelectionEvent value)? selectService, TResult Function(ServiceResetEvent value)? resetSelected, required TResult orElse(), @@ -411,21 +414,22 @@ abstract class ServiceSearchEvent implements ServiceEvent { } /// @nodoc -abstract class _$$ServiceChecklistEventImplCopyWith<$Res> { - factory _$$ServiceChecklistEventImplCopyWith( - _$ServiceChecklistEventImpl value, - $Res Function(_$ServiceChecklistEventImpl) then) = - __$$ServiceChecklistEventImplCopyWithImpl<$Res>; +abstract class _$$ServiceSurveyFormEventImplCopyWith<$Res> { + factory _$$ServiceSurveyFormEventImplCopyWith( + _$ServiceSurveyFormEventImpl value, + $Res Function(_$ServiceSurveyFormEventImpl) then) = + __$$ServiceSurveyFormEventImplCopyWithImpl<$Res>; @useResult $Res call({String value, bool submitTriggered}); } /// @nodoc -class __$$ServiceChecklistEventImplCopyWithImpl<$Res> - extends _$ServiceEventCopyWithImpl<$Res, _$ServiceChecklistEventImpl> - implements _$$ServiceChecklistEventImplCopyWith<$Res> { - __$$ServiceChecklistEventImplCopyWithImpl(_$ServiceChecklistEventImpl _value, - $Res Function(_$ServiceChecklistEventImpl) _then) +class __$$ServiceSurveyFormEventImplCopyWithImpl<$Res> + extends _$ServiceEventCopyWithImpl<$Res, _$ServiceSurveyFormEventImpl> + implements _$$ServiceSurveyFormEventImplCopyWith<$Res> { + __$$ServiceSurveyFormEventImplCopyWithImpl( + _$ServiceSurveyFormEventImpl _value, + $Res Function(_$ServiceSurveyFormEventImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -434,7 +438,7 @@ class __$$ServiceChecklistEventImplCopyWithImpl<$Res> Object? value = null, Object? submitTriggered = null, }) { - return _then(_$ServiceChecklistEventImpl( + return _then(_$ServiceSurveyFormEventImpl( value: null == value ? _value.value : value // ignore: cast_nullable_to_non_nullable @@ -449,8 +453,8 @@ class __$$ServiceChecklistEventImplCopyWithImpl<$Res> /// @nodoc -class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { - const _$ServiceChecklistEventImpl( +class _$ServiceSurveyFormEventImpl implements ServiceSurveyFormEvent { + const _$ServiceSurveyFormEventImpl( {required this.value, required this.submitTriggered}); @override @@ -460,14 +464,14 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { @override String toString() { - return 'ServiceEvent.multichecklistChanged(value: $value, submitTriggered: $submitTriggered)'; + return 'ServiceEvent.multiSurveyFormChanged(value: $value, submitTriggered: $submitTriggered)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ServiceChecklistEventImpl && + other is _$ServiceSurveyFormEventImpl && (identical(other.value, value) || other.value == value) && (identical(other.submitTriggered, submitTriggered) || other.submitTriggered == submitTriggered)); @@ -479,9 +483,9 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ServiceChecklistEventImplCopyWith<_$ServiceChecklistEventImpl> - get copyWith => __$$ServiceChecklistEventImplCopyWithImpl< - _$ServiceChecklistEventImpl>(this, _$identity); + _$$ServiceSurveyFormEventImplCopyWith<_$ServiceSurveyFormEventImpl> + get copyWith => __$$ServiceSurveyFormEventImplCopyWithImpl< + _$ServiceSurveyFormEventImpl>(this, _$identity); @override @optionalTypeArgs @@ -489,11 +493,11 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { required TResult Function(ServiceModel serviceModel) create, required TResult Function(ServiceSearchModel serviceSearchModel) search, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel service) selectService, required TResult Function(List serviceList) resetSelected, }) { - return multichecklistChanged(value, submitTriggered); + return multiSurveyFormChanged(value, submitTriggered); } @override @@ -502,11 +506,11 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { TResult? Function(ServiceModel serviceModel)? create, TResult? Function(ServiceSearchModel serviceSearchModel)? search, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel service)? selectService, TResult? Function(List serviceList)? resetSelected, }) { - return multichecklistChanged?.call(value, submitTriggered); + return multiSurveyFormChanged?.call(value, submitTriggered); } @override @@ -514,13 +518,14 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { TResult maybeWhen({ TResult Function(ServiceModel serviceModel)? create, TResult Function(ServiceSearchModel serviceSearchModel)? search, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel service)? selectService, TResult Function(List serviceList)? resetSelected, required TResult orElse(), }) { - if (multichecklistChanged != null) { - return multichecklistChanged(value, submitTriggered); + if (multiSurveyFormChanged != null) { + return multiSurveyFormChanged(value, submitTriggered); } return orElse(); } @@ -530,12 +535,12 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { TResult map({ required TResult Function(ServiceCreateEvent value) create, required TResult Function(ServiceSearchEvent value) search, - required TResult Function(ServiceChecklistEvent value) - multichecklistChanged, + required TResult Function(ServiceSurveyFormEvent value) + multiSurveyFormChanged, required TResult Function(ServiceSelectionEvent value) selectService, required TResult Function(ServiceResetEvent value) resetSelected, }) { - return multichecklistChanged(this); + return multiSurveyFormChanged(this); } @override @@ -543,11 +548,11 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { TResult? mapOrNull({ TResult? Function(ServiceCreateEvent value)? create, TResult? Function(ServiceSearchEvent value)? search, - TResult? Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult? Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult? Function(ServiceSelectionEvent value)? selectService, TResult? Function(ServiceResetEvent value)? resetSelected, }) { - return multichecklistChanged?.call(this); + return multiSurveyFormChanged?.call(this); } @override @@ -555,27 +560,27 @@ class _$ServiceChecklistEventImpl implements ServiceChecklistEvent { TResult maybeMap({ TResult Function(ServiceCreateEvent value)? create, TResult Function(ServiceSearchEvent value)? search, - TResult Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult Function(ServiceSelectionEvent value)? selectService, TResult Function(ServiceResetEvent value)? resetSelected, required TResult orElse(), }) { - if (multichecklistChanged != null) { - return multichecklistChanged(this); + if (multiSurveyFormChanged != null) { + return multiSurveyFormChanged(this); } return orElse(); } } -abstract class ServiceChecklistEvent implements ServiceEvent { - const factory ServiceChecklistEvent( +abstract class ServiceSurveyFormEvent implements ServiceEvent { + const factory ServiceSurveyFormEvent( {required final String value, - required final bool submitTriggered}) = _$ServiceChecklistEventImpl; + required final bool submitTriggered}) = _$ServiceSurveyFormEventImpl; String get value; bool get submitTriggered; @JsonKey(ignore: true) - _$$ServiceChecklistEventImplCopyWith<_$ServiceChecklistEventImpl> + _$$ServiceSurveyFormEventImplCopyWith<_$ServiceSurveyFormEventImpl> get copyWith => throw _privateConstructorUsedError; } @@ -648,7 +653,7 @@ class _$ServiceSelectionEventImpl implements ServiceSelectionEvent { required TResult Function(ServiceModel serviceModel) create, required TResult Function(ServiceSearchModel serviceSearchModel) search, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel service) selectService, required TResult Function(List serviceList) resetSelected, }) { @@ -661,7 +666,7 @@ class _$ServiceSelectionEventImpl implements ServiceSelectionEvent { TResult? Function(ServiceModel serviceModel)? create, TResult? Function(ServiceSearchModel serviceSearchModel)? search, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel service)? selectService, TResult? Function(List serviceList)? resetSelected, }) { @@ -673,7 +678,8 @@ class _$ServiceSelectionEventImpl implements ServiceSelectionEvent { TResult maybeWhen({ TResult Function(ServiceModel serviceModel)? create, TResult Function(ServiceSearchModel serviceSearchModel)? search, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel service)? selectService, TResult Function(List serviceList)? resetSelected, required TResult orElse(), @@ -689,8 +695,8 @@ class _$ServiceSelectionEventImpl implements ServiceSelectionEvent { TResult map({ required TResult Function(ServiceCreateEvent value) create, required TResult Function(ServiceSearchEvent value) search, - required TResult Function(ServiceChecklistEvent value) - multichecklistChanged, + required TResult Function(ServiceSurveyFormEvent value) + multiSurveyFormChanged, required TResult Function(ServiceSelectionEvent value) selectService, required TResult Function(ServiceResetEvent value) resetSelected, }) { @@ -702,7 +708,7 @@ class _$ServiceSelectionEventImpl implements ServiceSelectionEvent { TResult? mapOrNull({ TResult? Function(ServiceCreateEvent value)? create, TResult? Function(ServiceSearchEvent value)? search, - TResult? Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult? Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult? Function(ServiceSelectionEvent value)? selectService, TResult? Function(ServiceResetEvent value)? resetSelected, }) { @@ -714,7 +720,7 @@ class _$ServiceSelectionEventImpl implements ServiceSelectionEvent { TResult maybeMap({ TResult Function(ServiceCreateEvent value)? create, TResult Function(ServiceSearchEvent value)? search, - TResult Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult Function(ServiceSelectionEvent value)? selectService, TResult Function(ServiceResetEvent value)? resetSelected, required TResult orElse(), @@ -812,7 +818,7 @@ class _$ServiceResetEventImpl implements ServiceResetEvent { required TResult Function(ServiceModel serviceModel) create, required TResult Function(ServiceSearchModel serviceSearchModel) search, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel service) selectService, required TResult Function(List serviceList) resetSelected, }) { @@ -825,7 +831,7 @@ class _$ServiceResetEventImpl implements ServiceResetEvent { TResult? Function(ServiceModel serviceModel)? create, TResult? Function(ServiceSearchModel serviceSearchModel)? search, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel service)? selectService, TResult? Function(List serviceList)? resetSelected, }) { @@ -837,7 +843,8 @@ class _$ServiceResetEventImpl implements ServiceResetEvent { TResult maybeWhen({ TResult Function(ServiceModel serviceModel)? create, TResult Function(ServiceSearchModel serviceSearchModel)? search, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel service)? selectService, TResult Function(List serviceList)? resetSelected, required TResult orElse(), @@ -853,8 +860,8 @@ class _$ServiceResetEventImpl implements ServiceResetEvent { TResult map({ required TResult Function(ServiceCreateEvent value) create, required TResult Function(ServiceSearchEvent value) search, - required TResult Function(ServiceChecklistEvent value) - multichecklistChanged, + required TResult Function(ServiceSurveyFormEvent value) + multiSurveyFormChanged, required TResult Function(ServiceSelectionEvent value) selectService, required TResult Function(ServiceResetEvent value) resetSelected, }) { @@ -866,7 +873,7 @@ class _$ServiceResetEventImpl implements ServiceResetEvent { TResult? mapOrNull({ TResult? Function(ServiceCreateEvent value)? create, TResult? Function(ServiceSearchEvent value)? search, - TResult? Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult? Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult? Function(ServiceSelectionEvent value)? selectService, TResult? Function(ServiceResetEvent value)? resetSelected, }) { @@ -878,7 +885,7 @@ class _$ServiceResetEventImpl implements ServiceResetEvent { TResult maybeMap({ TResult Function(ServiceCreateEvent value)? create, TResult Function(ServiceSearchEvent value)? search, - TResult Function(ServiceChecklistEvent value)? multichecklistChanged, + TResult Function(ServiceSurveyFormEvent value)? multiSurveyFormChanged, TResult Function(ServiceSelectionEvent value)? selectService, TResult Function(ServiceResetEvent value)? resetSelected, required TResult orElse(), @@ -908,7 +915,7 @@ mixin _$ServiceState { required TResult Function() empty, required TResult Function() isloading, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing) serviceCreate, @@ -922,7 +929,7 @@ mixin _$ServiceState { TResult? Function()? empty, TResult? Function()? isloading, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -935,7 +942,8 @@ mixin _$ServiceState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? isloading, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -949,8 +957,8 @@ mixin _$ServiceState { TResult map({ required TResult Function(ServiceEmptyState value) empty, required TResult Function(ServiceIsloadingState value) isloading, - required TResult Function(ServiceMultichecklistChangedState value) - multichecklistChanged, + required TResult Function(ServiceMultiSurveyFormChangedState value) + multiSurveyFormChanged, required TResult Function(ServiceCreateState value) serviceCreate, required TResult Function(ServiceSearchState value) serviceSearch, }) => @@ -959,8 +967,8 @@ mixin _$ServiceState { TResult? mapOrNull({ TResult? Function(ServiceEmptyState value)? empty, TResult? Function(ServiceIsloadingState value)? isloading, - TResult? Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult? Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult? Function(ServiceCreateState value)? serviceCreate, TResult? Function(ServiceSearchState value)? serviceSearch, }) => @@ -969,8 +977,8 @@ mixin _$ServiceState { TResult maybeMap({ TResult Function(ServiceEmptyState value)? empty, TResult Function(ServiceIsloadingState value)? isloading, - TResult Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult Function(ServiceCreateState value)? serviceCreate, TResult Function(ServiceSearchState value)? serviceSearch, required TResult orElse(), @@ -1037,7 +1045,7 @@ class _$ServiceEmptyStateImpl implements ServiceEmptyState { required TResult Function() empty, required TResult Function() isloading, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing) serviceCreate, @@ -1054,7 +1062,7 @@ class _$ServiceEmptyStateImpl implements ServiceEmptyState { TResult? Function()? empty, TResult? Function()? isloading, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1070,7 +1078,8 @@ class _$ServiceEmptyStateImpl implements ServiceEmptyState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? isloading, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1090,8 +1099,8 @@ class _$ServiceEmptyStateImpl implements ServiceEmptyState { TResult map({ required TResult Function(ServiceEmptyState value) empty, required TResult Function(ServiceIsloadingState value) isloading, - required TResult Function(ServiceMultichecklistChangedState value) - multichecklistChanged, + required TResult Function(ServiceMultiSurveyFormChangedState value) + multiSurveyFormChanged, required TResult Function(ServiceCreateState value) serviceCreate, required TResult Function(ServiceSearchState value) serviceSearch, }) { @@ -1103,8 +1112,8 @@ class _$ServiceEmptyStateImpl implements ServiceEmptyState { TResult? mapOrNull({ TResult? Function(ServiceEmptyState value)? empty, TResult? Function(ServiceIsloadingState value)? isloading, - TResult? Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult? Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult? Function(ServiceCreateState value)? serviceCreate, TResult? Function(ServiceSearchState value)? serviceSearch, }) { @@ -1116,8 +1125,8 @@ class _$ServiceEmptyStateImpl implements ServiceEmptyState { TResult maybeMap({ TResult Function(ServiceEmptyState value)? empty, TResult Function(ServiceIsloadingState value)? isloading, - TResult Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult Function(ServiceCreateState value)? serviceCreate, TResult Function(ServiceSearchState value)? serviceSearch, required TResult orElse(), @@ -1176,7 +1185,7 @@ class _$ServiceIsloadingStateImpl implements ServiceIsloadingState { required TResult Function() empty, required TResult Function() isloading, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing) serviceCreate, @@ -1193,7 +1202,7 @@ class _$ServiceIsloadingStateImpl implements ServiceIsloadingState { TResult? Function()? empty, TResult? Function()? isloading, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1209,7 +1218,8 @@ class _$ServiceIsloadingStateImpl implements ServiceIsloadingState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? isloading, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1229,8 +1239,8 @@ class _$ServiceIsloadingStateImpl implements ServiceIsloadingState { TResult map({ required TResult Function(ServiceEmptyState value) empty, required TResult Function(ServiceIsloadingState value) isloading, - required TResult Function(ServiceMultichecklistChangedState value) - multichecklistChanged, + required TResult Function(ServiceMultiSurveyFormChangedState value) + multiSurveyFormChanged, required TResult Function(ServiceCreateState value) serviceCreate, required TResult Function(ServiceSearchState value) serviceSearch, }) { @@ -1242,8 +1252,8 @@ class _$ServiceIsloadingStateImpl implements ServiceIsloadingState { TResult? mapOrNull({ TResult? Function(ServiceEmptyState value)? empty, TResult? Function(ServiceIsloadingState value)? isloading, - TResult? Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult? Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult? Function(ServiceCreateState value)? serviceCreate, TResult? Function(ServiceSearchState value)? serviceSearch, }) { @@ -1255,8 +1265,8 @@ class _$ServiceIsloadingStateImpl implements ServiceIsloadingState { TResult maybeMap({ TResult Function(ServiceEmptyState value)? empty, TResult Function(ServiceIsloadingState value)? isloading, - TResult Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult Function(ServiceCreateState value)? serviceCreate, TResult Function(ServiceSearchState value)? serviceSearch, required TResult orElse(), @@ -1273,23 +1283,23 @@ abstract class ServiceIsloadingState implements ServiceState { } /// @nodoc -abstract class _$$ServiceMultichecklistChangedStateImplCopyWith<$Res> { - factory _$$ServiceMultichecklistChangedStateImplCopyWith( - _$ServiceMultichecklistChangedStateImpl value, - $Res Function(_$ServiceMultichecklistChangedStateImpl) then) = - __$$ServiceMultichecklistChangedStateImplCopyWithImpl<$Res>; +abstract class _$$ServiceMultiSurveyFormChangedStateImplCopyWith<$Res> { + factory _$$ServiceMultiSurveyFormChangedStateImplCopyWith( + _$ServiceMultiSurveyFormChangedStateImpl value, + $Res Function(_$ServiceMultiSurveyFormChangedStateImpl) then) = + __$$ServiceMultiSurveyFormChangedStateImplCopyWithImpl<$Res>; @useResult $Res call({String value, bool submitTriggered}); } /// @nodoc -class __$$ServiceMultichecklistChangedStateImplCopyWithImpl<$Res> +class __$$ServiceMultiSurveyFormChangedStateImplCopyWithImpl<$Res> extends _$ServiceStateCopyWithImpl<$Res, - _$ServiceMultichecklistChangedStateImpl> - implements _$$ServiceMultichecklistChangedStateImplCopyWith<$Res> { - __$$ServiceMultichecklistChangedStateImplCopyWithImpl( - _$ServiceMultichecklistChangedStateImpl _value, - $Res Function(_$ServiceMultichecklistChangedStateImpl) _then) + _$ServiceMultiSurveyFormChangedStateImpl> + implements _$$ServiceMultiSurveyFormChangedStateImplCopyWith<$Res> { + __$$ServiceMultiSurveyFormChangedStateImplCopyWithImpl( + _$ServiceMultiSurveyFormChangedStateImpl _value, + $Res Function(_$ServiceMultiSurveyFormChangedStateImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -1298,7 +1308,7 @@ class __$$ServiceMultichecklistChangedStateImplCopyWithImpl<$Res> Object? value = null, Object? submitTriggered = null, }) { - return _then(_$ServiceMultichecklistChangedStateImpl( + return _then(_$ServiceMultiSurveyFormChangedStateImpl( value: null == value ? _value.value : value // ignore: cast_nullable_to_non_nullable @@ -1313,9 +1323,9 @@ class __$$ServiceMultichecklistChangedStateImplCopyWithImpl<$Res> /// @nodoc -class _$ServiceMultichecklistChangedStateImpl - implements ServiceMultichecklistChangedState { - const _$ServiceMultichecklistChangedStateImpl( +class _$ServiceMultiSurveyFormChangedStateImpl + implements ServiceMultiSurveyFormChangedState { + const _$ServiceMultiSurveyFormChangedStateImpl( {this.value = '', this.submitTriggered = false}); @override @@ -1327,14 +1337,14 @@ class _$ServiceMultichecklistChangedStateImpl @override String toString() { - return 'ServiceState.multichecklistChanged(value: $value, submitTriggered: $submitTriggered)'; + return 'ServiceState.multiSurveyFormChanged(value: $value, submitTriggered: $submitTriggered)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ServiceMultichecklistChangedStateImpl && + other is _$ServiceMultiSurveyFormChangedStateImpl && (identical(other.value, value) || other.value == value) && (identical(other.submitTriggered, submitTriggered) || other.submitTriggered == submitTriggered)); @@ -1346,10 +1356,10 @@ class _$ServiceMultichecklistChangedStateImpl @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ServiceMultichecklistChangedStateImplCopyWith< - _$ServiceMultichecklistChangedStateImpl> - get copyWith => __$$ServiceMultichecklistChangedStateImplCopyWithImpl< - _$ServiceMultichecklistChangedStateImpl>(this, _$identity); + _$$ServiceMultiSurveyFormChangedStateImplCopyWith< + _$ServiceMultiSurveyFormChangedStateImpl> + get copyWith => __$$ServiceMultiSurveyFormChangedStateImplCopyWithImpl< + _$ServiceMultiSurveyFormChangedStateImpl>(this, _$identity); @override @optionalTypeArgs @@ -1357,7 +1367,7 @@ class _$ServiceMultichecklistChangedStateImpl required TResult Function() empty, required TResult Function() isloading, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing) serviceCreate, @@ -1365,7 +1375,7 @@ class _$ServiceMultichecklistChangedStateImpl ServiceModel? selectedService, bool loading) serviceSearch, }) { - return multichecklistChanged(value, submitTriggered); + return multiSurveyFormChanged(value, submitTriggered); } @override @@ -1374,7 +1384,7 @@ class _$ServiceMultichecklistChangedStateImpl TResult? Function()? empty, TResult? Function()? isloading, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1382,7 +1392,7 @@ class _$ServiceMultichecklistChangedStateImpl ServiceModel? selectedService, bool loading)? serviceSearch, }) { - return multichecklistChanged?.call(value, submitTriggered); + return multiSurveyFormChanged?.call(value, submitTriggered); } @override @@ -1390,7 +1400,8 @@ class _$ServiceMultichecklistChangedStateImpl TResult maybeWhen({ TResult Function()? empty, TResult Function()? isloading, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1399,8 +1410,8 @@ class _$ServiceMultichecklistChangedStateImpl serviceSearch, required TResult orElse(), }) { - if (multichecklistChanged != null) { - return multichecklistChanged(value, submitTriggered); + if (multiSurveyFormChanged != null) { + return multiSurveyFormChanged(value, submitTriggered); } return orElse(); } @@ -1410,12 +1421,12 @@ class _$ServiceMultichecklistChangedStateImpl TResult map({ required TResult Function(ServiceEmptyState value) empty, required TResult Function(ServiceIsloadingState value) isloading, - required TResult Function(ServiceMultichecklistChangedState value) - multichecklistChanged, + required TResult Function(ServiceMultiSurveyFormChangedState value) + multiSurveyFormChanged, required TResult Function(ServiceCreateState value) serviceCreate, required TResult Function(ServiceSearchState value) serviceSearch, }) { - return multichecklistChanged(this); + return multiSurveyFormChanged(this); } @override @@ -1423,12 +1434,12 @@ class _$ServiceMultichecklistChangedStateImpl TResult? mapOrNull({ TResult? Function(ServiceEmptyState value)? empty, TResult? Function(ServiceIsloadingState value)? isloading, - TResult? Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult? Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult? Function(ServiceCreateState value)? serviceCreate, TResult? Function(ServiceSearchState value)? serviceSearch, }) { - return multichecklistChanged?.call(this); + return multiSurveyFormChanged?.call(this); } @override @@ -1436,29 +1447,29 @@ class _$ServiceMultichecklistChangedStateImpl TResult maybeMap({ TResult Function(ServiceEmptyState value)? empty, TResult Function(ServiceIsloadingState value)? isloading, - TResult Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult Function(ServiceCreateState value)? serviceCreate, TResult Function(ServiceSearchState value)? serviceSearch, required TResult orElse(), }) { - if (multichecklistChanged != null) { - return multichecklistChanged(this); + if (multiSurveyFormChanged != null) { + return multiSurveyFormChanged(this); } return orElse(); } } -abstract class ServiceMultichecklistChangedState implements ServiceState { - const factory ServiceMultichecklistChangedState( +abstract class ServiceMultiSurveyFormChangedState implements ServiceState { + const factory ServiceMultiSurveyFormChangedState( {final String value, - final bool submitTriggered}) = _$ServiceMultichecklistChangedStateImpl; + final bool submitTriggered}) = _$ServiceMultiSurveyFormChangedStateImpl; String get value; bool get submitTriggered; @JsonKey(ignore: true) - _$$ServiceMultichecklistChangedStateImplCopyWith< - _$ServiceMultichecklistChangedStateImpl> + _$$ServiceMultiSurveyFormChangedStateImplCopyWith< + _$ServiceMultiSurveyFormChangedStateImpl> get copyWith => throw _privateConstructorUsedError; } @@ -1568,7 +1579,7 @@ class _$ServiceCreateStateImpl implements ServiceCreateState { required TResult Function() empty, required TResult Function() isloading, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing) serviceCreate, @@ -1585,7 +1596,7 @@ class _$ServiceCreateStateImpl implements ServiceCreateState { TResult? Function()? empty, TResult? Function()? isloading, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1602,7 +1613,8 @@ class _$ServiceCreateStateImpl implements ServiceCreateState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? isloading, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1622,8 +1634,8 @@ class _$ServiceCreateStateImpl implements ServiceCreateState { TResult map({ required TResult Function(ServiceEmptyState value) empty, required TResult Function(ServiceIsloadingState value) isloading, - required TResult Function(ServiceMultichecklistChangedState value) - multichecklistChanged, + required TResult Function(ServiceMultiSurveyFormChangedState value) + multiSurveyFormChanged, required TResult Function(ServiceCreateState value) serviceCreate, required TResult Function(ServiceSearchState value) serviceSearch, }) { @@ -1635,8 +1647,8 @@ class _$ServiceCreateStateImpl implements ServiceCreateState { TResult? mapOrNull({ TResult? Function(ServiceEmptyState value)? empty, TResult? Function(ServiceIsloadingState value)? isloading, - TResult? Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult? Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult? Function(ServiceCreateState value)? serviceCreate, TResult? Function(ServiceSearchState value)? serviceSearch, }) { @@ -1648,8 +1660,8 @@ class _$ServiceCreateStateImpl implements ServiceCreateState { TResult maybeMap({ TResult Function(ServiceEmptyState value)? empty, TResult Function(ServiceIsloadingState value)? isloading, - TResult Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult Function(ServiceCreateState value)? serviceCreate, TResult Function(ServiceSearchState value)? serviceSearch, required TResult orElse(), @@ -1781,7 +1793,7 @@ class _$ServiceSearchStateImpl implements ServiceSearchState { required TResult Function() empty, required TResult Function() isloading, required TResult Function(String value, bool submitTriggered) - multichecklistChanged, + multiSurveyFormChanged, required TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing) serviceCreate, @@ -1798,7 +1810,7 @@ class _$ServiceSearchStateImpl implements ServiceSearchState { TResult? Function()? empty, TResult? Function()? isloading, TResult? Function(String value, bool submitTriggered)? - multichecklistChanged, + multiSurveyFormChanged, TResult? Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1814,7 +1826,8 @@ class _$ServiceSearchStateImpl implements ServiceSearchState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? isloading, - TResult Function(String value, bool submitTriggered)? multichecklistChanged, + TResult Function(String value, bool submitTriggered)? + multiSurveyFormChanged, TResult Function(ServiceModel serviceList, ServiceModel? selectedService, bool loading, bool isEditing)? serviceCreate, @@ -1834,8 +1847,8 @@ class _$ServiceSearchStateImpl implements ServiceSearchState { TResult map({ required TResult Function(ServiceEmptyState value) empty, required TResult Function(ServiceIsloadingState value) isloading, - required TResult Function(ServiceMultichecklistChangedState value) - multichecklistChanged, + required TResult Function(ServiceMultiSurveyFormChangedState value) + multiSurveyFormChanged, required TResult Function(ServiceCreateState value) serviceCreate, required TResult Function(ServiceSearchState value) serviceSearch, }) { @@ -1847,8 +1860,8 @@ class _$ServiceSearchStateImpl implements ServiceSearchState { TResult? mapOrNull({ TResult? Function(ServiceEmptyState value)? empty, TResult? Function(ServiceIsloadingState value)? isloading, - TResult? Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult? Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult? Function(ServiceCreateState value)? serviceCreate, TResult? Function(ServiceSearchState value)? serviceSearch, }) { @@ -1860,8 +1873,8 @@ class _$ServiceSearchStateImpl implements ServiceSearchState { TResult maybeMap({ TResult Function(ServiceEmptyState value)? empty, TResult Function(ServiceIsloadingState value)? isloading, - TResult Function(ServiceMultichecklistChangedState value)? - multichecklistChanged, + TResult Function(ServiceMultiSurveyFormChangedState value)? + multiSurveyFormChanged, TResult Function(ServiceCreateState value)? serviceCreate, TResult Function(ServiceSearchState value)? serviceSearch, required TResult orElse(), diff --git a/packages/digit_data_model/lib/blocs/service_definition/service_definition.dart b/packages/survey_form/lib/blocs/service_definition.dart similarity index 73% rename from packages/digit_data_model/lib/blocs/service_definition/service_definition.dart rename to packages/survey_form/lib/blocs/service_definition.dart index 357eba268..18c6a475d 100644 --- a/packages/digit_data_model/lib/blocs/service_definition/service_definition.dart +++ b/packages/survey_form/lib/blocs/service_definition.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/survey_form.dart'; import '../../utils/typedefs.dart'; @@ -14,32 +14,33 @@ class ServiceDefinitionBloc extends Bloc { final ServiceDefinitionDataRepository serviceDefinitionDataRepository; ServiceDefinitionBloc( - super.initialState, { - required this.serviceDefinitionDataRepository, - }) { + super.initialState, { + required this.serviceDefinitionDataRepository, + }) { on(_handleFetch); on(_handleSelect); } + // This function is called to fetch all the service definitions from the table for the selected project FutureOr _handleFetch( - ServiceDefinitionFetchEvent event, - ServiceDefinitionEmitter emit, - ) async { + ServiceDefinitionFetchEvent event, + ServiceDefinitionEmitter emit, + ) async { final results = await serviceDefinitionDataRepository.search( ServiceDefinitionSearchModel( - tenantId: DigitDataModelSingleton().tenantId, + tenantId: SurveyFormSingleton().tenantId, ), ); - emit(ServiceDefinitionServiceFetchedState( serviceDefinitionList: results, )); } + // Called when we select a service definition from the displayed list of service definition FutureOr _handleSelect( - ServiceDefinitionSelectionEvent event, - ServiceDefinitionEmitter emit, - ) async { + ServiceDefinitionSelectionEvent event, + ServiceDefinitionEmitter emit, + ) async { state.mapOrNull( serviceDefinitionFetch: (value) => emit(value.copyWith( selectedServiceDefinition: event.serviceDefinition, @@ -60,9 +61,13 @@ class ServiceDefinitionEvent with _$ServiceDefinitionEvent { class ServiceDefinitionState with _$ServiceDefinitionState { const factory ServiceDefinitionState.empty() = ServiceDefinitionEmptyState; const factory ServiceDefinitionState.isloading() = - ServiceDefinitionIsloadingState; + ServiceDefinitionIsloadingState; const factory ServiceDefinitionState.serviceDefinitionFetch({ required List serviceDefinitionList, ServiceDefinitionModel? selectedServiceDefinition, }) = ServiceDefinitionServiceFetchedState; } + + + + diff --git a/packages/digit_data_model/lib/blocs/service_definition/service_definition.freezed.dart b/packages/survey_form/lib/blocs/service_definition.freezed.dart similarity index 100% rename from packages/digit_data_model/lib/blocs/service_definition/service_definition.freezed.dart rename to packages/survey_form/lib/blocs/service_definition.freezed.dart diff --git a/packages/survey_form/lib/blocs/survey_form_localization_delegate.dart b/packages/survey_form/lib/blocs/survey_form_localization_delegate.dart new file mode 100644 index 000000000..544c0fc76 --- /dev/null +++ b/packages/survey_form/lib/blocs/survey_form_localization_delegate.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +import 'app_localization.dart'; + +class SurveyFormLocalizationDelegate + extends LocalizationsDelegate { + final Future localizedStrings; + final List languages; + + const SurveyFormLocalizationDelegate(this.localizedStrings, this.languages); + + @override + bool isSupported(Locale locale) { + return languages.map((e) { + final results = e.value.split('_'); + if (results.isNotEmpty) return results.first; + }).contains(locale.languageCode); + } + + @override + Future load(Locale locale) async { + SurveyFormLocalization localization = + SurveyFormLocalization(locale, localizedStrings, languages); + await localization.load(); + + return localization; + } + + @override + bool shouldReload( + covariant LocalizationsDelegate old) { + return true; + } +} diff --git a/packages/digit_data_model/lib/data/repositories/local/service.dart b/packages/survey_form/lib/data/repositories/local/service.dart similarity index 75% rename from packages/digit_data_model/lib/data/repositories/local/service.dart rename to packages/survey_form/lib/data/repositories/local/service.dart index 785c1d7e9..522308291 100644 --- a/packages/digit_data_model/lib/data/repositories/local/service.dart +++ b/packages/survey_form/lib/data/repositories/local/service.dart @@ -2,18 +2,22 @@ import 'dart:async'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; + import 'package:drift/drift.dart'; +import 'package:survey_form/survey_form.dart'; + class ServiceLocalRepository extends LocalRepository { ServiceLocalRepository(super.sql, super.opLogManager); + // function to create a Service entity in the local database @override FutureOr create( - ServiceModel entity, { - bool createOpLog = true, - DataOperation dataOperation = DataOperation.singleCreate, - }) async { + ServiceModel entity, { + bool createOpLog = true, + DataOperation dataOperation = DataOperation.singleCreate, + }) async { return retryLocalCallOperation(() async { final serviceCompanion = entity.companion; final attributes = entity.attributes; @@ -65,19 +69,19 @@ class ServiceLocalRepository return e.dataType == 'Number' ? e.copyWith(value: int.tryParse(e.value)) : e.dataType == 'MultiValueList' - ? e.copyWith( - value: e.value.toString().split('.'), - additionalDetails: e.additionalDetails != null - ? {"value": e.additionalDetails} - : null, - ) - : e.dataType == 'SingleValueList' - ? e.copyWith( - additionalDetails: e.additionalDetails != null - ? {"value": e.additionalDetails} - : null, - ) - : e; + ? e.copyWith( + value: e.value.toString().split('.'), + additionalDetails: e.additionalDetails != null + ? {"value": e.additionalDetails} + : null, + ) + : e.dataType == 'SingleValueList' + ? e.copyWith( + additionalDetails: e.additionalDetails != null + ? {"value": e.additionalDetails} + : null, + ) + : e; }).toList(), ); @@ -89,23 +93,24 @@ class ServiceLocalRepository }); } + //function to search Service entities corresponding to selected service definition from local database @override FutureOr> search( - ServiceSearchModel query, - ) async { + ServiceSearchModel query, + ) async { return retryLocalCallOperation>(() async { final selectQuery = sql.select(sql.service).join([]); final results = await (selectQuery - ..where(buildAnd([ - if (query.id != null) - sql.service.serviceDefId.equals( - query.id!, - ), - if (query.clientId != null) - sql.service.clientId.equals( - query.clientId!, - ), - ]))) + ..where(buildAnd([ + if (query.id != null) + sql.service.serviceDefId.equals( + query.id!, + ), + if (query.clientId != null) + sql.service.clientId.equals( + query.clientId!, + ), + ]))) .get(); final List serviceList = []; @@ -114,11 +119,11 @@ class ServiceLocalRepository final selectattributeQuery = sql.select(sql.serviceAttributes).join([]); final val = await (selectattributeQuery - ..where(buildAnd([ - sql.serviceAttributes.referenceId.equals( - data.clientId, - ), - ]))) + ..where(buildAnd([ + sql.serviceAttributes.referenceId.equals( + data.clientId, + ), + ]))) .get(); final res = val.map((e) { final attribute = e.readTableOrNull(sql.serviceAttributes); diff --git a/packages/digit_data_model/lib/data/repositories/local/service_definition.dart b/packages/survey_form/lib/data/repositories/local/service_definition.dart similarity index 75% rename from packages/digit_data_model/lib/data/repositories/local/service_definition.dart rename to packages/survey_form/lib/data/repositories/local/service_definition.dart index 600e06750..30e3cbc49 100644 --- a/packages/digit_data_model/lib/data/repositories/local/service_definition.dart +++ b/packages/survey_form/lib/data/repositories/local/service_definition.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:drift/drift.dart'; class ServiceDefinitionLocalRepository extends LocalRepository< @@ -10,10 +11,10 @@ class ServiceDefinitionLocalRepository extends LocalRepository< @override FutureOr create( - ServiceDefinitionModel entity, { - bool createOpLog = false, - DataOperation dataOperation = DataOperation.create, - }) async { + ServiceDefinitionModel entity, { + bool createOpLog = false, + DataOperation dataOperation = DataOperation.create, + }) async { return retryLocalCallOperation(() async { final serviceDefinitionCompanion = entity.companion; final attributes = entity.attributes; @@ -42,24 +43,25 @@ class ServiceDefinitionLocalRepository extends LocalRepository< @override FutureOr> search( - ServiceDefinitionSearchModel query, { - bool createOpLog = false, - }) async { + ServiceDefinitionSearchModel query, { + bool createOpLog = false, + }) async { return retryLocalCallOperation(() async { final selectQuery = sql.select(sql.serviceDefinition).join([]); final results = await (selectQuery - ..where(buildAnd([ - if (query.id != null) - sql.serviceDefinition.id.equals( - query.id!, - ), - // To fetch service definition of a single checklist with the code - if (query.code != null) - sql.serviceDefinition.code.isIn( - query.code!, - ), - ]))) + ..where(buildAnd([ + // To fetch service definition with the id + if (query.id != null) + sql.serviceDefinition.id.equals( + query.id!, + ), + // To fetch service definition of a single survey_form with the code + if (query.code != null) + sql.serviceDefinition.code.isIn( + query.code!, + ), + ]))) .get(); final List serviceDefinitionList = []; @@ -68,11 +70,11 @@ class ServiceDefinitionLocalRepository extends LocalRepository< final selectattributeQuery = sql.select(sql.attributes).join([]); final val = await (selectattributeQuery - ..where(buildAnd([ - sql.attributes.referenceId.equals( - data.id!, - ), - ]))) + ..where(buildAnd([ + sql.attributes.referenceId.equals( + data.id!, + ), + ]))) .get(); final res = val.map((e) { @@ -80,10 +82,10 @@ class ServiceDefinitionLocalRepository extends LocalRepository< if (resull != null) { List list = resull.values != null ? resull.values! - .replaceFirst('[', '') - .replaceFirst(']', '') - .replaceAll(" ", '') - .split(',') + .replaceFirst('[', '') + .replaceFirst(']', '') + .replaceAll(" ", '') + .split(',') : []; if (list.isEmpty) list.removeRange(0, list.length); diff --git a/packages/survey_form/lib/data/repositories/oplog/oplog.dart b/packages/survey_form/lib/data/repositories/oplog/oplog.dart new file mode 100644 index 000000000..d7b1e9cda --- /dev/null +++ b/packages/survey_form/lib/data/repositories/oplog/oplog.dart @@ -0,0 +1,58 @@ +import 'package:digit_data_model/data/repositories/oplog/oplog.dart'; +import 'package:survey_form/survey_form.dart'; + + +//Oplog for managing Service definition +class ServiceDefinitionOpLogManager + extends OpLogManager { + ServiceDefinitionOpLogManager(super.isar); + + @override + ServiceDefinitionModel applyServerGeneratedIdToEntity( + ServiceDefinitionModel entity, + String serverGeneratedId, + int rowVersion, + ) => + entity.copyWith(id: serverGeneratedId, rowVersion: rowVersion); + + @override + String getClientReferenceId(ServiceDefinitionModel entity) { + throw UnimplementedError(); + } + + @override + String? getServerGeneratedId(ServiceDefinitionModel entity) => entity.id; + + @override + int? getRowVersion(ServiceDefinitionModel entity) => entity.rowVersion; + + @override + bool? getNonRecoverableError(ServiceDefinitionModel entity) => + entity.nonRecoverableError; +} + +//Oplog for managing Service +class ServiceOpLogManager extends OpLogManager { + ServiceOpLogManager(super.isar); + + @override + ServiceModel applyServerGeneratedIdToEntity( + ServiceModel entity, + String serverGeneratedId, + int rowVersion, + ) => + entity.copyWith(id: serverGeneratedId, rowVersion: rowVersion); + + @override + String getClientReferenceId(ServiceModel entity) => entity.clientId; + + @override + String? getServerGeneratedId(ServiceModel entity) => entity.id; + + @override + int? getRowVersion(ServiceModel entity) => entity.rowVersion; + + @override + bool? getNonRecoverableError(ServiceModel entity) => + entity.nonRecoverableError; +} \ No newline at end of file diff --git a/packages/digit_data_model/lib/data/repositories/remote/service.dart b/packages/survey_form/lib/data/repositories/remote/service.dart similarity index 76% rename from packages/digit_data_model/lib/data/repositories/remote/service.dart rename to packages/survey_form/lib/data/repositories/remote/service.dart index dc2a937cb..25eb3d70d 100644 --- a/packages/digit_data_model/lib/data/repositories/remote/service.dart +++ b/packages/survey_form/lib/data/repositories/remote/service.dart @@ -5,10 +5,10 @@ import '../../../models/entities/service.dart'; class ServiceRemoteRepository extends RemoteRepository { ServiceRemoteRepository( - super.dio, { - required super.actionMap, - super.entityName = 'Service', - }); + super.dio, { + required super.actionMap, + super.entityName = 'Service', + }); @override DataModelType get type => DataModelType.service; diff --git a/packages/digit_data_model/lib/data/repositories/remote/service_attributes.dart b/packages/survey_form/lib/data/repositories/remote/service_attributes.dart similarity index 78% rename from packages/digit_data_model/lib/data/repositories/remote/service_attributes.dart rename to packages/survey_form/lib/data/repositories/remote/service_attributes.dart index b3ec8a608..81d346d0c 100644 --- a/packages/digit_data_model/lib/data/repositories/remote/service_attributes.dart +++ b/packages/survey_form/lib/data/repositories/remote/service_attributes.dart @@ -5,10 +5,10 @@ import '../../../models/entities/service_attributes.dart'; class ServiceAttributesRemoteRepository extends RemoteRepository { ServiceAttributesRemoteRepository( - super.dio, { - required super.actionMap, - super.entityName = 'ServiceAttributes', - }); + super.dio, { + required super.actionMap, + super.entityName = 'ServiceAttributes', + }); @override DataModelType get type => DataModelType.serviceAttributes; diff --git a/packages/digit_data_model/lib/data/repositories/remote/service_definition.dart b/packages/survey_form/lib/data/repositories/remote/service_definition.dart similarity index 78% rename from packages/digit_data_model/lib/data/repositories/remote/service_definition.dart rename to packages/survey_form/lib/data/repositories/remote/service_definition.dart index 24d69707b..869bcea0d 100644 --- a/packages/digit_data_model/lib/data/repositories/remote/service_definition.dart +++ b/packages/survey_form/lib/data/repositories/remote/service_definition.dart @@ -5,10 +5,10 @@ import '../../../models/entities/service_definition.dart'; class ServiceDefinitionRemoteRepository extends RemoteRepository { ServiceDefinitionRemoteRepository( - super.dio, { - required super.actionMap, - super.entityName = 'ServiceDefinition', - }); + super.dio, { + required super.actionMap, + super.entityName = 'ServiceDefinition', + }); @override DataModelType get type => DataModelType.serviceDefinition; diff --git a/packages/digit_data_model/lib/models/entities/service.dart b/packages/survey_form/lib/models/entities/service.dart similarity index 94% rename from packages/digit_data_model/lib/models/entities/service.dart rename to packages/survey_form/lib/models/entities/service.dart index 87eccc440..4378198c5 100644 --- a/packages/digit_data_model/lib/models/entities/service.dart +++ b/packages/survey_form/lib/models/entities/service.dart @@ -3,8 +3,7 @@ import 'package:dart_mappable/dart_mappable.dart'; import 'package:drift/drift.dart'; import 'package:digit_data_model/data_model.dart'; - -import '../../data/local_store/sql_store/sql_store.dart'; +import '../entities/service_attributes.dart'; part 'service.mapper.dart'; @@ -16,7 +15,7 @@ class ServiceSearchModel extends EntitySearchModel with ServiceSearchModelMappab final String? accountId; final String? createdAt; final String? tenantId; - + ServiceSearchModel({ this.id, this.clientId, @@ -71,10 +70,13 @@ class ServiceModel extends EntityModel with ServiceModelMappable { this.tenantId, this.rowVersion, this.attributes, - super.auditDetails,super.clientAuditDetails, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, }): super(); + + //Helper object to represents the data you want to insert or update in a table ServiceCompanion get companion { return ServiceCompanion( auditCreatedBy: Value(auditDetails?.createdBy), @@ -97,7 +99,7 @@ class ServiceModel extends EntityModel with ServiceModelMappable { nonRecoverableError: Value(nonRecoverableError), tenantId: Value(tenantId), rowVersion: Value(rowVersion), - ); + ); } } diff --git a/packages/digit_data_model/lib/models/entities/service.mapper.dart b/packages/survey_form/lib/models/entities/service.mapper.dart similarity index 100% rename from packages/digit_data_model/lib/models/entities/service.mapper.dart rename to packages/survey_form/lib/models/entities/service.mapper.dart diff --git a/packages/digit_data_model/lib/models/entities/service_attributes.dart b/packages/survey_form/lib/models/entities/service_attributes.dart similarity index 95% rename from packages/digit_data_model/lib/models/entities/service_attributes.dart rename to packages/survey_form/lib/models/entities/service_attributes.dart index 4cec2d732..13775fdb1 100644 --- a/packages/digit_data_model/lib/models/entities/service_attributes.dart +++ b/packages/survey_form/lib/models/entities/service_attributes.dart @@ -3,16 +3,13 @@ import 'package:dart_mappable/dart_mappable.dart'; import 'package:drift/drift.dart'; import 'package:digit_data_model/data_model.dart'; - -import '../../data/local_store/sql_store/sql_store.dart'; - part 'service_attributes.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class ServiceAttributesSearchModel extends EntitySearchModel with ServiceAttributesSearchModelMappable { final List? clientReferenceId; final String? tenantId; - + ServiceAttributesSearchModel({ this.clientReferenceId, this.tenantId, @@ -34,10 +31,10 @@ class ServiceAttributesModel extends EntityModel with ServiceAttributesModelMapp static const schemaName = 'ServiceAttributes'; final String? attributeCode; - final dynamic? value; + final dynamic value; final String? dataType; final String? referenceId; - final dynamic? additionalDetails; + final dynamic additionalDetails; final bool? nonRecoverableError; final String clientReferenceId; final String? tenantId; @@ -59,6 +56,7 @@ class ServiceAttributesModel extends EntityModel with ServiceAttributesModelMapp super.isDeleted = false, }): super(); + //Helper object to represents the data you want to insert or update in a table ServiceAttributesCompanion get companion { return ServiceAttributesCompanion( auditCreatedBy: Value(auditDetails?.createdBy), @@ -80,7 +78,7 @@ class ServiceAttributesModel extends EntityModel with ServiceAttributesModelMapp clientReferenceId: Value(clientReferenceId), tenantId: Value(tenantId), rowVersion: Value(rowVersion), - ); + ); } } diff --git a/packages/digit_data_model/lib/models/entities/service_attributes.mapper.dart b/packages/survey_form/lib/models/entities/service_attributes.mapper.dart similarity index 100% rename from packages/digit_data_model/lib/models/entities/service_attributes.mapper.dart rename to packages/survey_form/lib/models/entities/service_attributes.mapper.dart diff --git a/packages/digit_data_model/lib/models/entities/service_definition.dart b/packages/survey_form/lib/models/entities/service_definition.dart similarity index 97% rename from packages/digit_data_model/lib/models/entities/service_definition.dart rename to packages/survey_form/lib/models/entities/service_definition.dart index 238c4304d..0d66ce150 100644 --- a/packages/digit_data_model/lib/models/entities/service_definition.dart +++ b/packages/survey_form/lib/models/entities/service_definition.dart @@ -4,9 +4,6 @@ import 'package:drift/drift.dart'; import 'package:digit_data_model/data_model.dart'; -import '../../data/local_store/sql_store/sql_store.dart'; -import 'attributes.dart'; - part 'service_definition.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) @@ -64,6 +61,7 @@ class ServiceDefinitionModel extends EntityModel super.isDeleted = false, }) : super(); + //Helper object to represents the data you want to insert or update in a table ServiceDefinitionCompanion get companion { return ServiceDefinitionCompanion( auditCreatedBy: Value(auditDetails?.createdBy), diff --git a/packages/digit_data_model/lib/models/entities/service_definition.mapper.dart b/packages/survey_form/lib/models/entities/service_definition.mapper.dart similarity index 100% rename from packages/digit_data_model/lib/models/entities/service_definition.mapper.dart rename to packages/survey_form/lib/models/entities/service_definition.mapper.dart diff --git a/packages/survey_form/lib/pages/acknowledgement.dart b/packages/survey_form/lib/pages/acknowledgement.dart new file mode 100644 index 000000000..cd4ec0f5f --- /dev/null +++ b/packages/survey_form/lib/pages/acknowledgement.dart @@ -0,0 +1,76 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:digit_components/digit_components.dart'; +import 'package:flutter/material.dart'; + +import '../utils/i18_key_constants.dart' as i18; +import '../widgets/localized.dart'; + +@RoutePage() +class SurveyFormAcknowledgementPage extends LocalizedStatefulWidget { + final bool isDataRecordSuccess; + final String? label; + final String? description; + final Map? descriptionTableData; + const SurveyFormAcknowledgementPage({ + super.key, + super.appLocalizations, + this.isDataRecordSuccess = false, + this.label, + this.description, + this.descriptionTableData, + }); + + @override + State createState() => AcknowledgementPageState(); +} + +class AcknowledgementPageState extends LocalizedState { + @override + Widget build(BuildContext context) { + return Scaffold( + body: DigitAcknowledgement.success( + description: widget.description ?? + localizations.translate( + i18.acknowledgementSuccess.acknowledgementDescriptionText, + ), + descriptionWidget: widget.isDataRecordSuccess + ? DigitTableCard( + element: widget.descriptionTableData ?? {}, + ) + : null, + label: widget.label ?? + localizations.translate( + i18.acknowledgementSuccess.acknowledgementLabelText, + ), + action: () { + context.router.popUntilRoot(); + }, + enableBackToSearch: widget.isDataRecordSuccess ? false : true, + actionLabel: + localizations.translate(i18.acknowledgementSuccess.actionLabelText), + ), + bottomNavigationBar: Offstage( + offstage: !widget.isDataRecordSuccess, + // Show the bottom navigation bar if `isDataRecordSuccess` is true + child: SizedBox( + height: 150, + child: DigitCard( + margin: const EdgeInsets.fromLTRB(0, kPadding, 0, 0), + padding: const EdgeInsets.fromLTRB(kPadding, 0, kPadding, 0), + child: Column( + children: [ + DigitElevatedButton( + child: Text(localizations + .translate(i18.acknowledgementSuccess.goToHome)), + onPressed: () { + context.router.maybePop(); + }, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/packages/survey_form/lib/pages/survey_form.dart b/packages/survey_form/lib/pages/survey_form.dart new file mode 100644 index 000000000..fc8db035c --- /dev/null +++ b/packages/survey_form/lib/pages/survey_form.dart @@ -0,0 +1,143 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:digit_components/digit_components.dart'; +import 'package:digit_components/widgets/digit_project_cell.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:survey_form/survey_form.dart'; + +import '../router/survey_form_router.gm.dart'; +import '../utils/constants.dart'; +import '../widgets/action_card.dart'; +import '../widgets/back_navigation_help_header.dart'; +import '../widgets/localized.dart'; +import '../utils/i18_key_constants.dart' as i18; +import '../widgets/no_result_card.dart'; + +@RoutePage() +class SurveyformPage extends LocalizedStatefulWidget { + const SurveyformPage({ + Key? key, + super.appLocalizations, + }) : super(key: key); + + @override + State createState() => SurveyFormPageState(); +} + +class SurveyFormPageState extends State { + @override + Widget build(BuildContext context) { + final localizations = SurveyFormLocalization.of(context); + + return Scaffold( + body: ScrollableContent( + header: const Column(children: [ + BackNavigationHelpHeaderWidget(), + ]), + children: [ + BlocBuilder( + builder: (context, state) { + return state.map( + empty: (value) => Text(localizations.translate( + i18.surveyForm.noSurveyFormFound, + ),), + isloading: (value) => const Center( + child: CircularProgressIndicator(), + ), + serviceDefinitionFetch: + (ServiceDefinitionServiceFetchedState value) { + final values = value.serviceDefinitionList.where( + (item) => + !SurveyFormSingleton().roles + .indexOf( + item.code!.split('.').lastOrNull!, + ) + .isNegative && + !item.code!.contains(Constants + .healthFacilitySurveyFormPrefix) && + (item.code ?? '').contains( + SurveyFormSingleton().projectName)); + + if (values.isEmpty) { + return Column( + children: [ + NoResultCard( + align: Alignment.center, + label: localizations.translate( + i18.common.noResultsFound, + ), + ), + ], + ); + } + return Column( + children: values + .map((e) => DigitProjectCell( + projectText: localizations + .translate('${e.code}'), + onTap: () { + context + .read() + .add( + ServiceDefinitionSelectionEvent( + serviceDefinition: e, + ), + ); + DigitActionDialog.show( + context, + widget: ActionCard(items: [ + ActionCardModel( + icon: Icons.edit_calendar, + label: localizations.translate(i18 + .surveyForm + .surveyFormCreateActionLabel), + action: () { + context.router.push( + SurveyFormBoundaryViewRoute(), + ); + Navigator.of( + context, + rootNavigator: true, + ).pop(); + }, + ), + ActionCardModel( + icon: Icons.visibility, + label: localizations.translate(i18 + .surveyForm + .surveyFormViewActionLabel), + action: () { + context + .read() + .add( + ServiceSearchEvent( + serviceSearchModel: + ServiceSearchModel( + id: e.id, + ), + ), + ); + context.router.push( + SurveyFormPreviewRoute(), + ); + Navigator.of( + context, + rootNavigator: true, + ).pop(); + }, + ), + ]), + ); + }, + )) + .toList(), + ); + }, + ); + }, + ), + ], + ), + ); + } +} diff --git a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_boundary_view.dart b/packages/survey_form/lib/pages/survey_form_boundary_view.dart similarity index 62% rename from apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_boundary_view.dart rename to packages/survey_form/lib/pages/survey_form_boundary_view.dart index 40f2f05f4..937cdaede 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_boundary_view.dart +++ b/packages/survey_form/lib/pages/survey_form_boundary_view.dart @@ -1,29 +1,34 @@ -import 'package:digit_components/digit_components.dart'; +import 'package:auto_route/auto_route.dart'; +import 'package:survey_form/survey_form.dart'; +import 'package:digit_components/widgets/digit_card.dart'; +import 'package:digit_components/widgets/digit_elevated_button.dart'; +import 'package:digit_components/widgets/digit_text_field.dart'; +import 'package:digit_components/widgets/scrollable_content.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -import '../../router/app_router.dart'; -import '../../utils/i18_key_constants.dart' as i18; -import '../../utils/utils.dart'; -import '../../widgets/header/back_navigation_help_header.dart'; -import '../../widgets/localized.dart'; +import '../router/survey_form_router.gm.dart'; +import '../widgets/back_navigation_help_header.dart'; +import '../widgets/localized.dart'; +import '../utils/i18_key_constants.dart' as i18; @RoutePage() -class ChecklistBoundaryViewPage extends LocalizedStatefulWidget { - const ChecklistBoundaryViewPage({ +class SurveyFormBoundaryViewPage extends LocalizedStatefulWidget { + const SurveyFormBoundaryViewPage({ Key? key, super.appLocalizations, }) : super(key: key); @override - State createState() => - _ChecklistBoundaryViewPageState(); + State createState() => + SurveyFormBoundaryViewPageState(); } -class _ChecklistBoundaryViewPageState - extends LocalizedState { +class SurveyFormBoundaryViewPageState + extends State { @override Widget build(BuildContext context) { + final localizations = SurveyFormLocalization.of(context); final theme = Theme.of(context); return Scaffold( @@ -33,7 +38,7 @@ class _ChecklistBoundaryViewPageState ]), footer: DigitCard( child: DigitElevatedButton( - onPressed: () => context.router.push(ChecklistViewRoute()), + onPressed: () => context.router.push(SurveyFormViewRoute()), child: Text(localizations.translate( i18.common.coreCommonContinue, )), @@ -47,14 +52,14 @@ class _ChecklistBoundaryViewPageState children: [ Text( localizations.translate( - i18.checklist.checklistDetailLabel, + i18.surveyForm.surveyFormDetailLabel, ), style: theme.textTheme.displayMedium, ), DigitTextField( readOnly: true, label: localizations.translate( - i18.checklist.checklistdate, + i18.surveyForm.surveyFormdate, ), suffixIcon: const Padding( padding: EdgeInsets.all(8), @@ -73,7 +78,7 @@ class _ChecklistBoundaryViewPageState ), controller: TextEditingController( text: localizations - .translate(context.boundary.code.toString()), + .translate(SurveyFormSingleton().boundary!.code.toString()), ), ), ], diff --git a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_preview.dart b/packages/survey_form/lib/pages/survey_form_preview.dart similarity index 93% rename from apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_preview.dart rename to packages/survey_form/lib/pages/survey_form_preview.dart index 105936fc5..aa4ffaa74 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_preview.dart +++ b/packages/survey_form/lib/pages/survey_form_preview.dart @@ -1,29 +1,33 @@ -import 'package:digit_components/digit_components.dart'; +import 'package:auto_route/annotations.dart'; +import 'package:digit_components/theme/digit_theme.dart'; import 'package:digit_components/widgets/atoms/digit_divider.dart'; -import 'package:digit_data_model/data_model.dart'; +import 'package:digit_components/widgets/digit_card.dart'; +import 'package:digit_components/widgets/digit_elevated_button.dart'; +import 'package:digit_components/widgets/digit_outline_button.dart'; +import 'package:digit_components/widgets/scrollable_content.dart'; import 'package:flutter/material.dart'; +import 'package:survey_form/survey_form.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import '../../widgets/no_result_card/no_result_card.dart'; import 'package:intl/intl.dart'; -import '../../router/app_router.dart'; -import '../../utils/constants.dart'; -import '../../utils/i18_key_constants.dart' as i18; -import '../../widgets/header/back_navigation_help_header.dart'; -import '../../widgets/localized.dart'; +import '../widgets/back_navigation_help_header.dart'; +import '../widgets/localized.dart'; +import '../utils/i18_key_constants.dart' as i18; +import '../utils/constants.dart'; +import '../widgets/no_result_card.dart'; @RoutePage() -class ChecklistPreviewPage extends LocalizedStatefulWidget { - const ChecklistPreviewPage({ +class SurveyFormPreviewPage extends LocalizedStatefulWidget { + const SurveyFormPreviewPage({ Key? key, super.appLocalizations, }) : super(key: key); @override - State createState() => _ChecklistPreviewPageState(); + State createState() => SurveyFormPreviewPageState(); } -class _ChecklistPreviewPageState extends LocalizedState { +class SurveyFormPreviewPageState extends LocalizedState { @override Widget build(BuildContext context) { final theme = Theme.of(context); @@ -76,11 +80,9 @@ class _ChecklistPreviewPageState extends LocalizedState { Align( alignment: Alignment.centerLeft, child: Text( - DateFormat(Constants - .checklistPreviewDateFormat) + DateFormat(Constants.SurveyFormPreviewDateFormat) .format( - DateFormat(Constants - .defaultDateFormat) + DateFormat(Constants.defaultDateFormat) .parse( e.createdAt.toString(), ), @@ -141,7 +143,7 @@ class _ChecklistPreviewPageState extends LocalizedState { child: NoResultCard( align: Alignment.center, label: localizations.translate( - i18.checklist.noChecklistFound), + i18.surveyForm.noSurveyFormFound), ), ), ), @@ -176,7 +178,7 @@ class _ChecklistPreviewPageState extends LocalizedState { ...(selectedService.attributes ?? []) .where((a) => a.value != - i18.checklist + i18.surveyForm .notSelectedKey && a.value != '') .map( diff --git a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart b/packages/survey_form/lib/pages/survey_form_view.dart similarity index 89% rename from apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart rename to packages/survey_form/lib/pages/survey_form_view.dart index 8556c1163..d280d4993 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart +++ b/packages/survey_form/lib/pages/survey_form_view.dart @@ -1,37 +1,47 @@ import 'dart:math'; -import 'package:digit_components/digit_components.dart'; +import 'package:auto_route/auto_route.dart'; +import 'package:survey_form/survey_form.dart'; +import 'package:survey_form/utils/extensions/context_utility.dart'; +import 'package:digit_components/blocs/location/location.dart'; +import 'package:digit_components/theme/colors.dart'; +import 'package:digit_components/theme/digit_theme.dart'; import 'package:digit_components/utils/date_utils.dart'; import 'package:digit_components/widgets/atoms/selection_card.dart'; +import 'package:digit_components/widgets/digit_card.dart'; +import 'package:digit_components/widgets/digit_checkbox_tile.dart'; +import 'package:digit_components/widgets/digit_dialog.dart'; +import 'package:digit_components/widgets/digit_elevated_button.dart'; +import 'package:digit_components/widgets/digit_text_field.dart'; +import 'package:digit_components/widgets/scrollable_content.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:group_radio_button/group_radio_button.dart'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:group_radio_button/group_radio_button.dart'; -import '../../models/data_model.dart'; -import '../../models/entities/roles_type.dart'; -import '../../router/app_router.dart'; -import '../../utils/i18_key_constants.dart' as i18; -import '../../utils/utils.dart'; -import '../../widgets/header/back_navigation_help_header.dart'; -import '../../widgets/localized.dart'; +import '../router/survey_form_router.gm.dart'; +import '../utils/constants.dart'; +import '../widgets/back_navigation_help_header.dart'; +import '../widgets/localized.dart'; +import '../utils/i18_key_constants.dart' as i18; @RoutePage() -class ChecklistViewPage extends LocalizedStatefulWidget { +class SurveyFormViewPage extends LocalizedStatefulWidget { final String? referralClientRefId; - const ChecklistViewPage({ + const SurveyFormViewPage({ Key? key, this.referralClientRefId, super.appLocalizations, }) : super(key: key); @override - State createState() => _ChecklistViewPageState(); + State createState() => SurveyFormViewPageState(); } -class _ChecklistViewPageState extends LocalizedState { +class SurveyFormViewPageState extends LocalizedState { String isStateChanged = ''; var submitTriggered = false; List controller = []; @@ -39,13 +49,13 @@ class _ChecklistViewPageState extends LocalizedState { List? initialAttributes; ServiceDefinitionModel? selectedServiceDefinition; bool isControllersInitialized = false; - List visibleChecklistIndexes = []; - GlobalKey checklistFormKey = GlobalKey(); + List visibleSurveyFormIndexes = []; + GlobalKey surveyFormFormKey = GlobalKey(); @override void initState() { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: Random().nextInt(100).toString(), submitTriggered: true, ), @@ -57,10 +67,7 @@ class _ChecklistViewPageState extends LocalizedState { Widget build(BuildContext context) { final theme = Theme.of(context); - bool isHealthFacilityWorker = context.loggedInUserRoles - .where((role) => role.code == RolesType.healthFacilityWorker.toValue()) - .toList() - .isNotEmpty; + bool isHealthFacilityWorker = SurveyFormSingleton().isHealthFacilityWorker; return WillPopScope( onWillPop: isHealthFacilityWorker && widget.referralClientRefId != null @@ -87,7 +94,6 @@ class _ChecklistViewPageState extends LocalizedState { } }, ); - return state.maybeMap( orElse: () => Text(state.runtimeType.toString()), serviceDefinitionFetch: (value) { @@ -108,13 +114,13 @@ class _ChecklistViewPageState extends LocalizedState { submitTriggered = true; context.read().add( - const ServiceChecklistEvent( + const ServiceSurveyFormEvent( value: '', submitTriggered: true, ), ); final isValid = - checklistFormKey.currentState?.validate(); + surveyFormFormKey.currentState?.validate(); if (!isValid!) { return; } @@ -124,7 +130,7 @@ class _ChecklistViewPageState extends LocalizedState { if (itemsAttributes?[i].required == true && ((itemsAttributes?[i].dataType == 'SingleValueList' && - visibleChecklistIndexes + visibleSurveyFormIndexes .any((e) => e == i) && (controller[i].text == '')) || (itemsAttributes?[i].dataType != @@ -151,14 +157,14 @@ class _ChecklistViewPageState extends LocalizedState { context, options: DigitDialogOptions( titleText: localizations.translate( - i18.checklist.checklistDialogLabel, + i18.surveyForm.surveyFormDialogLabel, ), content: Text(localizations.translate( - i18.checklist.checklistDialogDescription, + i18.surveyForm.surveyFormDialogDescription, )), primaryAction: DigitDialogActions( label: localizations.translate( - i18.checklist.checklistDialogPrimaryAction, + i18.surveyForm.surveyFormDialogPrimaryAction, ), action: (ctx) { final referenceId = IdGen.i.identifier; @@ -167,7 +173,7 @@ class _ChecklistViewPageState extends LocalizedState { final attribute = initialAttributes; attributes.add(ServiceAttributesModel( auditDetails: AuditDetails( - createdBy: context.loggedInUserUuid, + createdBy: SurveyFormSingleton().loggedInUserUuid, createdTime: context.millisecondsSinceEpoch(), ), @@ -187,9 +193,9 @@ class _ChecklistViewPageState extends LocalizedState { .isNotEmpty ? controller[i].text.toString() : '' - : visibleChecklistIndexes.contains(i) + : visibleSurveyFormIndexes.contains(i) ? controller[i].text.toString() - : i18.checklist.notSelectedKey, + : i18.surveyForm.notSelectedKey, rowVersion: 1, tenantId: attribute?[i].tenantId, additionalDetails: isHealthFacilityWorker && @@ -237,7 +243,7 @@ class _ChecklistViewPageState extends LocalizedState { .toLocal() .millisecondsSinceEpoch, dateFormat: Constants - .checklistViewDateFormat, + .SurveyFormViewDateFormat, ), tenantId: value .selectedServiceDefinition! @@ -252,24 +258,24 @@ class _ChecklistViewPageState extends LocalizedState { .selectedServiceDefinition?.id, attributes: attributes, rowVersion: 1, - accountId: context.projectId, + accountId: SurveyFormSingleton().projectId, auditDetails: AuditDetails( - createdBy: context.loggedInUserUuid, + createdBy: SurveyFormSingleton().loggedInUserUuid, createdTime: DateTime.now() .millisecondsSinceEpoch, ), clientAuditDetails: ClientAuditDetails( - createdBy: context.loggedInUserUuid, + createdBy: SurveyFormSingleton().loggedInUserUuid, createdTime: context .millisecondsSinceEpoch(), lastModifiedBy: - context.loggedInUserUuid, + SurveyFormSingleton().loggedInUserUuid, lastModifiedTime: context .millisecondsSinceEpoch(), ), additionalDetails: - context.boundary.code, + SurveyFormSingleton().boundary?.code, ), ), ); @@ -282,7 +288,7 @@ class _ChecklistViewPageState extends LocalizedState { ), secondaryAction: DigitDialogActions( label: localizations.translate( - i18.checklist.checklistDialogSecondaryAction, + i18.surveyForm.surveyFormDialogSecondaryAction, ), action: (context) { Navigator.of( @@ -294,9 +300,8 @@ class _ChecklistViewPageState extends LocalizedState { ), ); if (shouldSubmit ?? false) { - router.navigate(ChecklistRoute()); - - router.push(AcknowledgementRoute()); + router.navigate(SurveyformRoute()); + router.push(SurveyFormAcknowledgementRoute()); } }, child: Text( @@ -304,9 +309,10 @@ class _ChecklistViewPageState extends LocalizedState { ), ), ), + children: [ Form( - key: checklistFormKey, //assigning key to form + key: surveyFormFormKey, //assigning key to form child: DigitCard( child: Column(children: [ Padding( @@ -315,7 +321,7 @@ class _ChecklistViewPageState extends LocalizedState { '${localizations.translate( value.selectedServiceDefinition!.code .toString(), - )} ${localizations.translate(i18.checklist.checklist)}', + )} ${localizations.translate(i18.surveyForm.surveyForm)}', style: theme.textTheme.displayMedium, textAlign: TextAlign.left, ), @@ -324,13 +330,12 @@ class _ChecklistViewPageState extends LocalizedState { e, ) { int index = (initialAttributes ?? []).indexOf(e); - return Column(children: [ if (e.dataType == 'String' && !(e.code ?? '').contains('.')) ...[ DigitTextField( onChange: (value) { - checklistFormKey.currentState?.validate(); + surveyFormFormKey.currentState?.validate(); }, isRequired: false, controller: controller[index], @@ -362,7 +367,7 @@ class _ChecklistViewPageState extends LocalizedState { !(e.code ?? '').contains('.')) ...[ DigitTextField( onChange: (value) { - checklistFormKey.currentState?.validate(); + surveyFormFormKey.currentState?.validate(); }, textStyle: theme.textTheme.headlineMedium, textInputType: TextInputType.number, @@ -424,7 +429,7 @@ class _ChecklistViewPageState extends LocalizedState { context .read() .add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: e.toString(), submitTriggered: submitTriggered, @@ -454,10 +459,11 @@ class _ChecklistViewPageState extends LocalizedState { ); }, ), - ] else if (e.dataType == 'SingleValueList') ...[ + ] + else if (e.dataType == 'SingleValueList') ...[ if (!(e.code ?? '').contains('.')) DigitCard( - child: _buildChecklist( + child: _buildSurveyForm( e, index, value.selectedServiceDefinition, @@ -505,7 +511,7 @@ class _ChecklistViewPageState extends LocalizedState { context .read() .add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: curValue.toString(), submitTriggered: submitTriggered, @@ -542,16 +548,14 @@ class _ChecklistViewPageState extends LocalizedState { ); } - Widget _buildChecklist( + Widget _buildSurveyForm( AttributesModel item, int index, ServiceDefinitionModel? selectedServiceDefinition, BuildContext context, ) { - bool isHealthFacilityWorker = context.loggedInUserRoles - .where((role) => role.code == RolesType.healthFacilityWorker.toValue()) - .toList() - .isNotEmpty; + bool isHealthFacilityWorker = SurveyFormSingleton().isHealthFacilityWorker; + final theme = Theme.of(context); /* Check the data type of the attribute*/ if (item.dataType == 'SingleValueList') { @@ -562,14 +566,14 @@ class _ChecklistViewPageState extends LocalizedState { List excludedIndexes = []; // Ensure the current index is added to visible indexes and not excluded - if (!visibleChecklistIndexes.contains(index) && + if (!visibleSurveyFormIndexes.contains(index) && !excludedIndexes.contains(index)) { - visibleChecklistIndexes.add(index); + visibleSurveyFormIndexes.add(index); } // Determine excluded indexes for (int i = 0; i < (initialAttributes ?? []).length; i++) { - if (!visibleChecklistIndexes.contains(i)) { + if (!visibleSurveyFormIndexes.contains(i)) { excludedIndexes.add(i); } } @@ -596,7 +600,7 @@ class _ChecklistViewPageState extends LocalizedState { groupValue: controller[index].text.trim(), onChanged: (value) { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: Random().nextInt(100).toString(), submitTriggered: submitTriggered, ), @@ -608,7 +612,7 @@ class _ChecklistViewPageState extends LocalizedState { initialAttributes?.indexOf(matchingChildItem); if (childIndex != null) { // controller[childIndex].clear(); - visibleChecklistIndexes + visibleSurveyFormIndexes .removeWhere((v) => v == childIndex); } } @@ -640,7 +644,7 @@ class _ChecklistViewPageState extends LocalizedState { }, items: item.values != null ? item.values! - .where((e) => e != i18.checklist.notSelectedKey) + .where((e) => e != i18.surveyForm.notSelectedKey) .toList() : [], itemBuilder: (item) => RadioButtonBuilder( @@ -709,7 +713,7 @@ class _ChecklistViewPageState extends LocalizedState { ), if (childItems.isNotEmpty && controller[index].text.trim().isNotEmpty) ...[ - _buildNestedChecklists( + _buildNestedSurveyForm( item.code.toString(), index, controller[index].text.trim(), @@ -724,7 +728,7 @@ class _ChecklistViewPageState extends LocalizedState { child: DigitTextField( maxLength: 1000, onChange: (value) { - checklistFormKey.currentState?.validate(); + surveyFormFormKey.currentState?.validate(); }, isRequired: item.required ?? true, controller: controller[index], @@ -753,7 +757,7 @@ class _ChecklistViewPageState extends LocalizedState { } else if (item.dataType == 'Number') { return DigitTextField( onChange: (value) { - checklistFormKey.currentState?.validate(); + surveyFormFormKey.currentState?.validate(); }, textStyle: theme.textTheme.headlineMedium, textInputType: TextInputType.number, @@ -809,7 +813,7 @@ class _ChecklistViewPageState extends LocalizedState { value: controller[index].text.split('.').contains(e), onChanged: (value) { context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: e.toString(), submitTriggered: submitTriggered, ), @@ -867,10 +871,8 @@ class _ChecklistViewPageState extends LocalizedState { initialSelection: const [false], options: const [true, false], onSelectionChanged: (valuec) { - print(submitTriggered); - print(controller[index].text.split('.').contains(e)); context.read().add( - ServiceChecklistEvent( + ServiceSurveyFormEvent( value: valuec.toString(), submitTriggered: submitTriggered, ), @@ -899,8 +901,8 @@ class _ChecklistViewPageState extends LocalizedState { } } - // Function to build nested checklists for child attributes - Widget _buildNestedChecklists( + // Function to build nested SurveyForm for child attributes + Widget _buildNestedSurveyForm( String parentCode, int parentIndex, String parentControllerValue, @@ -922,7 +924,7 @@ class _ChecklistViewPageState extends LocalizedState { color: countDots(matchingChildItem.code ?? '') % 4 == 2 ? const Color.fromRGBO(238, 238, 238, 1) : const DigitColors().white, - child: _buildChecklist( + child: _buildSurveyForm( matchingChildItem, initialAttributes?.indexOf(matchingChildItem) ?? parentIndex, // Pass parentIndex here as we're building at the same level @@ -937,15 +939,15 @@ class _ChecklistViewPageState extends LocalizedState { // Function to get the next questions (child attributes) based on a parent code List getNextQuestions( String parentCode, - List checklistItems, + List surveyFormItems, ) { final childCodePrefix = '$parentCode.'; - final nextCheckLists = checklistItems.where((item) { + final nextSurveyForm = surveyFormItems.where((item) { return item.code!.startsWith(childCodePrefix) && item.code?.split('.').length == parentCode.split('.').length + 2; }).toList(); - return nextCheckLists; + return nextSurveyForm; } int countDots(String inputString) { @@ -965,14 +967,14 @@ class _ChecklistViewPageState extends LocalizedState { builder: (context) => DigitDialog( options: DigitDialogOptions( titleText: localizations.translate( - i18.checklist.checklistBackDialogLabel, + i18.surveyForm.surveyFormBackDialogLabel, ), content: Text(localizations.translate( - i18.checklist.checklistBackDialogDescription, + i18.surveyForm.surveyFormBackDialogDescription, )), primaryAction: DigitDialogActions( label: localizations - .translate(i18.checklist.checklistBackDialogPrimaryAction), + .translate(i18.surveyForm.surveyFormBackDialogPrimaryAction), action: (ctx) { Navigator.of( context, @@ -982,7 +984,7 @@ class _ChecklistViewPageState extends LocalizedState { ), secondaryAction: DigitDialogActions( label: localizations - .translate(i18.checklist.checklistBackDialogSecondaryAction), + .translate(i18.surveyForm.surveyFormBackDialogSecondaryAction), action: (context) { Navigator.of( context, diff --git a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_wrapper.dart b/packages/survey_form/lib/pages/survey_form_wrapper.dart similarity index 67% rename from apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_wrapper.dart rename to packages/survey_form/lib/pages/survey_form_wrapper.dart index f3627037c..ff640108d 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_wrapper.dart +++ b/packages/survey_form/lib/pages/survey_form_wrapper.dart @@ -1,33 +1,24 @@ import 'package:auto_route/auto_route.dart'; +import 'package:survey_form/utils/extensions/context_utility.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:digit_data_model/data_model.dart'; - -import '../../utils/extensions/extensions.dart'; -import '../../widgets/boundary_selection_wrapper.dart'; +import 'package:survey_form/survey_form.dart'; @RoutePage() -class ChecklistWrapperPage extends StatelessWidget implements AutoRouteWrapper { +class SurveyFormWrapperPage extends StatelessWidget { final bool isEditing; - const ChecklistWrapperPage({ + const SurveyFormWrapperPage({ super.key, this.isEditing = false, }); @override Widget build(BuildContext context) { - return const BoundarySelectionWrapper( - child: AutoRouter(), - ); - } - - @override - Widget wrappedRoute(BuildContext context) { final serviceDefinition = context - .repository(); + .repository(context); - final service = context.repository(); + final service = context.repository(context); return MultiBlocProvider( providers: [ @@ -36,6 +27,7 @@ class ChecklistWrapperPage extends StatelessWidget implements AutoRouteWrapper { const ServiceDefinitionEmptyState(), serviceDefinitionDataRepository: serviceDefinition, )..add(const ServiceDefinitionFetchEvent()), + lazy: false, ), BlocProvider( create: (_) => ServiceBloc( @@ -44,7 +36,7 @@ class ChecklistWrapperPage extends StatelessWidget implements AutoRouteWrapper { ), ), ], - child: this, + child: const AutoRouter(), ); } } diff --git a/packages/survey_form/lib/router/survey_form_router.dart b/packages/survey_form/lib/router/survey_form_router.dart new file mode 100644 index 000000000..70186e87a --- /dev/null +++ b/packages/survey_form/lib/router/survey_form_router.dart @@ -0,0 +1,29 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:survey_form/router/survey_form_router.gm.dart'; + + +//Used auto_route package to navigate to different pages in survey_form package + +@AutoRouterConfig.module() +class SurveyFormRoute extends $SurveyFormRoute { + + RouteType get defaultRouteType => const RouteType.material(); + + List routes = [ + AutoRoute( + page: SurveyFormWrapperRoute.page, + path: 'surveyForm', + children: [ + AutoRoute( + page: SurveyformRoute.page, + path: '', + ), + ], + ), + AutoRoute( + page: SurveyFormBoundaryViewRoute.page, path: 'view-boundary'), + AutoRoute(page: SurveyFormViewRoute.page, path: 'view'), + AutoRoute(page: SurveyFormPreviewRoute.page, path: 'preview'), + AutoRoute(page: SurveyFormAcknowledgementRoute.page, path: 'surveyForm-acknowledgement'), + ]; +} \ No newline at end of file diff --git a/packages/survey_form/lib/router/survey_form_router.gm.dart b/packages/survey_form/lib/router/survey_form_router.gm.dart new file mode 100644 index 000000000..50e3f4d55 --- /dev/null +++ b/packages/survey_form/lib/router/survey_form_router.gm.dart @@ -0,0 +1,354 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ************************************************************************** +// AutoRouterGenerator +// ************************************************************************** + +// ignore_for_file: type=lint +// coverage:ignore-file + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:auto_route/auto_route.dart' as _i7; +import 'package:flutter/material.dart' as _i8; +import 'package:survey_form/blocs/app_localization.dart' as _i9; +import 'package:survey_form/pages/acknowledgement.dart' as _i1; +import 'package:survey_form/pages/survey_form.dart' as _i6; +import 'package:survey_form/pages/survey_form_boundary_view.dart' as _i2; +import 'package:survey_form/pages/survey_form_preview.dart' as _i3; +import 'package:survey_form/pages/survey_form_view.dart' as _i4; +import 'package:survey_form/pages/survey_form_wrapper.dart' as _i5; +import 'package:survey_form/survey_form.dart' as _i10; + +abstract class $SurveyFormRoute extends _i7.AutoRouterModule { + @override + final Map pagesMap = { + SurveyFormAcknowledgementRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const SurveyFormAcknowledgementRouteArgs()); + return _i7.AutoRoutePage( + routeData: routeData, + child: _i1.SurveyFormAcknowledgementPage( + key: args.key, + appLocalizations: args.appLocalizations, + isDataRecordSuccess: args.isDataRecordSuccess, + label: args.label, + description: args.description, + descriptionTableData: args.descriptionTableData, + ), + ); + }, + SurveyFormBoundaryViewRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const SurveyFormBoundaryViewRouteArgs()); + return _i7.AutoRoutePage( + routeData: routeData, + child: _i2.SurveyFormBoundaryViewPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + SurveyFormPreviewRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const SurveyFormPreviewRouteArgs()); + return _i7.AutoRoutePage( + routeData: routeData, + child: _i3.SurveyFormPreviewPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + SurveyFormViewRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const SurveyFormViewRouteArgs()); + return _i7.AutoRoutePage( + routeData: routeData, + child: _i4.SurveyFormViewPage( + key: args.key, + referralClientRefId: args.referralClientRefId, + appLocalizations: args.appLocalizations, + ), + ); + }, + SurveyFormWrapperRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const SurveyFormWrapperRouteArgs()); + return _i7.AutoRoutePage( + routeData: routeData, + child: _i5.SurveyFormWrapperPage( + key: args.key, + isEditing: args.isEditing, + ), + ); + }, + SurveyformRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const SurveyformRouteArgs()); + return _i7.AutoRoutePage( + routeData: routeData, + child: _i6.SurveyformPage( + key: args.key, + appLocalizations: args.appLocalizations, + ), + ); + }, + }; +} + +/// generated route for +/// [_i1.SurveyFormAcknowledgementPage] +class SurveyFormAcknowledgementRoute + extends _i7.PageRouteInfo { + SurveyFormAcknowledgementRoute({ + _i8.Key? key, + _i9.SurveyFormLocalization? appLocalizations, + bool isDataRecordSuccess = false, + String? label, + String? description, + Map? descriptionTableData, + List<_i7.PageRouteInfo>? children, + }) : super( + SurveyFormAcknowledgementRoute.name, + args: SurveyFormAcknowledgementRouteArgs( + key: key, + appLocalizations: appLocalizations, + isDataRecordSuccess: isDataRecordSuccess, + label: label, + description: description, + descriptionTableData: descriptionTableData, + ), + initialChildren: children, + ); + + static const String name = 'SurveyFormAcknowledgementRoute'; + + static const _i7.PageInfo page = + _i7.PageInfo(name); +} + +class SurveyFormAcknowledgementRouteArgs { + const SurveyFormAcknowledgementRouteArgs({ + this.key, + this.appLocalizations, + this.isDataRecordSuccess = false, + this.label, + this.description, + this.descriptionTableData, + }); + + final _i8.Key? key; + + final _i9.SurveyFormLocalization? appLocalizations; + + final bool isDataRecordSuccess; + + final String? label; + + final String? description; + + final Map? descriptionTableData; + + @override + String toString() { + return 'SurveyFormAcknowledgementRouteArgs{key: $key, appLocalizations: $appLocalizations, isDataRecordSuccess: $isDataRecordSuccess, label: $label, description: $description, descriptionTableData: $descriptionTableData}'; + } +} + +/// generated route for +/// [_i2.SurveyFormBoundaryViewPage] +class SurveyFormBoundaryViewRoute + extends _i7.PageRouteInfo { + SurveyFormBoundaryViewRoute({ + _i8.Key? key, + _i10.SurveyFormLocalization? appLocalizations, + List<_i7.PageRouteInfo>? children, + }) : super( + SurveyFormBoundaryViewRoute.name, + args: SurveyFormBoundaryViewRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'SurveyFormBoundaryViewRoute'; + + static const _i7.PageInfo page = + _i7.PageInfo(name); +} + +class SurveyFormBoundaryViewRouteArgs { + const SurveyFormBoundaryViewRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i8.Key? key; + + final _i10.SurveyFormLocalization? appLocalizations; + + @override + String toString() { + return 'SurveyFormBoundaryViewRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i3.SurveyFormPreviewPage] +class SurveyFormPreviewRoute + extends _i7.PageRouteInfo { + SurveyFormPreviewRoute({ + _i8.Key? key, + _i10.SurveyFormLocalization? appLocalizations, + List<_i7.PageRouteInfo>? children, + }) : super( + SurveyFormPreviewRoute.name, + args: SurveyFormPreviewRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'SurveyFormPreviewRoute'; + + static const _i7.PageInfo page = + _i7.PageInfo(name); +} + +class SurveyFormPreviewRouteArgs { + const SurveyFormPreviewRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i8.Key? key; + + final _i10.SurveyFormLocalization? appLocalizations; + + @override + String toString() { + return 'SurveyFormPreviewRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i4.SurveyFormViewPage] +class SurveyFormViewRoute extends _i7.PageRouteInfo { + SurveyFormViewRoute({ + _i8.Key? key, + String? referralClientRefId, + _i10.SurveyFormLocalization? appLocalizations, + List<_i7.PageRouteInfo>? children, + }) : super( + SurveyFormViewRoute.name, + args: SurveyFormViewRouteArgs( + key: key, + referralClientRefId: referralClientRefId, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'SurveyFormViewRoute'; + + static const _i7.PageInfo page = + _i7.PageInfo(name); +} + +class SurveyFormViewRouteArgs { + const SurveyFormViewRouteArgs({ + this.key, + this.referralClientRefId, + this.appLocalizations, + }); + + final _i8.Key? key; + + final String? referralClientRefId; + + final _i10.SurveyFormLocalization? appLocalizations; + + @override + String toString() { + return 'SurveyFormViewRouteArgs{key: $key, referralClientRefId: $referralClientRefId, appLocalizations: $appLocalizations}'; + } +} + +/// generated route for +/// [_i5.SurveyFormWrapperPage] +class SurveyFormWrapperRoute + extends _i7.PageRouteInfo { + SurveyFormWrapperRoute({ + _i8.Key? key, + bool isEditing = false, + List<_i7.PageRouteInfo>? children, + }) : super( + SurveyFormWrapperRoute.name, + args: SurveyFormWrapperRouteArgs( + key: key, + isEditing: isEditing, + ), + initialChildren: children, + ); + + static const String name = 'SurveyFormWrapperRoute'; + + static const _i7.PageInfo page = + _i7.PageInfo(name); +} + +class SurveyFormWrapperRouteArgs { + const SurveyFormWrapperRouteArgs({ + this.key, + this.isEditing = false, + }); + + final _i8.Key? key; + + final bool isEditing; + + @override + String toString() { + return 'SurveyFormWrapperRouteArgs{key: $key, isEditing: $isEditing}'; + } +} + +/// generated route for +/// [_i6.SurveyformPage] +class SurveyformRoute extends _i7.PageRouteInfo { + SurveyformRoute({ + _i8.Key? key, + _i10.SurveyFormLocalization? appLocalizations, + List<_i7.PageRouteInfo>? children, + }) : super( + SurveyformRoute.name, + args: SurveyformRouteArgs( + key: key, + appLocalizations: appLocalizations, + ), + initialChildren: children, + ); + + static const String name = 'SurveyformRoute'; + + static const _i7.PageInfo page = + _i7.PageInfo(name); +} + +class SurveyformRouteArgs { + const SurveyformRouteArgs({ + this.key, + this.appLocalizations, + }); + + final _i8.Key? key; + + final _i10.SurveyFormLocalization? appLocalizations; + + @override + String toString() { + return 'SurveyformRouteArgs{key: $key, appLocalizations: $appLocalizations}'; + } +} diff --git a/packages/survey_form/lib/survey_form.dart b/packages/survey_form/lib/survey_form.dart new file mode 100644 index 000000000..e74936cdb --- /dev/null +++ b/packages/survey_form/lib/survey_form.dart @@ -0,0 +1,24 @@ +@MappableLib( + generateInitializerForScope: InitializerScope.package, +) +library survey_form; + +import 'package:dart_mappable/dart_mappable.dart'; + +//exporting all the files from survey_form package +export 'survey_form.init.dart'; +export 'models/entities/service.dart'; +export 'models/entities/service_attributes.dart'; +export 'models/entities/service_definition.dart'; +export 'data/repositories/oplog/oplog.dart'; +export 'data/repositories/local/service.dart'; +export 'data/repositories/local/service_definition.dart'; +export 'data/repositories/remote/service.dart'; +export 'data/repositories/remote/service_definition.dart'; +export 'data/repositories/remote/service_attributes.dart'; +export 'utils/utils.dart'; +export 'blocs/service.dart'; +export 'blocs/service_definition.dart'; +export 'blocs/app_localization.dart'; + + diff --git a/packages/survey_form/lib/survey_form.init.dart b/packages/survey_form/lib/survey_form.init.dart new file mode 100644 index 000000000..b9bd11a14 --- /dev/null +++ b/packages/survey_form/lib/survey_form.init.dart @@ -0,0 +1,20 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element + +import 'models/entities/service.dart' as p0; +import 'models/entities/service_attributes.dart' as p1; +import 'models/entities/service_definition.dart' as p2; + +void initializeMappers() { + p0.ServiceSearchModelMapper.ensureInitialized(); + p0.ServiceModelMapper.ensureInitialized(); + p0.ServiceAdditionalFieldsMapper.ensureInitialized(); + p1.ServiceAttributesSearchModelMapper.ensureInitialized(); + p1.ServiceAttributesModelMapper.ensureInitialized(); + p1.ServiceAttributesAdditionalFieldsMapper.ensureInitialized(); + p2.ServiceDefinitionSearchModelMapper.ensureInitialized(); + p2.ServiceDefinitionModelMapper.ensureInitialized(); + p2.ServiceDefinitionAdditionalFieldsMapper.ensureInitialized(); +} diff --git a/packages/survey_form/lib/utils/constants.dart b/packages/survey_form/lib/utils/constants.dart new file mode 100644 index 000000000..2b8733375 --- /dev/null +++ b/packages/survey_form/lib/utils/constants.dart @@ -0,0 +1,10 @@ +class Constants { + static const String SurveyFormPreviewDateFormat = 'dd MMMM yyyy'; + static const String defaultDateFormat = 'dd/MM/yyyy'; + static const String defaultDateTimeFormat = 'dd/MM/yyyy hh:mm a'; + static const String SurveyFormViewDateFormat = 'dd/MM/yyyy hh:mm a'; + static const String healthFacilitySurveyFormPrefix = 'HF_RF'; +} + +const String noResultSvg = 'assets/icons/svg/no_result.svg'; +const String mySurveyFormSvg = 'assets/icons/svg/mychecklist.svg'; \ No newline at end of file diff --git a/packages/survey_form/lib/utils/extensions/context_utility.dart b/packages/survey_form/lib/utils/extensions/context_utility.dart new file mode 100644 index 000000000..58d7fd4b0 --- /dev/null +++ b/packages/survey_form/lib/utils/extensions/context_utility.dart @@ -0,0 +1,25 @@ +import 'package:digit_data_model/data_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import '../utils.dart'; + +extension ContextUtilityExtensions on BuildContext { + int millisecondsSinceEpoch([DateTime? dateTime]) { + return (dateTime ?? DateTime.now()).millisecondsSinceEpoch; + } + + // Provides survey_form repository based on the persistence configuration + DataRepository + repository( + BuildContext context, + ) { + switch (SurveyFormSingleton().persistenceConfiguration) { + case PersistenceConfiguration.offlineFirst: + return context.read>(); + case PersistenceConfiguration.onlineOnly: + return context.read>(); + default: + return context.read>(); + } + } +} diff --git a/packages/survey_form/lib/utils/i18_key_constants.dart b/packages/survey_form/lib/utils/i18_key_constants.dart new file mode 100644 index 000000000..9ca7563f3 --- /dev/null +++ b/packages/survey_form/lib/utils/i18_key_constants.dart @@ -0,0 +1,245 @@ +library i18; + +const common = Common(); +const surveyForm = SurveyForm(); +const selectSurveyFormShowcase = SelectSurveyFormShowcase(); +const surveyFormDataShowcase = SurveyFormDataShowcase(); +const surveyFormListShowcase = SurveyFormListShowcase(); +const searchBeneficiary = SearchBeneficiary(); +const householdLocation = HouseholdLocation(); +const acknowledgementSuccess = AcknowledgementSuccess(); + +class Common { + const Common(); + + String get coreCommonContinue => 'CORE_COMMON_CONTINUE'; + + String get coreCommonAge => 'CORE_COMMON_AGE'; + + String get coreCommonName => 'CORE_COMMON_NAME'; + + String get coreCommonEmailId => 'CORE_COMMON_EMAIL_ID'; + + String get coreCommonGender => 'CORE_COMMON_GENDER'; + + String get coreCommonMobileNumber => 'CORE_COMMON_MOBILE_NUMBER'; + + String get coreCommonSubmit => 'CORE_COMMON_SUBMIT'; + + String get coreCommonSave => 'CORE_COMMON_SAVE'; + + String get coreCommonCancel => 'CORE_COMMON_CANCEL'; + + String get corecommonRequired => 'CORE_COMMON_REQUIRED'; + + String get coreCommonReasonRequired => 'CORE_COMMON_REASON_REQUIRED'; + + String get corecommonclose => 'CORE_COMMON_CLOSE'; + + String get coreCommonOk => 'CORE_COMMON_OK'; + + String get coreCommonNA => 'CORE_COMMON_NA'; + + String get coreCommonProfile => 'CORE_COMMON_PROFILE'; + + String get coreCommonLogout => 'CORE_COMMON_LOGOUT'; + + String get coreCommonBack => 'CORE_COMMON_BACK'; + + String get coreCommonHelp => 'CORE_COMMON_HELP'; + + String get coreCommonHome => 'CORE_COMMON_HOME'; + + String get coreCommonViewDownloadedData => 'CORE_COMMON_VIEW_DOWNLOADED_DATA'; + + String get coreCommonlanguage => 'CORE_COMMON_LANGUAGE'; + + String get coreCommonSyncProgress => 'CORE_COMMON_SYNC_PROGRESS'; + + String get coreCommonDataSynced => 'CORE_COMMON_DATA_SYNCED'; + + String get coreCommonDataSyncFailed => 'CORE_COMMON_DATA_SYNC_FAILED'; + + String get coreCommonDataSyncRetry => 'CORE_COMMON_DATA_SYNC_RETRY'; + + String get connectionLabel => 'CORE_COMMON_CONNECTION_LABEL'; + + String get connectionContent => 'CORE_COMMON_CONNECTION_CONTENT'; + + String get coreCommonSkip => 'CORE_COMMON_SKIP'; + + String get coreCommonNext => 'CORE_COMMON_NEXT'; + + String get coreCommonYes => 'CORE_COMMON_YES'; + + String get coreCommonNo => 'CORE_COMMON_NO'; + String get coreCommonGoback => 'CORE_COMMON_GO_BACK'; + + String get coreCommonRequiredItems => 'CORE_COMMON_REQUIRED_ITEMS'; + + String get min2CharsRequired => 'MIN_2_CHARS_REQUIRED'; + + String get maxCharsRequired => 'MAX_CHARS_ALLOWED'; + + String get maxValue => 'MAX_VALUE_ALLOWED'; + String get minValue => 'MIN_VALUE_ALLOWED'; + + String get noResultsFound => 'NO_RESULTS_FOUND'; + + String get coreCommonSyncInProgress => 'CORE_COMMON_SYNC_IN_PROGRESS'; + + String get facilitySearchHeaderLabel => 'FACILITY_SEARCH_HEADER_LABEL'; + String get projectFacilitySearchHeaderLabel => + 'PROJECT_FACILITY_SEARCH_HEADER_LABEL'; + + String get coreCommonDownload => 'CORE_COMMON_DOWNLOAD'; + + String get coreCommonDownloadFailed => 'CORE_COMMON_DOWNLOAD_FAILED'; + + String get noMatchFound => 'CORE_COMMON_NO_MATCH_FOUND'; + + String get scanBales => 'CORE_COMMON_SCAN_BALES'; + String get ageInMonths => 'AGE_IN_MONTHS_LABEL'; + + String get profileUpdateSuccess => 'PROFILE_UPDATE_SUCCESS'; +} + +class SelectSurveyFormShowcase { + const SelectSurveyFormShowcase(); + + String get selectSurveyForm { + return 'SELECT_CHECKLIST_SHOWCASE_SELECT_CHECKLIST'; + } +} + +class SurveyFormDataShowcase { + const SurveyFormDataShowcase(); + + String get date { + return 'CHECKLIST_DATA_SHOWCASE_DATE'; + } + + String get administrativeUnit { + return 'CHECKLIST_DATA_SHOWCASE_ADMINISTRATIVE_UNIT'; + } +} + +class SurveyFormListShowcase { + const SurveyFormListShowcase(); + + String get open { + return 'CHECKLIST_LIST_SHOWCASE_OPEN'; + } +} + +class SurveyForm { + const SurveyForm(); + + String get surveyForm => 'CHECKLIST'; + + String get surveyFormlabel => 'CHECKLIST_LABEL'; + + String get surveyFormCreateActionLabel => 'CHECKLIST_CREATE_ACTION_LABEL'; + + String get surveyFormViewActionLabel => 'CHECKLIST_VIEW_ACTION_LABEL'; + + String get surveyFormDetailLabel => 'CHECKLIST_DETAILS_LABEL'; + + String get surveyFormDialogLabel => 'CHECKLIST_DIALOG_LABEL'; + + String get surveyFormDialogDescription => 'CHECKLIST_DIALOG_DESCRITPTION'; + + String get surveyFormDialogPrimaryAction => 'CHECKLIST_DIALOG_PRIMARY_ACTION'; + + String get surveyFormDialogSecondaryAction => + 'CHECKLIST_DIALOG_SECONDARY_ACTION'; + + String get surveyFormdate => 'CHECKLIST_DATE'; + + String get surveyFormReasonRequiredError => 'CHECKLIST_REASON_REQUIRED_ERROR'; + + String get notSelectedKey => 'NOT_SELECTED'; + + String get surveyFormBackDialogLabel => 'CHECKLIST_BACK_DIALOG_LABEL'; + + String get surveyFormBackDialogDescription => + 'CHECKLIST_BACK_DIALOG_DESCRITPTION'; + + String get surveyFormBackDialogPrimaryAction => + 'CHECKLIST_BACK_DIALOG_PRIMARY_ACTION'; + + String get surveyFormBackDialogSecondaryAction => + 'CHECKLIST_BACK_DIALOG_SECONDARY_ACTION'; + + String get noSurveyFormFound => 'NO_CHECKLIST_FOUND'; +} + +class SearchBeneficiary { + const SearchBeneficiary(); + + String get statisticsLabelText => 'BENEFICIARY_STATISTICS_LABEL_TEXT'; + + String get searchIndividualLabelText => + 'BENEFICIARY_STATISTICS_SEARCH_INDIVIDUAL_LABEL'; + + String get noOfHouseholdsRegistered => 'NO_OF_HOUSEHOLDS_REGISTERED'; + + String get noOfResourcesDelivered => 'NO_OF_RESOURCES_DELIVERED'; + + String get beneficiarySearchHintText => 'BENEFICIARY_SEARCH_HINT_TEXT'; + + String get beneficiaryIndividualSearchHintText => + 'BENEFICIARY_INDIVIDUAL_SEARCH_HINT_TEXT'; + + String get beneficiaryInfoDescription => 'BENEFICIARY_INFO_DESCRIPTION'; + + String get beneficiaryInfoTitle => 'BENEFICIARY_INFO_TITLE'; + + String get beneficiaryAddActionLabel => 'BENEFICIARY_ADD_ACTION_LABEL'; + + String get iconLabel => 'ICON_LABEL'; + + String get yearsAbbr => 'YEARS_ABBR'; + + String get monthsAbbr => 'MONTHS_ABBR'; + + String get proximityLabel => 'PROXIMITY_LABEL'; +} + +class HouseholdLocation { + const HouseholdLocation(); + + String get householdLocationLabelText => 'HOUSEHOLD_LOCATION_LABEL_TEXT'; + + String get administrationAreaFormLabel => 'ADMINISTRATION_AREA_FORM_LABEL'; + + String get administrationAreaRequiredValidation => + 'HOUSEHOLD_LOCATION_ADMINISTRATION_AREA_REQUIRED_VALIDATION'; + + String get householdAddressLine1LabelText => + 'HOUSEHOLD_ADDRESS_LINE_1_FORM_LABEL'; + + String get landmarkFormLabel => 'LANDMARK_FORM_LABEL'; + + String get householdAddressLine2LabelText => + 'HOUSEHOLD_ADDRESS_LINE_2_FORM_LABEL'; + + String get postalCodeFormLabel => 'POSTAL_CODE_FORM_LABEL'; + + String get actionLabel => 'HOUSEHOLD_LOCATION_ACTION_LABEL'; +} + +class AcknowledgementSuccess { + const AcknowledgementSuccess(); + + String get actionLabelText => 'ACKNOWLEDGEMENT_SUCCESS_ACTION_LABEL_TEXT'; + + String get acknowledgementDescriptionText => + 'ACKNOWLEDGEMENT_SUCCESS_DESCRIPTION_TEXT'; + + String get acknowledgementLabelText => 'ACKNOWLEDGEMENT_SUCCESS_LABEL_TEXT'; + + String get goToHome => 'GO_TO_HOME_SCREEN'; + String get downloadmoredata => 'DOWNLOAD_MORE_DATA'; + String get dataDownloadedSuccessLabel => 'DATA_DOWNLOADED_SUCCESS_LABEL'; +} diff --git a/packages/survey_form/lib/utils/typedefs.dart b/packages/survey_form/lib/utils/typedefs.dart new file mode 100644 index 000000000..151f8f549 --- /dev/null +++ b/packages/survey_form/lib/utils/typedefs.dart @@ -0,0 +1,7 @@ +import 'package:digit_data_model/data/data_repository.dart'; +import 'package:survey_form/survey_form.dart'; + +typedef ServiceDataRepository += DataRepository; +typedef ServiceDefinitionDataRepository += DataRepository; \ No newline at end of file diff --git a/packages/survey_form/lib/utils/utils.dart b/packages/survey_form/lib/utils/utils.dart new file mode 100644 index 000000000..8f706e679 --- /dev/null +++ b/packages/survey_form/lib/utils/utils.dart @@ -0,0 +1,65 @@ +import 'package:digit_data_model/data_model.dart'; + +// Singleton class for managing survey_form operations +class SurveyFormSingleton { + static final SurveyFormSingleton _singleton = SurveyFormSingleton._internal(); + + factory SurveyFormSingleton() { + return _singleton; + } + + SurveyFormSingleton._internal(); + + String _projectId = ''; + String _projectName=''; + String _loggedInIndividualId = ''; + String _loggedInUserUuid = ''; + String _appVersion = ''; + String _tenantId = ''; + Object _roles=[]; + bool _isHealthFacilityWorker = false; + BoundaryModel? _boundaryModel; + PersistenceConfiguration _persistenceConfiguration = PersistenceConfiguration + .offlineFirst; // Default to offline first persistence configuration + + void setBoundary({required BoundaryModel boundary}) { + _boundaryModel = boundary; + } + // Method to set survey_form listeners and other information + void setInitialData( + {required String projectId, + required String projectName, + required String loggedInIndividualId, + required String loggedInUserUuid, + required String appVersion, + required bool isHealthFacilityWorker, + required Object roles}) { + + _projectId = projectId; + _projectName=projectName; + _loggedInIndividualId = loggedInIndividualId; + _loggedInUserUuid = loggedInUserUuid; + _appVersion = appVersion; + _roles=roles; + _isHealthFacilityWorker=isHealthFacilityWorker; + } + + get projectId => _projectId; + get projectName => _projectName; + get loggedInIndividualId => _loggedInIndividualId; + get loggedInUserUuid => _loggedInUserUuid; + get appVersion => _appVersion; + get tenantId => _tenantId; + get persistenceConfiguration => _persistenceConfiguration; + get roles => _roles; + get isHealthFacilityWorker => _isHealthFacilityWorker; + BoundaryModel? get boundary => _boundaryModel; + + void setTenantId(String tenantId) { + _tenantId = tenantId; + } + + void setPersistenceConfiguration(PersistenceConfiguration configuration) { + _persistenceConfiguration = configuration; + } +} diff --git a/packages/survey_form/lib/widgets/action_card.dart b/packages/survey_form/lib/widgets/action_card.dart new file mode 100644 index 000000000..c5468f7bf --- /dev/null +++ b/packages/survey_form/lib/widgets/action_card.dart @@ -0,0 +1,57 @@ +import 'package:digit_components/digit_components.dart'; +import 'package:flutter/material.dart'; + +class ActionCard extends StatelessWidget { + final List items; + + const ActionCard({super.key, required this.items}); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Column( + mainAxisSize: MainAxisSize.min, + children: items + .map( + (e) => Padding( + padding: const EdgeInsets.all(kPadding / 2), + child: DigitOutlineIconButton( + buttonStyle: OutlinedButton.styleFrom( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.zero, + ), + backgroundColor: Colors.white, + side: BorderSide( + width: 1.0, + color: e.action != null + ? theme.colorScheme.secondary + : theme.colorScheme.outline, + ), + minimumSize: Size( + MediaQuery.of(context).size.width / 1.25, + 50, + ), + ), + icon: e.icon, + label: e.label, + onPressed: e.action, + ), + ), + ) + .toList(), + ); + } +} + +class ActionCardModel { + final IconData icon; + final String label; + final VoidCallback? action; + + const ActionCardModel({ + required this.icon, + required this.label, + required this.action, + }); +} diff --git a/packages/survey_form/lib/widgets/back_navigation_help_header.dart b/packages/survey_form/lib/widgets/back_navigation_help_header.dart new file mode 100644 index 000000000..063f47bd1 --- /dev/null +++ b/packages/survey_form/lib/widgets/back_navigation_help_header.dart @@ -0,0 +1,79 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; + +import '../../utils/i18_key_constants.dart' as i18; +import '../blocs/app_localization.dart'; + +class BackNavigationHelpHeaderWidget extends StatelessWidget { + final bool showHelp; + final bool showBackNavigation; + final bool showLogoutCTA; + final VoidCallback? helpClicked; + final VoidCallback? handleBack; + + const BackNavigationHelpHeaderWidget({ + super.key, + this.showHelp = false, //hiding help + this.showBackNavigation = true, + this.showLogoutCTA = false, + this.helpClicked, + this.handleBack, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + children: [ + Expanded( + child: Row( + children: [ + if (showBackNavigation) + Flexible( + child: TextButton.icon( + style: TextButton.styleFrom( + foregroundColor: theme.colorScheme.onSurface, + padding: EdgeInsets.zero, + ), + onPressed: () { + context.router.maybePop(); + handleBack != null ? handleBack!() : null; + }, + icon: const Icon(Icons.arrow_left_sharp), + label: Text( + SurveyFormLocalization.of(context).translate( + i18.common.coreCommonBack, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ), + ), + SizedBox(width: showHelp ? 16 : 0), + if (showHelp) + TextButton( + style: TextButton.styleFrom(padding: EdgeInsets.zero), + onPressed: helpClicked, + child: Row( + children: [ + Text( + SurveyFormLocalization.of(context) + .translate(i18.common.coreCommonHelp), + overflow: TextOverflow.ellipsis, + ), + const Icon( + Icons.help_outline_outlined, + ), // Add the icon to the right + ], + ), + ), + ], + ), + ); + } +} diff --git a/packages/survey_form/lib/widgets/localized.dart b/packages/survey_form/lib/widgets/localized.dart new file mode 100644 index 000000000..206a64dc4 --- /dev/null +++ b/packages/survey_form/lib/widgets/localized.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; + +import '../blocs/app_localization.dart'; + + +abstract class LocalizedStatefulWidget extends StatefulWidget { + final SurveyFormLocalization? appLocalizations; + + const LocalizedStatefulWidget({ + super.key, + this.appLocalizations, + }); +} + +abstract class LocalizedState + extends State { + late SurveyFormLocalization _localizations; + + SurveyFormLocalization get localizations => _localizations; + + set localizations(SurveyFormLocalization localizations) { + if (mounted) { + setState(() { + _localizations = localizations; + }); + } + } + + @override + @mustCallSuper + void didChangeDependencies() { + _localizations = widget.appLocalizations ?? SurveyFormLocalization.of(context); + super.didChangeDependencies(); + } +} diff --git a/packages/survey_form/lib/widgets/no_result_card.dart b/packages/survey_form/lib/widgets/no_result_card.dart new file mode 100644 index 000000000..270f75fa0 --- /dev/null +++ b/packages/survey_form/lib/widgets/no_result_card.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +import '../utils/constants.dart'; + +class NoResultCard extends StatelessWidget { + final AlignmentGeometry align; + final String? label; + const NoResultCard({ + super.key, + this.align = Alignment.centerLeft, + this.label, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Align( + alignment: align, + child: Padding( + padding: const EdgeInsets.only(top: 100, bottom: 10, right: 8), + child: Column( + children: [ + SvgPicture.asset( + noResultSvg, + width: 340, + height: 200, + ), + const SizedBox(height: 20), + Text( + label ?? '', + style: theme.textTheme.bodyMedium, + ), + ], + ), + ), + ); + } +} diff --git a/packages/survey_form/pubspec.yaml b/packages/survey_form/pubspec.yaml new file mode 100644 index 000000000..171e7b3b4 --- /dev/null +++ b/packages/survey_form/pubspec.yaml @@ -0,0 +1,79 @@ +name: survey_form +description: "This package enables supervisors to monitor certain activities and record observations according to defined set of questions." +version: 0.0.1-dev.1 +homepage: "https://github.com/egovernments/health-campaign-field-worker-app/tree/checklist-package/packages/survey_form" +repository: "https://github.com/egovernments/health-campaign-field-worker-app" + +environment: + sdk: '>=3.0.0 <4.0.0' + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + digit_components: ^1.0.0+2 + flutter_bloc: ^8.1.1 + freezed_annotation: ^2.1.0 + build_runner: ^2.2.1 + reactive_forms: ^14.1.0 + fluttertoast: ^8.1.2 + overlay_builder: ^1.1.0 + intl: ^0.18.0 + flutter_svg: ^2.0.8 + dart_mappable: ^4.2.0 + drift: ^2.0.0 + auto_route: ^7.8.4 + digit_data_model: ^1.0.4-dev.4 + collection: ^1.16.0 + location: ^5.0.0 + dio: ^5.1.2 + group_radio_button: ^1.3.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + json_serializable: ^6.4.0 + freezed: ^2.2.0 + bloc_test: ^9.1.0 + mocktail: ^1.0.2 + dart_mappable_builder: ^4.2.0 + drift_dev: ^2.14.1 + auto_route_generator: ^7.3.2 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/survey_form/test/constants/test_constants.dart b/packages/survey_form/test/constants/test_constants.dart new file mode 100644 index 000000000..9a3132cb8 --- /dev/null +++ b/packages/survey_form/test/constants/test_constants.dart @@ -0,0 +1,86 @@ +import 'package:digit_data_model/data_model.dart'; +import 'package:survey_form/models/entities/service.dart'; +import 'package:survey_form/models/entities/service_definition.dart'; +import 'package:survey_form/models/entities/service_attributes.dart'; + +class ServiceTestConstants { + static const testTenantId = 'mz'; + static const testClientId = '170c46f0-5b95-11ef-8647-5ba267817823'; + static const testAccountId = 'a8e257fb-fa45-4488-b76c-7c2d2b70452c'; + static const testServiceDefId = '10a5342f-fe6b-4369-9197-7c871185d67d'; + static const testDataType = 'SingleValueList'; + + static final mockServiceAttributesModel1 = ServiceAttributesModel( + clientReferenceId: '170c46f1-5b95-11ef-8647-5ba267817823', + referenceId: testClientId, + tenantId: testTenantId, + attributeCode: 'ATTR1', + value: 'YES', + dataType: testDataType, + ); + + static final mockServiceAttributesModel2 = ServiceAttributesModel( + clientReferenceId: '170c46f2-5b95-11ef-8647-5ba267817823', + referenceId: testClientId, + tenantId: testTenantId, + attributeCode: 'ATTR2', + value: 'NO', + dataType: testDataType, + additionalDetails: { + "value": "kmlkml" + }, + ); + + static final mockServiceModel = ServiceModel( + clientId: testClientId, + serviceDefId: testServiceDefId, + isActive: true, + accountId: testAccountId, + additionalDetails: 'ADMIN_MO_06_05_03_01_04_SHERRIKEN', + createdAt: DateTime.utc(2024, 8, 16).toString(), + tenantId: testTenantId, + attributes: [mockServiceAttributesModel1, mockServiceAttributesModel2], + ); + + + static final mockAttributesModel1 = AttributesModel( + tenantId: testTenantId, + code: "ATTR1", + dataType: testDataType, + values: null, + required: true, + isActive: 'true', + regex: null, + order: 1, + ); + + static final mockAttributesModel2 = AttributesModel( + tenantId: testTenantId, + code: "ATTR2", + dataType: testDataType, + values: null, + required: true, + isActive: 'true', + regex: null, + order: 1, + ); + + static final mockServiceDefinitionModel = ServiceDefinitionModel( + id: testServiceDefId, + tenantId: testTenantId, + code: 'HEALTH', + isActive: true, + attributes: [mockAttributesModel1, mockAttributesModel2], + ); + + static final mockServiceSearchModel = ServiceSearchModel( + clientId: testClientId, + tenantId: testTenantId, + ); + + static final mockServiceDefinitionSearchModel = ServiceDefinitionSearchModel( + id: testServiceDefId, + tenantId: testTenantId, + code: ['HEALTH'], + ); +} diff --git a/packages/survey_form/test/unit/localization_methods_test.dart b/packages/survey_form/test/unit/localization_methods_test.dart new file mode 100644 index 000000000..6a913daaa --- /dev/null +++ b/packages/survey_form/test/unit/localization_methods_test.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; // Import necessary packages for testing. +import 'package:flutter_test/flutter_test.dart'; +import 'package:survey_form/survey_form.dart'; // Import your package for testing. + +void main() { + // Test for SurveyFormLocalization translation. + test('SurveyFormLocalization translation test', () async { + // Define mock localized strings for testing. + final mockLocalizedStrings = [ + Localization(locale: 'en_MZ', code: 'CORE_COMMON_NAME', message: 'Name'), + Localization(locale: 'fr_FR', code: 'CORE_COMMON_NAME', message: 'Nom'), + ]; + + // Define mock languages for testing. + final mockLanguages = [ + SurveyFormLanguages() + ..label = 'English' + ..value = 'en_MZ', + SurveyFormLanguages() + ..label = 'French' + ..value = 'fr_FR', + ]; + + // Define the test locale. + const testLocale = Locale('en', 'MZ'); + + // Initialize SurveyFormLocalization with mock data. + final surveyFormLocalization = SurveyFormLocalization( + testLocale, + Future.value(mockLocalizedStrings), + mockLanguages, + ); + + await surveyFormLocalization.load(); // Load the localization data. + + // Test if the translate function is working well, given the mock strings and languages. + expect(surveyFormLocalization.translate('CORE_COMMON_NAME'), 'Name'); + }); +} + +// Define a class for localization data. +class Localization { + late String code; + late String message; + late String module; + late String locale; + + // Constructor for localization data. + Localization( + {required this.locale, required this.code, required this.message}); +} + +// Class representing supported languages for surveyForm localization +class SurveyFormLanguages { + late String label; + late String value; +} diff --git a/packages/survey_form/test/unit/service_bloc_test.dart b/packages/survey_form/test/unit/service_bloc_test.dart new file mode 100644 index 000000000..090dcd514 --- /dev/null +++ b/packages/survey_form/test/unit/service_bloc_test.dart @@ -0,0 +1,82 @@ +import 'package:bloc_test/bloc_test.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; //used for mocking dependencies and repositories in bloc test +import 'package:survey_form/survey_form.dart'; +import 'package:survey_form/utils/typedefs.dart'; + +import '../constants/test_constants.dart'; + +class MockServiceDataRepository extends Mock implements ServiceDataRepository {} + +void main() { + group('ServiceBloc', () { + late ServiceBloc serviceBloc; + final serviceDataRepository = MockServiceDataRepository(); + + setUp(() { + serviceBloc = ServiceBloc( + const ServiceState.empty(), + serviceDataRepository: serviceDataRepository, + ); + }); + + setUpAll(() { + registerFallbackValue(ServiceModel(clientId: '')); + registerFallbackValue(ServiceSearchModel(clientId: '')); + }); + + test('Initial state is correct', () { + expect(serviceBloc.state, equals(const ServiceState.empty())); + }); + + // Test for the ServiceSearchEvent + blocTest( + 'emits ServiceSearchState when search event is added', + build: () { + when(() => serviceDataRepository.search(any())) + .thenAnswer((_) async => [ServiceTestConstants.mockServiceModel]); + return serviceBloc; + }, + act: (bloc) => bloc.add(ServiceEvent.search( + serviceSearchModel: ServiceTestConstants.mockServiceSearchModel, + )), + expect: () => [ + ServiceSearchState(serviceList: [ServiceTestConstants.mockServiceModel]), + ], + verify: (_) { + // Verify that the search method was called + verify(() => serviceDataRepository.search(any())).called(1); + }, + ); + + // Test for the ServiceCreateEvent + blocTest( + 'creates a ServiceModel when create event is added', + build: () { + when(() => serviceDataRepository.create(any())) + .thenAnswer((_) async => ServiceTestConstants.mockServiceModel); + return serviceBloc; + }, + act: (bloc) => bloc.add(ServiceEvent.create( + serviceModel: ServiceTestConstants.mockServiceModel, + )), + expect: () => [], + verify: (_) { + // Verify that the create method was called + verify(() => serviceDataRepository.create(any())).called(1); + }, + ); + + // Test for the ServiceResetEvent + blocTest( + 'emits a ServiceSearchState when reset event is added', + build: () => ServiceBloc( + ServiceState.serviceSearch(serviceList: [ServiceTestConstants.mockServiceModel]), + serviceDataRepository: serviceDataRepository), + act: (bloc) => bloc.add(ServiceEvent.resetSelected( + serviceList: [ServiceTestConstants.mockServiceModel], + )), + expect: () => [ServiceState.serviceSearch(serviceList: [ServiceTestConstants.mockServiceModel])], + ); + }); +} diff --git a/packages/survey_form/test/unit/service_definition_bloc_test.dart b/packages/survey_form/test/unit/service_definition_bloc_test.dart new file mode 100644 index 000000000..0be5485b7 --- /dev/null +++ b/packages/survey_form/test/unit/service_definition_bloc_test.dart @@ -0,0 +1,54 @@ +import 'package:bloc_test/bloc_test.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; //used for mocking dependencies and repositories in bloc test +import 'package:survey_form/survey_form.dart'; +import 'package:survey_form/utils/typedefs.dart'; + +import '../constants/test_constants.dart'; + +class MockServiceDefinitionDataRepository extends Mock implements ServiceDefinitionDataRepository {} + +void main() { + group('ServiceDefinitionBloc', () { + late ServiceDefinitionBloc serviceDefinitionBloc; + final serviceDefinitionDataRepository = MockServiceDefinitionDataRepository(); + + setUp(() { + serviceDefinitionBloc = ServiceDefinitionBloc( + const ServiceDefinitionState.empty(), + serviceDefinitionDataRepository: serviceDefinitionDataRepository + ); + }); + + setUpAll(() { + registerFallbackValue(ServiceDefinitionModel(tenantId : '')); + registerFallbackValue(ServiceDefinitionSearchModel(tenantId: '')); + }); + + test('Initial state is correct', () { + expect(serviceDefinitionBloc.state, equals(const ServiceDefinitionState.empty())); + }); + + // Test for the ServiceDefinitionFetchEvent + blocTest( + 'emits ServiceDefinitionServiceFetchedState when ServiceDefinitionFetchEvent is added', + build: () { + // Mocking the search method to return a list of ServiceDefinitionModel + when(() => serviceDefinitionDataRepository.search(any())) + .thenAnswer((_) async => [ServiceTestConstants.mockServiceDefinitionModel]); + + return serviceDefinitionBloc; + }, + act: (bloc) => bloc.add(const ServiceDefinitionEvent.fetch()), + expect: () => [ + ServiceDefinitionState.serviceDefinitionFetch( + serviceDefinitionList: [ServiceTestConstants.mockServiceDefinitionModel], + ), // State should be the fetched service definitions + ], + verify: (_) { + // Verify that the search method was called + verify(() => serviceDefinitionDataRepository.search(any())).called(1); + }, + ); + }); +} diff --git a/pubspec.lock b/pubspec.lock index ca5589ec2..8ec919d96 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -357,10 +357,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" pool: dependency: transitive description: @@ -413,10 +413,10 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.3.0" quiver: dependency: transitive description: @@ -477,10 +477,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" term_glyph: dependency: transitive description: @@ -493,10 +493,10 @@ packages: dependency: transitive description: name: test_api - sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.7.1" + version: "0.7.2" timing: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index be90b4ee5..6c653d317 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,3 +9,5 @@ dev_dependencies: dependencies: dart_mappable: ^4.2.0 + + diff --git a/tools/complaints_package.dart b/tools/complaints_package.dart new file mode 100644 index 000000000..1d230323b --- /dev/null +++ b/tools/complaints_package.dart @@ -0,0 +1,889 @@ +// Import the required Dart I/O package +import 'dart:io'; + +String createCaseCondition(String key, String value) { + return 'case "$key":\n $value'; +} + +void insertCaseCondition(List lines, String caseCondition) { + final defaultIndex = lines.indexWhere((line) => line.contains('default:')); + if (defaultIndex != -1 && + !lines.any((line) => line.contains(caseCondition.split('\n')[0]))) { + lines.insert(defaultIndex, caseCondition); + } +} + +// Define the main function +void main() { + // Get the current directory path + var appDir = Directory.current.path; + + // Define the paths for the application root and the files to be modified + var appRoot = appDir + '/apps/health_campaign_field_worker_app/lib'; + var localizationDelegatesFilePath = + appRoot + '/utils/localization_delegates.dart'; + var networkManagerProviderWrapperFilePath = + appRoot + '/widgets/network_manager_provider_wrapper.dart'; + var constantsFilePath = appRoot + '/utils/constants.dart'; + var utilsFilePath = appRoot + '/utils/utils.dart'; + var routerFilePath = appRoot + '/router/app_router.dart'; + var entityMapperFilePath = + appRoot + '/data/local_store/no_sql/schema/entity_mapper.dart'; + var syncUpFilePath = appRoot + '/data/repositories/sync/sync_up.dart'; + var homeFilePath = appRoot + '/pages/home.dart'; + var extensionsFilePath = appRoot + '/utils/extensions/extensions.dart'; + var contextUtilityFilePath = + appRoot + '/utils/extensions/context_utility.dart'; + + // Set boundary in the context utility file + _setBoundaryInContextUtilityFile(extensionsFilePath, contextUtilityFilePath); + + // Add complaints to home file + _updateHome(homeFilePath); + + // Update the sync_up.dart file + _updateSyncUpFile(syncUpFilePath); + + // Add complaints routes and import to the router file + _addComplaintsRoutesAndImportToRouterFile(routerFilePath); + + // Add new case statements to the entity_mapper.dart file + _updateEntityMapperFile(entityMapperFilePath); + + _createLocalizationDelegatesFile(localizationDelegatesFilePath); + + _addRepoToNetworkManagerProviderWrapper( + networkManagerProviderWrapperFilePath: + networkManagerProviderWrapperFilePath); + + _addComplaintsConstantsToConstantsFile(constantsFilePath: constantsFilePath); + + _addComplaintsMapperToUtilsFile(utilsFilePath: utilsFilePath); + + _formatFiles([ + homeFilePath, + syncUpFilePath, + entityMapperFilePath, + routerFilePath, + constantsFilePath, + utilsFilePath, + networkManagerProviderWrapperFilePath, + localizationDelegatesFilePath, + extensionsFilePath, + contextUtilityFilePath + ]); +} + +void _formatFiles(List filePaths) { + for (var filePath in filePaths) { + Process.runSync('dart', ['format', filePath]); + print('Formatted $filePath'); + } +} + +void _updateHome(String homeFilePath) { + var importStatement = ''' + import 'package:complaints/complaints.dart'; + import 'package:complaints/router/complaints_router.gm.dart'; + '''; + + var homeItemsData = ''' + i18.home.fileComplaint: + homeShowcaseData.distributorFileComplaint.buildWith( + child: HomeItemCard( + icon: Icons.announcement, + label: i18.home.fileComplaint, + onPressed: () => + context.router.push(const ComplaintsInboxWrapperRoute()), + ), + ), +'''; + + var showCaseData = ''' + i18.home.fileComplaint: + homeShowcaseData.distributorFileComplaint.showcaseKey, +'''; + + var itemsLabel = ''' + i18.home.fileComplaint, +'''; + + // Define the data to be added + var singletonData = ''' + ComplaintsSingleton().setInitialData( + tenantId: envConfig.variables.tenantId, + loggedInUserUuid: context.loggedInUserUuid, + userMobileNumber: context.loggedInUser.mobileNumber, + loggedInUserName: context.loggedInUser.name, + complaintTypes: + appConfiguration.complaintTypes!.map((e) => e.code).toList(), + userName: context.loggedInUser.name ?? '', + ); +'''; + + var localRepoData = ''' + context.read>(), +'''; + + var remoteRepoData = ''' + context.read>(), +'''; + + // Check if the home.dart file exists + var homeFile = File(homeFilePath); + if (!homeFile.existsSync()) { + print('Error: Home file does not exist at path: $homeFilePath'); + return; + } + + // Read the home.dart file + var homeFileContent = homeFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!homeFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + homeFileContent = importStatement + '\n' + homeFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Insert the data to be added + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add singleton of package Here', singletonData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add local repo of package Here', localRepoData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add repo repo of package Here', remoteRepoData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add home items of package Here', homeItemsData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add showcase keys of package Here', showCaseData); + homeFileContent = insertData(homeFileContent, + '// INFO: Need to add items label of package Here', itemsLabel); + + // Write the updated content back to the home.dart file + homeFile.writeAsStringSync(homeFileContent); +} + +String insertData(String fileContent, String marker, String data) { + var markerIndex = fileContent.indexOf(marker); + if (markerIndex != -1) { + var endOfMarker = markerIndex + marker.length; + if (!fileContent.substring(endOfMarker).contains(data.trim())) { + fileContent = fileContent.substring(0, endOfMarker) + + '\n' + + data + + fileContent.substring(endOfMarker); + print('Data was added after marker: $marker'); + } else { + print('Data already exists after marker: $marker'); + } + } else { + print('Error: Could not find the marker: $marker'); + } + return fileContent; +} + +//script working +void _updateSyncUpFile(String syncUpFilePath) { + // Define the import statement and the new case statements + var importStatement = "import 'package:complaints/complaints.dart';"; + var newCases = ''' + case DataModelType.complaints: + for (final entity in entities) { + if (remote is PgrServiceRemoteRepository && + entity is PgrServiceModel) { + final response = await remote.create(entity); + final responseData = response.data; + if (responseData is! Map) { + AppLogger.instance.error( + title: 'NetworkManager : PgrServiceRemoteRepository', + message: responseData, + stackTrace: StackTrace.current, + ); + continue; + } + + + + + PgrServiceCreateResponseModel + pgrServiceCreateResponseModel; + PgrComplaintResponseModel pgrComplaintModel; + try { + pgrServiceCreateResponseModel = + PgrServiceCreateResponseModelMapper.fromMap( + responseData, + ); + pgrComplaintModel = + pgrServiceCreateResponseModel.serviceWrappers.first; + } catch (e) { + rethrow; + } + + + + + final service = pgrComplaintModel.service; + final serviceRequestId = service.serviceRequestId; + + + + + if (serviceRequestId == null || + serviceRequestId.isEmpty) { + AppLogger.instance.error( + title: 'NetworkManager : PgrServiceRemoteRepository', + message: 'Service Request ID is null', + stackTrace: StackTrace.current, + ); + continue; + } + + + + + await local.markSyncedUp( + entry: sublist.firstWhere((element) => + element.clientReferenceId == + entity.clientReferenceId), + clientReferenceId: entity.clientReferenceId, + nonRecoverableError: entity.nonRecoverableError, + ); + + + + + await local.opLogManager.updateServerGeneratedIds( + model: UpdateServerGeneratedIdModel( + clientReferenceId: entity.clientReferenceId, + serverGeneratedId: serviceRequestId, + dataOperation: operationGroupedEntity.key, + rowVersion: entity.rowVersion, + ), + ); + + + + + await local.update( + entity.copyWith( + serviceRequestId: serviceRequestId, + id: service.id, + applicationStatus: service.applicationStatus, + accountId: service.accountId, + ), + createOpLog: false, + ); + } + } + break; +'''; + + // Check if the sync_up file exists + var syncUpFile = File(syncUpFilePath); + + if (!syncUpFile.existsSync()) { + print('Error: Sync Up file does not exist at path: $syncUpFilePath'); + return; + } + + // Read the sync_up file + var syncUpFileContent = syncUpFile.readAsStringSync(); + print(syncUpFileContent); + // Check if the import statement already exists and add it if not + if (!syncUpFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + syncUpFileContent = importStatement + '\n' + syncUpFileContent; + print('The import statement was added to sync_up.dart.'); + } else { + print('The import statement already exists in sync_up.dart.'); + } + + // Insert the new case statements + if (!syncUpFileContent.contains( + 'case DataModelType.complaints:'.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the new cases within the switch statement + var switchIndex = + syncUpFileContent.indexOf('switch (typeGroupedEntity.key) {'); + if (switchIndex != -1) { + var caseInsertionIndex = + syncUpFileContent.indexOf('default:', switchIndex); + if (caseInsertionIndex != -1) { + syncUpFileContent = syncUpFileContent.substring(0, caseInsertionIndex) + + newCases + + '\n' + + syncUpFileContent.substring(caseInsertionIndex); + print('The new cases were added to sync_up.dart.'); + + // Write the updated content back to the file + syncUpFile.writeAsStringSync(syncUpFileContent); + } else { + print( + 'Error: Could not find the default case in the switch statement in sync_up.dart.'); + return; + } + } else { + print('Error: Could not find the switch statement in sync_up.dart.'); + return; + } + } else { + print('The new cases already exist in sync_up.dart.'); + } +} + +void _updateEntityMapperFile(String entityMapperFilePath) { + // Define the import statement and new case statements + var importStatement = "import 'package:complaints/complaints.dart';"; + var newCases = ''' + case "complaints": + final entity = PgrServiceModelMapper.fromJson(entityString); + return entity; +'''; + + // Check if the entity_mapper file exists + var entityMapperFile = File(entityMapperFilePath); + + if (!entityMapperFile.existsSync()) { + print( + 'Error: Entity Mapper file does not exist at path: $entityMapperFilePath'); + return; + } + + // Read the entity_mapper file + var entityMapperFileContent = entityMapperFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!entityMapperFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + entityMapperFileContent = importStatement + '\n' + entityMapperFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the new cases already exist in the file + if (!entityMapperFileContent + .contains('case "complaints":'.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the new cases (before the default case) + var caseInsertionIndex = entityMapperFileContent.indexOf('default:'); + if (caseInsertionIndex != -1) { + entityMapperFileContent = + entityMapperFileContent.substring(0, caseInsertionIndex) + + newCases + + '\n' + + entityMapperFileContent.substring(caseInsertionIndex); + print('The new cases were added.'); + + // Write the updated content back to the file + entityMapperFile.writeAsStringSync(entityMapperFileContent); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The new cases already exist.'); + } +} + +//script working +void _addComplaintsRoutesAndImportToRouterFile(String routerFilePath) { + // Define the complaints route lines + var complaintsRoutes = ''' + AutoRoute( + page: ComplaintsInboxWrapperRoute.page, + path: 'complaints-inbox', + children: [ + AutoRoute( + page: ComplaintsInboxRoute.page, + path: 'complaints-inbox-items', + initial: true, + ), + AutoRoute( + page: ComplaintsInboxFilterRoute.page, + path: 'complaints-inbox-filter', + ), + AutoRoute( + page: ComplaintsInboxSearchRoute.page, + path: 'complaints-inbox-search', + ), + AutoRoute( + page: ComplaintsInboxSortRoute.page, + path: 'complaints-inbox-sort', + ), + AutoRoute( + page: ComplaintsDetailsViewRoute.page, + path: 'complaints-inbox-view-details', + ), + ], + ), + + + + + /// Complaints registration + AutoRoute( + page: ComplaintsRegistrationWrapperRoute.page, + path: 'complaints-registration', + children: [ + AutoRoute( + page: ComplaintTypeRoute.page, + path: 'complaints-type', + initial: true, + ), + AutoRoute( + page: ComplaintsLocationRoute.page, + path: 'complaints-location', + ), + AutoRoute( + page: ComplaintsDetailsRoute.page, + path: 'complaints-details', + ), + ], + ), + + + + + /// Complaints Acknowledgemnet + AutoRoute( + page: ComplaintsAcknowledgementRoute.page, + path: 'complaints-acknowledgement', + ), +'''; + + // Define the import statement + var importStatement1 = + "import 'package:complaints/router/complaints_router.gm.dart';"; + // Define the import statement + var importStatement2 = + "import 'package:complaints/router/complaints_router.dart';"; + + // Check if the router file exists + var routerFile = File(routerFilePath); + + if (!routerFile.existsSync()) { + print('Error: Router file does not exist at path: $routerFilePath'); + return; + } + + // Read the router file + var routerFileContent = routerFile.readAsStringSync(); + + // Normalize the whitespace in the file content + var normalizedFileContent = routerFileContent.replaceAll(RegExp(r'\s'), ''); + + // Check if the import statement already exists + if (!normalizedFileContent + .contains(importStatement1.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement at the beginning of the file + routerFileContent = importStatement1 + '\n' + routerFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the import statement already exists + if (!normalizedFileContent + .contains(importStatement2.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement at the beginning of the file + routerFileContent = importStatement2 + '\n' + routerFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the complaintsRoute module already exists + if (!routerFileContent + .contains('ComplaintsRoute'.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the module + var moduleInsertionIndex = routerFileContent.indexOf('@AutoRouterConfig('); + if (moduleInsertionIndex != -1) { + var endOfModulesIndex = + routerFileContent.indexOf(']', moduleInsertionIndex); + if (endOfModulesIndex != -1) { + var modulesEndIndex = + routerFileContent.lastIndexOf(']', endOfModulesIndex); + routerFileContent = routerFileContent.substring(0, modulesEndIndex) + + ' ComplaintsRoute,' + + routerFileContent.substring(modulesEndIndex); + + print('The ComplaintsRoute module was added.'); + } else { + print('Error: Could not find the end of the modules list.'); + return; + } + } else { + print('Error: Could not find @AutoRouterConfig annotation.'); + return; + } + } else { + print('The ComplaintsRoute module already exists.'); + } + + // Check if the complaints routes already exist in the file + if (!normalizedFileContent + .contains(complaintsRoutes.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the routes + var insertionIndex = routerFileContent + .indexOf('// INFO : Need to add Router of package Here'); + if (insertionIndex != -1) { + routerFileContent = routerFileContent.substring(0, insertionIndex) + + '// INFO : Need to add Router of package Here\n' + + complaintsRoutes + + routerFileContent.substring(insertionIndex + + '// INFO : Need to add Router of package Here'.length); + + print('The complaint routes were added.'); + // Write the updated content back to the file + routerFile.writeAsStringSync(routerFileContent); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The complaint routes already exist.'); + } +} + +//initialise mappers +void _addComplaintsMapperToUtilsFile({required String utilsFilePath}) { + // Define the complaints related lines + var complaintsImportStatement = [ + "import 'package:complaints/complaints.init.dart' as complaints_mappers;" + ]; + var complaintsInitializationStatement = + "Future(() => complaints_mappers.initializeMappers()),"; + + // Check if the utils.dart file exists + var utilsFile = File(utilsFilePath); + + // Read the utils.dart file + var utilsFileContent = utilsFile.readAsStringSync(); + + // Normalize the whitespace in the file content + var normalizedFileContent = utilsFileContent.replaceAll(RegExp(r'\s'), ''); + + var getSyncCountStatement = "case DataModelType.complaints:"; + + // Check if the import statement and delegate already exist in the file + // If not, add them to the file + if (!normalizedFileContent + .contains(complaintsImportStatement[0].replaceAll(RegExp(r'\s'), ''))) { + var libraryIndex = utilsFileContent.indexOf('library app_utils;'); + if (libraryIndex != -1) { + var endOfLibrary = libraryIndex + + utilsFileContent.substring(libraryIndex).indexOf(';') + + 1; + utilsFileContent = utilsFileContent.substring(0, endOfLibrary + 1) + + '\n' + + complaintsImportStatement[0] + + utilsFileContent.substring(endOfLibrary + 1); + print('The import statement was added.'); + } + } else { + print('The import statement already exists.'); + } + + if (!utilsFileContent.contains(complaintsInitializationStatement)) { + // Add the complaints related initialization statement to the file + var initializeAllMappersIndex = + utilsFileContent.indexOf('initializeAllMappers() async {'); + if (initializeAllMappersIndex == -1) { + print( + 'Error: Could not find a place to insert the complaint initialization statement.'); + return; + } + var endOfInitializeAllMappers = initializeAllMappersIndex + + utilsFileContent.substring(initializeAllMappersIndex).indexOf(']') + + 1; + utilsFileContent = + utilsFileContent.substring(0, endOfInitializeAllMappers - 1) + + '\n ' + + complaintsInitializationStatement + + utilsFileContent.substring(endOfInitializeAllMappers - 1); + print('complaint initialization statement added to utils.dart'); + } else { + print('The complaint initialization statement already exists.'); + } + + if (!utilsFileContent.contains(getSyncCountStatement)) { + var getSyncCountStatementIndex = + utilsFileContent.indexOf('add SyncCount case for package'); + if (getSyncCountStatementIndex == -1) { + print( + 'Error: Could not find a place to insert the complaint DataModelType statement.'); + return; + } + + var endOfgetSyncCountStatementIndex = getSyncCountStatementIndex + + utilsFileContent.substring(getSyncCountStatementIndex).indexOf('}') + + 1; + utilsFileContent = + utilsFileContent.substring(0, getSyncCountStatementIndex + 30) + + '\n ' + + getSyncCountStatement + + utilsFileContent.substring(getSyncCountStatementIndex + 30); + print('complaint DataModelType statement added to utils.dart'); + } else { + print('The complaint DataModelType statement already exists.'); + } + + // Write the updated content back to the utils.dart file + utilsFile.writeAsStringSync(utilsFileContent); +} + +void _addComplaintsConstantsToConstantsFile( + {required String constantsFilePath}) { + // Define the import statements + var importStatements = [ + "import 'package:complaints/complaints.dart';", + ]; + + // Define the local and remote repositories + var localRepository = [ + ''' +PgrServiceLocalRepository( + sql, + PgrServiceOpLogManager(isar), + ), +''' + ]; + + var remoteRepository = [ + ''' +if (value == DataModelType.complaints) + PgrServiceRemoteRepository(dio, actionMap: actions), +''' + ]; + + // Check if the constants.dart file exists + var constantsFile = File(constantsFilePath); + if (!constantsFile.existsSync()) { + print('Error: The constants.dart file does not exist.'); + return; + } + + // Read the constants.dart file + var constantsFileContent = constantsFile.readAsStringSync(); + + // Normalize the whitespace in the file content and the complaints configuration + var normalizedFileContent = + constantsFileContent.replaceAll(RegExp(r'\s'), ''); + + // Check if the import statements already exist in the file + for (var importStatement in importStatements) { + if (!normalizedFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement at the top of the file + constantsFileContent = importStatement + '\n' + constantsFileContent; + print('The import statement was added: $importStatement'); + } + } + + // Add the local and remote repositories to the getLocalRepositories and getRemoteRepositories methods + var getLocalRepositoriesIndex = + constantsFileContent.indexOf('getLocalRepositories('); + if (getLocalRepositoriesIndex != -1) { + var endOfGetLocalRepositories = getLocalRepositoriesIndex + + constantsFileContent.substring(getLocalRepositoriesIndex).indexOf(']') + + 1; + constantsFileContent = + constantsFileContent.substring(0, endOfGetLocalRepositories - 1) + + '\n' + + localRepository.join('\n') + + constantsFileContent.substring(endOfGetLocalRepositories - 1); + print('The local repositories were added.'); + } + + var getRemoteRepositoriesIndex = + constantsFileContent.indexOf('getRemoteRepositories('); + if (getRemoteRepositoriesIndex != -1) { + var endOfGetRemoteRepositories = getRemoteRepositoriesIndex + + constantsFileContent + .substring(getRemoteRepositoriesIndex) + .indexOf('addAll(') + + 'addAll('.length; + var endOfAddAll = constantsFileContent + .substring(endOfGetRemoteRepositories) + .indexOf(']') + + endOfGetRemoteRepositories; + constantsFileContent = constantsFileContent.substring(0, endOfAddAll) + + remoteRepository.join('\n') + + constantsFileContent.substring(endOfAddAll); + print('The remote repositories were added.'); + } + + // Write the updated content back to the constants.dart file + constantsFile.writeAsStringSync(constantsFileContent); +} + +void _addRepoToNetworkManagerProviderWrapper( + {required String networkManagerProviderWrapperFilePath}) { + // Define the import statements and repository providers + var importStatements = [ + "import 'package:complaints/complaints.dart';", + ]; + var localRepositories = [ + "RepositoryProvider<\n LocalRepository>(\n create: (_) => PgrServiceLocalRepository(\n sql,\n PgrServiceOpLogManager(isar),\n ),\n )," + ]; + +// Define the remote repositories of complaints + var remoteRepositoriesOfRegistrationDelivery = [ + "if (value == DataModelType.complaints)\n RepositoryProvider<\n RemoteRepository>(\n create: (_) => PgrServiceRemoteRepository(\n dio,\n actionMap: actions,\n ),\n)" + ]; + +// Read the network_manager_provider_wrapper.dart file + var networkManagerProviderWrapperFile = + File(networkManagerProviderWrapperFilePath); + var networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFile.readAsStringSync(); + +// Find the last import statement in the file + var lastImportIndex = networkManagerProviderWrapperFileContent + .lastIndexOf(RegExp(r'import .+;')); + + if (lastImportIndex != -1) { + var endOfLastImport = lastImportIndex + + networkManagerProviderWrapperFileContent + .substring(lastImportIndex) + .indexOf(';') + + 1; + + // Check if the import statements already exist in the file + for (var importStatement in importStatements) { + if (!networkManagerProviderWrapperFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement after the last import + networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFileContent.substring( + 0, endOfLastImport) + + '\n' + + importStatement + + networkManagerProviderWrapperFileContent + .substring(endOfLastImport); + endOfLastImport += importStatement.length + 1; + print('The import statement was added: $importStatement'); + } else { + print('The import statement already exists.'); + } + } + + // Normalize the whitespace in the file content and the remote repository of complaints + var normalizedFileContent = + networkManagerProviderWrapperFileContent.replaceAll(RegExp(r'\s'), ''); + +// Check if the local repository providers already exist in the file + for (var repositoryProvider in localRepositories) { + var normalizedLocalRepositoryOfComplaints = + repositoryProvider.replaceAll(RegExp(r'\s'), ''); + + if (!normalizedFileContent + .contains(normalizedLocalRepositoryOfComplaints)) { + // Add the local repository provider to the file + networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFileContent.replaceFirst( + '];', ' $repositoryProvider\n];'); + print('The local repository provider was added: $repositoryProvider'); + } else { + print('The local repository provider already exists.'); + } + } + +// Check if the remote repository of complaints already exists in the file + for (var remoteRepositoryOfRegistrationDelivery + in remoteRepositoriesOfRegistrationDelivery) { + var normalizedRemoteRepositoryOfRegistrationDelivery = + remoteRepositoryOfRegistrationDelivery.replaceAll(RegExp(r'\s'), ''); + + if (!normalizedFileContent + .contains(normalizedRemoteRepositoryOfRegistrationDelivery)) { + // Add the remote repository of complaints to the _getRemoteRepositories method + var replacementString = + networkManagerProviderWrapperFileContent.contains(']);') + ? ' $remoteRepositoryOfRegistrationDelivery,\n]);' + : ' $remoteRepositoryOfRegistrationDelivery\n]);'; + networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFileContent.replaceFirst( + ']);', replacementString); + print( + 'The remote repository of complaints was added: $remoteRepositoryOfRegistrationDelivery'); + } else { + print('The remote repository of complaints already exists.'); + } + } + + // Write the updated content back to the file + networkManagerProviderWrapperFile + .writeAsStringSync(networkManagerProviderWrapperFileContent); + } +} + +void _createLocalizationDelegatesFile(String localizationDelegatesFilePath) { + // Define the import statement and delegate for localization + var importStatement = + "import 'package:complaints/blocs/localization/app_localization.dart' as complaints_localization;"; + var delegate = + " complaints_localization.ComplaintsLocalization.getDelegate( LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future,appConfig.languages!,),"; + + // Read the localization delegates file + var localizationDelegatesFile = File(localizationDelegatesFilePath); + var localizationDelegatesFileContent = + localizationDelegatesFile.readAsStringSync(); + + var normalizedFileContent = + localizationDelegatesFileContent.replaceAll(RegExp(r'\s'), ''); + + // Check if the import statement and delegate already exist in the file + // If not, add them to the file + if (!normalizedFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + localizationDelegatesFileContent = + '$importStatement\n$localizationDelegatesFileContent'; + print('The import statement was added.'); + } + + if (!normalizedFileContent.contains(delegate.replaceAll(RegExp(r'\s'), ''))) { + var lastDelegateIndex = + localizationDelegatesFileContent.lastIndexOf(RegExp(r',')); + if (lastDelegateIndex != -1) { + localizationDelegatesFileContent = + localizationDelegatesFileContent.substring(0, lastDelegateIndex + 1) + + '\n $delegate' + + localizationDelegatesFileContent.substring(lastDelegateIndex + 1); + print('The delegate was added.'); + } + } + + // Write the updated content back to the file + localizationDelegatesFile.writeAsStringSync(localizationDelegatesFileContent); +} + +void _setBoundaryInContextUtilityFile( + String extensionsFilePath, String contextUtilityFilePath) { + // Define the lines to be added + var importStatement = "import 'package:complaints/utils/utils.dart';"; + var boundaryStatement = + 'ComplaintsSingleton().setBoundary(boundary: selectedBoundary);'; + + // Update the extensions.dart file + var extensionsFile = File(extensionsFilePath); + var extensionsFileContent = extensionsFile.readAsStringSync(); + if (!extensionsFileContent.contains(importStatement)) { + extensionsFileContent = importStatement + '\n' + extensionsFileContent; + extensionsFile.writeAsStringSync(extensionsFileContent); + print('Updated the extensions.dart file.'); + } + + // Update the context_utility.dart file + var contextUtilityFile = File(contextUtilityFilePath); + var contextUtilityFileContent = contextUtilityFile.readAsStringSync(); + + // Use the insertData method to insert the boundaryStatement + contextUtilityFileContent = insertData(contextUtilityFileContent, + '// INFO: Set Boundary for packages', boundaryStatement); + + // Write the updated content back to the context_utility.dart file + contextUtilityFile.writeAsStringSync(contextUtilityFileContent); +} diff --git a/tools/generate-apk.sh b/tools/generate-apk.sh index 8b3225c82..b99915beb 100755 --- a/tools/generate-apk.sh +++ b/tools/generate-apk.sh @@ -14,46 +14,14 @@ build_apk() { fi } -# Ask user for environment to build for -echo "Please select an environment to build for (UAT, DEV, QA or ALL):" -read env -env="${env:-ALL}" - -# Ask user for build config -echo "Please select a build config (release or profile):" -read build_config -build_config="${build_config:-release}" - -# Build APK for specified environment(s) and build config -if [ "$env" == "ALL" ]; then - env_list=("UAT" "DEV" "QA") -else - env_list=("$env") -fi +# Get environment and build config from GitHub Actions environment variables +build_config="${BUILD_CONFIG:-release}" ./tools/install_bricks.sh -for env_option in "${env_list[@]}"; do cd "$APP_DIR" || exit - case $env_option in - "UAT") - cp ".env.uat" ".env" - ;; - "QA") - cp ".env.qa" ".env" - ;; - "DEV") - cp ".env.dev" ".env" - ;; - esac - build_apk cd ../../ || exit - mkdir -p outputs - mv "$APP_DIR/build/app/outputs/flutter-apk/app-$build_config.apk" "outputs/app-$env_option-$build_config.apk" -done - -open outputs echo "APK generation complete." diff --git a/tools/survey_form_package_imports.dart b/tools/survey_form_package_imports.dart new file mode 100644 index 000000000..337bdc6b5 --- /dev/null +++ b/tools/survey_form_package_imports.dart @@ -0,0 +1,1054 @@ +// Import the required Dart I/O package +import 'dart:io'; + +String createCaseCondition(String key, String value) { + return 'case "$key":\n $value'; +} + +void insertCaseCondition(List lines, String caseCondition) { + final defaultIndex = lines.indexWhere((line) => line.contains('default:')); + if (defaultIndex != -1 && + !lines.any((line) => line.contains(caseCondition.split('\n')[0]))) { + lines.insert(defaultIndex, caseCondition); + } +} + +// Define the main function +void main() { + // Get the current directory path + var appDir = Directory.current.parent.path; + + // Define the paths for the application root and the files to be modified + var appRoot = appDir + '/apps/health_campaign_field_worker_app/lib'; + var localizationDelegatesFilePath = + appRoot + '/utils/localization_delegates.dart'; + var networkManagerProviderWrapperFilePath = + appRoot + '/widgets/network_manager_provider_wrapper.dart'; + var constantsFilePath = appRoot + '/utils/constants.dart'; + var utilsFilePath = appRoot + '/utils/utils.dart'; + var routerFilePath = appRoot + '/router/app_router.dart'; + var entityMapperFilePath = + appRoot + '/data/local_store/no_sql/schema/entity_mapper.dart'; + var syncDownFilePath = appRoot + '/data/repositories/sync/sync_down.dart'; + var homeFilePath = appRoot + '/pages/home.dart'; + var projectFilePath = appRoot + '/blocs/project/project.dart'; + var authenticatedFilePath = appRoot + '/pages/authenticated.dart'; + var contextUtilityFilePath = appRoot + '/utils/extensions/context_utility.dart'; + var appFilePath = appRoot + '/app.dart'; + var extensionFilePath = appRoot + '/utils/extensions/extensions.dart'; + + _updateExtensionFilePath(extensionFilePath); + + _updateAppFile(appFilePath); + + // Initialise Boundarycode in surveyFormSingleton class + _updateContextUtilityFile(contextUtilityFilePath); + + // Add Imports and service definition repo + _addprojectFilePath(projectFilePath); + + _addauthenticatedFilePath(authenticatedFilePath); + + + // Add surveyForm to home file + _updateHome(homeFilePath); + + // Add surveyForm routes and import to the router file + _addSurveyFormRoutesAndImportToRouterFile(routerFilePath); + + // Add new case statements to the entity_mapper.dart file + _updateEntityMapperFile(entityMapperFilePath); + + _createLocalizationDelegatesFile(localizationDelegatesFilePath); + + _addRepoToNetworkManagerProviderWrapper( + networkManagerProviderWrapperFilePath: + networkManagerProviderWrapperFilePath); + + _addSurveyFormConstantsToConstantsFile(constantsFilePath: constantsFilePath); + + _addSurveyFormMapperToUtilsFile(utilsFilePath: utilsFilePath); + + _formatFiles([ + homeFilePath, + syncDownFilePath, + entityMapperFilePath, + routerFilePath, + constantsFilePath, + utilsFilePath, + networkManagerProviderWrapperFilePath, + localizationDelegatesFilePath, + projectFilePath, + authenticatedFilePath, + contextUtilityFilePath, + appFilePath, + extensionFilePath + ]); +} + +void _formatFiles(List filePaths) { + for (var filePath in filePaths) { + Process.runSync('dart', ['format', filePath]); + print('Formatted $filePath'); + } +} + +void _updateExtensionFilePath(extensionFilePath){ + var importStatement = ''' + import 'package:survey_form/utils/utils.dart';'''; + + // Check if the extension.dart file exists + var extensionFile = File(extensionFilePath); + if (!extensionFile.existsSync()) { + print('Error: project file does not exist at path: $extensionFilePath'); + return; + } + + // Read the authenticated.dart file + var extensionFileContent = extensionFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!extensionFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + extensionFileContent = importStatement + '\n' + extensionFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + extensionFile.writeAsStringSync(extensionFileContent); +} + +void _updateAppFile(appFilePath) { + var importStatement = ''' + import 'package:survey_form/survey_form.dart';'''; + + var ServiceDefinitionRepository = '''serviceDefinitionRemoteRepository: ctx.read< + RemoteRepository>(), + serviceDefinitionLocalRepository: ctx.read< + LocalRepository>(),'''; + + // Check if the app.dart file exists + var appFile = File(appFilePath); + if (!appFile.existsSync()) { + print('Error: project file does not exist at path: $appFilePath'); + return; + } + + // Read the app.dart file + var appFileContent = appFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!appFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + appFileContent = importStatement + '\n' + appFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the new cases already exist in the file + if (!appFileContent + .contains(ServiceDefinitionRepository.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the new cases (before the default case) + var caseInsertionIndex = appFileContent.indexOf('ProjectBloc('); + caseInsertionIndex += 'ProjectBloc('.length; + if (caseInsertionIndex != -1) { + appFileContent = + appFileContent.substring(0, caseInsertionIndex) + + ServiceDefinitionRepository + + '\n' + + appFileContent.substring(caseInsertionIndex); + print('The new cases were added.'); + + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The new cases already exist.'); + } + + appFile.writeAsStringSync(appFileContent); +} + +void _updateContextUtilityFile(String contextUtilityFilepath) { + var surveyFormBoundary = '''SurveyFormSingleton().setBoundary(boundary: selectedBoundary);'''; + + // Check if the context_utility.dart file exists + var contextUtilityFile = File(contextUtilityFilepath); + if (!contextUtilityFile.existsSync()) { + print('Error: Context Utility file does not exist at path: $contextUtilityFilepath'); + return; + } + + // Read the context_utility.dart file + var contextUtilityFileContent = contextUtilityFile.readAsStringSync(); + + // Insert the data to be added + contextUtilityFileContent = insertData(contextUtilityFileContent, + '// INFO: Set Boundary for packages', surveyFormBoundary); + + // Write the updated content back to the context_utility.dart file + contextUtilityFile.writeAsStringSync(contextUtilityFileContent); +} + +void _addauthenticatedFilePath(String authenticatedFilePath) { + var importStatement = ''' + import 'package:survey_form/survey_form.dart';'''; + + var providers = '''BlocProvider( + create: (_) => ServiceBloc( + const ServiceEmptyState(), + serviceDataRepository: context + .repository(), + ), + ),'''; + + // Check if the authenticated.dart file exists + var authenticatedFile = File(authenticatedFilePath); + if (!authenticatedFile.existsSync()) { + print('Error: project file does not exist at path: $authenticatedFilePath'); + return; + } + + // Read the authenticated.dart file + var authenticatedFileContent = authenticatedFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!authenticatedFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + authenticatedFileContent = importStatement + '\n' + authenticatedFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the new cases already exist in the file + if (!authenticatedFileContent + .contains(providers.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the new cases (before the default case) + var caseInsertionIndex = authenticatedFileContent.indexOf('providers: ['); + caseInsertionIndex += 'providers: ['.length; + if (caseInsertionIndex != -1) { + authenticatedFileContent = + authenticatedFileContent.substring(0, caseInsertionIndex) + + providers + + '\n' + + authenticatedFileContent.substring(caseInsertionIndex); + print('The new cases were added.'); + + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The new cases already exist.'); + } + + authenticatedFile.writeAsStringSync(authenticatedFileContent); +} + +void _addprojectFilePath(String projectFilePath) { + var importStatement = ''' + import 'package:survey_form/survey_form.dart';'''; + + var ServicedefinitionRepo = '''/// Service Definition Repositories + final RemoteRepository + serviceDefinitionRemoteRepository; + final LocalRepository + serviceDefinitionLocalRepository;'''; + + var projectBloc = '''required this.serviceDefinitionRemoteRepository, + required this.serviceDefinitionLocalRepository,'''; + + var loadServicedefinition = '''FutureOr _loadServiceDefinition(List projects) async { + final configs = await isar.appConfigurations.where().findAll(); + final userObject = await localSecureStore.userRequestModel; + List codes = []; + for (UserRoleModel elements in userObject!.roles) { + configs.first.checklistTypes?.map((e) => e.code).forEach((element) { + for (final project in projects) { + codes.add( + '\${project.name}.\$element.\${elements.code.snakeCase.toUpperCase()}', + ); + } + }); + } + + final serviceDefinition = await serviceDefinitionRemoteRepository + .search(ServiceDefinitionSearchModel( + tenantId: envConfig.variables.tenantId, + code: codes, + )); + + for (var element in serviceDefinition) { + await serviceDefinitionLocalRepository.create( + element, + createOpLog: false, + ); + } + }'''; + + var loadfunctions = '''try { + await _loadServiceDefinition(projects); + } catch (_) { + emit( + state.copyWith( + loading: false, + syncError: ProjectSyncErrorType.serviceDefinitions, + ), + ); + } + try { + await _loadServiceDefinition(projects); + } catch (_) { + emit( + state.copyWith( + loading: false, + syncError: ProjectSyncErrorType.serviceDefinitions, + ), + ); + }'''; + + // Check if the project.dart file exists + var projectFile = File(projectFilePath); + if (!projectFile.existsSync()) { + print('Error: project file does not exist at path: $projectFilePath'); + return; + } + + // Read the project.dart file + var projectFileContent = projectFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!projectFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + projectFileContent = importStatement + '\n' + projectFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the Service Definition repo already exist in the file + if (!projectFileContent + .contains(ServicedefinitionRepo.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the Service Definition Repo + var caseInsertionIndex = projectFileContent.indexOf('class ProjectBloc extends Bloc {'); + caseInsertionIndex += 'class ProjectBloc extends Bloc {'.length; + if (caseInsertionIndex != -1) { + projectFileContent = + projectFileContent.substring(0, caseInsertionIndex) + '\n' + + ServicedefinitionRepo + + '\n' + + projectFileContent.substring(caseInsertionIndex); + print('The Service Definition repo were added.'); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The Service Definition Repo already exist.'); + } + + // Check if the Project Bloc already exist in the file + if (!projectFileContent + .contains(projectBloc.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the Project Bloc + var caseInsertionIndex = projectFileContent.indexOf('ProjectBloc({'); + caseInsertionIndex += 'ProjectBloc({'.length; + if (caseInsertionIndex != -1) { + projectFileContent = + projectFileContent.substring(0, caseInsertionIndex) + '\n' + + projectBloc + + '\n' + + projectFileContent.substring(caseInsertionIndex); + print('The Project Bloc were added.'); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The Project Bloc already exist.'); + } + + // Check if the load service definition function already exist in the file + if (!projectFileContent + .contains(loadServicedefinition.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the load service definition function + var caseInsertionIndex = projectFileContent.indexOf('class ProjectBloc extends Bloc {'); + caseInsertionIndex += 'class ProjectBloc extends Bloc {'.length; + if (caseInsertionIndex != -1) { + projectFileContent = + projectFileContent.substring(0, caseInsertionIndex) + '\n' + + loadServicedefinition + + '\n' + + projectFileContent.substring(caseInsertionIndex); + print('The load service definition function were added.'); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The load service definition function already exist.'); + } + + // Check if the load functions calling already exist in the file + if (!projectFileContent + .contains(loadfunctions.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the load function calling + var caseInsertionIndex = projectFileContent.indexOf('// INFO : Need to add project load functions'); + caseInsertionIndex += '// INFO : Need to add project load functions'.length; + if (caseInsertionIndex != -1) { + projectFileContent = + projectFileContent.substring(0, caseInsertionIndex) + '\n' + + loadfunctions + + '\n' + + projectFileContent.substring(caseInsertionIndex); + print('The load function calling were added.'); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The load function calling already exist.'); + } + + // Write the updated content back to the project.dart file + projectFile.writeAsStringSync(projectFileContent); +} + +void _updateHome(String homeFilePath) { + var importStatement = ''' + import 'package:survey_form/survey_form.dart'; + import 'package:survey_form/router/survey_form_router.gm.dart'; + '''; + + var homeItemsData = ''' + i18.home.mySurveyForm: homeShowcaseData.supervisorMySurveyForm.buildWith( + child: HomeItemCard( + enableCustomIcon: true, + customIcon: mySurveyFormSvg, + icon: Icons.checklist, + label: i18.home.mySurveyForm, + onPressed: () => context.router.push(SurveyFormWrapperRoute()), + ), + ), + '''; + + var showCaseData = ''' + i18.home.mySurveyForm: homeShowcaseData.supervisorMySurveyForm.showcaseKey, + '''; + + var itemsLabel = ''' + i18.home.mySurveyForm, + '''; + + // Define the data to be added + var singletonData = ''' + SurveyFormSingleton().setInitialData( + projectId: context.projectId, + projectName: context.selectedProject.name, + loggedInIndividualId: context.loggedInIndividualId ?? '', + loggedInUserUuid: context.loggedInUserUuid, + appVersion: Constants().version, + isHealthFacilityWorker: context.loggedInUserRoles.where((role) => role.code == RolesType.healthFacilityWorker.toValue()).toList().isNotEmpty, + roles: context.read().state.maybeMap( + orElse: () => const Offstage(), + authenticated: (res) { + return res.userModel.roles + .map((e) => e.code.snakeCase.toUpperCase()) + .toList(); + }), + ); + '''; + + var localRepoData = ''' + context.read>(), + '''; + + var remoteRepoData = ''' + context.read>(), + '''; + + // Check if the home.dart file exists + var homeFile = File(homeFilePath); + if (!homeFile.existsSync()) { + print('Error: Home file does not exist at path: $homeFilePath'); + return; + } + + // Read the home.dart file + var homeFileContent = homeFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!homeFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + homeFileContent = importStatement + '\n' + homeFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Insert the data to be added + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add singleton of package Here', singletonData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add local repo of package Here', localRepoData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add repo repo of package Here', remoteRepoData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add home items of package Here', homeItemsData); + homeFileContent = insertData(homeFileContent, + '// INFO : Need to add showcase keys of package Here', showCaseData); + homeFileContent = insertData(homeFileContent, + '// INFO: Need to add items label of package Here', itemsLabel); + + // Write the updated content back to the home.dart file + homeFile.writeAsStringSync(homeFileContent); +} + +String insertData(String fileContent, String marker, String data) { + var markerIndex = fileContent.indexOf(marker); + if (markerIndex != -1) { + var endOfMarker = markerIndex + marker.length; + if (!fileContent.substring(endOfMarker).contains(data.trim())) { + fileContent = fileContent.substring(0, endOfMarker) + + '\n' + + data + + fileContent.substring(endOfMarker); + print('Data was added after marker: $marker'); + } else { + print('Data already exists after marker: $marker'); + } + } else { + print('Error: Could not find the marker: $marker'); + } + return fileContent; +} + +void _updateEntityMapperFile(String entityMapperFilePath) { + // Define the import statement and new case statements + var importStatement = + "import 'package:survey_form/survey_form.dart';"; + var newCases = ''' + case "service": + final entity = ServiceModelMapper.fromJson(entityString); + return entity; +'''; + + // Check if the entity_mapper file exists + var entityMapperFile = File(entityMapperFilePath); + + if (!entityMapperFile.existsSync()) { + print( + 'Error: Entity Mapper file does not exist at path: $entityMapperFilePath'); + return; + } + + // Read the entity_mapper file + var entityMapperFileContent = entityMapperFile.readAsStringSync(); + + // Check if the import statement already exists and add it if not + if (!entityMapperFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + entityMapperFileContent = importStatement + '\n' + entityMapperFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the new cases already exist in the file + if (!entityMapperFileContent + .contains('case "service":'.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the new cases (before the default case) + var caseInsertionIndex = entityMapperFileContent.indexOf('default:'); + if (caseInsertionIndex != -1) { + entityMapperFileContent = + entityMapperFileContent.substring(0, caseInsertionIndex) + + newCases + + '\n' + + entityMapperFileContent.substring(caseInsertionIndex); + print('The new cases were added.'); + + // Write the updated content back to the file + entityMapperFile.writeAsStringSync(entityMapperFileContent); + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The new cases already exist.'); + } +} + +void _addSurveyFormRoutesAndImportToRouterFile(String routerFilePath) { + // Define the SurveyForm route lines + var surveyFormRoutes = ''' + // SurveyForm Route + AutoRoute( + page: SurveyFormWrapperRoute.page, + path: 'surveyForm', + children: [ + AutoRoute( + page: SurveyformRoute.page, + path: '', + ), + AutoRoute( + page: SurveyFormBoundaryViewRoute.page, path: 'view-boundary'), + AutoRoute(page: SurveyFormViewRoute.page, path: 'view'), + AutoRoute(page: SurveyFormPreviewRoute.page, path: 'preview'), + AutoRoute(page: SurveyFormAcknowledgementRoute.page, path: 'surveyForm-acknowledgement'), + ]), + '''; + + // Define the import statement + var importStatement1 = + "import 'package:survey_form/router/survey_form_router.dart';"; + // Define the import statement + var importStatement2 = + "import 'package:survey_form/router/survey_form_router.gm.dart';"; + + // Check if the router file exists + var routerFile = File(routerFilePath); + + if (!routerFile.existsSync()) { + print('Error: Router file does not exist at path: $routerFilePath'); + return; + } + + // Read the router file + var routerFileContent = routerFile.readAsStringSync(); + + // Check if the import statement already exists + if (!routerFileContent + .contains(importStatement1.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement at the beginning of the file + routerFileContent = importStatement1 + '\n' + routerFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + + // Check if the import statement already exists + if (!routerFileContent + .contains(importStatement2.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement at the beginning of the file + routerFileContent = importStatement2 + '\n' + routerFileContent; + print('The import statement was added.'); + } else { + print('The import statement already exists.'); + } + // Check if the surveyFormRoute module already exists + if (!routerFileContent + .contains('SurveyFormRoute'.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the module + var moduleInsertionIndex = routerFileContent.indexOf('@AutoRouterConfig('); + if (moduleInsertionIndex != -1) { + var endOfModulesIndex = + routerFileContent.indexOf(']', moduleInsertionIndex); + if (endOfModulesIndex != -1) { + var modulesEndIndex = + routerFileContent.lastIndexOf(']', endOfModulesIndex); + routerFileContent = routerFileContent.substring(0, modulesEndIndex) + + 'SurveyFormRoute,' + + routerFileContent.substring(modulesEndIndex); + + // Write the updated content back to the project.dart file + routerFile.writeAsStringSync(routerFileContent); + print('The SurveyFormRoute module was added.'); + } else { + print('Error: Could not find the end of the modules list.'); + return; + } + } else { + print('Error: Could not find @AutoRouterConfig annotation.'); + return; + } + } else { + print('The SurveyFormRoute module already exists.'); + } + + // Check if the SurveyForm routes already exist in the file + if (!routerFileContent + .contains(surveyFormRoutes.replaceAll(RegExp(r'\s'), ''))) { + // Find the position to insert the routes + var insertionIndex = routerFileContent + .indexOf('// INFO : Need to add Router of package Here'); + if (insertionIndex != -1) { + routerFileContent = routerFileContent.substring(0, insertionIndex) + + '// INFO : Need to add Router of package Here\n' + + surveyFormRoutes + + routerFileContent.substring(insertionIndex + + '// INFO : Need to add Router of package Here'.length); + print('The surveyForm routes were added.'); + + } else { + print('Error: Could not find the insertion point.'); + return; + } + } else { + print('The surveyForm routes already exist.'); + } + // Write the updated content back to the file + routerFile.writeAsStringSync(routerFileContent); +} + +void _addSurveyFormMapperToUtilsFile({required String utilsFilePath}) { + // Define the surveyForm related lines + var surveyFormImportStatement = [ + '''import 'package:survey_form/survey_form.init.dart' + as surveyForm_mappers;''' + ]; + var surveyFormInitializationStatement = + "Future(() => surveyForm_mappers.initializeMappers()),"; + + // Check if the utils.dart file exists + var utilsFile = File(utilsFilePath); + + // Read the utils.dart file + var utilsFileContent = utilsFile.readAsStringSync(); + + // Normalize the whitespace in the file content + var normalizedFileContent = utilsFileContent.replaceAll(RegExp(r'\s'), ''); + + // Check if the import statement and delegate already exist in the file + // If not, add them to the file + if (!normalizedFileContent + .contains(surveyFormImportStatement[0].replaceAll(RegExp(r'\s'), ''))) { + var libraryIndex = utilsFileContent.indexOf('library app_utils;'); + if (libraryIndex != -1) { + var endOfLibrary = libraryIndex + + utilsFileContent.substring(libraryIndex).indexOf(';') + + 1; + utilsFileContent = utilsFileContent.substring(0, endOfLibrary + 1) + + '\n' + + surveyFormImportStatement[0] + + utilsFileContent.substring(endOfLibrary + 1); + print('The import statement was added.'); + } + } else { + print('The import statement already exists.'); + } + + if (!utilsFileContent.contains(surveyFormInitializationStatement)) { + // Add the surveyForm related initialization statement to the file + var initializeAllMappersIndex = + utilsFileContent.indexOf('initializeAllMappers() async {'); + if (initializeAllMappersIndex == -1) { + print( + 'Error: Could not find a place to insert the survey form initialization statement.'); + return; + } + var endOfInitializeAllMappers = initializeAllMappersIndex + + utilsFileContent.substring(initializeAllMappersIndex).indexOf(']') + + 1; + utilsFileContent = + utilsFileContent.substring(0, endOfInitializeAllMappers - 1) + + '\n ' + + surveyFormInitializationStatement + + utilsFileContent.substring(endOfInitializeAllMappers - 1); + + print('Survey Form initialization statement added to utils.dart'); + } else { + print('The Survey Form initialization statement already exists.'); + } + + // Write the updated content back to the utils.dart file + utilsFile.writeAsStringSync(utilsFileContent); +} + +void _addSurveyFormConstantsToConstantsFile( + {required String constantsFilePath}) { + // Define the import statements + var importStatements = [ + "import 'package:survey_form/survey_form.dart';", + ]; + + // Define the Survey Form configuration + var SurveyFormConfiguration = ''' +SurveyFormSingleton().setTenantId(envConfig.variables.tenantId); + '''; + + // Define the local and remote repositories + var localRepository = [ + ''' +ServiceDefinitionLocalRepository( + sql, + ServiceDefinitionOpLogManager(isar), + ), + ServiceLocalRepository( + sql, + ServiceOpLogManager(isar), + ), + ''' + ]; + + var remoteRepository = [ + ''' +if (value == DataModelType.serviceDefinition) + ServiceDefinitionRemoteRepository(dio, actionMap: actions), +if (value == DataModelType.service) + ServiceRemoteRepository(dio, actionMap: actions), + ''' + ]; + + // Check if the constants.dart file exists + var constantsFile = File(constantsFilePath); + if (!constantsFile.existsSync()) { + print('Error: The constants.dart file does not exist.'); + return; + } + + // Read the constants.dart file + var constantsFileContent = constantsFile.readAsStringSync(); + + // Normalize the whitespace in the file content and the Survey Form configuration + var normalizedFileContent = + constantsFileContent.replaceAll(RegExp(r'\s'), ''); + var normalizedSurveyFormConfiguration = + SurveyFormConfiguration.replaceAll(RegExp(r'\s'), ''); + + // Check if the import statements already exist in the file + for (var importStatement in importStatements) { + if (!normalizedFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement at the top of the file + constantsFileContent = importStatement + '\n' + constantsFileContent; + print('The import statement was added: $importStatement'); + } + } + + // Check if the Survey Form configuration already exists in the file + // If not, add it to the file + if (!normalizedFileContent.contains(normalizedSurveyFormConfiguration)) { + // Find the setInitialDataOfPackages method and add the Survey Form configuration inside it + var setInitialDataOfPackagesIndex = + constantsFileContent.indexOf('void setInitialDataOfPackages() {'); + if (setInitialDataOfPackagesIndex != -1) { + var endOfSetInitialDataOfPackages = setInitialDataOfPackagesIndex + + constantsFileContent + .substring(setInitialDataOfPackagesIndex) + .indexOf('}') + + 1; + constantsFileContent = + constantsFileContent.substring(0, endOfSetInitialDataOfPackages - 1) + + '\n $SurveyFormConfiguration' + + constantsFileContent.substring(endOfSetInitialDataOfPackages - 1); + print('The Survey Form configuration was added.'); + } + } + + // Add the local and remote repositories to the getLocalRepositories and getRemoteRepositories methods + var getLocalRepositoriesIndex = + constantsFileContent.indexOf('getLocalRepositories('); + if (getLocalRepositoriesIndex != -1) { + var endOfGetLocalRepositories = getLocalRepositoriesIndex + + constantsFileContent.substring(getLocalRepositoriesIndex).indexOf(']') + + 1; + constantsFileContent = + constantsFileContent.substring(0, endOfGetLocalRepositories - 1) + + '\n' + + localRepository.join('\n') + + constantsFileContent.substring(endOfGetLocalRepositories - 1); + print('The local repositories were added.'); + } + + var getRemoteRepositoriesIndex = + constantsFileContent.indexOf('getRemoteRepositories('); + if (getRemoteRepositoriesIndex != -1) { + var endOfGetRemoteRepositories = getRemoteRepositoriesIndex + + constantsFileContent + .substring(getRemoteRepositoriesIndex) + .indexOf('addAll(') + + 'addAll('.length; + var endOfAddAll = constantsFileContent + .substring(endOfGetRemoteRepositories) + .indexOf(']') + + endOfGetRemoteRepositories; + constantsFileContent = constantsFileContent.substring(0, endOfAddAll) + + remoteRepository.join('\n') + + constantsFileContent.substring(endOfAddAll); + print('The remote repositories were added.'); + } + + // Write the updated content back to the constants.dart file + constantsFile.writeAsStringSync(constantsFileContent); +} + +void _addRepoToNetworkManagerProviderWrapper( + {required String networkManagerProviderWrapperFilePath}) { + // Define the import statements and repository providers + var importStatements = [ + "import 'package:survey_form/survey_form.dart';", + ]; + var localRepositories = [ + '''RepositoryProvider< + LocalRepository>( + create: (_) => ServiceDefinitionLocalRepository( + sql, + ServiceDefinitionOpLogManager( + isar, + ), + ), + ), + RepositoryProvider>( + create: (_) => ServiceLocalRepository( + sql, + ServiceOpLogManager(isar), + ), + )''' + ]; + +// Define the remote repositories of Survey Form + var remoteRepositoriesOfSurveyForm = [ + '''if (value == DataModelType.service) + RepositoryProvider< + RemoteRepository>( + create: (_) => ServiceRemoteRepository( + dio, + actionMap: actions, + ), + ), + if (value == DataModelType.serviceDefinition) + RepositoryProvider< + RemoteRepository>( + create: (_) => ServiceDefinitionRemoteRepository( + dio, + actionMap: actions, + ), + )''' + ]; + +// Read the network_manager_provider_wrapper.dart file + var networkManagerProviderWrapperFile = + File(networkManagerProviderWrapperFilePath); + var networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFile.readAsStringSync(); + +// Find the last import statement in the file + var lastImportIndex = networkManagerProviderWrapperFileContent + .lastIndexOf(RegExp(r'import .+;')); + + if (lastImportIndex != -1) { + var endOfLastImport = lastImportIndex + + networkManagerProviderWrapperFileContent + .substring(lastImportIndex) + .indexOf(';') + + 1; + + // Check if the import statements already exist in the file + for (var importStatement in importStatements) { + if (!networkManagerProviderWrapperFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + // Add the import statement after the last import + networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFileContent.substring( + 0, endOfLastImport) + + '\n' + + importStatement + + networkManagerProviderWrapperFileContent + .substring(endOfLastImport); + endOfLastImport += importStatement.length + 1; + print('The import statement was added: $importStatement'); + } else { + print('The import statement already exists.'); + } + } + + // Normalize the whitespace in the file content and the remote repository of Survey Form + var normalizedFileContent = + networkManagerProviderWrapperFileContent.replaceAll(RegExp(r'\s'), ''); + +// Check if the local repository providers already exist in the file + for (var repositoryProvider in localRepositories) { + var normalizedLocalRepositoryOfSurveyForm = + repositoryProvider.replaceAll(RegExp(r'\s'), ''); + + if (!normalizedFileContent + .contains(normalizedLocalRepositoryOfSurveyForm)) { + // Add the local repository provider to the file + networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFileContent.replaceFirst( + '];', ' $repositoryProvider\n];'); + print('The local repository provider was added: $repositoryProvider'); + } else { + print('The local repository provider already exists.'); + } + } + +// Check if the remote repository of Survey Form already exists in the file + for (var remoteRepositoryOfSurveyForm + in remoteRepositoriesOfSurveyForm) { + var normalizedRemoteRepositoryOfSurveyForm = + remoteRepositoryOfSurveyForm.replaceAll(RegExp(r'\s'), ''); + + if (!normalizedFileContent + .contains(normalizedRemoteRepositoryOfSurveyForm)) { + // Add the remote repository of Survey Form to the _getRemoteRepositories method + var replacementString = + networkManagerProviderWrapperFileContent.contains(']);') + ? ' $remoteRepositoryOfSurveyForm,\n]);' + : ' $remoteRepositoryOfSurveyForm\n]);'; + networkManagerProviderWrapperFileContent = + networkManagerProviderWrapperFileContent.replaceFirst( + ']);', replacementString); + print( + 'The remote repository of Survey Form was added: $remoteRepositoryOfSurveyForm'); + } else { + print('The remote repository of Survey Form already exists.'); + } + } + + // Write the updated content back to the file + networkManagerProviderWrapperFile + .writeAsStringSync(networkManagerProviderWrapperFileContent); + } +} + +void _createLocalizationDelegatesFile(String localizationDelegatesFilePath) { + // Define the import statement and delegate for localization + var importStatement = + "import 'package:survey_form/blocs/app_localization.dart' as surveyForm_localization;"; + var delegate = + '''surveyForm_localization.SurveyFormLocalization.getDelegate( + LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, + appConfig.languages!, + ),'''; + + // Read the localization delegates file + var localizationDelegatesFile = File(localizationDelegatesFilePath); + var localizationDelegatesFileContent = + localizationDelegatesFile.readAsStringSync(); + + var normalizedFileContent = + localizationDelegatesFileContent.replaceAll(RegExp(r'\s'), ''); + + // Check if the import statement and delegate already exist in the file + // If not, add them to the file + if (!normalizedFileContent + .contains(importStatement.replaceAll(RegExp(r'\s'), ''))) { + localizationDelegatesFileContent = + '$importStatement\n$localizationDelegatesFileContent'; + print('The import statement was added.'); + } + + if (!normalizedFileContent.contains(delegate.replaceAll(RegExp(r'\s'), ''))) { + var lastDelegateIndex = + localizationDelegatesFileContent.lastIndexOf(RegExp(r',')); + if (lastDelegateIndex != -1) { + localizationDelegatesFileContent = + localizationDelegatesFileContent.substring(0, lastDelegateIndex + 1) + + '\n $delegate' + + localizationDelegatesFileContent.substring(lastDelegateIndex + 1); + print('The delegate was added.'); + } + } + + // Write the updated content back to the file + localizationDelegatesFile.writeAsStringSync(localizationDelegatesFileContent); +}