Denis Ramdan
Denis Ramdan

Reputation: 1954

Flutter Stepper on ListView

I have question, I have a Stepper in the listView but it can't even be scolled, I tried it for three days, but there was no result, why did this happen and how to solve it?

can someone help me solve this problem?

this my code,

new ListView(   padding: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 3.0),   children: <Widget>[
    new ListTile(
      title: new Text(
        "Day 1",
        style: new TextStyle(fontSize: 20.0, color: Colors.lightGreen, fontWeight: FontWeight.bold,fontFamily: 'GoogleSans'),
      ),
      subtitle: new Stepper(
        currentStep: this._currentStep1,
        onStepTapped: (step){
          setState(() {
            this._currentStep1 = step;
          });
        },
        onStepContinue: (){
          setState(() {
            if(this._currentStep1 < 4){
              this._currentStep1 += 1;
            } else {
              //logika jika komplit
            }
          });
        },
        onStepCancel: (){
          setState(() {
            if(this._currentStep1 > 0){
              this._currentStep1 -= 1;
            } else {
              this._currentStep1 = 0;
            }
          });
        },
        steps: [
          Step(
              title: new Text("arrived in bali.",style: new TextStyle(fontSize: 16.0, color: Colors.black87, fontWeight: FontWeight.bold,fontFamily: 'GoogleSans')),
              content: new Text("to register please show your QR code on the attendance menu. when it arrived at the venue to the admin.",style: new TextStyle(fontSize: 14.0, color: Colors.grey,fontFamily: 'GoogleSans')),
              isActive: _currentStep1 >= 0
          ),
          Step(
              title: new Text("arrived in hotel bali.",style: new TextStyle(fontSize: 16.0, color: Colors.black87, fontWeight: FontWeight.bold,fontFamily: 'GoogleSans')),
              content:  new Text("to book a room when it arrives at the hotel, show your QR code to the hotel admin to scan it.",style: new TextStyle(fontSize: 14.0, color: Colors.grey,fontFamily: 'GoogleSans')),
              isActive: _currentStep1 >= 2
          ),
          Step(
              title: new Text("Step 3"),
              content: new TextField(),
              isActive: _currentStep1 >= 3
          ),
          Step(
              title: new Text("Step 4"),
              content: new TextField(),
              isActive: _currentStep1 >= 4
          ),
          Step(
              title: new Text("Step 5 "),
              content: new TextField(),
              isActive: _currentStep1 >= 5
          )
        ],
      ),
    ),   ], ),

thank you for all the answers, best regard.

Upvotes: 0

Views: 2925

Answers (1)

NiklasPor
NiklasPor

Reputation: 9785

The Stepper itself is already a scrollable widget.

If you want to place it in a ListView, you can simply set physics: ClampingScrollPhysics() inside the Stepper.

Upvotes: 6

Related Questions