rectFromGrid method

Rect? rectFromGrid({
  1. int? column,
  2. int row = 1,
  3. String? singlePT,
  4. required List<NamedLine> verticals,
  5. required List<NamedLine> horizontals,
  6. bool isGlobal = true,
})

Implementation

Rect? rectFromGrid({int? column, int row = 1, String? singlePT, required List<NamedLine> verticals, required List<NamedLine> horizontals, bool isGlobal = true}){
  assert(verticals.length > 1 && horizontals.length > 1);
  assert(column != null || singlePT != null);
  Rect? measured;
  if(singlePT != null){
    measured = measuredPT(singlePT);
  }else{
    measured = measuredCell(column!, row);
  }
  if(measured != null){
    return Rect.fromLTRB(verticals.first.computeWidth(measured.size), horizontals.first.computeHeight(measured.size),
                        verticals.last.computeWidth(measured.size), horizontals.last.computeHeight(measured.size)).shift( isGlobal ? measured.topLeft : Offset.zero );
  }
  return null;
}