Skip to content

Commit d26b94c

Browse files
authored
Merge pull request boyan01#3 from jwiese-ms/master
Updated to include icons on the buttons
2 parents c3291eb + ff9c07b commit d26b94c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/panel/controller.dart

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ class DirectionController extends StatelessWidget {
4444
_Button(
4545
enableLongPress: false,
4646
size: _DIRECTION_BUTTON_SIZE,
47+
buttonIcon: Icons.rotate_right,
4748
onTap: () {
4849
Game.of(context).rotate();
4950
}),
5051
SizedBox(width: _DIRECTION_SPACE),
5152
_Button(
5253
size: _DIRECTION_BUTTON_SIZE,
54+
buttonIcon: Icons.chevron_right,
5355
onTap: () {
5456
Game.of(context).right();
5557
}),
@@ -61,12 +63,14 @@ class DirectionController extends StatelessWidget {
6163
children: <Widget>[
6264
_Button(
6365
size: _DIRECTION_BUTTON_SIZE,
66+
buttonIcon: Icons.chevron_left,
6467
onTap: () {
6568
Game.of(context).left();
6669
}),
6770
SizedBox(width: _DIRECTION_SPACE),
6871
_Button(
6972
size: _DIRECTION_BUTTON_SIZE,
73+
buttonIcon: Icons.keyboard_arrow_down,
7074
onTap: () {
7175
Game.of(context).down();
7276
},
@@ -118,6 +122,7 @@ class DropButton extends StatelessWidget {
118122
return _Button(
119123
enableLongPress: false,
120124
size: Size(90, 90),
125+
buttonIcon: Icons.file_download,
121126
onTap: () {
122127
Game.of(context).drop();
123128
});
@@ -178,6 +183,7 @@ class _SystemButton extends StatelessWidget {
178183

179184
class _Button extends StatefulWidget {
180185
final Size size;
186+
final IconData buttonIcon;
181187

182188
final VoidCallback onTap;
183189

@@ -190,6 +196,7 @@ class _Button extends StatefulWidget {
190196
{Key key,
191197
@required this.size,
192198
@required this.onTap,
199+
@required this.buttonIcon,
193200
this.color = Colors.blue,
194201
this.enableLongPress = true})
195202
: super(key: key);
@@ -268,7 +275,14 @@ class _ButtonState extends State<_Button> {
268275
_color = widget.color;
269276
});
270277
},
271-
child: SizedBox.fromSize(size: widget.size),
278+
child: SizedBox.fromSize(
279+
size: widget.size,
280+
child: Transform.rotate(angle: (widget.buttonIcon == Icons.file_download) ? 0 : - (math.pi/ 12.0) * 3,
281+
child: Icon(
282+
widget.buttonIcon,
283+
color: Colors.white),
284+
),
285+
),
272286
),
273287
);
274288
}

0 commit comments

Comments
 (0)