Flutter 左滑删除控件

child: ListView.builder(
          itemBuilder: (context, i) {
            if (i == _dataList.length) {
              return _addItemWidget();
            } else {
              return Dismissible(
                key: Key(i.toString()),
                child: _taskItemWidget(_dataList[i]),
                onDismissed: (direction) {
                  _dataList.removeAt(i);
                  setState(() {});
                },
              );
            }
          },
          itemCount: _dataList.length + 1 > 6 ? 6 : _dataList.length + 1,
        ),

 

你可能感兴趣的:(Flutter)