showMsg method

dynamic showMsg(
  1. dynamic context,
  2. dynamic result,
  3. dynamic backcolor
)

Implementation

showMsg(context, dynamic result, backcolor) {
  myLogAll('showMsg');
  //print('showMsg: $result');
  backcolor ??= _defaultBackGroundColor;
  if (result.toString().indexOf(gAction) == 0) {
    List msgA = result.toString().split(",");
    var action = '';
    var name = '';
    var sData = '';
    for (String i in msgA) {
      List msgiA = i.split(":");
      if (msgiA[0] == gAction) {
        action = msgiA[1];
      } else if (msgiA[0] == gName) {
        name = msgiA[1];
      } else if (msgiA[0] == gData) {
        sData = msgiA[1];
      }
    }
    if (action == 'showDroplist') {
      //formChanged(context, gLogin);
      List<Widget> lCompanies = [];
      List sDataA = sData.split("]");
      for (String s in sDataA) {
        List sA = s.split('[');
        _i10nMap[sA[0]] = {};

        _i10nMap[sA[0]][gEn] = sA[1];

        lCompanies.add(InkWell(
          onTap: () {
            if (name == 'multicompany') {
              setGlobalParam(
                  [gGlobalCompanyid], [sA[0].toString().substring(7)]);
              //_globalParam[gGlobalCompanyid] = sA[0].toString().substring(7);
            } else if (name == 'multiemail') {
              setValue(
                  gLogin, gEmail, '', sA[0].toString().substring(5), context);
            }
            formSubmit(context, gLogin);
          },
          child: Center(
            child: MyLabel({gLabel: sA[0]}, _colorList[0].value),
          ),
        ));
        lCompanies.add(const Divider());
      }

      showDialogByList(context, lCompanies);

      return;
    }

    return;
  }

  Widget w = MyLabel({
    gLabel: result,
  }, backcolor);
  if (isSS()) {
    showPopup(context, w, null, null, false);
    return;
  }

  Map paramSubmit = {
    gWidth: MediaQuery.of(context).size.width, //200.0,
    gHeight: 55.0,
    gBorderRadius: gValueRadius,
    gMargin: const EdgeInsets.all(gValueMargin),
    gPadding: const EdgeInsets.all(gValuePadding),
    gBlur: 10.0,
    gAlignment: Alignment.topLeft,
    gBorder: 2.0,
    gColor: Colors.grey.shade900,
    gBackgroundColor: Colors.white, //Color.fromARGB(255, 218, 165, 32),
    gChild: MyLabel(const {gLabel: 'OK'}, Colors.white.value)
  };
  //if (datamodel.formLists[_formName][gStatus] ?? false) {
  Widget continueButton = InkWell(
    child: MyGlass(paramSubmit),
    onTap: () {
      Navigator.of(context).pop();

      myNotifyListeners();
    },
  );

  AlertDialog alert = AlertDialog(
    title: const MyIcon({gValue: 0xf30d}),
    content: w,
    actions: [
      continueButton,
    ],
  );
  // show the dialog
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return alert;
    },
  );
}