我正在try 解决在使用Dismissible小工具和Provider package时发生的问题.
当我放弃一张卡时,这叫做:
Provider.of<NMyProvider>(context, listen: false).toggleIsDone(object.id);
提供者:
Future<void> deleteNotebook(int id) async {
...
final notebookId = _items.indexWhere((notebook) => notebook.id == id);
...
_items.removeAt(notebookId);
notifyListeners();
}
这会使动画变得笨重,具有明显的滞后,但在移除NotifyListeners时不会发生.