firstWidget method

dynamic firstWidget(
  1. dynamic context,
  2. dynamic data
)

Implementation

firstWidget(context, data) {
  int stackLength = _stackList.length;
  if (stackLength > 1) {
    return _firstPage;
  }
  if (isNull(data)) {
    return;
  }
  _context = context;
  sendRequestList(context);
  Map mapTable = data[0];
  if (mapTable[gType] == gTable) {
    dynamic title = mapTable[gTitle] ?? '';
    dynamic where = mapTable[gWhere] ?? '';
    List columns = mapTable[gColumns] ?? [];
    List data = mapTable[gData] ?? [];
    //show table
    //save to table Zzyreport
    bool haveID = false;
    for (int i = 0; i < columns.length; i++) {
      dynamic ci = columns[i];
      if (ci[gId] == gId) {
        haveID = true;
        break;
      }
    }
    if (!haveID) {
      columns.insert(
        0,
        {
          "id": "id",
          "dbid": "id",
          "type": "hidden",
          "label": "id",
          "defaultValue": "",
          "required": false,
          "minLength": 0,
          "length": 255,
          "hash": false,
          "unit": "character",
          "prefixIcon": null,
          "inputType": "hidden",
          "fontSize": null,
          "letterSpacing": 0.0,
          "isPrimary": false,
          "isKeyword": false,
          "droplist": "",
          "uniqueKey": "",
          "isUnique": false,
          "colType": "java.lang.String",
          "isFile": false,
          "seq": 2,
          "canshow": true,
          "fromsource": "",
          "isFrozen": false,
          "addNewCheck": false,
          "isWholePage": false,
          "after": "",
          "showrange": ""
        },
      );
      for (int i = 0; i < data.length; i++) {
        data[i][gId] = '$i';
      }
    }
    getDeviceId();
    dynamic result = setRpt(title, where, columns, data, context);
    if (isNull(result)) {
      return;
    }
    _firstPage = result;

    _methodChannel = mapTable[gMsgChannel];
    /*BuildContext contextTable = mapTable[gContext];
    Route lastRoute = MaterialPageRoute(builder: (context) => _firstPage);

    Navigator.push(contextTable, lastRoute);*/
    //return result;
  }
  myLogAll('firstWidget');
  //_instanceMirror = instanceMirror;
  if (_sessionkey == '') {
    _requestCnt = 0;
    resetSessionKey(context);
    //} else {
  }
  init();
  /*if (isSS() && !Platform.isWindows && !Platform.isLinux) {
    setFcmToken();
  }*/

  return _firstPage;
}