import 'package:flutter/material.dart';

import '../../../models/app_notification.dart';
import '../../app_style/colors.dart';
import '../../app_style/sizing.dart';

class NotificationItem extends StatelessWidget {
  final AppNotification notification;
  final Function(AppNotification)? onPressed;
  const NotificationItem({Key? key, required this.notification, this.onPressed}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 4),
      child: ElevatedButton(
        style: ElevatedButton.styleFrom(
          padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
          primary: AColors.primaryColor,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
          ),
        ),
        onPressed: () {
          onPressed!(notification);
        },
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: [
                Expanded(
                  child: Text(
                    notification.title ?? "No Hospital Found",
                    style: Theme.of(context).textTheme.headline6?.copyWith(color: AColors.white, fontSize: 16, fontWeight: FontWeight.bold),
                  ),
                ),
                Text(
                  notification.date ?? "complaint not available",
                  style: Theme.of(context).textTheme.subtitle1?.copyWith(color: AColors.white, fontSize: 12, fontWeight: FontWeight.bold),
                ),
              ],
            ),
            Divider(
              color: AColors.white,
            ),
            Text(
              notification.description ?? "complaint not available",
              style: Theme.of(context).textTheme.subtitle1?.copyWith(
                    color: AColors.white,
                    fontSize: 14,
                  ),
            ),
          ],
        ),
      ),
    );
  }
}
