mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
👌 Throw exception from parseAnchor in examples/widgets instead of returning null (#632)
This commit is contained in:
@ -33,7 +33,7 @@ Anchor parseAnchor(String name) {
|
||||
return Anchor.bottomRight;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw Exception("Cannot parse anchor name `$name`");
|
||||
}
|
||||
|
||||
void main() async {
|
||||
@ -108,9 +108,8 @@ void main() async {
|
||||
child: SpriteWidget(
|
||||
sprite: shieldSprite,
|
||||
anchor: parseAnchor(
|
||||
ctx.listProperty('anchor', 'Anchor.center', anchorOptions),
|
||||
) ??
|
||||
Anchor.topLeft,
|
||||
ctx.listProperty('anchor', 'Anchor.center', anchorOptions),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -135,9 +134,8 @@ void main() async {
|
||||
animation: _animation,
|
||||
playing: ctx.boolProperty('playing', true),
|
||||
anchor: parseAnchor(
|
||||
ctx.listProperty('anchor', 'Anchor.center', anchorOptions),
|
||||
) ??
|
||||
Anchor.topLeft,
|
||||
ctx.listProperty('anchor', 'Anchor.center', anchorOptions),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user