aBox method

void aBox(
  1. int _r,
  2. int _c,
  3. int _items,
  4. int _w,
  5. List<String> _l,
)

Fill list-data in matrix in r, _c coordinates. parameters now:: int _r, int _c, List

Implementation

//

//  :bug:  dart doc    warning: 7x     unresolved doc reference [int _r = 0]
void aBox(int _r, int _c, int _items, int _w, List<String> _l) {
  //  If not know list length / wanted items and width, try 100. lol
  //  TODO box   Truncate items and length, if List outOfMatrix borders
  int _overWidth = 0;
  int _overLength = 0;
  bool error = false;
  String _overWidthS = '';
  String _overLengthS = '';
  if ((_c + _w > sw) || (_r + _items > rc)) {
    error = true;
    _overWidth = (_c + _w) - sw;
    print(_overWidth);
    //  howTo NULL  cast num toInt
    //  noComprendo    _overLength = (_r + _items) - rc;
    //  _overLength = (_r + _items) - rc;
    //  NO  _overLength = (((_r + _items).toInt) (- rc).toInt;
    //  maybe caller:   int _r, int _c, int _items, int _w,
    _overLength = (_r + _items) - rc;

    print(_overLength);
    print('W: $_w  Items:  $_items  ');

    if (_overWidth > 0) _w = (_w - _overWidth);
    if (_overLength > 0) _items = (_items - _overLength);
    print('W: $_w  Items:  $_items  ');
    print('sw: $sw   ');
    print('Overlength::  $_overLength     OwerWidth::  $_overWidth');
    _overWidthS = _overWidth.toString(); //assume like: '7'
    _overLengthS = _overLength.toString(); //  like: '3'
  }
  ;

  //  ??  If error-position, parameters should now have changed ??
  tl.boxInList(_r, _c, _items, _w, _l, _matrix);
  if (error) {
    //  lay vertical #VARNING line !!!
    //  howTo NULL  List:  use List.generate  or  .filled
    //  howTo List.generate  external factory List.generate(int length, E generator(int index)
    //  /// .generate   Creates an unmodifiable list containing all [elements].
    //  NO  List<String> verticalWarningL = new List.generate(_items, 0);
    //  ..
    //  external factory List.filled(int length, E fill, {bool growable = false});
    List<String> verticalWarningL = List.filled(_items, '');

    verticalWarningL.fillRange(0, _items, _overWidthS);
    //  call: void vertWarning(int _x, _y, count, String _s)
    print('vert warning::  ');
    vertWarning(_r, _c + _w + 2, _items, _overWidthS); //  try +1 .. 2
    print('_overLengthS::  $_overLengthS ');
    print('horizWarnig::  ');

    horizWarning((_r + _items - 1).toInt(), _c, _w, _overLengthS);
    print('error done::');
    //  lay horizontal #VARNING line
  } //  -----  error
}