settle method
Settles the drawer by given DragEndDetails.
Implementation
void settle(DragEndDetails details) {
if (_controller.isDismissed) return;
if (details.velocity.pixelsPerSecond.dx.abs() >= _kMinFlingVelocity) {
double visualVelocity = details.velocity.pixelsPerSecond.dx / width;
switch (widget.alignment) {
case DrawerAlignment.start:
break;
case DrawerAlignment.end:
visualVelocity = -visualVelocity;
break;
}
switch (Directionality.of(context)) {
case TextDirection.rtl:
_controller.fling(velocity: -visualVelocity);
widget.drawerCallback?.call(visualVelocity < 0.0);
break;
case TextDirection.ltr:
_controller.fling(velocity: visualVelocity);
widget.drawerCallback?.call(visualVelocity > 0.0);
break;
}
} else if (_controller.value < 0.5) {
close();
} else {
open();
}
}