doc: public member api docs

pull/40/head
RuiAlonso 4 years ago
parent 9a86c622c1
commit 49ff116865

@ -65,6 +65,10 @@ class Ball extends PositionBodyComponent<PinballGame, SpriteComponent> {
}
}
/// Modifies maskBits of [Ball] for collisions.
///
/// Changes the [Filter] data for category and maskBits of the [Ball] to
/// collide with other objects of same bits and ignore others.
void setMaskBits(int maskBits) {
body.fixtures.first
..filterData.categoryBits = maskBits

@ -53,6 +53,7 @@ extension RampTypeX on RampType {
/// Collisions with [RampArea] are listened by [RampAreaCallback].
/// {@endtemplate}
abstract class RampArea extends BodyComponent {
/// {@macro ramp_area}
RampArea({
required Vector2 position,
required int categoryBits,
@ -65,8 +66,13 @@ abstract class RampArea extends BodyComponent {
final Vector2 _position;
final int _categoryBits;
/// Mask of category bits for collision with [RampArea]
int get categoryBits => _categoryBits;
/// The [Shape] of the [RampArea]
Shape get shape;
/// Orientation of the [RampArea] entrance/exit
RampOrientation get orientation;
@override

@ -11,6 +11,7 @@ import 'package:pinball/game/game.dart';
/// a ball gets into/out of the ramp.
/// {@endtemplate}
class JetpackRamp extends PositionComponent with HasGameRef<PinballGame> {
/// {@macro jetpack_ramp}
JetpackRamp({
required Vector2 position,
}) : _position = position,
@ -64,6 +65,7 @@ class JetpackRamp extends PositionComponent with HasGameRef<PinballGame> {
/// inside [JetpackRamp].
/// {@endtemplate}
class JetpackRampArea extends RampArea {
/// {@macro jetpack_ramp_area}
JetpackRampArea({
required Vector2 position,
double rotation = 0,

@ -1,4 +1,3 @@
import 'dart:math' as math;
import 'package:flame/components.dart';
import 'package:flame/extensions.dart';
import 'package:flame_forge2d/flame_forge2d.dart';
@ -12,6 +11,7 @@ import 'package:pinball/game/game.dart';
/// a ball gets into/out of the ramp.
/// {@endtemplate}
class SparkyRamp extends PositionComponent with HasGameRef<PinballGame> {
/// {@macro sparky_ramp}
SparkyRamp({
required Vector2 position,
}) : _position = position,
@ -59,6 +59,7 @@ class SparkyRamp extends PositionComponent with HasGameRef<PinballGame> {
/// inside [SparkyRamp].
/// {@endtemplate}
class SparkyRampArea extends RampArea {
/// {@macro sparky_ramp_area}
SparkyRampArea({
required Vector2 position,
double rotation = 0,
@ -99,6 +100,7 @@ class SparkyRampArea extends RampArea {
/// gets into a [SparkyRampArea].
/// {@endtemplate}
class SparkyRampAreaCallback extends RampAreaCallback<SparkyRampArea> {
/// {@macro sparky_ramp_area_callback}
SparkyRampAreaCallback() : super();
/// Collection of balls inside [SparkyRamp].

@ -0,0 +1,45 @@
#!/bin/bash
# This script can be used to run flutter test for a given directory (defaults to the current directory)
# It will exclude generated code and translations (mimicking the ci) and open the coverage report in a
# new window once it has run successfully.
#
# To run in main project:
# ./tool/coverage.sh
#
# To run in other directory:
# ./tool/coverage.sh ./path/to/other/project
set -e
PROJECT_PATH="${1:-.}"
PROJECT_COVERAGE=./coverage/lcov.info
cd ${PROJECT_PATH}
rm -rf coverage
if grep -q "flutter:" pubspec.yaml; then
flutter --version
flutter test --no-pub --test-randomize-ordering-seed random --coverage -j 28
else
dart --version
dart test --coverage=coverage && dart run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib
fi
lcov --remove ${PROJECT_COVERAGE} -o ${PROJECT_COVERAGE} \
'**/*.g.dart' \
'**/l10n/*.dart' \
'**/l10n/**/*.dart' \
'**/main/bootstrap.dart' \
'**/*.gen.dart'
genhtml ${PROJECT_COVERAGE} -o coverage | tee ./coverage/output.txt
COV_LINE=$(tail -2 ./coverage/output.txt | head -1)
SUB='100.0%'
if [[ "$COV_LINE" == *"$SUB"* ]]; then
echo "The coverage is 100%"
else
echo "Coverage is below 100%! Check the report to see which lines are not covered."
echo $COV_LINE
open ./coverage/index.html
fi
Loading…
Cancel
Save