Settings
This commit is contained in:
parent
e53db97f40
commit
008a146ace
|
|
@ -1,10 +1,8 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
|
|
||||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/custom_fields_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/custom_fields_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
|
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
|
||||||
|
|
@ -84,7 +82,6 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final viewModel = widget.viewModel;
|
final viewModel = widget.viewModel;
|
||||||
final settings = viewModel.settings;
|
|
||||||
final state = viewModel.state;
|
final state = viewModel.state;
|
||||||
|
|
||||||
return SettingsScaffold(
|
return SettingsScaffold(
|
||||||
|
|
@ -96,7 +93,7 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(
|
Tab(
|
||||||
text: localization.general,
|
text: localization.company,
|
||||||
),
|
),
|
||||||
Tab(
|
Tab(
|
||||||
text: localization.clients,
|
text: localization.clients,
|
||||||
|
|
@ -119,64 +116,6 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ListView(
|
ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
FormCard(
|
|
||||||
children: <Widget>[
|
|
||||||
InputDecorator(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: localization.numberPadding,
|
|
||||||
),
|
|
||||||
child: DropdownButtonHideUnderline(
|
|
||||||
child: DropdownButton<int>(
|
|
||||||
value: settings.counterPadding,
|
|
||||||
isExpanded: true,
|
|
||||||
isDense: true,
|
|
||||||
onChanged: (value) => viewModel.onSettingsChanged(
|
|
||||||
settings.rebuild((b) => b..counterPadding = value)),
|
|
||||||
items: List<int>.generate(10, (i) => i + 1)
|
|
||||||
.map((value) => DropdownMenuItem(
|
|
||||||
child: Text('${'0' * (value - 1)}1'),
|
|
||||||
value: value,
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
DecoratedFormField(
|
|
||||||
label: localization.recurringPrefix,
|
|
||||||
controller: _recurringPrefixController,
|
|
||||||
),
|
|
||||||
InputDecorator(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: localization.resetCounter,
|
|
||||||
),
|
|
||||||
child: DropdownButtonHideUnderline(
|
|
||||||
child: DropdownButton<String>(
|
|
||||||
value: settings.resetCounterFrequencyId,
|
|
||||||
isExpanded: true,
|
|
||||||
isDense: true,
|
|
||||||
onChanged: (value) => viewModel.onSettingsChanged(
|
|
||||||
settings.rebuild(
|
|
||||||
(b) => b..resetCounterFrequencyId = value)),
|
|
||||||
items: memoizedFrequencyList(
|
|
||||||
state.staticState.frequencyMap)
|
|
||||||
.map((frequencyId) => DropdownMenuItem(
|
|
||||||
child: Text(state.staticState
|
|
||||||
.frequencyMap[frequencyId].name),
|
|
||||||
value: frequencyId,
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if ((settings.resetCounterFrequencyId ?? '').isNotEmpty)
|
|
||||||
DatePicker(
|
|
||||||
labelText: localization.nextReset,
|
|
||||||
selectedDate: settings.resetCounterDate,
|
|
||||||
onSelected: (value) => viewModel.onSettingsChanged(
|
|
||||||
settings.rebuild((b) => b..resetCounterDate = value)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
CustomFieldsSettings(
|
CustomFieldsSettings(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
fieldLabel: localization.customCompanyField,
|
fieldLabel: localization.customCompanyField,
|
||||||
|
|
@ -186,7 +125,6 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
|
||||||
CustomFieldsSettings(
|
CustomFieldsSettings(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
fieldLabel: localization.customClientField,
|
fieldLabel: localization.customClientField,
|
||||||
|
|
@ -197,7 +135,6 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
|
||||||
CustomFieldsSettings(
|
CustomFieldsSettings(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
fieldLabel: localization.customInvoiceField,
|
fieldLabel: localization.customInvoiceField,
|
||||||
|
|
@ -209,14 +146,12 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
|
||||||
CustomFieldsSettings(
|
CustomFieldsSettings(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
fieldLabel: localization.customCreditField,
|
fieldLabel: localization.customCreditField,
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
|
||||||
CustomFieldsSettings(
|
CustomFieldsSettings(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
fieldLabel: localization.customPaymentField,
|
fieldLabel: localization.customPaymentField,
|
||||||
|
|
@ -228,76 +163,6 @@ class _CustomFieldsState extends State<CustomFields>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class EntityNumberSettings extends StatefulWidget {
|
|
||||||
@override
|
|
||||||
_EntityNumberSettingsState createState() => _EntityNumberSettingsState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _EntityNumberSettingsState extends State<EntityNumberSettings> {
|
|
||||||
final _counterController = TextEditingController();
|
|
||||||
final _patternController = TextEditingController();
|
|
||||||
|
|
||||||
List<TextEditingController> _controllers = [];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_controllers.forEach((dynamic controller) {
|
|
||||||
controller.removeListener(_onChanged);
|
|
||||||
controller.dispose();
|
|
||||||
});
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didChangeDependencies() {
|
|
||||||
_controllers = [
|
|
||||||
_counterController,
|
|
||||||
_patternController,
|
|
||||||
];
|
|
||||||
|
|
||||||
_controllers
|
|
||||||
.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
|
||||||
|
|
||||||
/*
|
|
||||||
final product = widget.viewModel.product;
|
|
||||||
_productKeyController.text = product.productKey;
|
|
||||||
*/
|
|
||||||
|
|
||||||
_controllers
|
|
||||||
.forEach((dynamic controller) => controller.addListener(_onChanged));
|
|
||||||
|
|
||||||
super.didChangeDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onChanged() {
|
|
||||||
/*
|
|
||||||
final product = widget.viewModel.product.rebuild((b) => b
|
|
||||||
..customValue2 = _custom2Controller.text.trim());
|
|
||||||
if (product != widget.viewModel.product) {
|
|
||||||
widget.viewModel.onChanged(product);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final localization = AppLocalization.of(context);
|
|
||||||
|
|
||||||
return FormCard(
|
|
||||||
children: <Widget>[
|
|
||||||
DecoratedFormField(
|
|
||||||
label: localization.numberPattern,
|
|
||||||
controller: _patternController,
|
|
||||||
),
|
|
||||||
DecoratedFormField(
|
|
||||||
label: localization.numberCounter,
|
|
||||||
controller: _counterController,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomFieldsSettings extends StatefulWidget {
|
class CustomFieldsSettings extends StatefulWidget {
|
||||||
const CustomFieldsSettings(
|
const CustomFieldsSettings(
|
||||||
{@required this.fieldLabel,
|
{@required this.fieldLabel,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
|
||||||
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
||||||
|
|
@ -88,7 +87,7 @@ class _GeneratedNumbersState extends State<GeneratedNumbers>
|
||||||
final state = viewModel.state;
|
final state = viewModel.state;
|
||||||
|
|
||||||
return SettingsScaffold(
|
return SettingsScaffold(
|
||||||
title: localization.customFields,
|
title: localization.generatedNumbers,
|
||||||
onSavePressed: viewModel.onSavePressed,
|
onSavePressed: viewModel.onSavePressed,
|
||||||
appBarBottom: TabBar(
|
appBarBottom: TabBar(
|
||||||
key: ValueKey(state.settingsUIState.updatedAt),
|
key: ValueKey(state.settingsUIState.updatedAt),
|
||||||
|
|
@ -96,7 +95,7 @@ class _GeneratedNumbersState extends State<GeneratedNumbers>
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(
|
Tab(
|
||||||
text: localization.general,
|
text: localization.settings,
|
||||||
),
|
),
|
||||||
Tab(
|
Tab(
|
||||||
text: localization.clients,
|
text: localization.clients,
|
||||||
|
|
@ -177,50 +176,19 @@ class _GeneratedNumbersState extends State<GeneratedNumbers>
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customCompanyField,
|
|
||||||
valueLabel: localization.customCompanyValue,
|
|
||||||
showValues: true,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
EntityNumberSettings(),
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customClientField,
|
|
||||||
),
|
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customContactField,
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
EntityNumberSettings(),
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customInvoiceField,
|
|
||||||
),
|
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customInvoiceSurcharge,
|
|
||||||
showChargeTaxes: true,
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
EntityNumberSettings(),
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customCreditField,
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
ListView(children: <Widget>[
|
ListView(children: <Widget>[
|
||||||
EntityNumberSettings(),
|
EntityNumberSettings(),
|
||||||
GeneratedNumbersSettings(
|
|
||||||
viewModel: viewModel,
|
|
||||||
fieldLabel: localization.customPaymentField,
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -298,226 +266,3 @@ class _EntityNumberSettingsState extends State<EntityNumberSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneratedNumbersSettings extends StatefulWidget {
|
|
||||||
const GeneratedNumbersSettings(
|
|
||||||
{@required this.fieldLabel,
|
|
||||||
@required this.viewModel,
|
|
||||||
this.showChargeTaxes = false,
|
|
||||||
this.showValues = false,
|
|
||||||
this.valueLabel});
|
|
||||||
|
|
||||||
final GeneratedNumbersVM viewModel;
|
|
||||||
final String fieldLabel;
|
|
||||||
final String valueLabel;
|
|
||||||
final bool showChargeTaxes;
|
|
||||||
final bool showValues;
|
|
||||||
|
|
||||||
@override
|
|
||||||
_GeneratedNumbersSettingsState createState() => _GeneratedNumbersSettingsState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _GeneratedNumbersSettingsState extends State<GeneratedNumbersSettings> {
|
|
||||||
final _customField1Controller = TextEditingController();
|
|
||||||
final _customField2Controller = TextEditingController();
|
|
||||||
final _customField3Controller = TextEditingController();
|
|
||||||
final _customField4Controller = TextEditingController();
|
|
||||||
|
|
||||||
final _customValue1Controller = TextEditingController();
|
|
||||||
final _customValue2Controller = TextEditingController();
|
|
||||||
final _customValue3Controller = TextEditingController();
|
|
||||||
final _customValue4Controller = TextEditingController();
|
|
||||||
|
|
||||||
List<TextEditingController> _controllers = [];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_controllers.forEach((dynamic controller) {
|
|
||||||
controller.removeListener(_onChanged);
|
|
||||||
controller.dispose();
|
|
||||||
});
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didChangeDependencies() {
|
|
||||||
_controllers = [
|
|
||||||
_customField1Controller,
|
|
||||||
_customField2Controller,
|
|
||||||
_customField3Controller,
|
|
||||||
_customField4Controller,
|
|
||||||
_customValue1Controller,
|
|
||||||
_customValue2Controller,
|
|
||||||
_customValue3Controller,
|
|
||||||
_customValue4Controller,
|
|
||||||
];
|
|
||||||
|
|
||||||
_controllers
|
|
||||||
.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
|
||||||
|
|
||||||
/*
|
|
||||||
final product = widget.viewModel.product;
|
|
||||||
_productKeyController.text = product.productKey;
|
|
||||||
*/
|
|
||||||
|
|
||||||
_controllers
|
|
||||||
.forEach((dynamic controller) => controller.addListener(_onChanged));
|
|
||||||
|
|
||||||
super.didChangeDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onChanged() {
|
|
||||||
/*
|
|
||||||
final product = widget.viewModel.product.rebuild((b) => b
|
|
||||||
..customValue2 = _custom2Controller.text.trim());
|
|
||||||
if (product != widget.viewModel.product) {
|
|
||||||
widget.viewModel.onChanged(product);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final viewModel = widget.viewModel;
|
|
||||||
final company = viewModel.company;
|
|
||||||
|
|
||||||
return FormCard(
|
|
||||||
children: <Widget>[
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.fieldLabel,
|
|
||||||
controller: _customField1Controller,
|
|
||||||
showTaxes: widget.showChargeTaxes,
|
|
||||||
taxesEnabled: company.enableCustomSurchargeTaxes1,
|
|
||||||
onTaxesChanged: (value) => viewModel.onCompanyChanged(company
|
|
||||||
.rebuild((b) => b..enableCustomSurchargeTaxes1 = value)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (widget.showValues) ...[
|
|
||||||
SizedBox(width: kGutterWidth),
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.valueLabel,
|
|
||||||
controller: _customValue1Controller,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.fieldLabel,
|
|
||||||
controller: _customField2Controller,
|
|
||||||
showTaxes: widget.showChargeTaxes,
|
|
||||||
taxesEnabled: company.enableCustomSurchargeTaxes2,
|
|
||||||
onTaxesChanged: (value) => viewModel.onCompanyChanged(company
|
|
||||||
.rebuild((b) => b..enableCustomSurchargeTaxes2 = value)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (widget.showValues) ...[
|
|
||||||
SizedBox(width: kGutterWidth),
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.valueLabel,
|
|
||||||
controller: _customValue2Controller,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.fieldLabel,
|
|
||||||
controller: _customField3Controller,
|
|
||||||
showTaxes: widget.showChargeTaxes,
|
|
||||||
taxesEnabled: company.enableCustomSurchargeTaxes3,
|
|
||||||
onTaxesChanged: (value) => viewModel.onCompanyChanged(company
|
|
||||||
.rebuild((b) => b..enableCustomSurchargeTaxes3 = value)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (widget.showValues) ...[
|
|
||||||
SizedBox(width: kGutterWidth),
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.valueLabel,
|
|
||||||
controller: _customValue3Controller,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.fieldLabel,
|
|
||||||
controller: _customField4Controller,
|
|
||||||
showTaxes: widget.showChargeTaxes,
|
|
||||||
taxesEnabled: company.enableCustomSurchargeTaxes4,
|
|
||||||
onTaxesChanged: (value) => viewModel.onCompanyChanged(company
|
|
||||||
.rebuild((b) => b..enableCustomSurchargeTaxes4 = value)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (widget.showValues) ...[
|
|
||||||
SizedBox(width: kGutterWidth),
|
|
||||||
Expanded(
|
|
||||||
child: CustomFormField(
|
|
||||||
label: widget.valueLabel,
|
|
||||||
controller: _customValue4Controller,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomFormField extends StatelessWidget {
|
|
||||||
const CustomFormField({
|
|
||||||
@required this.label,
|
|
||||||
@required this.controller,
|
|
||||||
this.showTaxes = false,
|
|
||||||
this.taxesEnabled,
|
|
||||||
this.onTaxesChanged,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String label;
|
|
||||||
final TextEditingController controller;
|
|
||||||
final bool showTaxes;
|
|
||||||
final bool taxesEnabled;
|
|
||||||
final Function(bool) onTaxesChanged;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final localization = AppLocalization.of(context);
|
|
||||||
|
|
||||||
return Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: DecoratedFormField(
|
|
||||||
label: label,
|
|
||||||
controller: controller,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (showTaxes) ...[
|
|
||||||
Checkbox(
|
|
||||||
activeColor: Theme.of(context).accentColor,
|
|
||||||
value: taxesEnabled ?? false,
|
|
||||||
onChanged: onTaxesChanged,
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
child: Text(localization.chargeTaxes),
|
|
||||||
onTap: () => onTaxesChanged(!taxesEnabled),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'company': 'Company',
|
||||||
'generated_numbers': 'Generated Numbers',
|
'generated_numbers': 'Generated Numbers',
|
||||||
'charge_taxes': 'Charge Taxes',
|
'charge_taxes': 'Charge Taxes',
|
||||||
'credit': 'Credit',
|
'credit': 'Credit',
|
||||||
|
|
@ -15207,6 +15208,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get generatedNumbers => _localizedValues[localeCode]['generated_numbers'];
|
String get generatedNumbers => _localizedValues[localeCode]['generated_numbers'];
|
||||||
|
|
||||||
|
String get company => _localizedValues[localeCode]['company'];
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
return _localizedValues[localeCode][lookupKey] ??
|
return _localizedValues[localeCode][lookupKey] ??
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue