My vertical Stepper view goes out of the view after few pressing continue buttons

Viewed 35

My Stepper view goes out of the view after few pressing continue buttons and then i have to scroll down every time.

how can i remain my stepper view in front always.

below is the code for my stepper view

step: _stepList is a list for the steppers

should i give height to container or not

  return Container(
    height: MediaQuery.of(context).size.height * 0.75,
    child: new Form(
      key: _formKey,
      child: new ListView(children: <Widget>[
        new Stepper(
            physics: ClampingScrollPhysics(),
            steps: _stepList,
            type: StepperType.vertical,
            currentStep: currStep,
            controlsBuilder: (BuildContext context,
                {VoidCallback onStepContinue, VoidCallback 
                  onStepCancel}) {
              return Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  if (currStep == 1)
                    Container(
                      margin: EdgeInsets.only(top: 10),
                      height: 40,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(16),
                        color: Color.fromRGBO(92, 93, 238, 1),
                      ),
                      child: FlatButton(
                          onPressed: () => {
                            onStepContinue(),
                            setState(() {
                              _current = _current + 1;
                            })
                          },
                          child: Text(
                            "Male",
                            style: GoogleFonts.ubuntu(
                                textStyle: TextStyle(
                                      fontSize: 20, color: 
                    Colors.white)),
                          )),
                    ),
                  if (currStep == 1)
                    Container(
                      margin: EdgeInsets.only(top: 10, left: 10),
                      height: 40,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(16),
                        color: Color.fromRGBO(92, 93, 238, 1),
                      ),
                      child: FlatButton(
                          onPressed: () => {},
                          child: Text("Female",
                              style: GoogleFonts.ubuntu(
                                  textStyle: TextStyle(
                                      fontSize: 20, color: 
                  Colors.white)))),
                    ),
                  if (currStep == 0)
                    Container(
                      margin: EdgeInsets.only(top: 10, right: 16),
                      height: 40,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(16),
                        color: Color.fromRGBO(92, 93, 238, 1),
                      ),
                      child: FlatButton(
                          onPressed: () => {
                            onStepContinue(),
                            setState(() {
                              _current = _current + 1;
                            }),
                          },
                          child: Text(
                            "Next",
                            style: GoogleFonts.ubuntu(
                                textStyle: TextStyle(
                                    fontSize: 20, color: 
                          Colors.white)),
                          )),
                    ),
                  if ((currStep != 1) && (currStep != 0))
                    Container(
                      margin: EdgeInsets.only(top: 10, left: 0),
                      height: 40,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(16),
                        color: Color.fromRGBO(92, 93, 238, 1),
                      ),
                      child: FlatButton(
                          onPressed: () => {
                            onStepContinue(),
                            setState(() {
                              _current = _current + 1;
                            }),
                          },
                          child: Text("No",
                              style: GoogleFonts.ubuntu(
                                  textStyle: TextStyle(
                                      fontSize: 20, color: 
                    Colors.white)))),
                    ),
                  if ((currStep != 1) && (currStep != 0))
                    Container(
                      margin: EdgeInsets.only(top: 10, left: 10),
                      height: 40,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(16),
                        color: Color.fromRGBO(92, 93, 238, 1),
                      ),
                      child: FlatButton(
                          onPressed: () => {
                            onStepContinue(),
                            setState(() {
                              _current = _current + 1;
                            }),
                          },
                          child: Text("Yes",
                              style: GoogleFonts.ubuntu(
                                  textStyle: TextStyle(
                                      fontSize: 20, color: 
                      Colors.white)))),
                    ),
                ],
              );
             },
             onStepContinue: () {
              setState(() {
                if (currStep < _stepList.length - 1) {
                  currStep = currStep + 1;
                } else {
                  currStep = 0;
                }
               
              });
            }),
      ]),
    ));

}

see the picture. enter image description here

thanks

0 Answers
Related