import 'package:flutter/material.dart'; import '../../game/enums.dart'; import '../../game/config.dart'; import '../../providers/battle_provider.dart'; import 'battle_controls.dart'; import 'battle_log_overlay.dart'; class BattleBottomSection extends StatelessWidget { final BattleProvider battleProvider; final bool showLogs; final bool isPlayerAttacking; final bool isEnemyAttacking; final VoidCallback onToggleLogs; final VoidCallback onAttackPressed; final VoidCallback onDefendPressed; final VoidCallback onItemPressed; // Custom buttons/panels passed from parent to keep their logic there for now final Widget equipmentSwapButton; final Widget? equipmentSwapPanel; const BattleBottomSection({ super.key, required this.battleProvider, required this.showLogs, required this.isPlayerAttacking, required this.isEnemyAttacking, required this.onToggleLogs, required this.onAttackPressed, required this.onDefendPressed, required this.onItemPressed, required this.equipmentSwapButton, this.equipmentSwapPanel, }); @override Widget build(BuildContext context) { return Stack( children: [ // 1. Logs Overlay if (showLogs && battleProvider.logs.isNotEmpty) Positioned( top: 60, left: 16, right: 16, height: BattleConfig.logsOverlayHeight, child: BattleLogOverlay(logs: battleProvider.logs), ), // 2. Battle Controls (Bottom Right) Positioned( bottom: 20, right: 20, child: BattleControls( isAttackEnabled: battleProvider.isPlayerTurn && !battleProvider.player.isDead && !battleProvider.enemy.isDead && !battleProvider.showRewardPopup && !isPlayerAttacking && !isEnemyAttacking, isDefendEnabled: battleProvider.isPlayerTurn && !battleProvider.player.isDead && !battleProvider.enemy.isDead && !battleProvider.showRewardPopup && !isPlayerAttacking && !isEnemyAttacking && !battleProvider.player.hasStatus( StatusEffectType.defenseForbidden, ), onAttackPressed: onAttackPressed, onDefendPressed: onDefendPressed, onItemPressed: onItemPressed, ), ), // 3. Equipment Swap Panel if (equipmentSwapPanel != null) Positioned( bottom: 20, right: 96, width: 260, child: equipmentSwapPanel!, ), // 4. Log Toggle & Swap Button (Bottom Left) Positioned( bottom: 20, left: 20, child: Column( mainAxisSize: MainAxisSize.min, children: [ equipmentSwapButton, const SizedBox(height: 12), FloatingActionButton( heroTag: "logToggle", mini: true, backgroundColor: ThemeConfig.toggleBtnBg, onPressed: onToggleLogs, child: Icon( showLogs ? Icons.visibility_off : Icons.visibility, color: ThemeConfig.textColorWhite, ), ), ], ), ), ], ); } }