createInnerMarginDivides static method

List<NamedLine> createInnerMarginDivides(
  1. Expression divide, {
  2. NamedLine? fromStartLine,
  3. NamedLine? toEndLine,
  4. END_POINT endPoint = END_POINT.exclude_start_end,
})

创建内双边距线

Implementation

static List<NamedLine> createInnerMarginDivides(Expression divide, {
  NamedLine? fromStartLine,
  NamedLine? toEndLine,
  END_POINT endPoint = END_POINT.exclude_start_end}){
  NamedLine fromStart = fromStartLine ?? NamedLine.percent(0.0, name: NAME_START);
  NamedLine toEnd = toEndLine ?? NamedLine.percent(1.0, name: NAME_END);
  List<NamedLine> excludeStartEnd = [
      NamedLine.expression(fromStart + divide,
        name: '$NAME_MARGIN-$NAME_START:$divide',
      ),
      NamedLine.expression(toEnd - divide,
        name: '$NAME_MARGIN-$NAME_END:$divide',
      ),
    ];
  return [
    if(endPoint == END_POINT.include_start_only || endPoint == END_POINT.include_start_end)
    NamedLine.rename(rename: '$NAME_MARGIN-$NAME_START', copy: fromStart),
    ...excludeStartEnd,
    if(endPoint == END_POINT.include_end_only || endPoint == END_POINT.include_start_end)
    NamedLine.rename(rename: '$NAME_MARGIN-$NAME_END', copy: toEnd)
  ];
}