generateForm method

Widget generateForm()

It creates a list of widgets, each of which is a column containing a text widget and an image widget

Returns: A list of widgets.

Implementation

Widget generateForm() {
  _controllerDate.text =
      "${_selectedDate.day}/${_selectedDate.month}/${_selectedDate.year}";

  return Form(
    child: CupertinoFormSection.insetGrouped(
      header: Text(
        "${CATLocalizations.of(context).session}: ${widget.sessionID}",
      ),
      children: <Widget>[
        CupertinoTextFormFieldRow(
          prefix: Text(
            "${CATLocalizations.of(context).gender}:",
            textAlign: TextAlign.right,
          ),
          placeholder: CATLocalizations.of(context).inputGender,
          readOnly: true,
          onTap: _showPicker,
          controller: _gender,
        ),
        CupertinoTextFormFieldRow(
          prefix: Text(
            "${CATLocalizations.of(context).birth}:",
            textAlign: TextAlign.right,
          ),
          readOnly: true,
          onTap: _dataPicker,
          controller: _controllerDate,
        ),
        CupertinoButton(
          onPressed: () {
            Connection()
                .addStudent(
              _selectedDate,
              _selectedGender,
              widget.sessionID,
            )
                .then(
              (int studentID) {
                CatLogger().resetLogs();

                Navigator.push(
                  context,
                  CupertinoPageRoute<Widget>(
                    builder: (BuildContext context) => ActivityHome(
                      sessionID: widget.sessionID,
                      studentID: studentID,
                    ),
                  ),
                );
              },
            );
          },
          child: Text(CATLocalizations.of(context).continueStudentID),
        ),
      ],
    ),
  );
}