import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';

import '../../../app_style/app_color.dart';

class CalendarDaysCard extends StatelessWidget {
  final String day;
  final bool fill;

  const CalendarDaysCard({Key? key, required this.day, this.fill = false}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final bgColor = fill ? AppColor.primary40.withOpacity(context.isDark ? 0.4 : 0.3) : AppColor.neutral30;
    final dotColor = fill ? AppColor.primary40 : AppColor.green50;
    return SizedBox(
      height: 45.toScreenWidth,
      width: 45.toScreenWidth,
      child: Stack(
        children: [
          Container(
            height: 37.toScreenWidth,
            width: 37.toScreenWidth,
            alignment: Alignment.center,
            decoration: BoxDecoration(shape: BoxShape.circle, color: bgColor),
            child: day.bodyText(context).custom(color: fill && context.isDark ? AppColor.neutral40 : AppColor.neutral50),
          ),
          if (fill)
            PositionedDirectional(
              bottom: 16.toScreenHeight,
              end: 16.toScreenWidth,
              child: CircleAvatar(backgroundColor: dotColor, radius: 2.5),
            ),
        ],
      ),
    );
  }
}
