1
0

w_month.dart 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import 'package:flutter/material.dart';
  2. import 'package:jiffy/jiffy.dart';
  3. class WMonth extends StatelessWidget {
  4. const WMonth({super.key, this.date, this.selected = false});
  5. final dynamic date;
  6. final bool selected;
  7. @override
  8. Widget build(BuildContext context) {
  9. Jiffy jdate;
  10. if (date is Jiffy) {
  11. jdate = Jiffy.parseFromJiffy(date);
  12. } else if (date is String) {
  13. jdate = Jiffy.parse(date, isUtc: true);
  14. } else if (date is List) {
  15. jdate = Jiffy.parseFromList(date, isUtc: true);
  16. } else {
  17. jdate = Jiffy.now().toUtc();
  18. }
  19. return Container(
  20. height: 80.0,
  21. width: 80.0,
  22. margin: const EdgeInsets.all(5.0),
  23. decoration: BoxDecoration(
  24. gradient: const LinearGradient(
  25. colors: [
  26. Color.fromRGBO(112, 64, 103, 1),
  27. Color.fromRGBO(84, 1, 68, 1),
  28. ],
  29. begin: Alignment.centerLeft,
  30. end: Alignment.centerRight,
  31. ),
  32. border: Border.all(color: selected ? Colors.yellow : Colors.black),
  33. borderRadius: const BorderRadius.all(
  34. Radius.circular(15.0),
  35. ),
  36. boxShadow: const [
  37. BoxShadow(
  38. color: Colors.black26,
  39. spreadRadius: 2,
  40. blurRadius: 8,
  41. offset: Offset(3, 3),
  42. )
  43. ],
  44. ),
  45. child: Center(
  46. child: Column(
  47. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  48. children: [
  49. Text(
  50. jdate.format(pattern: "MMM").toUpperCase(),
  51. textAlign: TextAlign.center,
  52. style: const TextStyle(
  53. letterSpacing: 2,
  54. fontSize: 24,
  55. fontWeight: FontWeight.bold,
  56. color: Colors.white,
  57. ),
  58. ),
  59. Text(
  60. jdate.format(pattern: "yyyy").toUpperCase(),
  61. textAlign: TextAlign.center,
  62. style: const TextStyle(
  63. fontSize: 16,
  64. color: Colors.white,
  65. ),
  66. ),
  67. ],
  68. ),
  69. ),
  70. );
  71. }
  72. }