createTableContent function
List
createTableContent(
- dynamic content,
- dynamic head,
- dynamic body,
- dynamic foot, {
- bool? header,
Implementation
List createTableContent(content, caption, head, body, foot,
{bool? header, bool? footer}) {
if (content == null) {
return [
createTableCaption(caption),
createTableEntry(head, header: true),
createTableEntry(body),
createTableEntry(foot, footer: true)
];
}
if (content is Iterable) {
content = content.asList;
}
if (content is List) {
if (listMatchesAll(content, (dynamic e) => _domHTML.isHtmlNode(e))) {
var caption = content.firstWhere(
(e) => _domHTML.getNodeTag(e) == 'caption',
orElse: () => null);
var thread = content.firstWhere((e) => _domHTML.getNodeTag(e) == 'thead',
orElse: () => null);
var tfoot = content.firstWhere((e) => _domHTML.getNodeTag(e) == 'tfoot',
orElse: () => null);
var tbody = content.firstWhere((e) => _domHTML.getNodeTag(e) == 'tbody',
orElse: () => null);
var list = <DOMNode?>[
DOMNode.from(caption),
DOMNode.from(thread),
DOMNode.from(tbody),
DOMNode.from(tfoot)
].nonNulls.toList();
return list;
} else {
return content.map((e) => createTableEntry(e)).toList();
}
} else {
return [createTableEntry(body)];
}
}