From 16b7e9bf131acb04f3de604d6da5a843e66cffa8 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 6 May 2021 17:03:34 +0300 Subject: [PATCH] Tasks --- lib/ui/settings/task_settings.dart | 49 ++++++++++++++++++------------ lib/utils/i18n.dart | 9 ++++++ 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/lib/ui/settings/task_settings.dart b/lib/ui/settings/task_settings.dart index e0c2075ac..86262d328 100644 --- a/lib/ui/settings/task_settings.dart +++ b/lib/ui/settings/task_settings.dart @@ -87,24 +87,36 @@ class _TaskSettingsState extends State { formKey: _formKey, focusNode: _focusNode, children: [ - FormCard( - children: [ - DecoratedFormField( - controller: _taskRateController, - label: localization.defaultTaskRate, - onSavePressed: viewModel.onSavePressed, - isMoney: true, + FormCard(children: [ + DecoratedFormField( + controller: _taskRateController, + label: localization.defaultTaskRate, + onSavePressed: viewModel.onSavePressed, + isMoney: true, + ), + if (!viewModel.state.settingsUIState.isFiltered) ...[ + SizedBox(height: 32), + SwitchListTile( + activeColor: Theme.of(context).accentColor, + title: Text(localization.autoStartTasks), + value: company.autoStartTasks, + subtitle: Text(localization.autoStartTasksHelp), + onChanged: (value) => viewModel.onCompanyChanged( + company.rebuild((b) => b..autoStartTasks = value)), ), - if (!viewModel.state.settingsUIState.isFiltered) ...[ - SizedBox(height: 32), - SwitchListTile( - activeColor: Theme.of(context).accentColor, - title: Text(localization.autoStartTasks), - value: company.autoStartTasks, - subtitle: Text(localization.autoStartTasksHelp), - onChanged: (value) => viewModel.onCompanyChanged( - company.rebuild((b) => b..autoStartTasks = value)), - ), + SwitchListTile( + activeColor: Theme.of(context).accentColor, + title: Text(localization.showTaskEndDate), + value: company.showTaskEndDate, + subtitle: Text(localization.showTaskEndDateHelp), + onChanged: (value) => viewModel.onCompanyChanged( + company.rebuild((b) => b..showTaskEndDate = value)), + ), + ] + ]), + if (!viewModel.state.settingsUIState.isFiltered) + FormCard( + children: [ SwitchListTile( activeColor: Theme.of(context).accentColor, title: Text(localization.showTasksTable), @@ -138,8 +150,7 @@ class _TaskSettingsState extends State { company.rebuild((b) => b..invoiceTaskDocuments = value)), ), ], - ], - ), + ), if (!viewModel.state.settingsUIState.isFiltered) Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 5b2b80c32..5bed400be 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -15,6 +15,8 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // STARTER: lang key - do not remove comment + 'show_task_end_date': 'Show Task End Date', + 'show_task_end_date_help': 'Enable specifying the task end date', 'gateway_setup': 'Gateway Setup', 'preview_sidebar': 'Preview Sidebar', 'number_years_active': 'Number Years Active', @@ -60327,6 +60329,13 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['gateway_setup'] ?? _localizedValues['en']['gateway_setup']; + String get showTaskEndDate => + _localizedValues[localeCode]['show_task_end_date'] ?? + _localizedValues['en']['show_task_end_date']; + + String get showTaskEndDateHelp => + _localizedValues[localeCode]['show_task_end_date_help'] ?? + _localizedValues['en']['show_task_end_date_help']; String lookup(String key) { final lookupKey = toSnakeCase(key);