diff --git a/lib/constants.dart b/lib/constants.dart index 9fb3a29dc..93af7b6f3 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -109,6 +109,11 @@ const String kGatewayTypeCustom3 = '12'; const String kGatewayStripe = 'd14dd26a37cecc30fdd65700bfb55b23'; +const String kEmailDesignPlain = 'plain'; +const String kEmailDesignLight = 'light'; +const String kEmailDesignDark = 'dark'; +const String kEmailDesignCustom = 'custom'; + const String kEntityStateActive = 'active'; const String kEntityStateArchived = 'archived'; const String kEntityStateDeleted = 'deleted'; diff --git a/lib/ui/app/forms/bool_dropdown_button.dart b/lib/ui/app/forms/bool_dropdown_button.dart index 55768d3a3..dc911f617 100644 --- a/lib/ui/app/forms/bool_dropdown_button.dart +++ b/lib/ui/app/forms/bool_dropdown_button.dart @@ -8,11 +8,13 @@ class BoolDropdownButton extends StatelessWidget { @required this.onChanged, @required this.showBlank, this.enabledLabel, + this.helpLabel, this.disabledLabel, this.iconData, }); final String label; + final String helpLabel; final bool value; final Function(bool) onChanged; final IconData iconData; @@ -28,13 +30,14 @@ class BoolDropdownButton extends StatelessWidget { if (!showBlank && enabledLabel == null) { return Padding( - padding: const EdgeInsets.only(top: 10), + padding: const EdgeInsets.only(top: 12), child: SwitchListTile( title: Text(label), value: value, secondary: iconData != null ? Icon(iconData) : null, onChanged: (value) => onChanged(value), activeColor: Theme.of(context).accentColor, + subtitle: helpLabel != null ? Text(helpLabel) : null, ), ); } diff --git a/lib/ui/settings/email_settings.dart b/lib/ui/settings/email_settings.dart index 864f27792..699fa0d56 100644 --- a/lib/ui/settings/email_settings.dart +++ b/lib/ui/settings/email_settings.dart @@ -1,6 +1,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:invoiceninja_flutter/constants.dart'; import 'package:invoiceninja_flutter/data/models/entities.dart'; import 'package:invoiceninja_flutter/ui/app/form_card.dart'; import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart'; @@ -96,7 +97,7 @@ class _EmailSettingsState extends State { controller: _bccEmailController, keyboardType: TextInputType.emailAddress, ), - SizedBox(height: 20), + SizedBox(height: 10), BoolDropdownButton( label: localization.attachPdf, value: false, @@ -119,8 +120,48 @@ class _EmailSettingsState extends State { ), FormCard( children: [ - + InputDecorator( + decoration: InputDecoration( + labelText: localization.emailDesign, + ), + isEmpty: false, + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: kEmailDesignPlain, + onChanged: (value) => null, + isExpanded: true, + isDense: true, + items: [ + DropdownMenuItem( + child: Text(localization.plain), + value: kEmailDesignPlain, + ), + DropdownMenuItem( + child: Text(localization.light), + value: kEmailDesignLight, + ), + DropdownMenuItem( + child: Text(localization.dark), + value: kEmailDesignDark, + ), + DropdownMenuItem( + child: Text(localization.custom), + value: kEmailDesignCustom, + ), + ], + ), + ), + ), + SizedBox(height: 10), + BoolDropdownButton( + label: localization.enableMarkup, + helpLabel: localization.enableMarkupHelp, + value: false, + iconData: FontAwesomeIcons.link, + showBlank: state.settingsUIState.isFiltered, + ), ], + ), ], ), diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 6bd2e4cc3..0d502a76a 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -14,11 +14,17 @@ abstract class LocaleCodeAware { mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { + 'enable_email_markup_help': + 'Make it easier for your clients to pay you by adding schema.org markup to your emails.', + 'plain': 'Plain', + 'light': 'Light', + 'dark': 'Dark', + 'email_design': 'Email Design', 'attach_pdf': 'Attach PDF', 'attach_documents': 'Attach Documents', 'attach_ubl': 'Attach UBL', 'email_style': 'Email Style', - 'enable_markup': 'Enable Markup', + 'enable_email_markup': 'Enable Markup', 'reply_to_email': 'Reply-To Email', 'bcc_email': 'BCC Email', 'processed': 'Processed', @@ -15028,7 +15034,19 @@ mixin LocalizationsProvider on LocaleCodeAware { String get emailStyle => _localizedValues[localeCode]['email_style']; - String get enableMarkup => _localizedValues[localeCode]['enable_markup']; + String get enableMarkup => + _localizedValues[localeCode]['enable_email_markup']; + + String get enableMarkupHelp => + _localizedValues[localeCode]['enable_email_markup_help']; + + String get emailDesign => _localizedValues[localeCode]['email_design']; + + String get plain => _localizedValues[localeCode]['plain']; + + String get light => _localizedValues[localeCode]['light']; + + String get dark => _localizedValues[localeCode]['dark']; String lookup(String key) { final lookupKey = toSnakeCase(key);