import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

/// Widget untuk tombol tambah item
class AddItemButton extends StatelessWidget {
  final VoidCallback onTap;

  const AddItemButton({super.key, required this.onTap});

  @override
  Widget build(BuildContext context) {
    // Mencoba menggunakan Google Fonts Courier Prime, jika gagal gunakan font sistem
    TextStyle courierPrime;
    try {
      courierPrime = GoogleFonts.courierPrime(
        textStyle: const TextStyle(
          fontSize: 14,
          height: 1.2,
        ),
      );
    } catch (e) {
      // Fallback ke font sistem jika Google Fonts tidak tersedia
      courierPrime = const TextStyle(
        fontFamily: 'CourierPrime, Courier, monospace',
        fontSize: 14,
        height: 1.2,
      );
    }

    return GestureDetector(
      onTap: onTap,
      child: Container(
        width: double.infinity,
        padding: const EdgeInsets.all(8.0),
        color: Colors.white,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(Icons.add, size: 16, color: Colors.grey[700]),
            const SizedBox(width: 8),
            Text(
              'Tambah Item',
              style: courierPrime.copyWith(
                color: Colors.grey[700],
                fontWeight: FontWeight.bold,
              ),
            ),
          ],
        ),
      ),
    );
  }
}