Settings
This commit is contained in:
parent
7eebfb6e69
commit
59e3cf2c44
|
|
@ -37,6 +37,7 @@ import 'package:invoiceninja_flutter/ui/settings/notifications_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/products_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/products_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/templates_and_reminders_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/templates_and_reminders_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/user_details_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/user_details_vm.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/settings/workflow_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/task/task_screen_vm.dart';
|
import 'package:invoiceninja_flutter/ui/task/task_screen_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/tax_rate/edit/tax_rate_edit_vm.dart';
|
import 'package:invoiceninja_flutter/ui/tax_rate/edit/tax_rate_edit_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/tax_rate/tax_rate_screen_vm.dart';
|
import 'package:invoiceninja_flutter/ui/tax_rate/tax_rate_screen_vm.dart';
|
||||||
|
|
@ -218,6 +219,9 @@ class SettingsScreens extends StatelessWidget {
|
||||||
case kSettingsCustomFields:
|
case kSettingsCustomFields:
|
||||||
screen = CustomFieldsScreen();
|
screen = CustomFieldsScreen();
|
||||||
break;
|
break;
|
||||||
|
case kSettingsWorkflowSettings:
|
||||||
|
screen = WorkflowSettingsScreen();
|
||||||
|
break;
|
||||||
case kSettingsInvoiceDesign:
|
case kSettingsInvoiceDesign:
|
||||||
screen = InvoiceDesignScreen();
|
screen = InvoiceDesignScreen();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/device_settings_list_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/device_settings_list_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
|
@ -40,6 +41,8 @@ class _DeviceSettingsState extends State<DeviceSettings> {
|
||||||
body: Form(
|
body: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
FormCard(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(AppLocalization.of(context).darkMode),
|
title: Text(AppLocalization.of(context).darkMode),
|
||||||
|
|
@ -104,6 +107,8 @@ class _DeviceSettingsState extends State<DeviceSettings> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,11 @@ class SettingsList extends StatelessWidget {
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
icon: FontAwesomeIcons.heading,
|
icon: FontAwesomeIcons.heading,
|
||||||
),
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
section: kSettingsWorkflowSettings,
|
||||||
|
viewModel: viewModel,
|
||||||
|
icon: FontAwesomeIcons.codeBranch,
|
||||||
|
),
|
||||||
/*
|
/*
|
||||||
SettingsListTile(
|
SettingsListTile(
|
||||||
section: kSettingsInvoiceDesign,
|
section: kSettingsInvoiceDesign,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.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/settings/settings_scaffold.dart';
|
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
|
||||||
|
|
@ -30,14 +31,33 @@ class _WorkflowSettingsState extends State<WorkflowSettings> {
|
||||||
final settings = viewModel.settings;
|
final settings = viewModel.settings;
|
||||||
|
|
||||||
return SettingsScaffold(
|
return SettingsScaffold(
|
||||||
title: localization.productSettings,
|
title: localization.workflowSettings,
|
||||||
onSavePressed: viewModel.onSavePressed,
|
onSavePressed: viewModel.onSavePressed,
|
||||||
body: AppForm(
|
body: AppForm(
|
||||||
formKey: _formKey,
|
formKey: _formKey,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
FormCard(
|
FormCard(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
SwitchListTile(
|
||||||
|
secondary: Icon(FontAwesomeIcons.solidEnvelope),
|
||||||
|
activeColor: Theme.of(context).accentColor,
|
||||||
|
title: Text(localization.autoEmailInvoice),
|
||||||
|
subtitle: Text(localization.autoEmailInvoiceHelp),
|
||||||
|
value: settings.autoEmailInvoice ?? false,
|
||||||
|
onChanged: (value) => viewModel.onSettingsChanged(settings.rebuild((b) => b
|
||||||
|
..autoEmailInvoice = value
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
secondary: Icon(FontAwesomeIcons.archive),
|
||||||
|
activeColor: Theme.of(context).accentColor,
|
||||||
|
title: Text(localization.autoArchiveInvoice),
|
||||||
|
subtitle: Text(localization.autoArchiveInvoiceHelp),
|
||||||
|
value: settings.autoArchiveInvoice ?? false,
|
||||||
|
onChanged: (value) => viewModel.onSettingsChanged(settings.rebuild((b) => b
|
||||||
|
..autoArchiveInvoice = value
|
||||||
|
)),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,19 @@ 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': {
|
||||||
|
'auto_email_invoice': 'Auto Email',
|
||||||
|
'auto_email_invoice_help':
|
||||||
|
'Automatically email recurring invoices when they are created.',
|
||||||
|
'auto_archive_invoice': 'Auto Archive',
|
||||||
|
'auto_archive_invoice_help':
|
||||||
|
'Automatically archive invoices when they are paid.',
|
||||||
|
'auto_archive_quote': 'Auto Archive',
|
||||||
|
'auto_archive_quote_help':
|
||||||
|
'Automatically archive quotes when they are converted.',
|
||||||
|
'auto_convert_quote': 'Auto Convert',
|
||||||
|
'auto_convert_quote_help':
|
||||||
|
'Automatically convert a quote to an invoice when approved by a client.',
|
||||||
|
'workflow_settings': 'Workflow Settings',
|
||||||
'freq_weekly': 'Weekly',
|
'freq_weekly': 'Weekly',
|
||||||
'freq_two_weeks': 'Two Weeks',
|
'freq_two_weeks': 'Two Weeks',
|
||||||
'freq_four_weeks': 'Four Weeks',
|
'freq_four_weeks': 'Four Weeks',
|
||||||
|
|
@ -15250,6 +15263,33 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get freqTwoYears => _localizedValues[localeCode]['freq_two_years'];
|
String get freqTwoYears => _localizedValues[localeCode]['freq_two_years'];
|
||||||
|
|
||||||
|
String get workflowSettings =>
|
||||||
|
_localizedValues[localeCode]['workflow_settings'];
|
||||||
|
|
||||||
|
String get autoEmailInvoice =>
|
||||||
|
_localizedValues[localeCode]['auto_email_invoice'];
|
||||||
|
|
||||||
|
String get autoEmailInvoiceHelp =>
|
||||||
|
_localizedValues[localeCode]['auto_email_invoice_help'];
|
||||||
|
|
||||||
|
String get autoArchiveInvoice =>
|
||||||
|
_localizedValues[localeCode]['auto_archive_invoice'];
|
||||||
|
|
||||||
|
String get autoArchiveInvoiceHelp =>
|
||||||
|
_localizedValues[localeCode]['auto_archive_invoice_help'];
|
||||||
|
|
||||||
|
String get autoArchiveQuote =>
|
||||||
|
_localizedValues[localeCode]['auto_archive_quote'];
|
||||||
|
|
||||||
|
String get autoArchiveQuoteHelp =>
|
||||||
|
_localizedValues[localeCode]['auto_archive_quote_help'];
|
||||||
|
|
||||||
|
String get autoConvertQuote =>
|
||||||
|
_localizedValues[localeCode]['auto_convert_quote'];
|
||||||
|
|
||||||
|
String get autoConvertQuoteHelp =>
|
||||||
|
_localizedValues[localeCode]['auto_convert_quote_help'];
|
||||||
|
|
||||||
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