import 'package:flutter/material.dart';

class DetailPage extends StatelessWidget {
  final String title;
  final String texto;
  final String categoria;

  const DetailPage({
    super.key,
    required this.title,
    required this.texto,
    required this.categoria,
  });

  @override
  Widget build(BuildContext context) => Scaffold(
    appBar: AppBar(
      flexibleSpace: Padding(
        padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top - 20),
        child: Image.asset('assets/header_image.png', fit: BoxFit.cover),
      ),
      toolbarHeight: MediaQuery.of(context).size.height * 0.19,
      title: Text(
        categoria,
        style: const TextStyle(color: Colors.white, fontSize: 16),
      ),
    ),
    body: Container(
      decoration: const BoxDecoration(color: Color.fromARGB(255, 254, 242, 221)),
      child: Padding(
        padding: const EdgeInsets.all(16.0),
        child: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                title,
                style: const TextStyle(
                  fontSize: 24,
                  fontWeight: FontWeight.bold,
                  color: Colors.black87,
                ),
              ),
              const SizedBox(height: 8),
              Container(
                padding: const EdgeInsets.all(12),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(8),
                ),
                child: Text(
                  texto,
                  style: const TextStyle(fontSize: 16, height: 1.5),
                  textAlign: TextAlign.justify,
                ),
              ),
            ],
          ),
        ),
      ),
    ),
  );
}