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';
|
||||||
|
|
@ -41,68 +42,72 @@ class _DeviceSettingsState extends State<DeviceSettings> {
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SwitchListTile(
|
FormCard(
|
||||||
title: Text(AppLocalization.of(context).darkMode),
|
children: <Widget>[
|
||||||
value: widget.viewModel.enableDarkMode,
|
SwitchListTile(
|
||||||
onChanged: (value) =>
|
title: Text(AppLocalization.of(context).darkMode),
|
||||||
widget.viewModel.onDarkModeChanged(context, value),
|
value: widget.viewModel.enableDarkMode,
|
||||||
secondary: Icon(FontAwesomeIcons.moon),
|
onChanged: (value) =>
|
||||||
activeColor: Theme.of(context).accentColor,
|
widget.viewModel.onDarkModeChanged(context, value),
|
||||||
),
|
secondary: Icon(FontAwesomeIcons.moon),
|
||||||
FutureBuilder(
|
activeColor: Theme.of(context).accentColor,
|
||||||
future: widget.viewModel.authenticationSupported,
|
),
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
FutureBuilder(
|
||||||
if (snapshot.hasData && snapshot.data == true) {
|
future: widget.viewModel.authenticationSupported,
|
||||||
return SwitchListTile(
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
title: Text(
|
if (snapshot.hasData && snapshot.data == true) {
|
||||||
AppLocalization.of(context).biometricAuthentication),
|
return SwitchListTile(
|
||||||
value: widget.viewModel.requireAuthentication,
|
title: Text(
|
||||||
onChanged: (value) => widget.viewModel
|
AppLocalization.of(context).biometricAuthentication),
|
||||||
.onRequireAuthenticationChanged(context, value),
|
value: widget.viewModel.requireAuthentication,
|
||||||
secondary: Icon(widget.viewModel.requireAuthentication
|
onChanged: (value) => widget.viewModel
|
||||||
? FontAwesomeIcons.lock
|
.onRequireAuthenticationChanged(context, value),
|
||||||
: FontAwesomeIcons.unlockAlt),
|
secondary: Icon(widget.viewModel.requireAuthentication
|
||||||
activeColor: Theme.of(context).accentColor,
|
? FontAwesomeIcons.lock
|
||||||
);
|
: FontAwesomeIcons.unlockAlt),
|
||||||
} else {
|
activeColor: Theme.of(context).accentColor,
|
||||||
return SizedBox();
|
);
|
||||||
}
|
} else {
|
||||||
},
|
return SizedBox();
|
||||||
),
|
}
|
||||||
widget.viewModel.state.selectedCompany
|
},
|
||||||
|
),
|
||||||
|
widget.viewModel.state.selectedCompany
|
||||||
.isModuleEnabled(EntityType.task)
|
.isModuleEnabled(EntityType.task)
|
||||||
? SwitchListTile(
|
? SwitchListTile(
|
||||||
title: Text(AppLocalization.of(context).autoStartTasks),
|
title: Text(AppLocalization.of(context).autoStartTasks),
|
||||||
value: widget.viewModel.autoStartTasks,
|
value: widget.viewModel.autoStartTasks,
|
||||||
onChanged: (value) => widget.viewModel
|
onChanged: (value) => widget.viewModel
|
||||||
.onAutoStartTasksChanged(context, value),
|
.onAutoStartTasksChanged(context, value),
|
||||||
secondary: Icon(FontAwesomeIcons.clock),
|
secondary: Icon(FontAwesomeIcons.clock),
|
||||||
activeColor: Theme.of(context).accentColor,
|
activeColor: Theme.of(context).accentColor,
|
||||||
)
|
)
|
||||||
: SizedBox(),
|
: SizedBox(),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalization.of(context).longPressSelectionIsDefault),
|
AppLocalization.of(context).longPressSelectionIsDefault),
|
||||||
value: widget.viewModel.longPressSelectionIsDefault,
|
value: widget.viewModel.longPressSelectionIsDefault,
|
||||||
onChanged: (value) => widget.viewModel
|
onChanged: (value) => widget.viewModel
|
||||||
.onLongPressSelectionIsDefault(context, value),
|
.onLongPressSelectionIsDefault(context, value),
|
||||||
secondary: Icon(FontAwesomeIcons.checkSquare),
|
secondary: Icon(FontAwesomeIcons.checkSquare),
|
||||||
activeColor: Theme.of(context).accentColor,
|
activeColor: Theme.of(context).accentColor,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(FontAwesomeIcons.syncAlt),
|
leading: Icon(FontAwesomeIcons.syncAlt),
|
||||||
title: Text(AppLocalization.of(context).refreshData),
|
title: Text(AppLocalization.of(context).refreshData),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.viewModel.onRefreshTap(context);
|
widget.viewModel.onRefreshTap(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(FontAwesomeIcons.powerOff),
|
leading: Icon(FontAwesomeIcons.powerOff),
|
||||||
title: Text(AppLocalization.of(context).logout),
|
title: Text(AppLocalization.of(context).logout),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.viewModel.onLogoutTap(context);
|
widget.viewModel.onLogoutTap(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -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