padListRL method

void padListRL(
  1. List<String> _l,
  2. int _w,
  3. String _leS,
  4. dynamic _raS,
)

Add padLeft & padRight Strings to make this more useful. Pad List right and left with: _leS, _raS and make all even length

Implementation

void padListRL(List<String> _l, int _w, String _leS, _raS) {
  //  Add new parameter, asked width: _w
  //  Using here new Tools, tl class.
  //  If asked shorter rows.
  int long = min(tl.longestItemInList(_l), _w);
  //  looks funny, surely we can make better :)
  for (var x = 0; x < _l.length; x++) {
    //  int itemLength = _l.length;  //  length NOW
    String _thisItem = _l[x];
    String _s = ('$_leS$_thisItem');
    String _ss = _s.padRight(long + 2, _raS);
    _l[x] = _ss;
    //  Pad every item right with _leS, _raS to length of the longest item.
  }
}