如何以编程方式编辑Flutter Stepper项目

时间:2019-05-22 07:17:12

标签: dart flutter flutter-layout

我已经搜索了2天,但没有找到答案,所以希望任何人都可以提供帮助,我的问题是: 我想更新步进器上的步进项目列表,像这样的脚本:

List<Step> _listStep = List<Step>();

_reservationFlight(c){
    return
    Step(
        title: new Text("Jakarta - Soul", overflow: TextOverflow.ellipsis, style: new TextStyle(fontSize: 16.0, color: Colors.black87, fontWeight: FontWeight.bold,fontFamily: 'GoogleSans')),
        subtitle: new Text("Flight Reservation",style: new TextStyle(fontSize: 14.0, color: Colors.red,fontFamily: 'GoogleSans')),
        content: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            new Text("From - to",textAlign: TextAlign.left, style: new TextStyle(fontSize: 14.0, color: Colors.black54,fontFamily: 'GoogleSans', fontWeight: FontWeight.w600)),
          ],
        ),
        isActive: false
    );
  }

_setReservationTile(value) async {
  value.forEach((c){
    _listStep.add(_reservationFlight(c));
  }
}

@override
void initState() {
  _setReservationTile();
}

...
new Stepper(
            currentStep: 0,
            steps: _listStep,
          )
...

我的脚本出了什么问题,请帮忙? 最好的问候,

0 个答案:

没有答案