Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 2.2 MiB |
@ -1 +0,0 @@
|
||||
export 'view/landing_page.dart';
|
@ -1 +1,2 @@
|
||||
export 'bloc/start_game_bloc.dart';
|
||||
export 'widgets/widgets.dart';
|
||||
|
@ -0,0 +1 @@
|
||||
export 'how_to_play_dialog.dart';
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 290 KiB |
@ -0,0 +1,114 @@
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
|
||||
/// {@template render_priority}
|
||||
/// Priorities for the component rendering order in the pinball game.
|
||||
/// {@endtemplate}
|
||||
// TODO(allisonryan0002): find alternative to section comments.
|
||||
abstract class RenderPriority {
|
||||
static const _base = 0;
|
||||
static const _above = 1;
|
||||
static const _below = -1;
|
||||
|
||||
// Ball
|
||||
|
||||
/// Render priority for the [Ball] while it's on the board.
|
||||
static const int ballOnBoard = _base;
|
||||
|
||||
/// Render priority for the [Ball] while it's on the [SpaceshipRamp].
|
||||
static const int ballOnSpaceshipRamp =
|
||||
_above + spaceshipRampBackgroundRailing;
|
||||
|
||||
/// Render priority for the [Ball] while it's on the [Spaceship].
|
||||
static const int ballOnSpaceship = _above + spaceshipSaucer;
|
||||
|
||||
/// Render priority for the [Ball] while it's on the [SpaceshipRail].
|
||||
static const int ballOnSpaceshipRail = _below + spaceshipSaucer;
|
||||
|
||||
/// Render priority for the [Ball] while it's on the [LaunchRamp].
|
||||
static const int ballOnLaunchRamp = _above + launchRamp;
|
||||
|
||||
// Background
|
||||
|
||||
// TODO(allisonryan0002): fix this magic priority. Could bump all priorities
|
||||
// so there are no negatives.
|
||||
static const int background = 3 * _below + _base;
|
||||
|
||||
// Boundaries
|
||||
|
||||
static const int bottomBoundary = _above + dinoBottomWall;
|
||||
|
||||
static const int outerBoudary = _above + background;
|
||||
|
||||
// Bottom Group
|
||||
|
||||
static const int bottomGroup = _above + ballOnBoard;
|
||||
|
||||
// Launcher
|
||||
|
||||
static const int launchRamp = _above + outerBoudary;
|
||||
|
||||
static const int launchRampForegroundRailing = _above + ballOnLaunchRamp;
|
||||
|
||||
static const int plunger = _above + launchRamp;
|
||||
|
||||
static const int rocket = _above + bottomBoundary;
|
||||
|
||||
// Dino Land
|
||||
|
||||
static const int dinoTopWall = _above + ballOnBoard;
|
||||
|
||||
static const int dino = _above + dinoTopWall;
|
||||
|
||||
static const int dinoBottomWall = _above + dino;
|
||||
|
||||
static const int slingshot = _above + ballOnBoard;
|
||||
|
||||
// Flutter Forest
|
||||
|
||||
static const int flutterSignPost = _above + launchRampForegroundRailing;
|
||||
|
||||
static const int dashBumper = _above + ballOnBoard;
|
||||
|
||||
static const int dashAnimatronic = _above + launchRampForegroundRailing;
|
||||
|
||||
// Sparky Fire Zone
|
||||
|
||||
static const int computerBase = _below + ballOnBoard;
|
||||
|
||||
static const int computerTop = _above + ballOnBoard;
|
||||
|
||||
static const int sparkyAnimatronic = _above + spaceshipRampForegroundRailing;
|
||||
|
||||
static const int sparkyBumper = _above + ballOnBoard;
|
||||
|
||||
static const int turboChargeFlame = _above + ballOnBoard;
|
||||
|
||||
// Android Spaceship
|
||||
|
||||
static const int spaceshipRail = _above + bottomGroup;
|
||||
|
||||
static const int spaceshipRailForeground = _above + spaceshipRail;
|
||||
|
||||
static const int spaceshipSaucer = _above + spaceshipRail;
|
||||
|
||||
static const int spaceshipSaucerWall = _above + spaceshipSaucer;
|
||||
|
||||
static const int androidHead = _above + spaceshipSaucer;
|
||||
|
||||
static const int spaceshipRamp = _above + ballOnBoard;
|
||||
|
||||
static const int spaceshipRampBackgroundRailing = _above + spaceshipRamp;
|
||||
|
||||
static const int spaceshipRampForegroundRailing =
|
||||
_above + ballOnSpaceshipRamp;
|
||||
|
||||
static const int spaceshipRampBoardOpening = _below + ballOnBoard;
|
||||
|
||||
static const int alienBumper = _above + ballOnBoard;
|
||||
|
||||
// Score Text
|
||||
|
||||
static const int scoreText = _above + spaceshipRampForegroundRailing;
|
||||
}
|
Before Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 42 KiB |
@ -1,71 +0,0 @@
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockingjay/mockingjay.dart';
|
||||
import 'package:pinball/l10n/l10n.dart';
|
||||
import 'package:pinball/landing/landing.dart';
|
||||
|
||||
import '../../helpers/helpers.dart';
|
||||
|
||||
void main() {
|
||||
group('LandingPage', () {
|
||||
testWidgets('renders correctly', (tester) async {
|
||||
final l10n = await AppLocalizations.delegate.load(Locale('en'));
|
||||
await tester.pumpApp(LandingPage());
|
||||
|
||||
expect(find.byType(TextButton), findsNWidgets(2));
|
||||
expect(find.text(l10n.play), findsOneWidget);
|
||||
expect(find.text(l10n.howToPlay), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('tapping on play button navigates to CharacterSelectionPage',
|
||||
(tester) async {
|
||||
final l10n = await AppLocalizations.delegate.load(Locale('en'));
|
||||
final navigator = MockNavigator();
|
||||
when(() => navigator.push<void>(any())).thenAnswer((_) async {});
|
||||
|
||||
await tester.pumpApp(
|
||||
LandingPage(),
|
||||
navigator: navigator,
|
||||
);
|
||||
|
||||
await tester.tap(find.widgetWithText(TextButton, l10n.play));
|
||||
|
||||
verify(() => navigator.push<void>(any())).called(1);
|
||||
});
|
||||
|
||||
testWidgets('tapping on how to play button displays dialog with controls',
|
||||
(tester) async {
|
||||
final l10n = await AppLocalizations.delegate.load(Locale('en'));
|
||||
await tester.pumpApp(LandingPage());
|
||||
|
||||
await tester.tap(find.widgetWithText(TextButton, l10n.howToPlay));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(Dialog), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('KeyIndicator', () {
|
||||
testWidgets('fromKeyName renders correctly', (tester) async {
|
||||
const keyName = 'A';
|
||||
|
||||
await tester.pumpApp(
|
||||
KeyIndicator.fromKeyName(keyName: keyName),
|
||||
);
|
||||
|
||||
expect(find.text(keyName), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('fromIcon renders correctly', (tester) async {
|
||||
const keyIcon = Icons.keyboard_arrow_down;
|
||||
|
||||
await tester.pumpApp(
|
||||
KeyIndicator.fromIcon(keyIcon: keyIcon),
|
||||
);
|
||||
|
||||
expect(find.byIcon(keyIcon), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball/start_game/start_game.dart';
|
||||
|
||||
import '../../helpers/helpers.dart';
|
||||
|
||||
void main() {
|
||||
group('HowToPlayDialog', () {
|
||||
testWidgets('displays dialog', (tester) async {
|
||||
await tester.pumpApp(HowToPlayDialog());
|
||||
|
||||
expect(find.byType(Dialog), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('KeyIndicator', () {
|
||||
testWidgets('fromKeyName renders correctly', (tester) async {
|
||||
const keyName = 'A';
|
||||
|
||||
await tester.pumpApp(
|
||||
KeyIndicator.fromKeyName(keyName: keyName),
|
||||
);
|
||||
|
||||
expect(find.text(keyName), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('fromIcon renders correctly', (tester) async {
|
||||
const keyIcon = Icons.keyboard_arrow_down;
|
||||
|
||||
await tester.pumpApp(
|
||||
KeyIndicator.fromIcon(keyIcon: keyIcon),
|
||||
);
|
||||
|
||||
expect(find.byIcon(keyIcon), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|