滑动格式不好

时间:2019-11-23 10:26:21

标签: flutter dart format swipe

我正在Flutter中使用Slidable。每当我想删除一项时,左侧的文本就会从放置在卡片上的卡片移出。

enter image description here

Widget buildItemList(BuildContext context, DocumentSnapshot document) {
    return new Container(
          child: Card(
            child: Slidable(
                actionPane: SlidableDrawerActionPane(),
                actionExtentRatio: 0.25,
                closeOnScroll: false,
                secondaryActions: <Widget>[
                  IconSlideAction(
                    caption: 'Delete',
                    color: Colors.red,
                    icon: Icons.delete,
                    onTap: () async {
                      await Firestore.instance.
                            collection('events').
                            document(widget.documentId).
                            collection('itemList').
                            document(document.documentID.toString()).
                            delete();
                    },
                  )
                ],
            child: Row(
              children: <Widget>[
                Row(
                      // some information deleted for better understanding 
                    ), 
                    Container(
                      constraints: BoxConstraints(maxWidth: 250),
                      padding: const EdgeInsets.only(left: 12.0, right: 12.0),
                      child: Text(
                        document['name'],
                        overflow: TextOverflow.ellipsis,
                      ),
                    ), 
                  ],
                ),
                Expanded(
                  child: Container(
                    alignment: Alignment.centerRight,
                  padding: const EdgeInsets.only(right: 12.0),
                  child: Text('0/${document['value'].toString()}'),
                )          
                )]
            ),
        ),
      ),
    ));
  }

这里有人提供解决此问题的建议吗? 谢谢

0 个答案:

没有答案