game/lib/widgets/battle/battle_controls.dart

50 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import '../common/custom_icon_button.dart';
class BattleControls extends StatelessWidget {
final bool isAttackEnabled;
final bool isDefendEnabled;
final VoidCallback onAttackPressed;
final VoidCallback onDefendPressed;
final VoidCallback onItemPressed; // New
const BattleControls({
super.key,
required this.isAttackEnabled,
required this.isDefendEnabled,
required this.onAttackPressed,
required this.onDefendPressed,
required this.onItemPressed, // New
});
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
CustomIconButton(
iconPath: 'assets/images/icons/weapons/sword_02.png',
isEnabled: isAttackEnabled,
onTap: onAttackPressed,
iconColor: Colors.white,
),
const SizedBox(height: 16),
CustomIconButton(
iconPath: 'assets/images/icons/subweapons/shield_01.png',
isEnabled: isDefendEnabled,
onTap: onDefendPressed,
iconColor: Colors.white,
),
const SizedBox(height: 16),
CustomIconButton(
iconPath: 'assets/images/icons/potions/potion_blue.png',
isEnabled: isAttackEnabled, // Enabled when it's player turn
onTap: onItemPressed,
iconColor: Colors.white,
),
],
);
}
}