added game status

This commit is contained in:
2024-02-04 19:14:41 +05:30
parent eda5f77e2d
commit 494b27bf9e
16 changed files with 691 additions and 137 deletions

View File

@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:rogapp/widgets/GameState/Colors.dart';
class GameStatusIndicator extends StatelessWidget {
final bool gameStarted;
final bool minimized;
const GameStatusIndicator(
{Key? key, required this.gameStarted, this.minimized = true})
: super(key: key);
@override
Widget build(BuildContext context) {
// Icons to show based on the game status
IconData iconData =
gameStarted ? Icons.stop_circle : Icons.play_circle_filled;
// Text to show based on the game status
String text = gameStarted ? 'ゲーム開始' : 'ゲーム未開始';
// Layout for minimized view
if (minimized) {
return Container(
height: 40, // Square size
width: 40, // Square size
decoration: BoxDecoration(
color:
gameStarted ? JapaneseColors.indigo : JapaneseColors.sakuraPink,
shape: BoxShape
.circle, // Making it circle when minimized for a more distinct look
),
child: Icon(iconData, color: Colors.white),
);
}
// Layout for expanded view
return Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: gameStarted ? JapaneseColors.indigo : JapaneseColors.sakuraPink,
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(iconData, color: Colors.white),
SizedBox(width: 8),
Text(
text,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
],
),
);
}
}