diff --git a/packages/pinball_components/lib/src/components/error_component.dart b/packages/pinball_components/lib/src/components/error_component.dart index bf11b9f8..49be8069 100644 --- a/packages/pinball_components/lib/src/components/error_component.dart +++ b/packages/pinball_components/lib/src/components/error_component.dart @@ -75,9 +75,9 @@ class ErrorComponent extends SpriteComponent with HasGameRef { final lines = _splitInLines(); - /// Based on how many lines we have, their size and a small - /// offset due to the centering, this calculates where the lines - /// should start on the y axis to be centered + // 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++) { diff --git a/packages/pinball_components/sandbox/lib/stories/error_component/error_component_game.dart b/packages/pinball_components/sandbox/lib/stories/error_component/error_component_game.dart index a39e598e..c64e6d48 100644 --- a/packages/pinball_components/sandbox/lib/stories/error_component/error_component_game.dart +++ b/packages/pinball_components/sandbox/lib/stories/error_component/error_component_game.dart @@ -5,8 +5,7 @@ import 'package:sandbox/common/common.dart'; class ErrorComponentGame extends AssetsGame { ErrorComponentGame({required this.text}); - static const description = - 'Shows how ErrorComponents are rendered.'; + static const description = 'Shows how ErrorComponents are rendered.'; final String text;