【发布时间】:2020-11-21 22:57:08
【问题描述】:
我遇到了 GestureDetector 包装 SmoothStarRating 的问题,由于某些奇怪的原因 onHorizontalDragEnd 不起作用。我只能检测到 onTap 或 onLongPressEnd。 onRatingChanged 运行良好,但它在拖动和更新评级时多次调用 BE。这就是为什么我用 GestureDetector 包装它(仅在拖动完成时更新评级)。 有谁知道如何解决这个问题?
我在下面附上一个代码sn-p。
GestureDetector(
onHorizontalDragEnd: (detail){
print("on drug end doesnt work");
// when drug is finished update record in DB
},
onLongPressEnd: (detail){
print("this works");
},
child: Container(
child: SmoothStarRating(
allowHalfRating: true,
onRatingChanged: (v) {
// sending Bloc event to update raiting
},
starCount: 5,
rating: (rating),
【问题讨论】: