如何隐藏 Flutter Stepper 上的“继续”和“取消”按钮

Seg*_*ara 5 android flutter flutter-layout

我想隐藏步进器上的“继续”和“取消”按钮,并更改为“输入文本字段”以继续该步骤。是否可以?怎么做?

谢谢

小智 2

我已经使用此代码来隐藏“继续”和“取消”。

首先声明变量 hide 为 bool 并且值为 false

bool hide = false;
Run Code Online (Sandbox Code Playgroud)

然后在stapper中使用controlsBuilder。

对于颤振>2.6

controlsBuilder: (BuildContext ctx, ControlsDetails dtl){
           return Row(
            children: <Widget>[
              TextButton(
                onPressed: dtl.onStepContinue,
                child: Text(hide == true ? '' : 'NEXT'),
              ),
              TextButton(
                onPressed: dtl.onStepCancel,
                child: Text(hide == true ? '' :'CANCEL'),
              ),
            ],
          ); 
        },
Run Code Online (Sandbox Code Playgroud)

对于颤振 <= 2.5

controlsBuilder: (BuildContext context, { VoidCallback? onStepContinue, VoidCallback? onStepCancel }) {
         return Row(
           children: <Widget>[
             TextButton(
               onPressed: onStepContinue,
               child:  Text(hide == true ? '' : 'NEXT'),
             ),
             TextButton(
               onPressed: onStepCancel,
               child: Text(hide == true ? '' : 'CANCEL'),
             ),
           ],
         );
      },
Run Code Online (Sandbox Code Playgroud)

CMIIW

谢谢,