generate method
Implementation
@override
Widget generate(Context context) {
var prefixes = Condition.getPrefixes(conds, invert);
var children = <Widget>[];
// group into seperate file(and get if id)
if (orElse != null || prefixes.length >= 2 || assignTag != null) {
assignTag ??= Entity.Self();
if (then.length > 2 && context.file.isNotEmpty) {
then.insert(0, Comment('If statement from file: ${context.file}'));
}
if (orElse != null && orElse!.length > 2 && context.file.isNotEmpty) {
orElse!.insert(0, Comment('Else statement from file: ${context.file}'));
}
children = _getTagVersion(prefixes);
} else {
// insert Then inline
for (var prefix in prefixes) {
children.add(Group(
prefix: 'execute $prefix run',
path: targetFilePath,
generateIDs: targetFileName == null,
filename: targetFileName ?? 'if',
groupMin: encapsulate ? 3 : -1,
children: then,
));
}
}
if (elseWidget != null) children.add(elseWidget!);
if (predicate != null) children.add(predicate!);
return For.of(children);
}