Флаттер Stepper в ListView - PullRequest
       12

Флаттер Stepper в ListView

0 голосов
/ 22 марта 2019

У меня есть вопрос, У меня есть степпер в listView, но его даже нельзя отругать, я пробовал три дня, но результата не было, почему это произошло и как его решить?

Может кто-нибудь помочь мне решить эту проблему?

это мой код,

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
          )
        ],
      ),
    ),   ], ),

спасибо за все ответы, С наилучшими пожеланиями.

1 Ответ

1 голос
/ 22 марта 2019

Stepper сам по себе уже является прокручиваемым виджетом.

Если вы хотите поместить его в ListView , вы можете просто установить physics: ClampingScrollPhysics() внутри Stepper.

...