buildEntry method
Implementation
String buildEntry(
String template, String id, String text, String name, ItemType type,
{required bool isRequired}) {
final String prefix;
switch (type) {
case ItemType.appStore:
prefix = '[App Store] ';
break;
case ItemType.googlePlay:
prefix = '[Google Play] ';
break;
case ItemType.byDefault:
// ignore: no_default_cases
default:
prefix = '';
break;
}
final display = type == ItemType.byDefault ? "block" : "none";
final itemNameSb = StringBuffer()
..write(prefix)
..write(name);
if (isRequired) itemNameSb.write('*');
return template
.replaceAll("%id%", id)
.replaceAll("%name%", itemNameSb.toString())
.replaceAll("%text%", text)
.replaceAll("%display%", display)
.replaceAll("%type%", type.id)
.replaceAll("%maxlength%", "${type.maxChars}")
.replaceAll("%required%", isRequired ? 'required' : '');
}