createSingleLineMargin static method
List<NamedLine>
createSingleLineMargin(
- List<
NamedLine> singleLines, { - Expression? plus,
- Expression? minus,
- END_POINT endPoint = END_POINT.exclude_start_end,
创建单条线两侧边距 支持多条辅助线一同创建
Implementation
static List<NamedLine> createSingleLineMargin(List<NamedLine> singleLines, { Expression? plus, Expression? minus, END_POINT endPoint = END_POINT.exclude_start_end}){
assert(plus != null || minus != null);
return singleLines.expandIndexed<NamedLine>((index, line){
if(index == 0 && endPoint == END_POINT.include_end_only || endPoint == END_POINT.exclude_start_end) return [];
if(index == singleLines.length - 1 && endPoint == END_POINT.include_start_only || endPoint == END_POINT.exclude_start_end) return [];
return [
if(minus != null)
NamedLine.expression(line - minus, name: '(${line.name})-$NAME_MARGIN:$minus'),
if(plus != null)
NamedLine.expression(line + plus, name: '(${line.name})+$NAME_MARGIN:$plus')
];
}).toList();
}