This commit is contained in:
Hillel Coren 2019-10-22 18:15:09 +03:00
parent 7338e5abce
commit a45c28e203
4 changed files with 72 additions and 5 deletions

View File

@ -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';

View File

@ -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,
),
);
}

View File

@ -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<EmailSettings> {
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<EmailSettings> {
),
FormCard(
children: <Widget>[
InputDecorator(
decoration: InputDecoration(
labelText: localization.emailDesign,
),
isEmpty: false,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
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,
),
],
),
],
),

View File

@ -14,11 +14,17 @@ abstract class LocaleCodeAware {
mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _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);