有没有办法通过点击屏幕而不是向后滑动来关闭可滑动的颤动?当屏幕上有任何其他交互时,我只希望可滑动自动滑回。这是我添加可滑动小部件的代码部分。 提前致谢
Expanded(
child: ListView.builder(
//children: List.generate(todos.length, (index) => null),
itemCount: todos.length,
itemBuilder: (BuildContext context, int i){
return Slidable(
dismissal: SlidableDismissal(
child: SlidableDrawerDismissal(),
onDismissed: (actionType) {
setState(() {
todos.removeAt(i);
});
},
),
key: ValueKey(todos[i]),
actionPane: SlidableScrollActionPane(),
actionExtentRatio: 0.25,
child: ListTile(
onTap: (){
setState(() {
_isVisible= !_isVisible;
});
},
title: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: CustomCheckbox(
selectedColor: Color(0xFF005ef5)
),
),
SizedBox(
width: 5, // here put the desired space between the icon and the text
),
Flexible(
child: Text(
todos[i],
style: Theme.of(context).textTheme.bodyText1,
)
) // here we could use a column widget if we want to add a subtitle
],
),
),
actions: <Widget>[
IconSlideAction(
icon: Icons.close,
caption: 'Delete',
color: Theme.of(context).accentColor,
onTap: (){
setState(() {
todos.removeAt(i);
});
},
)
],
);
},
),
),