Skip to content
Snippets Groups Projects
Commit 617aa066 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Add players indicators

parent 570cb968
No related branches found
No related tags found
1 merge request!35Resolve "Add players indicators"
Pipeline #6991 passed
Improve player indicators.
Améliorations graphiques sur les indicateurs de joueur.
......@@ -13,6 +13,10 @@ class GameBottomWidget extends StatelessWidget {
builder: (BuildContext context, ActivityState activityState) {
final Activity currentActivity = activityState.currentActivity;
if (currentActivity.isFinished) {
return SizedBox.shrink();
}
final Color color = currentActivity.currentPlayer == 0
? Colors.grey
: (currentActivity.currentPlayer == 1 ? Colors.yellow : Colors.red);
......
......@@ -45,6 +45,28 @@ class GameEndWidget extends StatelessWidget {
fit: BoxFit.fill,
);
final Widget indicatorPlayer1 = (currentActivity.currentPlayer == 1 && connected4)
? AspectRatio(
aspectRatio: 1,
child: StyledButton(
color: Colors.yellow,
onPressed: () {},
child: SizedBox.shrink(),
),
)
: player1Image;
final Widget indicatorPlayer2 = (currentActivity.currentPlayer == 2 && connected4)
? AspectRatio(
aspectRatio: 1,
child: StyledButton(
color: Colors.red,
onPressed: () {},
child: SizedBox.shrink(),
),
)
: player2Image;
return Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
......@@ -57,7 +79,7 @@ class GameEndWidget extends StatelessWidget {
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [player1Image],
children: [indicatorPlayer1],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
......@@ -86,7 +108,7 @@ class GameEndWidget extends StatelessWidget {
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [player2Image],
children: [indicatorPlayer2],
),
],
),
......
......@@ -3,7 +3,7 @@ description: puissance4
publish_to: "none"
version: 1.4.2+30
version: 1.4.3+31
environment:
sdk: "^3.0.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment