solving problem with taxForm

This commit is contained in:
José Salazar
2026-02-04 00:41:53 +09:00
parent 470749501b
commit 306994a223
3 changed files with 26 additions and 20 deletions

View File

@@ -159,7 +159,7 @@ class _FormI9PageState extends State<FormI9Page> {
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () => Modular.to.pop(),
onPressed: () => Modular.to.pop(true),
style: ElevatedButton.styleFrom(
backgroundColor: UiColors.primary,
foregroundColor: UiColors.bgPopup,
@@ -513,23 +513,23 @@ class _FormI9PageState extends State<FormI9Page> {
_buildRadioOption(
context,
state,
'citizen',
'CITIZEN',
'1. A citizen of the United States',
),
const SizedBox(height: 12),
_buildRadioOption(
context,
state,
'noncitizen_national',
'NONCITIZEN',
'2. A noncitizen national of the United States',
),
const SizedBox(height: 12),
_buildRadioOption(
context,
state,
'permanent_resident',
'PERMANENT_RESIDENT',
'3. A lawful permanent resident',
child: state.citizenshipStatus == 'permanent_resident'
child: state.citizenshipStatus == 'PERMANENT_RESIDENT'
? Padding(
padding: const EdgeInsets.only(top: 12),
child: _buildTextField(
@@ -545,9 +545,9 @@ class _FormI9PageState extends State<FormI9Page> {
_buildRadioOption(
context,
state,
'alien_authorized',
'ALIEN',
'4. An alien authorized to work',
child: state.citizenshipStatus == 'alien_authorized'
child: state.citizenshipStatus == 'ALIEN'
? Padding(
padding: const EdgeInsets.only(top: 12),
child: Column(
@@ -765,13 +765,13 @@ class _FormI9PageState extends State<FormI9Page> {
String _getReadableCitizenship(String status) {
switch (status) {
case 'citizen':
case 'CITIZEN':
return 'US Citizen';
case 'noncitizen_national':
case 'NONCITIZEN':
return 'Noncitizen National';
case 'permanent_resident':
case 'PERMANENT_RESIDENT':
return 'Permanent Resident';
case 'alien_authorized':
case 'ALIEN':
return 'Alien Authorized to Work';
default:
return 'Unknown';

View File

@@ -205,7 +205,7 @@ class _FormW4PageState extends State<FormW4Page> {
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () => Modular.to.pop(),
onPressed: () => Modular.to.pop(true),
style: ElevatedButton.styleFrom(
backgroundColor: UiColors.primary,
foregroundColor: UiColors.bgPopup,
@@ -460,7 +460,7 @@ class _FormW4PageState extends State<FormW4Page> {
_buildRadioOption(
context,
state,
'single',
'SINGLE',
'Single or Married filing separately',
null,
),
@@ -468,7 +468,7 @@ class _FormW4PageState extends State<FormW4Page> {
_buildRadioOption(
context,
state,
'married',
'MARRIED',
'Married filing jointly or Qualifying surviving spouse',
null,
),
@@ -476,7 +476,7 @@ class _FormW4PageState extends State<FormW4Page> {
_buildRadioOption(
context,
state,
'head_of_household',
'HEAD',
'Head of household',
'Check only if you\'re unmarried and pay more than half the costs of keeping up a home',
),

View File

@@ -75,7 +75,7 @@ class TaxFormsPage extends StatelessWidget {
spacing: UiConstants.space6,
children: <Widget>[
_buildProgressOverview(state.forms),
...state.forms.map(_buildFormCard),
...state.forms.map((TaxForm form) => _buildFormCard(context, form)),
_buildInfoCard(),
],
),
@@ -138,16 +138,22 @@ class TaxFormsPage extends StatelessWidget {
);
}
Widget _buildFormCard(TaxForm form) {
Widget _buildFormCard(BuildContext context, TaxForm form) {
// Helper to get icon based on type (could be in entity or a mapper)
final String icon = form is I9TaxForm ? '🛂' : '📋';
return GestureDetector(
onTap: () {
onTap: () async {
if (form is I9TaxForm) {
Modular.to.pushNamed('i9', arguments: form);
final result = await Modular.to.pushNamed('i9', arguments: form);
if (result == true && context.mounted) {
BlocProvider.of<TaxFormsCubit>(context).loadTaxForms();
}
} else if (form is W4TaxForm) {
Modular.to.pushNamed('w4', arguments: form);
final result = await Modular.to.pushNamed('w4', arguments: form);
if (result == true && context.mounted) {
BlocProvider.of<TaxFormsCubit>(context).loadTaxForms();
}
}
},
child: Container(