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/templates_and_reminders_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/tax_rate/edit/tax_rate_edit_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/tax_rate/tax_rate_screen_vm.dart';
|
||||
|
|
@ -218,6 +219,9 @@ class SettingsScreens extends StatelessWidget {
|
|||
case kSettingsCustomFields:
|
||||
screen = CustomFieldsScreen();
|
||||
break;
|
||||
case kSettingsWorkflowSettings:
|
||||
screen = WorkflowSettingsScreen();
|
||||
break;
|
||||
case kSettingsInvoiceDesign:
|
||||
screen = InvoiceDesignScreen();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.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/utils/localization.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
|
|
@ -41,68 +42,72 @@ class _DeviceSettingsState extends State<DeviceSettings> {
|
|||
key: _formKey,
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalization.of(context).darkMode),
|
||||
value: widget.viewModel.enableDarkMode,
|
||||
onChanged: (value) =>
|
||||
widget.viewModel.onDarkModeChanged(context, value),
|
||||
secondary: Icon(FontAwesomeIcons.moon),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
),
|
||||
FutureBuilder(
|
||||
future: widget.viewModel.authenticationSupported,
|
||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||
if (snapshot.hasData && snapshot.data == true) {
|
||||
return SwitchListTile(
|
||||
title: Text(
|
||||
AppLocalization.of(context).biometricAuthentication),
|
||||
value: widget.viewModel.requireAuthentication,
|
||||
onChanged: (value) => widget.viewModel
|
||||
.onRequireAuthenticationChanged(context, value),
|
||||
secondary: Icon(widget.viewModel.requireAuthentication
|
||||
? FontAwesomeIcons.lock
|
||||
: FontAwesomeIcons.unlockAlt),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
);
|
||||
} else {
|
||||
return SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
widget.viewModel.state.selectedCompany
|
||||
FormCard(
|
||||
children: <Widget>[
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalization.of(context).darkMode),
|
||||
value: widget.viewModel.enableDarkMode,
|
||||
onChanged: (value) =>
|
||||
widget.viewModel.onDarkModeChanged(context, value),
|
||||
secondary: Icon(FontAwesomeIcons.moon),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
),
|
||||
FutureBuilder(
|
||||
future: widget.viewModel.authenticationSupported,
|
||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||
if (snapshot.hasData && snapshot.data == true) {
|
||||
return SwitchListTile(
|
||||
title: Text(
|
||||
AppLocalization.of(context).biometricAuthentication),
|
||||
value: widget.viewModel.requireAuthentication,
|
||||
onChanged: (value) => widget.viewModel
|
||||
.onRequireAuthenticationChanged(context, value),
|
||||
secondary: Icon(widget.viewModel.requireAuthentication
|
||||
? FontAwesomeIcons.lock
|
||||
: FontAwesomeIcons.unlockAlt),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
);
|
||||
} else {
|
||||
return SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
widget.viewModel.state.selectedCompany
|
||||
.isModuleEnabled(EntityType.task)
|
||||
? SwitchListTile(
|
||||
title: Text(AppLocalization.of(context).autoStartTasks),
|
||||
value: widget.viewModel.autoStartTasks,
|
||||
onChanged: (value) => widget.viewModel
|
||||
.onAutoStartTasksChanged(context, value),
|
||||
secondary: Icon(FontAwesomeIcons.clock),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
)
|
||||
: SizedBox(),
|
||||
SwitchListTile(
|
||||
title: Text(
|
||||
AppLocalization.of(context).longPressSelectionIsDefault),
|
||||
value: widget.viewModel.longPressSelectionIsDefault,
|
||||
onChanged: (value) => widget.viewModel
|
||||
.onLongPressSelectionIsDefault(context, value),
|
||||
secondary: Icon(FontAwesomeIcons.checkSquare),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(FontAwesomeIcons.syncAlt),
|
||||
title: Text(AppLocalization.of(context).refreshData),
|
||||
onTap: () {
|
||||
widget.viewModel.onRefreshTap(context);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(FontAwesomeIcons.powerOff),
|
||||
title: Text(AppLocalization.of(context).logout),
|
||||
onTap: () {
|
||||
widget.viewModel.onLogoutTap(context);
|
||||
},
|
||||
),
|
||||
? SwitchListTile(
|
||||
title: Text(AppLocalization.of(context).autoStartTasks),
|
||||
value: widget.viewModel.autoStartTasks,
|
||||
onChanged: (value) => widget.viewModel
|
||||
.onAutoStartTasksChanged(context, value),
|
||||
secondary: Icon(FontAwesomeIcons.clock),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
)
|
||||
: SizedBox(),
|
||||
SwitchListTile(
|
||||
title: Text(
|
||||
AppLocalization.of(context).longPressSelectionIsDefault),
|
||||
value: widget.viewModel.longPressSelectionIsDefault,
|
||||
onChanged: (value) => widget.viewModel
|
||||
.onLongPressSelectionIsDefault(context, value),
|
||||
secondary: Icon(FontAwesomeIcons.checkSquare),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(FontAwesomeIcons.syncAlt),
|
||||
title: Text(AppLocalization.of(context).refreshData),
|
||||
onTap: () {
|
||||
widget.viewModel.onRefreshTap(context);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(FontAwesomeIcons.powerOff),
|
||||
title: Text(AppLocalization.of(context).logout),
|
||||
onTap: () {
|
||||
widget.viewModel.onLogoutTap(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -130,6 +130,11 @@ class SettingsList extends StatelessWidget {
|
|||
viewModel: viewModel,
|
||||
icon: FontAwesomeIcons.heading,
|
||||
),
|
||||
SettingsListTile(
|
||||
section: kSettingsWorkflowSettings,
|
||||
viewModel: viewModel,
|
||||
icon: FontAwesomeIcons.codeBranch,
|
||||
),
|
||||
/*
|
||||
SettingsListTile(
|
||||
section: kSettingsInvoiceDesign,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/foundation.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/forms/app_form.dart';
|
||||
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
|
||||
|
|
@ -30,14 +31,33 @@ class _WorkflowSettingsState extends State<WorkflowSettings> {
|
|||
final settings = viewModel.settings;
|
||||
|
||||
return SettingsScaffold(
|
||||
title: localization.productSettings,
|
||||
title: localization.workflowSettings,
|
||||
onSavePressed: viewModel.onSavePressed,
|
||||
body: AppForm(
|
||||
formKey: _formKey,
|
||||
children: <Widget>[
|
||||
FormCard(
|
||||
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 {
|
||||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'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_two_weeks': 'Two Weeks',
|
||||
'freq_four_weeks': 'Four Weeks',
|
||||
|
|
@ -15250,6 +15263,33 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
|
||||
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) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
return _localizedValues[localeCode][lookupKey] ??
|
||||
|
|
|
|||
Loading…
Reference in New Issue