Prevent double-dismissing of Dismissables, center card_collection under-text

This commit is contained in:
Hans Muller 2015-08-05 13:31:25 -07:00
parent 9c4ed3f82d
commit e4d9e320b0
2 changed files with 11 additions and 3 deletions

View File

@ -77,9 +77,8 @@ class CardCollectionApp extends App {
)
);
Widget backgroundText = new Center(
child: new Text("Swipe in either direction", style: backgroundTextStyle)
);
Widget backgroundText =
new Text("Swipe in either direction", style: backgroundTextStyle);
// The background Widget appears behind the Dismissable card when the card
// moves to the left or right. The Positioned widget ensures that the

View File

@ -100,6 +100,9 @@ class Dismissable extends StatefulComponent {
}
EventDisposition _handlePointerDown(sky.PointerEvent event) {
if (_fadePerformance.isAnimating)
return EventDisposition.processed;
_dragUnderway = true;
_dragX = 0.0;
_fadePerformance.progress = 0.0;
@ -110,6 +113,9 @@ class Dismissable extends StatefulComponent {
if (!_isActive)
return EventDisposition.ignored;
if (_fadePerformance.isAnimating)
return EventDisposition.processed;
double oldDragX = _dragX;
_dragX += event.dx;
if (oldDragX.sign != _dragX.sign)
@ -123,6 +129,9 @@ class Dismissable extends StatefulComponent {
if (!_isActive)
return EventDisposition.ignored;
if (_fadePerformance.isAnimating)
return EventDisposition.processed;
_dragUnderway = false;
if (_fadePerformance.isCompleted)
_startResizePerformance();