mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
linting
This commit is contained in:
@ -12,7 +12,12 @@ void main() async {
|
|||||||
final nineTileBoxImage = await Flame.images.load('nine_tile_box.png');
|
final nineTileBoxImage = await Flame.images.load('nine_tile_box.png');
|
||||||
await Flame.images.load('buttons.png');
|
await Flame.images.load('buttons.png');
|
||||||
|
|
||||||
final _buttons = SpriteSheet(imageName: 'buttons.png', textureHeight: 20, textureWidth: 60, columns: 1, rows: 2);
|
final _buttons = SpriteSheet(
|
||||||
|
imageName: 'buttons.png',
|
||||||
|
textureHeight: 20,
|
||||||
|
textureWidth: 60,
|
||||||
|
columns: 1,
|
||||||
|
rows: 2);
|
||||||
|
|
||||||
final dashbook = Dashbook();
|
final dashbook = Dashbook();
|
||||||
|
|
||||||
@ -38,11 +43,14 @@ void main() async {
|
|||||||
|
|
||||||
dashbook.storiesOf('SpriteButton').decorator(CenterDecorator()).add(
|
dashbook.storiesOf('SpriteButton').decorator(CenterDecorator()).add(
|
||||||
'default',
|
'default',
|
||||||
(ctx) => Container(padding: const EdgeInsets.all(20), child: SpriteButton(
|
(ctx) => Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: SpriteButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('Pressed');
|
print('Pressed');
|
||||||
},
|
},
|
||||||
label: const Text('Sprite Button', style: const TextStyle(color: const Color(0xFF5D275D))),
|
label: const Text('Sprite Button',
|
||||||
|
style: const TextStyle(color: const Color(0xFF5D275D))),
|
||||||
sprite: _buttons.getSprite(0, 0),
|
sprite: _buttons.getSprite(0, 0),
|
||||||
pressedSprite: _buttons.getSprite(1, 0),
|
pressedSprite: _buttons.getSprite(1, 0),
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -15,7 +15,6 @@ class SpriteButton extends StatefulWidget {
|
|||||||
@required this.label,
|
@required this.label,
|
||||||
@required this.sprite,
|
@required this.sprite,
|
||||||
@required this.pressedSprite,
|
@required this.pressedSprite,
|
||||||
|
|
||||||
this.width,
|
this.width,
|
||||||
this.height,
|
this.height,
|
||||||
});
|
});
|
||||||
@ -49,7 +48,8 @@ class _ButtonState extends State<SpriteButton> {
|
|||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
painter: _ButtonPainer(_pressed ? widget.pressedSprite : widget.sprite),
|
painter:
|
||||||
|
_ButtonPainer(_pressed ? widget.pressedSprite : widget.sprite),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: _pressed ? const EdgeInsets.only(top: 5) : null,
|
padding: _pressed ? const EdgeInsets.only(top: 5) : null,
|
||||||
|
|||||||
Reference in New Issue
Block a user