Tax model
This commit is contained in:
parent
9fd6481417
commit
ad1a072a80
|
|
@ -195,8 +195,7 @@ class _TaxSettingsState extends State<TaxSettings> {
|
|||
SizedBox(height: 12),
|
||||
...taxData.regions.keys.map((region) {
|
||||
final taxDataRegion = taxData.regions[region];
|
||||
return Column(
|
||||
children: [
|
||||
return Column(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
|
|
@ -208,8 +207,8 @@ class _TaxSettingsState extends State<TaxSettings> {
|
|||
child: AppDropdownButton<bool>(
|
||||
value: taxDataRegion.taxAll,
|
||||
onChanged: (dynamic value) {
|
||||
viewModel.onCompanyChanged(
|
||||
company.rebuild((b) => b
|
||||
viewModel.onCompanyChanged(company.rebuild(
|
||||
(b) => b
|
||||
..taxData.regions[region] =
|
||||
taxDataRegion.rebuild(
|
||||
(b) => b..taxAll = value)));
|
||||
|
|
@ -249,15 +248,24 @@ class _TaxSettingsState extends State<TaxSettings> {
|
|||
],
|
||||
),
|
||||
),
|
||||
if (_showDetails[region])
|
||||
if (_showDetails[region]) ...[
|
||||
SizedBox(height: 8),
|
||||
...taxDataRegion.subregions.keys.map((subregion) {
|
||||
final taxDataSubregion =
|
||||
taxDataRegion.subregions[subregion];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Row(
|
||||
return Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
Expanded(
|
||||
child: CheckboxListTile(
|
||||
title: Text(region == kTaxRegionUnitedStates
|
||||
? subregion
|
||||
: (countryMap[subregion]?.name ??
|
||||
subregion)),
|
||||
subtitle: Text(
|
||||
'${taxDataSubregion.taxName}: ${formatNumber(taxDataSubregion.taxRate, context, formatNumberType: FormatNumberType.percent) + (taxDataSubregion.reducedTaxRate != 0 ? ' • ' + formatNumber(taxDataSubregion.reducedTaxRate, context, formatNumberType: FormatNumberType.percent) : '')}',
|
||||
),
|
||||
controlAffinity:
|
||||
ListTileControlAffinity.leading,
|
||||
value: taxDataRegion.taxAll ||
|
||||
taxDataSubregion.applyTax,
|
||||
onChanged: taxDataRegion.taxAll
|
||||
|
|
@ -268,34 +276,22 @@ class _TaxSettingsState extends State<TaxSettings> {
|
|||
..regions[region] =
|
||||
taxDataRegion.rebuild((b) => b
|
||||
..subregions[subregion] =
|
||||
taxDataSubregion.rebuild((b) => b
|
||||
..applyTax =
|
||||
value))))));
|
||||
}),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(region == kTaxRegionUnitedStates
|
||||
? subregion
|
||||
: (countryMap[subregion]?.name ??
|
||||
subregion)),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${taxDataSubregion.taxName}: ${formatNumber(taxDataSubregion.taxRate, context, formatNumberType: FormatNumberType.percent)}',
|
||||
taxDataSubregion.rebuild(
|
||||
(b) => b
|
||||
..applyTax = value))))));
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
taxDataSubregion.reducedTaxRate != 0
|
||||
? '${localization.reducedRate}: ${formatNumber(taxDataSubregion.reducedTaxRate, context, formatNumberType: FormatNumberType.percent)}'
|
||||
: '',
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
//
|
||||
},
|
||||
child: Text(localization.edit))
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
);
|
||||
]);
|
||||
}).toList(),
|
||||
]
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue