import 'package:flutter/material.dart';

import '../../../../core/infra/player_engine/player_engine.dart';
import '../player_play_pause_button.dart';

class AndroidBottomTransportControls extends StatelessWidget {
  const AndroidBottomTransportControls({
    super.key,
    required this.player,
    required this.hasPrev,
    required this.hasNext,
    required this.onPrevItem,
    required this.onNextItem,
  });

  final PlayerEngine player;
  final bool hasPrev;
  final bool hasNext;
  final VoidCallback onPrevItem;
  final VoidCallback onNextItem;

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        IconButton(
          tooltip: '上一集',
          constraints: const BoxConstraints(minWidth: 40, minHeight: 40),
          padding: EdgeInsets.zero,
          icon: Icon(
            Icons.skip_previous,
            color: hasPrev ? Colors.white : Colors.white38,
            size: 28,
          ),
          onPressed: hasPrev ? onPrevItem : null,
        ),
        PlayerPlayPauseButton(
          player: player,
          iconSize: 30,
          constraints: const BoxConstraints(minWidth: 40, minHeight: 40),
        ),
        IconButton(
          tooltip: '下一集',
          constraints: const BoxConstraints(minWidth: 40, minHeight: 40),
          padding: EdgeInsets.zero,
          icon: Icon(
            Icons.skip_next,
            color: hasNext ? Colors.white : Colors.white38,
            size: 28,
          ),
          onPressed: hasNext ? onNextItem : null,
        ),
      ],
    );
  }
}
