import 'package:flutter/material.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
import 'package:refilc_mobile_ui/common/panel/panel_button.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'missed_exam_tile.i18n.dart';

class MissedExamTile extends StatelessWidget {
  const MissedExamTile(this.missedExams, {super.key, this.onTap, this.padding});

  final List<Lesson> missedExams;
  final Function()? onTap;
  final EdgeInsetsGeometry? padding;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0),
      child: PanelButton(
        padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 6),
        leading: SizedBox(
            width: 36,
            height: 36,
            child: Icon(
              FeatherIcons.slash,
              color: AppColors.of(context).red.withValues(alpha: .75),
              size: 28.0,
            )),
        title: Text("missed_exams"
            .plural(missedExams.length)
            .fill([missedExams.length])),
        trailing: const Icon(FeatherIcons.arrowRight),
        onPressed: onTap,
      ),
    );
  }
}
