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

class StrawberryInfoPage extends StatelessWidget {
  const StrawberryInfoPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: const Color(0xFF891A2D),
        title: Text(
          "Informasi Stroberi",
          style: GoogleFonts.poppins(
            color: Colors.white,
            // fontWeight: FontWeight.w600,
            fontSize: 20,
          ),
        ),
        centerTitle: true,
        iconTheme: const IconThemeData(color: Colors.white),
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(20),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              // Carousel untuk gambar stroberi
              Container(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(15),
                  boxShadow: [
                    BoxShadow(
                      color: Colors.black.withOpacity(0.1),
                      blurRadius: 10,
                      spreadRadius: 5,
                    ),
                  ],
                ),
                child: CarouselSlider(
                  options: CarouselOptions(
                    height: 200.0,
                    autoPlay: true,
                    autoPlayInterval: const Duration(seconds: 4),
                    enlargeCenterPage: true,
                    viewportFraction: 0.9,
                  ),
                  items: [
                    "assets/stroberi1.jpg",
                    "assets/stroberi2.jpg",
                    "assets/stroberi3.jpg",
                  ].map((imagePath) {
                    return ClipRRect(
                      borderRadius: BorderRadius.circular(15),
                      child: Image.asset(
                        imagePath,
                        width: double.infinity,
                        fit: BoxFit.cover,
                      ),
                    );
                  }).toList(),
                ),
              ),

              const SizedBox(height: 20),

              // Bagian judul dan deskripsi
              Card(
                elevation: 5,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(15),
                ),
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        "Apa Itu Stroberi?",
                        style: GoogleFonts.poppins(
                          fontSize: 24,
                          fontWeight: FontWeight.bold,
                          color: const Color(0xFF891A2D),
                        ),
                      ),
                      const SizedBox(height: 10),
                      Text(
                        "Stroberi adalah buah merah kecil yang kaya akan vitamin C, antioksidan, dan serat. Buah ini memiliki rasa manis asam dan sering digunakan dalam berbagai makanan dan minuman.",
                        textAlign: TextAlign.justify,
                        style: GoogleFonts.poppins(
                          fontSize: 15,
                          color: Colors.black87,
                          height: 1.5,
                        ),
                      ),
                    ],
                  ),
                ),
              ),

              const SizedBox(height: 20),

              // Bagian manfaat stroberi
              Card(
                elevation: 5,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(15),
                ),
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        "Manfaat Stroberi",
                        style: GoogleFonts.poppins(
                          fontSize: 20,
                          fontWeight: FontWeight.bold,
                          color: const Color(0xFF891A2D),
                        ),
                      ),
                      const SizedBox(height: 15),
                      _benefitItem(
                        Icons.health_and_safety,
                        "Menjaga Kesehatan Jantung",
                        "Mendukung kesehatan kardiovaskular dengan antioksidan.",
                      ),
                      _benefitItem(
                        Icons.remove_red_eye,
                        "Menjaga Kesehatan Mata",
                        "Melindungi mata dari kerusakan akibat radikal bebas.",
                      ),
                      _benefitItem(
                        Icons.shield,
                        "Meningkatkan Sistem Imun",
                        "Memperkuat pertahanan tubuh dengan vitamin C.",
                      ),
                      _benefitItem(
                        Icons.directions_run,
                        "Membantu Pencernaan",
                        "Serat alami membantu kelancaran sistem pencernaan.",
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  // Widget untuk menampilkan setiap manfaat stroberi
  Widget _benefitItem(IconData icon, String title, String description) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 10),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Icon(icon, color: const Color(0xFF891A2D), size: 30),
          const SizedBox(width: 15),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  title,
                  style: GoogleFonts.poppins(
                    fontSize: 16,
                    fontWeight: FontWeight.w600,
                    color: Colors.black87,
                  ),
                ),
                const SizedBox(height: 5),
                Text(
                  description,
                  style: GoogleFonts.poppins(
                    fontSize: 14,
                    color: Colors.grey[700],
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
