PR suggestions

This commit is contained in:
Erick Zanardo
2020-04-21 09:37:30 -03:00
parent b5ae4f25f2
commit f47cd38d77
2 changed files with 8 additions and 10 deletions

View File

@ -56,6 +56,8 @@ void main() async {
),
sprite: _buttons.getSprite(0, 0),
pressedSprite: _buttons.getSprite(1, 0),
width: ctx.numberProperty('width', 250),
height: ctx.numberProperty('height', 75),
),
),
);

View File

@ -15,8 +15,8 @@ class SpriteButton extends StatefulWidget {
@required this.label,
@required this.sprite,
@required this.pressedSprite,
this.width,
this.height,
this.width = 200,
this.height = 50,
});
@override
@ -28,19 +28,15 @@ class _ButtonState extends State<SpriteButton> {
@override
Widget build(_) {
final width = widget.width ?? 200;
final height = widget.height ?? 50;
final width = widget.width;
final height = widget.height;
return GestureDetector(
onTapDown: (_) {
setState(() {
_pressed = true;
});
setState(() => _pressed = true);
},
onTapUp: (_) {
setState(() {
_pressed = false;
});
setState(() => _pressed = false);
widget.onPressed?.call();
},