Flutter:从列表中删除卡无效

时间:2019-01-04 09:47:06

标签: list dart flutter

我已经使用成功创建的卡片列表创建了列表,现在我正尝试使用“删除”按钮删除卡片,但不会将其删除

我写的代码

   List<DriverList> list = DriverList.list();

按钮代码:

      FlatButton(
              child: Text("Cancel"),
              onPressed: () {
                showDialog(
                    context: context,
                    child: new AlertDialog(
                      title: new Text("Fair Bid"),
                      content: new Text("Are you sure you want to 
                      cancel?"),
                      actions: <Widget>[
                        // usually buttons at the bottom of the dialog
                        new FlatButton(
                            child: new Text("OK"), onPressed: () {
                              list.removeAt(index);
                        }),
                      ],
                    ));
              }, 

0 个答案:

没有答案