iterableDiagonalM function

List<String> iterableDiagonalM(
  1. List<Map<String, String>> _ilM,
  2. int sw
)

List and Map versions of this method Version, that uses Map in incoming data. ******************** map *** Screen-sized matrix pierced with staggered list elements. #Users: Caller: effort getDiagonalList

Implementation

List<String> iterableDiagonalM(List<Map<String, String>> _ilM, int sw) {
  int _sw = sw; //  screen width.
  ///  Using different,  count Map method.
  int _ilMC = tl.countInnerMap(_ilM); //  serves also as row-count.
  int cStep = ((sw - 50) ~/ _ilMC); //  spread info to screen.
  //  TODO  More complicated than 1 by 1 system.
  int cInd = 0; //  colon index.
  //  int rInd = 0; //  row-index if needed.
  String _s = '';
  String infoS1 = ' it-diag-Map  INFO: V:= Value E: = Effort D: = Done :  ';
  String infoS2 = ' ** Diagonal list describing Chore-Effort user-data  **  ';
  String infoS3 =
      '  - Finally this data is best when get by server to client. -';
  List<String> _ol = [':sh-it-diagM-   First Item  $infoS1 $infoS2 $infoS3'];
  String topLine = tl.strMark('>', _sw);
  String emptyLine = tl.strMark('_', _sw);
  String botLine = tl.strMark('<', _sw);
  _ol.add(topLine);
  _ol.add(emptyLine);
  for (var x = 0; x < _ilM.length; x++) {
    ///  Loop to handle all map values
    for (var y in _ilM[x].keys) {
      _s = '';
      String ts = ''; //  temporary String for padding
      cInd = cInd + cStep;
      ts = _s.padLeft(cInd, '_');
      //  Must get key AND value to String : hklTry  glorious: y
      //  howTo NULL
      _s = (ts + y + ' ' + _ilM[x][y]!);
      //Not needed: current item length   int _wl = _ilM[x][y].length;
      ts = _s.padRight((_sw), '_'); //  to be visible: _
      _ol.add(ts);
      //  empty String
    } //  ---------------    Items in one list.
    cInd + 6; //  extra tick to get TAB in screen.
    //  pad String to _sw, screen width.
    String _nlS = '.'.padRight(sw - 2, ' ');
    String _nlS2 = _nlS + '.';
    //  TODO  Make something more visible and useful.
    _ol.add(_nlS2);
  } //  -----------------    All incoming lists.3
  _ol.add(emptyLine);
  _ol.add(botLine);
  return _ol; //  ---------- return type:   List<String>
}