feat: adding error component (#355)

* feat: adding error component

* Update packages/pinball_components/lib/src/components/error_component.dart

Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>

* Update packages/pinball_components/sandbox/lib/stories/error_component/error_component_game.dart

Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>

* Update packages/pinball_components/sandbox/lib/stories/error_component/stories.dart

Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>

* pr suggestions

* fix tests

* suggestions

Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>
pull/367/head
Erick 3 years ago committed by GitHub
parent 43d3a4fd51
commit 0502d97400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -3,8 +3,6 @@
/// FlutterGen /// FlutterGen
/// ***************************************************** /// *****************************************************
// ignore_for_file: directives_ordering,unnecessary_import
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class $AssetsImagesGen { class $AssetsImagesGen {
@ -14,14 +12,13 @@ class $AssetsImagesGen {
$AssetsImagesBackboxGen get backbox => const $AssetsImagesBackboxGen(); $AssetsImagesBackboxGen get backbox => const $AssetsImagesBackboxGen();
$AssetsImagesBallGen get ball => const $AssetsImagesBallGen(); $AssetsImagesBallGen get ball => const $AssetsImagesBallGen();
$AssetsImagesBaseboardGen get baseboard => const $AssetsImagesBaseboardGen(); $AssetsImagesBaseboardGen get baseboard => const $AssetsImagesBaseboardGen();
/// File path: assets/images/board-background.png
AssetGenImage get boardBackground => AssetGenImage get boardBackground =>
const AssetGenImage('assets/images/board-background.png'); const AssetGenImage('assets/images/board-background.png');
$AssetsImagesBoundaryGen get boundary => const $AssetsImagesBoundaryGen(); $AssetsImagesBoundaryGen get boundary => const $AssetsImagesBoundaryGen();
$AssetsImagesDashGen get dash => const $AssetsImagesDashGen(); $AssetsImagesDashGen get dash => const $AssetsImagesDashGen();
$AssetsImagesDinoGen get dino => const $AssetsImagesDinoGen(); $AssetsImagesDinoGen get dino => const $AssetsImagesDinoGen();
AssetGenImage get errorBackground =>
const AssetGenImage('assets/images/error_background.png');
$AssetsImagesFlapperGen get flapper => const $AssetsImagesFlapperGen(); $AssetsImagesFlapperGen get flapper => const $AssetsImagesFlapperGen();
$AssetsImagesFlipperGen get flipper => const $AssetsImagesFlipperGen(); $AssetsImagesFlipperGen get flipper => const $AssetsImagesFlipperGen();
$AssetsImagesGoogleWordGen get googleWord => $AssetsImagesGoogleWordGen get googleWord =>
@ -54,11 +51,8 @@ class $AssetsImagesAndroidGen {
class $AssetsImagesBackboxGen { class $AssetsImagesBackboxGen {
const $AssetsImagesBackboxGen(); const $AssetsImagesBackboxGen();
/// File path: assets/images/backbox/display-divider.png
AssetGenImage get displayDivider => AssetGenImage get displayDivider =>
const AssetGenImage('assets/images/backbox/display-divider.png'); const AssetGenImage('assets/images/backbox/display-divider.png');
/// File path: assets/images/backbox/marquee.png
AssetGenImage get marquee => AssetGenImage get marquee =>
const AssetGenImage('assets/images/backbox/marquee.png'); const AssetGenImage('assets/images/backbox/marquee.png');
} }
@ -66,10 +60,6 @@ class $AssetsImagesBackboxGen {
class $AssetsImagesBallGen { class $AssetsImagesBallGen {
const $AssetsImagesBallGen(); const $AssetsImagesBallGen();
/// File path: assets/images/ball/ball.png
AssetGenImage get ball => const AssetGenImage('assets/images/ball/ball.png');
/// File path: assets/images/ball/flame_effect.png
AssetGenImage get flameEffect => AssetGenImage get flameEffect =>
const AssetGenImage('assets/images/ball/flame_effect.png'); const AssetGenImage('assets/images/ball/flame_effect.png');
} }
@ -77,11 +67,8 @@ class $AssetsImagesBallGen {
class $AssetsImagesBaseboardGen { class $AssetsImagesBaseboardGen {
const $AssetsImagesBaseboardGen(); const $AssetsImagesBaseboardGen();
/// File path: assets/images/baseboard/left.png
AssetGenImage get left => AssetGenImage get left =>
const AssetGenImage('assets/images/baseboard/left.png'); const AssetGenImage('assets/images/baseboard/left.png');
/// File path: assets/images/baseboard/right.png
AssetGenImage get right => AssetGenImage get right =>
const AssetGenImage('assets/images/baseboard/right.png'); const AssetGenImage('assets/images/baseboard/right.png');
} }
@ -89,15 +76,10 @@ class $AssetsImagesBaseboardGen {
class $AssetsImagesBoundaryGen { class $AssetsImagesBoundaryGen {
const $AssetsImagesBoundaryGen(); const $AssetsImagesBoundaryGen();
/// File path: assets/images/boundary/bottom.png
AssetGenImage get bottom => AssetGenImage get bottom =>
const AssetGenImage('assets/images/boundary/bottom.png'); const AssetGenImage('assets/images/boundary/bottom.png');
/// File path: assets/images/boundary/outer-bottom.png
AssetGenImage get outerBottom => AssetGenImage get outerBottom =>
const AssetGenImage('assets/images/boundary/outer-bottom.png'); const AssetGenImage('assets/images/boundary/outer-bottom.png');
/// File path: assets/images/boundary/outer.png
AssetGenImage get outer => AssetGenImage get outer =>
const AssetGenImage('assets/images/boundary/outer.png'); const AssetGenImage('assets/images/boundary/outer.png');
} }
@ -105,10 +87,8 @@ class $AssetsImagesBoundaryGen {
class $AssetsImagesDashGen { class $AssetsImagesDashGen {
const $AssetsImagesDashGen(); const $AssetsImagesDashGen();
/// File path: assets/images/dash/animatronic.png
AssetGenImage get animatronic => AssetGenImage get animatronic =>
const AssetGenImage('assets/images/dash/animatronic.png'); const AssetGenImage('assets/images/dash/animatronic.png');
$AssetsImagesDashBumperGen get bumper => const $AssetsImagesDashBumperGen(); $AssetsImagesDashBumperGen get bumper => const $AssetsImagesDashBumperGen();
} }
@ -117,16 +97,10 @@ class $AssetsImagesDinoGen {
$AssetsImagesDinoAnimatronicGen get animatronic => $AssetsImagesDinoAnimatronicGen get animatronic =>
const $AssetsImagesDinoAnimatronicGen(); const $AssetsImagesDinoAnimatronicGen();
/// File path: assets/images/dino/bottom-wall.png
AssetGenImage get bottomWall => AssetGenImage get bottomWall =>
const AssetGenImage('assets/images/dino/bottom-wall.png'); const AssetGenImage('assets/images/dino/bottom-wall.png');
/// File path: assets/images/dino/top-wall-tunnel.png
AssetGenImage get topWallTunnel => AssetGenImage get topWallTunnel =>
const AssetGenImage('assets/images/dino/top-wall-tunnel.png'); const AssetGenImage('assets/images/dino/top-wall-tunnel.png');
/// File path: assets/images/dino/top-wall.png
AssetGenImage get topWall => AssetGenImage get topWall =>
const AssetGenImage('assets/images/dino/top-wall.png'); const AssetGenImage('assets/images/dino/top-wall.png');
} }
@ -134,15 +108,10 @@ class $AssetsImagesDinoGen {
class $AssetsImagesFlapperGen { class $AssetsImagesFlapperGen {
const $AssetsImagesFlapperGen(); const $AssetsImagesFlapperGen();
/// File path: assets/images/flapper/back-support.png
AssetGenImage get backSupport => AssetGenImage get backSupport =>
const AssetGenImage('assets/images/flapper/back-support.png'); const AssetGenImage('assets/images/flapper/back-support.png');
/// File path: assets/images/flapper/flap.png
AssetGenImage get flap => AssetGenImage get flap =>
const AssetGenImage('assets/images/flapper/flap.png'); const AssetGenImage('assets/images/flapper/flap.png');
/// File path: assets/images/flapper/front-support.png
AssetGenImage get frontSupport => AssetGenImage get frontSupport =>
const AssetGenImage('assets/images/flapper/front-support.png'); const AssetGenImage('assets/images/flapper/front-support.png');
} }
@ -150,11 +119,8 @@ class $AssetsImagesFlapperGen {
class $AssetsImagesFlipperGen { class $AssetsImagesFlipperGen {
const $AssetsImagesFlipperGen(); const $AssetsImagesFlipperGen();
/// File path: assets/images/flipper/left.png
AssetGenImage get left => AssetGenImage get left =>
const AssetGenImage('assets/images/flipper/left.png'); const AssetGenImage('assets/images/flipper/left.png');
/// File path: assets/images/flipper/right.png
AssetGenImage get right => AssetGenImage get right =>
const AssetGenImage('assets/images/flipper/right.png'); const AssetGenImage('assets/images/flipper/right.png');
} }
@ -186,15 +152,10 @@ class $AssetsImagesKickerGen {
class $AssetsImagesLaunchRampGen { class $AssetsImagesLaunchRampGen {
const $AssetsImagesLaunchRampGen(); const $AssetsImagesLaunchRampGen();
/// File path: assets/images/launch_ramp/background-railing.png
AssetGenImage get backgroundRailing => AssetGenImage get backgroundRailing =>
const AssetGenImage('assets/images/launch_ramp/background-railing.png'); const AssetGenImage('assets/images/launch_ramp/background-railing.png');
/// File path: assets/images/launch_ramp/foreground-railing.png
AssetGenImage get foregroundRailing => AssetGenImage get foregroundRailing =>
const AssetGenImage('assets/images/launch_ramp/foreground-railing.png'); const AssetGenImage('assets/images/launch_ramp/foreground-railing.png');
/// File path: assets/images/launch_ramp/ramp.png
AssetGenImage get ramp => AssetGenImage get ramp =>
const AssetGenImage('assets/images/launch_ramp/ramp.png'); const AssetGenImage('assets/images/launch_ramp/ramp.png');
} }
@ -202,11 +163,8 @@ class $AssetsImagesLaunchRampGen {
class $AssetsImagesMultiballGen { class $AssetsImagesMultiballGen {
const $AssetsImagesMultiballGen(); const $AssetsImagesMultiballGen();
/// File path: assets/images/multiball/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/multiball/dimmed.png'); const AssetGenImage('assets/images/multiball/dimmed.png');
/// File path: assets/images/multiball/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/multiball/lit.png'); const AssetGenImage('assets/images/multiball/lit.png');
} }
@ -224,11 +182,8 @@ class $AssetsImagesMultiplierGen {
class $AssetsImagesPlungerGen { class $AssetsImagesPlungerGen {
const $AssetsImagesPlungerGen(); const $AssetsImagesPlungerGen();
/// File path: assets/images/plunger/plunger.png
AssetGenImage get plunger => AssetGenImage get plunger =>
const AssetGenImage('assets/images/plunger/plunger.png'); const AssetGenImage('assets/images/plunger/plunger.png');
/// File path: assets/images/plunger/rocket.png
AssetGenImage get rocket => AssetGenImage get rocket =>
const AssetGenImage('assets/images/plunger/rocket.png'); const AssetGenImage('assets/images/plunger/rocket.png');
} }
@ -236,19 +191,12 @@ class $AssetsImagesPlungerGen {
class $AssetsImagesScoreGen { class $AssetsImagesScoreGen {
const $AssetsImagesScoreGen(); const $AssetsImagesScoreGen();
/// File path: assets/images/score/five-thousand.png
AssetGenImage get fiveThousand => AssetGenImage get fiveThousand =>
const AssetGenImage('assets/images/score/five-thousand.png'); const AssetGenImage('assets/images/score/five-thousand.png');
/// File path: assets/images/score/one-million.png
AssetGenImage get oneMillion => AssetGenImage get oneMillion =>
const AssetGenImage('assets/images/score/one-million.png'); const AssetGenImage('assets/images/score/one-million.png');
/// File path: assets/images/score/twenty-thousand.png
AssetGenImage get twentyThousand => AssetGenImage get twentyThousand =>
const AssetGenImage('assets/images/score/twenty-thousand.png'); const AssetGenImage('assets/images/score/twenty-thousand.png');
/// File path: assets/images/score/two-hundred-thousand.png
AssetGenImage get twoHundredThousand => AssetGenImage get twoHundredThousand =>
const AssetGenImage('assets/images/score/two-hundred-thousand.png'); const AssetGenImage('assets/images/score/two-hundred-thousand.png');
} }
@ -256,19 +204,12 @@ class $AssetsImagesScoreGen {
class $AssetsImagesSignpostGen { class $AssetsImagesSignpostGen {
const $AssetsImagesSignpostGen(); const $AssetsImagesSignpostGen();
/// File path: assets/images/signpost/active1.png
AssetGenImage get active1 => AssetGenImage get active1 =>
const AssetGenImage('assets/images/signpost/active1.png'); const AssetGenImage('assets/images/signpost/active1.png');
/// File path: assets/images/signpost/active2.png
AssetGenImage get active2 => AssetGenImage get active2 =>
const AssetGenImage('assets/images/signpost/active2.png'); const AssetGenImage('assets/images/signpost/active2.png');
/// File path: assets/images/signpost/active3.png
AssetGenImage get active3 => AssetGenImage get active3 =>
const AssetGenImage('assets/images/signpost/active3.png'); const AssetGenImage('assets/images/signpost/active3.png');
/// File path: assets/images/signpost/inactive.png
AssetGenImage get inactive => AssetGenImage get inactive =>
const AssetGenImage('assets/images/signpost/inactive.png'); const AssetGenImage('assets/images/signpost/inactive.png');
} }
@ -276,19 +217,12 @@ class $AssetsImagesSignpostGen {
class $AssetsImagesSkillShotGen { class $AssetsImagesSkillShotGen {
const $AssetsImagesSkillShotGen(); const $AssetsImagesSkillShotGen();
/// File path: assets/images/skill_shot/decal.png
AssetGenImage get decal => AssetGenImage get decal =>
const AssetGenImage('assets/images/skill_shot/decal.png'); const AssetGenImage('assets/images/skill_shot/decal.png');
/// File path: assets/images/skill_shot/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/skill_shot/dimmed.png'); const AssetGenImage('assets/images/skill_shot/dimmed.png');
/// File path: assets/images/skill_shot/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/skill_shot/lit.png'); const AssetGenImage('assets/images/skill_shot/lit.png');
/// File path: assets/images/skill_shot/pin.png
AssetGenImage get pin => AssetGenImage get pin =>
const AssetGenImage('assets/images/skill_shot/pin.png'); const AssetGenImage('assets/images/skill_shot/pin.png');
} }
@ -296,11 +230,8 @@ class $AssetsImagesSkillShotGen {
class $AssetsImagesSlingshotGen { class $AssetsImagesSlingshotGen {
const $AssetsImagesSlingshotGen(); const $AssetsImagesSlingshotGen();
/// File path: assets/images/slingshot/lower.png
AssetGenImage get lower => AssetGenImage get lower =>
const AssetGenImage('assets/images/slingshot/lower.png'); const AssetGenImage('assets/images/slingshot/lower.png');
/// File path: assets/images/slingshot/upper.png
AssetGenImage get upper => AssetGenImage get upper =>
const AssetGenImage('assets/images/slingshot/upper.png'); const AssetGenImage('assets/images/slingshot/upper.png');
} }
@ -308,10 +239,8 @@ class $AssetsImagesSlingshotGen {
class $AssetsImagesSparkyGen { class $AssetsImagesSparkyGen {
const $AssetsImagesSparkyGen(); const $AssetsImagesSparkyGen();
/// File path: assets/images/sparky/animatronic.png
AssetGenImage get animatronic => AssetGenImage get animatronic =>
const AssetGenImage('assets/images/sparky/animatronic.png'); const AssetGenImage('assets/images/sparky/animatronic.png');
$AssetsImagesSparkyBumperGen get bumper => $AssetsImagesSparkyBumperGen get bumper =>
const $AssetsImagesSparkyBumperGen(); const $AssetsImagesSparkyBumperGen();
$AssetsImagesSparkyComputerGen get computer => $AssetsImagesSparkyComputerGen get computer =>
@ -332,11 +261,8 @@ class $AssetsImagesAndroidBumperGen {
class $AssetsImagesAndroidRailGen { class $AssetsImagesAndroidRailGen {
const $AssetsImagesAndroidRailGen(); const $AssetsImagesAndroidRailGen();
/// File path: assets/images/android/rail/exit.png
AssetGenImage get exit => AssetGenImage get exit =>
const AssetGenImage('assets/images/android/rail/exit.png'); const AssetGenImage('assets/images/android/rail/exit.png');
/// File path: assets/images/android/rail/main.png
AssetGenImage get main => AssetGenImage get main =>
const AssetGenImage('assets/images/android/rail/main.png'); const AssetGenImage('assets/images/android/rail/main.png');
} }
@ -346,20 +272,12 @@ class $AssetsImagesAndroidRampGen {
$AssetsImagesAndroidRampArrowGen get arrow => $AssetsImagesAndroidRampArrowGen get arrow =>
const $AssetsImagesAndroidRampArrowGen(); const $AssetsImagesAndroidRampArrowGen();
/// File path: assets/images/android/ramp/board-opening.png
AssetGenImage get boardOpening => AssetGenImage get boardOpening =>
const AssetGenImage('assets/images/android/ramp/board-opening.png'); const AssetGenImage('assets/images/android/ramp/board-opening.png');
/// File path: assets/images/android/ramp/main.png
AssetGenImage get main => AssetGenImage get main =>
const AssetGenImage('assets/images/android/ramp/main.png'); const AssetGenImage('assets/images/android/ramp/main.png');
/// File path: assets/images/android/ramp/railing-background.png
AssetGenImage get railingBackground => AssetGenImage get railingBackground =>
const AssetGenImage('assets/images/android/ramp/railing-background.png'); const AssetGenImage('assets/images/android/ramp/railing-background.png');
/// File path: assets/images/android/ramp/railing-foreground.png
AssetGenImage get railingForeground => AssetGenImage get railingForeground =>
const AssetGenImage('assets/images/android/ramp/railing-foreground.png'); const AssetGenImage('assets/images/android/ramp/railing-foreground.png');
} }
@ -367,15 +285,10 @@ class $AssetsImagesAndroidRampGen {
class $AssetsImagesAndroidSpaceshipGen { class $AssetsImagesAndroidSpaceshipGen {
const $AssetsImagesAndroidSpaceshipGen(); const $AssetsImagesAndroidSpaceshipGen();
/// File path: assets/images/android/spaceship/animatronic.png
AssetGenImage get animatronic => AssetGenImage get animatronic =>
const AssetGenImage('assets/images/android/spaceship/animatronic.png'); const AssetGenImage('assets/images/android/spaceship/animatronic.png');
/// File path: assets/images/android/spaceship/light-beam.png
AssetGenImage get lightBeam => AssetGenImage get lightBeam =>
const AssetGenImage('assets/images/android/spaceship/light-beam.png'); const AssetGenImage('assets/images/android/spaceship/light-beam.png');
/// File path: assets/images/android/spaceship/saucer.png
AssetGenImage get saucer => AssetGenImage get saucer =>
const AssetGenImage('assets/images/android/spaceship/saucer.png'); const AssetGenImage('assets/images/android/spaceship/saucer.png');
} }
@ -392,11 +305,8 @@ class $AssetsImagesDashBumperGen {
class $AssetsImagesDinoAnimatronicGen { class $AssetsImagesDinoAnimatronicGen {
const $AssetsImagesDinoAnimatronicGen(); const $AssetsImagesDinoAnimatronicGen();
/// File path: assets/images/dino/animatronic/head.png
AssetGenImage get head => AssetGenImage get head =>
const AssetGenImage('assets/images/dino/animatronic/head.png'); const AssetGenImage('assets/images/dino/animatronic/head.png');
/// File path: assets/images/dino/animatronic/mouth.png
AssetGenImage get mouth => AssetGenImage get mouth =>
const AssetGenImage('assets/images/dino/animatronic/mouth.png'); const AssetGenImage('assets/images/dino/animatronic/mouth.png');
} }
@ -404,11 +314,8 @@ class $AssetsImagesDinoAnimatronicGen {
class $AssetsImagesGoogleWordLetter1Gen { class $AssetsImagesGoogleWordLetter1Gen {
const $AssetsImagesGoogleWordLetter1Gen(); const $AssetsImagesGoogleWordLetter1Gen();
/// File path: assets/images/google_word/letter1/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter1/dimmed.png'); const AssetGenImage('assets/images/google_word/letter1/dimmed.png');
/// File path: assets/images/google_word/letter1/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter1/lit.png'); const AssetGenImage('assets/images/google_word/letter1/lit.png');
} }
@ -416,11 +323,8 @@ class $AssetsImagesGoogleWordLetter1Gen {
class $AssetsImagesGoogleWordLetter2Gen { class $AssetsImagesGoogleWordLetter2Gen {
const $AssetsImagesGoogleWordLetter2Gen(); const $AssetsImagesGoogleWordLetter2Gen();
/// File path: assets/images/google_word/letter2/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter2/dimmed.png'); const AssetGenImage('assets/images/google_word/letter2/dimmed.png');
/// File path: assets/images/google_word/letter2/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter2/lit.png'); const AssetGenImage('assets/images/google_word/letter2/lit.png');
} }
@ -428,11 +332,8 @@ class $AssetsImagesGoogleWordLetter2Gen {
class $AssetsImagesGoogleWordLetter3Gen { class $AssetsImagesGoogleWordLetter3Gen {
const $AssetsImagesGoogleWordLetter3Gen(); const $AssetsImagesGoogleWordLetter3Gen();
/// File path: assets/images/google_word/letter3/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter3/dimmed.png'); const AssetGenImage('assets/images/google_word/letter3/dimmed.png');
/// File path: assets/images/google_word/letter3/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter3/lit.png'); const AssetGenImage('assets/images/google_word/letter3/lit.png');
} }
@ -440,11 +341,8 @@ class $AssetsImagesGoogleWordLetter3Gen {
class $AssetsImagesGoogleWordLetter4Gen { class $AssetsImagesGoogleWordLetter4Gen {
const $AssetsImagesGoogleWordLetter4Gen(); const $AssetsImagesGoogleWordLetter4Gen();
/// File path: assets/images/google_word/letter4/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter4/dimmed.png'); const AssetGenImage('assets/images/google_word/letter4/dimmed.png');
/// File path: assets/images/google_word/letter4/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter4/lit.png'); const AssetGenImage('assets/images/google_word/letter4/lit.png');
} }
@ -452,11 +350,8 @@ class $AssetsImagesGoogleWordLetter4Gen {
class $AssetsImagesGoogleWordLetter5Gen { class $AssetsImagesGoogleWordLetter5Gen {
const $AssetsImagesGoogleWordLetter5Gen(); const $AssetsImagesGoogleWordLetter5Gen();
/// File path: assets/images/google_word/letter5/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter5/dimmed.png'); const AssetGenImage('assets/images/google_word/letter5/dimmed.png');
/// File path: assets/images/google_word/letter5/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter5/lit.png'); const AssetGenImage('assets/images/google_word/letter5/lit.png');
} }
@ -464,11 +359,8 @@ class $AssetsImagesGoogleWordLetter5Gen {
class $AssetsImagesGoogleWordLetter6Gen { class $AssetsImagesGoogleWordLetter6Gen {
const $AssetsImagesGoogleWordLetter6Gen(); const $AssetsImagesGoogleWordLetter6Gen();
/// File path: assets/images/google_word/letter6/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter6/dimmed.png'); const AssetGenImage('assets/images/google_word/letter6/dimmed.png');
/// File path: assets/images/google_word/letter6/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter6/lit.png'); const AssetGenImage('assets/images/google_word/letter6/lit.png');
} }
@ -476,11 +368,8 @@ class $AssetsImagesGoogleWordLetter6Gen {
class $AssetsImagesKickerLeftGen { class $AssetsImagesKickerLeftGen {
const $AssetsImagesKickerLeftGen(); const $AssetsImagesKickerLeftGen();
/// File path: assets/images/kicker/left/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/kicker/left/dimmed.png'); const AssetGenImage('assets/images/kicker/left/dimmed.png');
/// File path: assets/images/kicker/left/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/kicker/left/lit.png'); const AssetGenImage('assets/images/kicker/left/lit.png');
} }
@ -488,11 +377,8 @@ class $AssetsImagesKickerLeftGen {
class $AssetsImagesKickerRightGen { class $AssetsImagesKickerRightGen {
const $AssetsImagesKickerRightGen(); const $AssetsImagesKickerRightGen();
/// File path: assets/images/kicker/right/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/kicker/right/dimmed.png'); const AssetGenImage('assets/images/kicker/right/dimmed.png');
/// File path: assets/images/kicker/right/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/kicker/right/lit.png'); const AssetGenImage('assets/images/kicker/right/lit.png');
} }
@ -500,11 +386,8 @@ class $AssetsImagesKickerRightGen {
class $AssetsImagesMultiplierX2Gen { class $AssetsImagesMultiplierX2Gen {
const $AssetsImagesMultiplierX2Gen(); const $AssetsImagesMultiplierX2Gen();
/// File path: assets/images/multiplier/x2/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/multiplier/x2/dimmed.png'); const AssetGenImage('assets/images/multiplier/x2/dimmed.png');
/// File path: assets/images/multiplier/x2/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/multiplier/x2/lit.png'); const AssetGenImage('assets/images/multiplier/x2/lit.png');
} }
@ -512,11 +395,8 @@ class $AssetsImagesMultiplierX2Gen {
class $AssetsImagesMultiplierX3Gen { class $AssetsImagesMultiplierX3Gen {
const $AssetsImagesMultiplierX3Gen(); const $AssetsImagesMultiplierX3Gen();
/// File path: assets/images/multiplier/x3/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/multiplier/x3/dimmed.png'); const AssetGenImage('assets/images/multiplier/x3/dimmed.png');
/// File path: assets/images/multiplier/x3/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/multiplier/x3/lit.png'); const AssetGenImage('assets/images/multiplier/x3/lit.png');
} }
@ -524,11 +404,8 @@ class $AssetsImagesMultiplierX3Gen {
class $AssetsImagesMultiplierX4Gen { class $AssetsImagesMultiplierX4Gen {
const $AssetsImagesMultiplierX4Gen(); const $AssetsImagesMultiplierX4Gen();
/// File path: assets/images/multiplier/x4/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/multiplier/x4/dimmed.png'); const AssetGenImage('assets/images/multiplier/x4/dimmed.png');
/// File path: assets/images/multiplier/x4/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/multiplier/x4/lit.png'); const AssetGenImage('assets/images/multiplier/x4/lit.png');
} }
@ -536,11 +413,8 @@ class $AssetsImagesMultiplierX4Gen {
class $AssetsImagesMultiplierX5Gen { class $AssetsImagesMultiplierX5Gen {
const $AssetsImagesMultiplierX5Gen(); const $AssetsImagesMultiplierX5Gen();
/// File path: assets/images/multiplier/x5/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/multiplier/x5/dimmed.png'); const AssetGenImage('assets/images/multiplier/x5/dimmed.png');
/// File path: assets/images/multiplier/x5/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/multiplier/x5/lit.png'); const AssetGenImage('assets/images/multiplier/x5/lit.png');
} }
@ -548,11 +422,8 @@ class $AssetsImagesMultiplierX5Gen {
class $AssetsImagesMultiplierX6Gen { class $AssetsImagesMultiplierX6Gen {
const $AssetsImagesMultiplierX6Gen(); const $AssetsImagesMultiplierX6Gen();
/// File path: assets/images/multiplier/x6/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/multiplier/x6/dimmed.png'); const AssetGenImage('assets/images/multiplier/x6/dimmed.png');
/// File path: assets/images/multiplier/x6/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/multiplier/x6/lit.png'); const AssetGenImage('assets/images/multiplier/x6/lit.png');
} }
@ -568,15 +439,10 @@ class $AssetsImagesSparkyBumperGen {
class $AssetsImagesSparkyComputerGen { class $AssetsImagesSparkyComputerGen {
const $AssetsImagesSparkyComputerGen(); const $AssetsImagesSparkyComputerGen();
/// File path: assets/images/sparky/computer/base.png
AssetGenImage get base => AssetGenImage get base =>
const AssetGenImage('assets/images/sparky/computer/base.png'); const AssetGenImage('assets/images/sparky/computer/base.png');
/// File path: assets/images/sparky/computer/glow.png
AssetGenImage get glow => AssetGenImage get glow =>
const AssetGenImage('assets/images/sparky/computer/glow.png'); const AssetGenImage('assets/images/sparky/computer/glow.png');
/// File path: assets/images/sparky/computer/top.png
AssetGenImage get top => AssetGenImage get top =>
const AssetGenImage('assets/images/sparky/computer/top.png'); const AssetGenImage('assets/images/sparky/computer/top.png');
} }
@ -584,11 +450,8 @@ class $AssetsImagesSparkyComputerGen {
class $AssetsImagesAndroidBumperAGen { class $AssetsImagesAndroidBumperAGen {
const $AssetsImagesAndroidBumperAGen(); const $AssetsImagesAndroidBumperAGen();
/// File path: assets/images/android/bumper/a/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/android/bumper/a/dimmed.png'); const AssetGenImage('assets/images/android/bumper/a/dimmed.png');
/// File path: assets/images/android/bumper/a/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/android/bumper/a/lit.png'); const AssetGenImage('assets/images/android/bumper/a/lit.png');
} }
@ -596,11 +459,8 @@ class $AssetsImagesAndroidBumperAGen {
class $AssetsImagesAndroidBumperBGen { class $AssetsImagesAndroidBumperBGen {
const $AssetsImagesAndroidBumperBGen(); const $AssetsImagesAndroidBumperBGen();
/// File path: assets/images/android/bumper/b/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/android/bumper/b/dimmed.png'); const AssetGenImage('assets/images/android/bumper/b/dimmed.png');
/// File path: assets/images/android/bumper/b/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/android/bumper/b/lit.png'); const AssetGenImage('assets/images/android/bumper/b/lit.png');
} }
@ -608,11 +468,8 @@ class $AssetsImagesAndroidBumperBGen {
class $AssetsImagesAndroidBumperCowGen { class $AssetsImagesAndroidBumperCowGen {
const $AssetsImagesAndroidBumperCowGen(); const $AssetsImagesAndroidBumperCowGen();
/// File path: assets/images/android/bumper/cow/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/android/bumper/cow/dimmed.png'); const AssetGenImage('assets/images/android/bumper/cow/dimmed.png');
/// File path: assets/images/android/bumper/cow/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/android/bumper/cow/lit.png'); const AssetGenImage('assets/images/android/bumper/cow/lit.png');
} }
@ -620,27 +477,16 @@ class $AssetsImagesAndroidBumperCowGen {
class $AssetsImagesAndroidRampArrowGen { class $AssetsImagesAndroidRampArrowGen {
const $AssetsImagesAndroidRampArrowGen(); const $AssetsImagesAndroidRampArrowGen();
/// File path: assets/images/android/ramp/arrow/active1.png
AssetGenImage get active1 => AssetGenImage get active1 =>
const AssetGenImage('assets/images/android/ramp/arrow/active1.png'); const AssetGenImage('assets/images/android/ramp/arrow/active1.png');
/// File path: assets/images/android/ramp/arrow/active2.png
AssetGenImage get active2 => AssetGenImage get active2 =>
const AssetGenImage('assets/images/android/ramp/arrow/active2.png'); const AssetGenImage('assets/images/android/ramp/arrow/active2.png');
/// File path: assets/images/android/ramp/arrow/active3.png
AssetGenImage get active3 => AssetGenImage get active3 =>
const AssetGenImage('assets/images/android/ramp/arrow/active3.png'); const AssetGenImage('assets/images/android/ramp/arrow/active3.png');
/// File path: assets/images/android/ramp/arrow/active4.png
AssetGenImage get active4 => AssetGenImage get active4 =>
const AssetGenImage('assets/images/android/ramp/arrow/active4.png'); const AssetGenImage('assets/images/android/ramp/arrow/active4.png');
/// File path: assets/images/android/ramp/arrow/active5.png
AssetGenImage get active5 => AssetGenImage get active5 =>
const AssetGenImage('assets/images/android/ramp/arrow/active5.png'); const AssetGenImage('assets/images/android/ramp/arrow/active5.png');
/// File path: assets/images/android/ramp/arrow/inactive.png
AssetGenImage get inactive => AssetGenImage get inactive =>
const AssetGenImage('assets/images/android/ramp/arrow/inactive.png'); const AssetGenImage('assets/images/android/ramp/arrow/inactive.png');
} }
@ -648,11 +494,8 @@ class $AssetsImagesAndroidRampArrowGen {
class $AssetsImagesDashBumperAGen { class $AssetsImagesDashBumperAGen {
const $AssetsImagesDashBumperAGen(); const $AssetsImagesDashBumperAGen();
/// File path: assets/images/dash/bumper/a/active.png
AssetGenImage get active => AssetGenImage get active =>
const AssetGenImage('assets/images/dash/bumper/a/active.png'); const AssetGenImage('assets/images/dash/bumper/a/active.png');
/// File path: assets/images/dash/bumper/a/inactive.png
AssetGenImage get inactive => AssetGenImage get inactive =>
const AssetGenImage('assets/images/dash/bumper/a/inactive.png'); const AssetGenImage('assets/images/dash/bumper/a/inactive.png');
} }
@ -660,11 +503,8 @@ class $AssetsImagesDashBumperAGen {
class $AssetsImagesDashBumperBGen { class $AssetsImagesDashBumperBGen {
const $AssetsImagesDashBumperBGen(); const $AssetsImagesDashBumperBGen();
/// File path: assets/images/dash/bumper/b/active.png
AssetGenImage get active => AssetGenImage get active =>
const AssetGenImage('assets/images/dash/bumper/b/active.png'); const AssetGenImage('assets/images/dash/bumper/b/active.png');
/// File path: assets/images/dash/bumper/b/inactive.png
AssetGenImage get inactive => AssetGenImage get inactive =>
const AssetGenImage('assets/images/dash/bumper/b/inactive.png'); const AssetGenImage('assets/images/dash/bumper/b/inactive.png');
} }
@ -672,11 +512,8 @@ class $AssetsImagesDashBumperBGen {
class $AssetsImagesDashBumperMainGen { class $AssetsImagesDashBumperMainGen {
const $AssetsImagesDashBumperMainGen(); const $AssetsImagesDashBumperMainGen();
/// File path: assets/images/dash/bumper/main/active.png
AssetGenImage get active => AssetGenImage get active =>
const AssetGenImage('assets/images/dash/bumper/main/active.png'); const AssetGenImage('assets/images/dash/bumper/main/active.png');
/// File path: assets/images/dash/bumper/main/inactive.png
AssetGenImage get inactive => AssetGenImage get inactive =>
const AssetGenImage('assets/images/dash/bumper/main/inactive.png'); const AssetGenImage('assets/images/dash/bumper/main/inactive.png');
} }
@ -684,11 +521,8 @@ class $AssetsImagesDashBumperMainGen {
class $AssetsImagesSparkyBumperAGen { class $AssetsImagesSparkyBumperAGen {
const $AssetsImagesSparkyBumperAGen(); const $AssetsImagesSparkyBumperAGen();
/// File path: assets/images/sparky/bumper/a/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/sparky/bumper/a/dimmed.png'); const AssetGenImage('assets/images/sparky/bumper/a/dimmed.png');
/// File path: assets/images/sparky/bumper/a/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/sparky/bumper/a/lit.png'); const AssetGenImage('assets/images/sparky/bumper/a/lit.png');
} }
@ -696,11 +530,8 @@ class $AssetsImagesSparkyBumperAGen {
class $AssetsImagesSparkyBumperBGen { class $AssetsImagesSparkyBumperBGen {
const $AssetsImagesSparkyBumperBGen(); const $AssetsImagesSparkyBumperBGen();
/// File path: assets/images/sparky/bumper/b/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/sparky/bumper/b/dimmed.png'); const AssetGenImage('assets/images/sparky/bumper/b/dimmed.png');
/// File path: assets/images/sparky/bumper/b/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/sparky/bumper/b/lit.png'); const AssetGenImage('assets/images/sparky/bumper/b/lit.png');
} }
@ -708,11 +539,8 @@ class $AssetsImagesSparkyBumperBGen {
class $AssetsImagesSparkyBumperCGen { class $AssetsImagesSparkyBumperCGen {
const $AssetsImagesSparkyBumperCGen(); const $AssetsImagesSparkyBumperCGen();
/// File path: assets/images/sparky/bumper/c/dimmed.png
AssetGenImage get dimmed => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/sparky/bumper/c/dimmed.png'); const AssetGenImage('assets/images/sparky/bumper/c/dimmed.png');
/// File path: assets/images/sparky/bumper/c/lit.png
AssetGenImage get lit => AssetGenImage get lit =>
const AssetGenImage('assets/images/sparky/bumper/c/lit.png'); const AssetGenImage('assets/images/sparky/bumper/c/lit.png');
} }

@ -3,14 +3,9 @@
/// FlutterGen /// FlutterGen
/// ***************************************************** /// *****************************************************
// ignore_for_file: directives_ordering,unnecessary_import
class FontFamily { class FontFamily {
FontFamily._(); FontFamily._();
/// Font family: PixeloidMono
static const String pixeloidMono = 'PixeloidMono'; static const String pixeloidMono = 'PixeloidMono';
/// Font family: PixeloidSans
static const String pixeloidSans = 'PixeloidSans'; static const String pixeloidSans = 'PixeloidSans';
} }

@ -12,6 +12,7 @@ export 'chrome_dino/chrome_dino.dart';
export 'dash_animatronic.dart'; export 'dash_animatronic.dart';
export 'dash_nest_bumper/dash_nest_bumper.dart'; export 'dash_nest_bumper/dash_nest_bumper.dart';
export 'dino_walls.dart'; export 'dino_walls.dart';
export 'error_component.dart';
export 'fire_effect.dart'; export 'fire_effect.dart';
export 'flapper/flapper.dart'; export 'flapper/flapper.dart';
export 'flipper.dart'; export 'flipper.dart';

@ -0,0 +1,95 @@
import 'package:flame/components.dart';
import 'package:flutter/material.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:pinball_ui/pinball_ui.dart';
final _boldLabelTextPaint = TextPaint(
style: const TextStyle(
fontSize: 1.8,
color: PinballColors.white,
fontFamily: PinballFonts.pixeloidSans,
fontWeight: FontWeight.w700,
),
);
final _labelTextPaint = TextPaint(
style: const TextStyle(
fontSize: 1.8,
color: PinballColors.white,
fontFamily: PinballFonts.pixeloidSans,
fontWeight: FontWeight.w400,
),
);
/// {@template error_component}
/// A plain visual component used to show errors for the user.
/// {@endtemplate}
class ErrorComponent extends SpriteComponent with HasGameRef {
/// {@macro error_component}
ErrorComponent({required this.label, Vector2? position})
: _textPaint = _labelTextPaint,
super(
position: position,
);
/// {@macro error_component}
ErrorComponent.bold({required this.label, Vector2? position})
: _textPaint = _boldLabelTextPaint,
super(
position: position,
);
/// Text shown on the error message.
final String label;
final TextPaint _textPaint;
List<String> _splitInLines() {
final maxWidth = size.x - 8;
final lines = <String>[];
var currentLine = '';
final words = label.split(' ');
while (words.isNotEmpty) {
final word = words.removeAt(0);
if (_textPaint.measureTextWidth('$currentLine $word') <= maxWidth) {
currentLine = '$currentLine $word'.trim();
} else {
lines.add(currentLine);
currentLine = word;
}
}
lines.add(currentLine);
return lines;
}
@override
Future<void> onLoad() async {
anchor = Anchor.center;
final sprite = await gameRef.loadSprite(
Assets.images.errorBackground.keyName,
);
size = sprite.originalSize / 20;
this.sprite = sprite;
final lines = _splitInLines();
// Calculates vertical offset based on the number of lines of text to be
// displayed. This offset is used to keep the middle of the multi-line text
// at the center of the [ErrorComponent].
final yOffset = ((size.y / 2.2) / lines.length) * 1.5;
for (var i = 0; i < lines.length; i++) {
await add(
TextComponent(
position: Vector2(size.x / 2, yOffset + 2.2 * i),
size: Vector2(size.x - 4, 2.2),
text: lines[i],
textRenderer: _textPaint,
anchor: Anchor.center,
),
);
}
}
}

@ -23,6 +23,8 @@ dependencies:
path: ../pinball_flame path: ../pinball_flame
pinball_theme: pinball_theme:
path: ../pinball_theme path: ../pinball_theme
pinball_ui:
path: ../pinball_ui
dev_dependencies: dev_dependencies:
bloc_test: ^9.0.3 bloc_test: ^9.0.3
@ -33,6 +35,7 @@ dev_dependencies:
very_good_analysis: ^2.4.0 very_good_analysis: ^2.4.0
flutter: flutter:
uses-material-design: true
generate: true generate: true
fonts: fonts:
- family: PixeloidSans - family: PixeloidSans

@ -8,6 +8,7 @@ void main() {
addBallStories(dashbook); addBallStories(dashbook);
addLayerStories(dashbook); addLayerStories(dashbook);
addEffectsStories(dashbook); addEffectsStories(dashbook);
addErrorComponentStories(dashbook);
addFlutterForestStories(dashbook); addFlutterForestStories(dashbook);
addSparkyScorchStories(dashbook); addSparkyScorchStories(dashbook);
addAndroidAcresStories(dashbook); addAndroidAcresStories(dashbook);

@ -0,0 +1,24 @@
import 'package:flame/components.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart';
class ErrorComponentGame extends AssetsGame {
ErrorComponentGame({required this.text});
static const description = 'Shows how ErrorComponents are rendered.';
final String text;
@override
Future<void> onLoad() async {
camera.followVector2(Vector2.zero());
await add(ErrorComponent(label: text));
await add(
ErrorComponent.bold(
label: text,
position: Vector2(0, 10),
),
);
}
}

@ -0,0 +1,16 @@
import 'package:dashbook/dashbook.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/error_component/error_component_game.dart';
void addErrorComponentStories(Dashbook dashbook) {
dashbook.storiesOf('ErrorComponent').addGame(
title: 'Basic',
description: ErrorComponentGame.description,
gameBuilder: (context) => ErrorComponentGame(
text: context.textProperty(
'label',
'Oh no, something went wrong!',
),
),
);
}

@ -4,6 +4,7 @@ export 'bottom_group/stories.dart';
export 'boundaries/stories.dart'; export 'boundaries/stories.dart';
export 'dino_desert/stories.dart'; export 'dino_desert/stories.dart';
export 'effects/stories.dart'; export 'effects/stories.dart';
export 'error_component/stories.dart';
export 'flutter_forest/stories.dart'; export 'flutter_forest/stories.dart';
export 'google_word/stories.dart'; export 'google_word/stories.dart';
export 'launch_ramp/stories.dart'; export 'launch_ramp/stories.dart';

@ -270,6 +270,13 @@ packages:
relative: true relative: true
source: path source: path
version: "1.0.0+1" version: "1.0.0+1"
pinball_ui:
dependency: transitive
description:
path: "../../pinball_ui"
relative: true
source: path
version: "1.0.0+1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -407,7 +414,7 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.20" version: "6.1.0"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:

@ -0,0 +1,57 @@
// ignore_for_file: cascade_invocations
import 'package:flame/components.dart';
import 'package:flame_test/flame_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pinball_components/pinball_components.dart';
import '../../helpers/helpers.dart';
extension _IterableX on Iterable<Component> {
int countTexts(String value) {
return where(
(component) => component is TextComponent && component.text == value,
).length;
}
}
void main() {
group('ErrorComponent', () {
TestWidgetsFlutterBinding.ensureInitialized();
final assets = [
Assets.images.errorBackground.keyName,
];
final flameTester = FlameTester(() => TestGame(assets));
flameTester.test('renders correctly', (game) async {
await game.ensureAdd(ErrorComponent(label: 'Error Message'));
final count = game.descendants().countTexts('Error Message');
expect(count, equals(1));
});
group('when the text is longer than one line', () {
flameTester.test('renders correctly', (game) async {
await game.ensureAdd(
ErrorComponent(
label: 'Error With A Longer Message',
),
);
final count1 = game.descendants().countTexts('Error With A');
final count2 = game.descendants().countTexts('Longer Message');
expect(count1, equals(1));
expect(count2, equals(1));
});
});
group('when using the bold font', () {
flameTester.test('renders correctly', (game) async {
await game.ensureAdd(ErrorComponent.bold(label: 'Error Message'));
final count = game.descendants().countTexts('Error Message');
expect(count, equals(1));
});
});
});
}
Loading…
Cancel
Save