Code style, updated code for better icon handling

This commit is contained in:
Lucien Cartier-Tilet 2020-05-26 00:35:34 +02:00
parent 99c2127cc8
commit 06994305ac
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 9 additions and 10 deletions

View File

@ -32,8 +32,8 @@ final icons = {
String getPageTitle() => querySelector('title').text;
Element makeIcon(SvgElement elem) {
final icon = elem
Element makeIcon(SvgElement t_elem) {
final icon = t_elem
..classes.add('nav-icon');
return icon;
}
@ -59,14 +59,14 @@ Future<Element> makePages() async {
..append(pages);
}
Element makeShareLink(Element icon, String url) {
Element makeShareLink(Element t_icon, String t_url) {
return Element.li()
..classes.add('dropdown-item')
..append(Element.a()
..attributes['href'] = url
..attributes['href'] = t_url
..attributes['target'] = '_blank'
..attributes['rel'] = 'noreferrer'
..append(icon));
..append(t_icon));
}
Future<Element> makeShare() async {
@ -95,12 +95,11 @@ Future<Element> makeShare() async {
}
Future<Element> makeThemeChanger() async {
Element makeThemeItem(String t_btnId, Element t_icon, String t_text) {
Element makeThemeItem(String t_btnId, String t_text, [Element t_icon]) {
return Element.li()
..classes.add('dropdown-item')
..append(Element.span()
..attributes['id'] = t_btnId
..append(t_icon)
..appendText(' $t_text'));
}
@ -115,9 +114,9 @@ Future<Element> makeThemeChanger() async {
..append(Element.ul()
..classes.add('dropdown')
..attributes['id'] = 'theme-dropdown'
..append(makeThemeItem('lightBtn', makeIcon(icons['sun']), 'Clair'))
..append(makeThemeItem('darkBtn', makeIcon(icons['lightbulb']), 'Sombre'))
..append(makeThemeItem('blackBtn', makeIcon(icons['moon']), 'Noir')));
..append(makeThemeItem('lightBtn', 'Clair', makeIcon(icons['sun'])))
..append(makeThemeItem('darkBtn', 'Sombre', makeIcon(icons['lightbulb'])))
..append(makeThemeItem('blackBtn', 'Noir', makeIcon(icons['moon']))));
}
Future<Element> makeHome() async {