// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:flutter/material.dart';

import 'package:qadirneyriz/config/config.dart';

class PickerCustom extends StatelessWidget {
  final String showDate;
  final void Function()? onTap;
  final String? title;
  final bool isForm;
  final IconData icon;

  const PickerCustom(
      {Key? key,
      required this.showDate,
      required this.onTap,
      this.title,
      this.icon = Icons.calendar_month,
      this.isForm = false})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        decoration: BoxDecoration(
          border: Border(
            bottom: BorderSide(color: config.ui.mainGreen, width: 2),
          ),
        ),
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              if (this.isForm)
                Text(
                  this.title ?? '',
                  style: TextStyle(
                      fontWeight: FontWeight.normal,
                      fontSize: 13,
                      color: Colors.black.withOpacity(.8)),
                ),
              if (this.isForm)
                SizedBox(
                  height: 5,
                ),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 8),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      showDate,
                      style: TextStyle(
                          fontSize: 13, color: Colors.black.withOpacity(.5)),
                    ), // This will show the updated date
                    const SizedBox(width: 10),
                    Icon(
                      icon,
                      size: 17,
                      color: config.ui.secendGreen,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
