77 lines
2.3 KiB
Dart
77 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../common/custom_button_widget.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: [
|
|
CustomButtonWidget(
|
|
width: 64,
|
|
height: 64,
|
|
padding: const EdgeInsets.all(12),
|
|
onTap: isAttackEnabled ? onAttackPressed : null,
|
|
child: Opacity(
|
|
opacity: isAttackEnabled ? 1.0 : 0.5,
|
|
child: Image.asset(
|
|
'assets/images/icons/weapons/sword_02.png',
|
|
color: Colors.white,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
CustomButtonWidget(
|
|
width: 64,
|
|
height: 64,
|
|
padding: const EdgeInsets.all(12),
|
|
onTap: isDefendEnabled ? onDefendPressed : null,
|
|
child: Opacity(
|
|
opacity: isDefendEnabled ? 1.0 : 0.5,
|
|
child: Image.asset(
|
|
'assets/images/icons/subweapons/shield_02.png',
|
|
color: Colors.white,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
CustomButtonWidget(
|
|
width: 64,
|
|
height: 64,
|
|
padding: const EdgeInsets.all(12),
|
|
onTap:
|
|
onItemPressed, // Item usually always enabled or managed by parent? Sticking to logic
|
|
child: Opacity(
|
|
opacity: isAttackEnabled
|
|
? 1.0
|
|
: 0.5, // Using AttackEnabled as proxy for "Player Turn"? Text implies "Enabled when it's player turn"
|
|
child: Image.asset(
|
|
'assets/images/icons/potions/potion_blue.png',
|
|
color: Colors.white,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|