feat: Refactor context reading in emergency contact and FAQs widgets
- Updated the context reading method in `EmergencyContactAddButton` and `EmergencyContactFormItem` to use `ReadContext`. - Modified the `FaqsWidget` to utilize `ReadContext` for fetching FAQs. - Adjusted the `PrivacySectionWidget` to read from `PrivacySecurityBloc` using `ReadContext`. feat: Implement Firebase Auth isolation pattern - Introduced `FirebaseAuthService` and `FirebaseAuthServiceImpl` to abstract Firebase Auth operations. - Ensured features do not directly import `firebase_auth`, adhering to architecture rules. feat: Create repository interfaces for billing and coverage - Added `BillingRepositoryInterface` for billing-related operations. - Created `CoverageRepositoryInterface` for coverage data access. feat: Add use cases for order management - Implemented use cases for fetching hubs, managers, and roles related to orders. - Created `GetHubsUseCase`, `GetManagersByHubUseCase`, and `GetRolesByVendorUseCase`. feat: Develop report use cases for client reports - Added use cases for fetching various reports including coverage, daily operations, forecast, no-show, performance, and spend reports. - Implemented `GetCoverageReportUseCase`, `GetDailyOpsReportUseCase`, `GetForecastReportUseCase`, `GetNoShowReportUseCase`, `GetPerformanceReportUseCase`, and `GetSpendReportUseCase`. feat: Establish profile repository and use cases - Created `ProfileRepositoryInterface` for staff profile data access. - Implemented use cases for retrieving staff profile and section statuses: `GetStaffProfileUseCase` and `GetProfileSectionsUseCase`. - Added `SignOutUseCase` for signing out the current user.
This commit is contained in:
@@ -121,14 +121,14 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
|
||||
void _handleNext(BuildContext context, int currentStep) {
|
||||
if (currentStep < _steps.length - 1) {
|
||||
context.read<FormI9Cubit>().nextStep(_steps.length);
|
||||
ReadContext(context).read<FormI9Cubit>().nextStep(_steps.length);
|
||||
} else {
|
||||
context.read<FormI9Cubit>().submit();
|
||||
ReadContext(context).read<FormI9Cubit>().submit();
|
||||
}
|
||||
}
|
||||
|
||||
void _handleBack(BuildContext context) {
|
||||
context.read<FormI9Cubit>().previousStep();
|
||||
ReadContext(context).read<FormI9Cubit>().previousStep();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -459,7 +459,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.first_name,
|
||||
value: state.firstName,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().firstNameChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().firstNameChanged(val),
|
||||
placeholder: i18n.fields.hints.first_name,
|
||||
),
|
||||
),
|
||||
@@ -469,7 +469,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.last_name,
|
||||
value: state.lastName,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().lastNameChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().lastNameChanged(val),
|
||||
placeholder: i18n.fields.hints.last_name,
|
||||
),
|
||||
),
|
||||
@@ -483,7 +483,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.middle_initial,
|
||||
value: state.middleInitial,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().middleInitialChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().middleInitialChanged(val),
|
||||
placeholder: i18n.fields.hints.middle_initial,
|
||||
),
|
||||
),
|
||||
@@ -494,7 +494,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.other_last_names,
|
||||
value: state.otherLastNames,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().otherLastNamesChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().otherLastNamesChanged(val),
|
||||
placeholder: i18n.fields.maiden_name,
|
||||
),
|
||||
),
|
||||
@@ -505,7 +505,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.dob,
|
||||
value: state.dob,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().dobChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().dobChanged(val),
|
||||
placeholder: i18n.fields.hints.dob,
|
||||
keyboardType: TextInputType.datetime,
|
||||
),
|
||||
@@ -518,7 +518,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
onChanged: (String val) {
|
||||
String text = val.replaceAll(RegExp(r'\D'), '');
|
||||
if (text.length > 9) text = text.substring(0, 9);
|
||||
context.read<FormI9Cubit>().ssnChanged(text);
|
||||
ReadContext(context).read<FormI9Cubit>().ssnChanged(text);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
@@ -526,7 +526,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.email,
|
||||
value: state.email,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().emailChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().emailChanged(val),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
placeholder: i18n.fields.hints.email,
|
||||
),
|
||||
@@ -535,7 +535,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.phone,
|
||||
value: state.phone,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().phoneChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().phoneChanged(val),
|
||||
keyboardType: TextInputType.phone,
|
||||
placeholder: i18n.fields.hints.phone,
|
||||
),
|
||||
@@ -554,7 +554,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.address_long,
|
||||
value: state.address,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().addressChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().addressChanged(val),
|
||||
placeholder: i18n.fields.hints.address,
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
@@ -562,7 +562,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.apt,
|
||||
value: state.aptNumber,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().aptNumberChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().aptNumberChanged(val),
|
||||
placeholder: i18n.fields.hints.apt,
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
@@ -574,7 +574,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.city,
|
||||
value: state.city,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().cityChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().cityChanged(val),
|
||||
placeholder: i18n.fields.hints.city,
|
||||
),
|
||||
),
|
||||
@@ -593,7 +593,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
DropdownButtonFormField<String>(
|
||||
initialValue: state.state.isEmpty ? null : state.state,
|
||||
onChanged: (String? val) =>
|
||||
context.read<FormI9Cubit>().stateChanged(val ?? ''),
|
||||
ReadContext(context).read<FormI9Cubit>().stateChanged(val ?? ''),
|
||||
items: _usStates.map((String stateAbbr) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: stateAbbr,
|
||||
@@ -626,7 +626,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.zip,
|
||||
value: state.zipCode,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().zipCodeChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().zipCodeChanged(val),
|
||||
placeholder: i18n.fields.hints.zip,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
@@ -660,7 +660,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
i18n.fields.uscis_number_label,
|
||||
value: state.uscisNumber,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().uscisNumberChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().uscisNumberChanged(val),
|
||||
placeholder: i18n.fields.hints.uscis,
|
||||
),
|
||||
)
|
||||
@@ -718,7 +718,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
}) {
|
||||
final bool isSelected = state.citizenshipStatus == value;
|
||||
return GestureDetector(
|
||||
onTap: () => context.read<FormI9Cubit>().citizenshipStatusChanged(value),
|
||||
onTap: () => ReadContext(context).read<FormI9Cubit>().citizenshipStatusChanged(value),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
decoration: BoxDecoration(
|
||||
@@ -803,7 +803,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
CheckboxListTile(
|
||||
value: state.preparerUsed,
|
||||
onChanged: (bool? val) {
|
||||
context.read<FormI9Cubit>().preparerUsedChanged(val ?? false);
|
||||
ReadContext(context).read<FormI9Cubit>().preparerUsedChanged(val ?? false);
|
||||
},
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
@@ -837,7 +837,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
TextPosition(offset: state.signature.length),
|
||||
),
|
||||
onChanged: (String val) =>
|
||||
context.read<FormI9Cubit>().signatureChanged(val),
|
||||
ReadContext(context).read<FormI9Cubit>().signatureChanged(val),
|
||||
decoration: InputDecoration(
|
||||
hintText: i18n.fields.signature_hint,
|
||||
filled: true,
|
||||
|
||||
@@ -111,14 +111,14 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
|
||||
void _handleNext(BuildContext context, int currentStep) {
|
||||
if (currentStep < _steps.length - 1) {
|
||||
context.read<FormW4Cubit>().nextStep(_steps.length);
|
||||
ReadContext(context).read<FormW4Cubit>().nextStep(_steps.length);
|
||||
} else {
|
||||
context.read<FormW4Cubit>().submit();
|
||||
ReadContext(context).read<FormW4Cubit>().submit();
|
||||
}
|
||||
}
|
||||
|
||||
void _handleBack(BuildContext context) {
|
||||
context.read<FormW4Cubit>().previousStep();
|
||||
ReadContext(context).read<FormW4Cubit>().previousStep();
|
||||
}
|
||||
|
||||
int _totalCredits(FormW4State state) {
|
||||
@@ -458,7 +458,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.first_name,
|
||||
value: state.firstName,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().firstNameChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().firstNameChanged(val),
|
||||
placeholder: i18n.fields.placeholder_john,
|
||||
),
|
||||
),
|
||||
@@ -468,7 +468,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.last_name,
|
||||
value: state.lastName,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().lastNameChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().lastNameChanged(val),
|
||||
placeholder: i18n.fields.placeholder_smith,
|
||||
),
|
||||
),
|
||||
@@ -483,7 +483,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
onChanged: (String val) {
|
||||
String text = val.replaceAll(RegExp(r'\D'), '');
|
||||
if (text.length > 9) text = text.substring(0, 9);
|
||||
context.read<FormW4Cubit>().ssnChanged(text);
|
||||
ReadContext(context).read<FormW4Cubit>().ssnChanged(text);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
@@ -491,7 +491,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.address,
|
||||
value: state.address,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().addressChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().addressChanged(val),
|
||||
placeholder: i18n.fields.placeholder_address,
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
@@ -499,7 +499,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.city_state_zip,
|
||||
value: state.cityStateZip,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().cityStateZipChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().cityStateZipChanged(val),
|
||||
placeholder: i18n.fields.placeholder_csz,
|
||||
),
|
||||
],
|
||||
@@ -557,7 +557,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
) {
|
||||
final bool isSelected = state.filingStatus == value;
|
||||
return GestureDetector(
|
||||
onTap: () => context.read<FormW4Cubit>().filingStatusChanged(value),
|
||||
onTap: () => ReadContext(context).read<FormW4Cubit>().filingStatusChanged(value),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
decoration: BoxDecoration(
|
||||
@@ -641,7 +641,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
),
|
||||
const SizedBox(height: UiConstants.space6),
|
||||
GestureDetector(
|
||||
onTap: () => context.read<FormW4Cubit>().multipleJobsChanged(
|
||||
onTap: () => ReadContext(context).read<FormW4Cubit>().multipleJobsChanged(
|
||||
!state.multipleJobs,
|
||||
),
|
||||
child: Container(
|
||||
@@ -752,7 +752,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.children_each,
|
||||
(FormW4State s) => s.qualifyingChildren,
|
||||
(int val) =>
|
||||
context.read<FormW4Cubit>().qualifyingChildrenChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().qualifyingChildrenChanged(val),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
@@ -765,7 +765,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.other_each,
|
||||
(FormW4State s) => s.otherDependents,
|
||||
(int val) =>
|
||||
context.read<FormW4Cubit>().otherDependentsChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().otherDependentsChanged(val),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -881,7 +881,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.other_income,
|
||||
value: state.otherIncome,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().otherIncomeChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().otherIncomeChanged(val),
|
||||
placeholder: i18n.fields.hints.zero,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
@@ -897,7 +897,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.deductions,
|
||||
value: state.deductions,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().deductionsChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().deductionsChanged(val),
|
||||
placeholder: i18n.fields.hints.zero,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
@@ -913,7 +913,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
i18n.fields.extra_withholding,
|
||||
value: state.extraWithholding,
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().extraWithholdingChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().extraWithholdingChanged(val),
|
||||
placeholder: i18n.fields.hints.zero,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
@@ -996,7 +996,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
TextPosition(offset: state.signature.length),
|
||||
),
|
||||
onChanged: (String val) =>
|
||||
context.read<FormW4Cubit>().signatureChanged(val),
|
||||
ReadContext(context).read<FormW4Cubit>().signatureChanged(val),
|
||||
decoration: InputDecoration(
|
||||
hintText: i18n.fields.signature_hint,
|
||||
filled: true,
|
||||
|
||||
@@ -11,7 +11,7 @@ class EmergencyContactAddButton extends StatelessWidget {
|
||||
return Center(
|
||||
child: TextButton.icon(
|
||||
onPressed: () =>
|
||||
context.read<EmergencyContactBloc>().add(EmergencyContactAdded()),
|
||||
ReadContext(context).read<EmergencyContactBloc>().add(EmergencyContactAdded()),
|
||||
icon: const Icon(UiIcons.add, size: 20.0),
|
||||
label: Text(
|
||||
'Add Another Contact',
|
||||
|
||||
@@ -44,7 +44,7 @@ class EmergencyContactFormItem extends StatelessWidget {
|
||||
initialValue: contact.fullName,
|
||||
hint: 'Contact name',
|
||||
icon: UiIcons.user,
|
||||
onChanged: (val) => context.read<EmergencyContactBloc>().add(
|
||||
onChanged: (val) => ReadContext(context).read<EmergencyContactBloc>().add(
|
||||
EmergencyContactUpdated(index, contact.copyWith(fullName: val)),
|
||||
),
|
||||
),
|
||||
@@ -54,7 +54,7 @@ class EmergencyContactFormItem extends StatelessWidget {
|
||||
initialValue: contact.phone,
|
||||
hint: '+1 (555) 000-0000',
|
||||
icon: UiIcons.phone,
|
||||
onChanged: (val) => context.read<EmergencyContactBloc>().add(
|
||||
onChanged: (val) => ReadContext(context).read<EmergencyContactBloc>().add(
|
||||
EmergencyContactUpdated(index, contact.copyWith(phone: val)),
|
||||
),
|
||||
),
|
||||
@@ -66,7 +66,7 @@ class EmergencyContactFormItem extends StatelessWidget {
|
||||
items: _kRelationshipTypes,
|
||||
onChanged: (val) {
|
||||
if (val != null) {
|
||||
context.read<EmergencyContactBloc>().add(
|
||||
ReadContext(context).read<EmergencyContactBloc>().add(
|
||||
EmergencyContactUpdated(
|
||||
index,
|
||||
contact.copyWith(relationshipType: val),
|
||||
@@ -144,7 +144,7 @@ class EmergencyContactFormItem extends StatelessWidget {
|
||||
color: UiColors.textError,
|
||||
size: 20.0,
|
||||
),
|
||||
onPressed: () => context.read<EmergencyContactBloc>().add(
|
||||
onPressed: () => ReadContext(context).read<EmergencyContactBloc>().add(
|
||||
EmergencyContactRemoved(index),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -37,9 +37,9 @@ class _FaqsWidgetState extends State<FaqsWidget> {
|
||||
|
||||
void _onSearchChanged(String value) {
|
||||
if (value.isEmpty) {
|
||||
context.read<FaqsBloc>().add(const FetchFaqsEvent());
|
||||
ReadContext(context).read<FaqsBloc>().add(const FetchFaqsEvent());
|
||||
} else {
|
||||
context.read<FaqsBloc>().add(SearchFaqsEvent(query: value));
|
||||
ReadContext(context).read<FaqsBloc>().add(SearchFaqsEvent(query: value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PrivacySectionWidget extends StatelessWidget {
|
||||
type: UiSnackbarType.success,
|
||||
);
|
||||
// Clear the flag after showing the snackbar
|
||||
context.read<PrivacySecurityBloc>().add(
|
||||
ReadContext(context).read<PrivacySecurityBloc>().add(
|
||||
const ClearProfileVisibilityUpdatedEvent(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user