createLiteralInnerMarginDivides static method

List<NamedLine> createLiteralInnerMarginDivides(
  1. (double, PxUnit) literal, {
  2. NamedLine? fromStartLine,
  3. NamedLine? toEndLine,
  4. END_POINT endPoint = END_POINT.exclude_start_end,
})

Implementation

static List<NamedLine> createLiteralInnerMarginDivides((double, PxUnit) literal, {
  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 + literal,
        name: '$NAME_MARGIN-$NAME_START:$literal',
      ),
      NamedLine.expression(toEnd - literal,
        name: '$NAME_MARGIN-$NAME_END:$literal',
      ),
    ];
  return [
    if(endPoint == END_POINT.include_start_only || endPoint == END_POINT.include_start_end)
    NamedLine.rename(rename: '$NAME_MARGIN-$NAME_START-$NAME_RENAME-${fromStart.name}', copy: fromStart),
    ...excludeStartEnd,
    if(endPoint == END_POINT.include_end_only || endPoint == END_POINT.include_start_end)
    NamedLine.rename(rename: '$NAME_MARGIN-$NAME_END-$NAME_RENAME-${toEnd.name}', copy: toEnd)
  ];
}