Widget withGestures(Widget child) { if (onPress != null) { return GestureDetector( onTap: onPress, child: child, ); } return child; }