Settings
This commit is contained in:
parent
dcc54782e8
commit
b83eced96e
|
|
@ -88,6 +88,7 @@ class _InvoiceDesignState extends State<InvoiceDesign>
|
||||||
final settings = viewModel.settings;
|
final settings = viewModel.settings;
|
||||||
final company = viewModel.company;
|
final company = viewModel.company;
|
||||||
final designs = company.getInvoiceDesigns();
|
final designs = company.getInvoiceDesigns();
|
||||||
|
final fontMap = memoizedFontMap(kGoogleFonts);
|
||||||
|
|
||||||
return SettingsScaffold(
|
return SettingsScaffold(
|
||||||
title: localization.invoiceDesign,
|
title: localization.invoiceDesign,
|
||||||
|
|
@ -141,14 +142,32 @@ class _InvoiceDesignState extends State<InvoiceDesign>
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
FormCard(
|
||||||
|
children: <Widget>[
|
||||||
EntityDropdown(
|
EntityDropdown(
|
||||||
entityType: EntityType.font,
|
entityType: EntityType.font,
|
||||||
labelText: localization.primaryFont,
|
labelText: localization.primaryFont,
|
||||||
initialValue: settings.primaryFont,
|
initialValue: settings.primaryFont,
|
||||||
entityMap: memoizedFontMap(kGoogleFonts),
|
entityMap: fontMap,
|
||||||
onSelected: (font) => viewModel.onSettingsChanged(
|
onSelected: (font) => viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..primaryFont = font.id)),
|
settings.rebuild((b) => b..primaryFont = font.id)),
|
||||||
|
allowClearing: state.settingsUIState.isFiltered,
|
||||||
),
|
),
|
||||||
|
EntityDropdown(
|
||||||
|
entityType: EntityType.font,
|
||||||
|
labelText: localization.secondaryFont,
|
||||||
|
initialValue: settings.secondaryFont,
|
||||||
|
entityMap: memoizedFontMap(kGoogleFonts),
|
||||||
|
onSelected: (font) => viewModel.onSettingsChanged(
|
||||||
|
settings.rebuild((b) => b..secondaryFont = font.id)),
|
||||||
|
allowClearing: state.settingsUIState.isFiltered,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
FormCard(
|
||||||
|
children: <Widget>[
|
||||||
AppDropdownButton(
|
AppDropdownButton(
|
||||||
labelText: localization.pageSize,
|
labelText: localization.pageSize,
|
||||||
value: settings.pageSize,
|
value: settings.pageSize,
|
||||||
|
|
@ -157,42 +176,46 @@ class _InvoiceDesignState extends State<InvoiceDesign>
|
||||||
settings.rebuild((b) => b..pageSize = value)),
|
settings.rebuild((b) => b..pageSize = value)),
|
||||||
items: kPageSizes
|
items: kPageSizes
|
||||||
.map((pageSize) => DropdownMenuItem<String>(
|
.map((pageSize) => DropdownMenuItem<String>(
|
||||||
value: pageSize,
|
value: pageSize,
|
||||||
child: Text(pageSize),
|
child: Text(pageSize),
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
AppDropdownButton(
|
AppDropdownButton(
|
||||||
labelText: localization.fontSize,
|
labelText: localization.fontSize,
|
||||||
value:
|
value: settings.fontSize == null
|
||||||
settings.fontSize == null ? '' : '${settings.fontSize}',
|
? ''
|
||||||
|
: '${settings.fontSize}',
|
||||||
//showBlank: state.settingsUIState.isFiltered,
|
//showBlank: state.settingsUIState.isFiltered,
|
||||||
// TODO remove this and 0 from options
|
// TODO remove this and 0 from options
|
||||||
showBlank: true,
|
showBlank: true,
|
||||||
onChanged: (value) => viewModel.onSettingsChanged(
|
onChanged: (value) => viewModel.onSettingsChanged(settings
|
||||||
settings.rebuild((b) => b..fontSize = int.parse(value))),
|
.rebuild((b) => b..fontSize = int.parse(value))),
|
||||||
items: [0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
items: [0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||||
.map((fontSize) => DropdownMenuItem<String>(
|
.map((fontSize) => DropdownMenuItem<String>(
|
||||||
value: '$fontSize',
|
value: '$fontSize',
|
||||||
child:
|
child: fontSize == 0
|
||||||
fontSize == 0 ? SizedBox() : Text('$fontSize'),
|
? SizedBox()
|
||||||
))
|
: Text('$fontSize'),
|
||||||
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
FormColorPicker(
|
|
||||||
labelText: localization.primaryColor,
|
|
||||||
onSelected: (value) => viewModel.onSettingsChanged(
|
|
||||||
settings.rebuild((b) => b..primaryColor = value)),
|
|
||||||
initialValue: settings.primaryColor,
|
|
||||||
),
|
|
||||||
FormColorPicker(
|
|
||||||
labelText: localization.secondaryColor,
|
|
||||||
onSelected: (value) => viewModel.onSettingsChanged(
|
|
||||||
settings.rebuild((b) => b..secondaryColor = value)),
|
|
||||||
initialValue: settings.secondaryColor,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
FormCard(children: <Widget>[
|
||||||
|
FormColorPicker(
|
||||||
|
labelText: localization.primaryColor,
|
||||||
|
onSelected: (value) => viewModel.onSettingsChanged(
|
||||||
|
settings.rebuild((b) => b..primaryColor = value)),
|
||||||
|
initialValue: settings.primaryColor,
|
||||||
|
),
|
||||||
|
FormColorPicker(
|
||||||
|
labelText: localization.secondaryColor,
|
||||||
|
onSelected: (value) => viewModel.onSettingsChanged(
|
||||||
|
settings.rebuild((b) => b..secondaryColor = value)),
|
||||||
|
initialValue: settings.secondaryColor,
|
||||||
|
),
|
||||||
|
]),
|
||||||
]),
|
]),
|
||||||
ListView(),
|
ListView(),
|
||||||
ListView(),
|
ListView(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue