ohneMaengelAction method

dynamic ohneMaengelAction(
  1. dynamic context
)

Implementation

ohneMaengelAction(context) async {
  if ((await all().last).isEmpty) {
    // final x = currentData;
    await API().setNew<CheckPointDefect>(
      CheckPointDefect(
        pjNr: currentData.pjNr,
        category_index: currentData.category_index,
        check_index: currentData.index,
        index: -1,
        ereArt: OufnessChooser.none,
        kurzText: "ohne Mangel",
        langText: currentData.title + " ohne Mangel",
      )
        ..parentId = currentData.pjNr.toString() +
            "-" +
            currentData.category_index.toString() +
            "-" +
            currentData.index.toString() +
            "-" +
            "0"
        ..id = LOCALLY_ADDED_PREFIX + UniqueKey().hashCode.toRadixString(36),

      // ..height = "----",
      caller: currentData,
    ); //TO-DO: does not work in online mode #387
    notifyListeners();
    return;
  } else {
    showDialog(
      barrierDismissible: true,
      barrierColor: Colors.black54,
      context: context,
      builder: (BuildContext context) {
        return MySimpleAlertBox(
          actions: <Widget>[
            Center(
              child: TextButton(
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                  child: Text(S.current!.cancel)),
            ),
          ],
          title: S.of(context).uhoh,
          bodyLines: [
            S.of(context).areYouSure,
          ],
        );
      },
    );
  }
}