w_hour.dart 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'package:flutter/material.dart';
  2. import 'package:gap/gap.dart';
  3. import 'package:jiffy/jiffy.dart';
  4. const double hourSize = 18;
  5. const double minuteSize = 14;
  6. class WHour extends StatelessWidget {
  7. const WHour(
  8. {super.key,
  9. required this.jiffy,
  10. this.size,
  11. this.color,
  12. this.hide = false});
  13. final Jiffy jiffy;
  14. final double? size;
  15. final Color? color;
  16. final bool hide;
  17. @override
  18. Widget build(BuildContext context) {
  19. return Row(
  20. crossAxisAlignment: CrossAxisAlignment.start,
  21. children: [
  22. Text(hide ? "--" : jiffy.format(pattern: "HH"),
  23. style: color == null
  24. ? TextStyle(
  25. fontSize: size ?? hourSize, fontWeight: FontWeight.w500)
  26. : TextStyle(
  27. fontSize: size ?? hourSize,
  28. color: color,
  29. fontWeight: FontWeight.w600)),
  30. const Gap(1),
  31. Text(hide ? "--" : jiffy.format(pattern: "mm"),
  32. style: color == null
  33. ? TextStyle(
  34. fontSize: ((size ?? minuteSize) * minuteSize / hourSize),
  35. fontWeight: FontWeight.w400)
  36. : TextStyle(
  37. fontSize: ((size ?? minuteSize) * minuteSize / hourSize),
  38. color: color,
  39. fontWeight: FontWeight.w600)),
  40. ],
  41. );
  42. }
  43. }