import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:jiffy/jiffy.dart';

const double hourSize = 18;
const double minuteSize = 14;

class WHour extends StatelessWidget {
  const WHour(
      {super.key,
      required this.jiffy,
      this.size,
      this.color,
      this.hide = false});

  final Jiffy jiffy;
  final double? size;
  final Color? color;
  final bool hide;

  @override
  Widget build(BuildContext context) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(hide ? "--" : jiffy.format(pattern: "HH"),
            style: color == null
                ? TextStyle(
                    fontSize: size ?? hourSize, fontWeight: FontWeight.w500)
                : TextStyle(
                    fontSize: size ?? hourSize,
                    color: color,
                    fontWeight: FontWeight.w600)),
        const Gap(1),
        Text(hide ? "--" : jiffy.format(pattern: "mm"),
            style: color == null
                ? TextStyle(
                    fontSize: ((size ?? minuteSize) * minuteSize / hourSize),
                    fontWeight: FontWeight.w400)
                : TextStyle(
                    fontSize: ((size ?? minuteSize) * minuteSize / hourSize),
                    color: color,
                    fontWeight: FontWeight.w600)),
      ],
    );
  }
}
