56 lines
1.6 KiB
Dart
56 lines
1.6 KiB
Dart
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),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|