createCustomSeperateSpaces static method

List<NamedLine> createCustomSeperateSpaces(
  1. List<int> weights, {
  2. NamedLine? fromStartLine,
  3. NamedLine? toEndLine,
  4. bool includeStartEnd = false,
})

创建自定义线(分段占比重权值,加和占首尾线区间=1)

Implementation

static List<NamedLine> createCustomSeperateSpaces(List<int> weights, {
  NamedLine? fromStartLine,
  NamedLine? toEndLine,
  bool includeStartEnd = false}){
  assert(weights.length >= 2);
  var addups = weights.fold<List<int>>([], (addup, weight)=>addup..add(addup.isEmpty ? weight : addup.last + weight));
  return createCustomDivides(addups.map<double>((addup)=>addup/addups.last).toList()..removeLast(), fromStartLine: fromStartLine, toEndLine: toEndLine, includeStartEnd: includeStartEnd);
}