Flutter How to Scaffold layout size ( error)

274 Views Asked by At

I'm still working on learn Flutter.

I have a button in my home page and it navigate to my CustomWidget. (It is StepperWidget btw)

Whenever I tried to add Scaffold in my widget it's break.enter image description here

and giving this error message. Here is my widget tree Scaffold --> Container (height and widht) --> SingleChildScrollView ---> Stepper with steps.

I tried to remove scaffold. But this time, whenever i clicked textformfield, bottom overflowed error shows up. Thanks in advance.. //

Here is my codes;

 return Scaffold(
      body: Container(
        height: 400,
        width: 400,
        color: Colors.red,
        child: SingleChildScrollView(
          child: Stepper(
            currentStep: currentStep,
            onStepTapped: (step) {
              if (step > currentStep) {
                setState(() {
                  currentStep = step;
                });
              }
            },
            onStepContinue: () {
              if (currentStep != 2) {
                setState(() {
                  currentStep += 1;
                });
              }
            },
            onStepCancel: () {
              if (currentStep != 0) {
                setState(() {
                  currentStep -= 1;
                });
              }
            },
            controlsBuilder: (BuildContext context,
                {VoidCallback? onStepContinue,
                VoidCallback? onStepCancel,
                VoidCallback? onStepTapped}) {
              return Row(
                children: <Widget>[
                  ElevatedButton(
                    onPressed: onStepContinue,
                    child: const Text('ONAYLA'),
                    style: ButtonStyle(
                      backgroundColor:
                          MaterialStateProperty.all(Colors.green[400]),
                    ),
                  ),
                  TextButton(
                    onPressed: onStepCancel,
                    child: const Text('GERİ'),
                  ),
                ],
              );
            },
            steps: [
              Step(
                title: const Text('baslık'),
                content: TextFormField(
                  controller: _yukBaslikController,
                  cursorColor: ColorConstants.dordunculRenk,
                  decoration: const InputDecoration(
                    enabledBorder: UnderlineInputBorder(
                      borderSide:
                          BorderSide(color: ColorConstants.dordunculRenk),
                    ),
                    focusedBorder: UnderlineInputBorder(
                      borderSide:
                          BorderSide(color: ColorConstants.dordunculRenk),
                    ),
                    /* suffixIcon: Icon(
                                      Icons.insert_drive_file_outlined,
                                      color: ColorConstants.dordunculRenk,
                                    ), */
                    helperText: "orn",
                    helperStyle: TextStyle(
                        fontStyle: FontStyle.italic, color: Colors.black),
                    hintText: "Başlık giriniz",
                    //label: Text("Yükünüz hakkında bilgi giriniz"),
                    //labelStyle: TextStyle(color: ColorConstants.dordunculRenk),
                  ),
                  //controller: _yukTextController,
                ),
              ),
              Step(
                title: const Text('ICERIK'),
                content: TextFormField(
                  controller: _yukIcerikController,
                  cursorColor: ColorConstants.dordunculRenk,
                  decoration: const InputDecoration(
                    enabledBorder: UnderlineInputBorder(
                      borderSide:
                          BorderSide(color: ColorConstants.dordunculRenk),
                    ),
                    focusedBorder: UnderlineInputBorder(
                      borderSide:
                          BorderSide(color: ColorConstants.dordunculRenk),
                    ),
                    /* suffixIcon: Icon(
                                      Icons.insert_drive_file_outlined,
                                      color: ColorConstants.dordunculRenk,
                                    ), */
                    helperText: "orn",
                    helperStyle: TextStyle(
                        fontStyle: FontStyle.italic, color: Colors.black),
                    hintText: "Başlık giriniz",
                
                  ),
                  //controller: _yukTextController,
                ),
              ),
              Step(
                title: Text('bilgi'),
                content: Container(),
              ),
            ],
          ),
        ),
      ),
    );
1

There are 1 best solutions below

1
On

Put a fragment of the code to be able to visualize better, the problem is a component that cannot be the parent of the other