mirror of https://github.com/flutter/pinball.git
feat: final screen for the initials submission error (#393)
parent
75feeaae26
commit
6aef28ed8c
@ -1,27 +1,47 @@
|
|||||||
import 'package:flame/components.dart';
|
import 'package:flame/components.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pinball/game/game.dart';
|
import 'package:pinball/game/game.dart';
|
||||||
|
import 'package:pinball/l10n/l10n.dart';
|
||||||
import 'package:pinball_components/pinball_components.dart';
|
import 'package:pinball_components/pinball_components.dart';
|
||||||
|
import 'package:pinball_flame/pinball_flame.dart';
|
||||||
import 'package:pinball_ui/pinball_ui.dart';
|
import 'package:pinball_ui/pinball_ui.dart';
|
||||||
|
|
||||||
final _bodyTextPaint = TextPaint(
|
final _bodyTextPaint = TextPaint(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 3,
|
fontSize: 1.8,
|
||||||
color: PinballColors.white,
|
color: PinballColors.white,
|
||||||
fontFamily: PinballFonts.pixeloidSans,
|
fontFamily: PinballFonts.pixeloidSans,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/// {@template initials_submission_failure_display}
|
/// {@template initials_submission_failure_display}
|
||||||
/// [Backbox] display for when a failure occurs during initials submission.
|
/// [Backbox] display for when a failure occurs during initials submission.
|
||||||
/// {@endtemplate}
|
/// {@endtemplate}
|
||||||
class InitialsSubmissionFailureDisplay extends TextComponent {
|
class InitialsSubmissionFailureDisplay extends Component {
|
||||||
|
/// {@macro initials_submission_failure_display}
|
||||||
|
InitialsSubmissionFailureDisplay({
|
||||||
|
required this.onDismissed,
|
||||||
|
});
|
||||||
|
|
||||||
|
final VoidCallback onDismissed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onLoad() async {
|
Future<void> onLoad() async {
|
||||||
await super.onLoad();
|
final l10n = readProvider<AppLocalizations>();
|
||||||
position = Vector2(0, -10);
|
|
||||||
anchor = Anchor.center;
|
await addAll([
|
||||||
text = 'Failure!';
|
ErrorComponent.bold(
|
||||||
textRenderer = _bodyTextPaint;
|
label: l10n.initialsErrorTitle,
|
||||||
|
position: Vector2(0, -20),
|
||||||
|
),
|
||||||
|
TextComponent(
|
||||||
|
text: l10n.initialsErrorMessage,
|
||||||
|
anchor: Anchor.center,
|
||||||
|
position: Vector2(0, -12),
|
||||||
|
textRenderer: _bodyTextPaint,
|
||||||
|
),
|
||||||
|
TimerComponent(period: 4, onTick: onDismissed),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue