import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

class DayOfWeekCell extends StatelessWidget {
  const DayOfWeekCell({
    super.key,
    required this.date,
  });

  final DateTime date;

  String get locale => "en"; //国际化
  String get text => DateFormat.E(locale).format(date); //星期显示

  @override
  Widget build(BuildContext context) {
    return Align(
      alignment: Alignment.bottomCenter,
      child: Text(
        text,
        style: TextStyle(
          fontSize: 13,
          fontWeight: FontWeight.w500,
          color: _isWeekend(date) ? context.appColors.textBlack : context.appColors.textBlack,
        ),
      ),
    );
  }

  //是否是周末
  bool _isWeekend(DateTime date) {
    return date.weekday == DateTime.saturday || date.weekday == DateTime.sunday;
  }
}
