import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:flutter/material.dart';

class ReportPageTitle extends StatelessWidget {
  final String title;
  final String searchDateFormatted;
  final Function() onExport;
  final bool isExport;
  const ReportPageTitle(
      {super.key,
      required this.title,
      required this.searchDateFormatted,
      required this.onExport,
      this.isExport = true});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(16.0),
      decoration: BoxDecoration(color: AppColors.white),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                title,
                style: const TextStyle(
                    fontWeight: FontWeight.w800, fontSize: 16.0),
              ),
              const SizedBox(
                height: 8.0,
              ),
              Text(
                searchDateFormatted,
                style: const TextStyle(fontSize: 16.0),
              ),
            ],
          ),
          if (isExport)
            GestureDetector(
              onTap: onExport,
              child: const Row(
                children: [
                  Text(
                    "PDF",
                    style: TextStyle(
                      fontSize: 14.0,
                      fontWeight: FontWeight.bold,
                      color: AppColors.primary,
                    ),
                  ),
                  Icon(
                    Icons.download_outlined,
                    color: AppColors.primary,
                  )
                ],
              ),
            ),
        ],
      ),
    );
  }
}
