You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
3.7KB

  1. import 'package:farm_tpf/utils/formatter.dart';
  2. import 'package:flutter/material.dart';
  3. import '../../../../themes/app_colors.dart';
  4. import '../../../../themes/styles_text.dart';
  5. import '../models/stamp_timeline.dart';
  6. class ItemCodeTimeline extends StatelessWidget {
  7. final Function onPressed;
  8. final ContentTimeline item;
  9. const ItemCodeTimeline({
  10. super.key,
  11. required this.onPressed,
  12. required this.item,
  13. });
  14. @override
  15. Widget build(BuildContext context) {
  16. return Container(
  17. child: Stack(
  18. children: [
  19. Row(
  20. children: [
  21. const SizedBox(
  22. width: 16,
  23. height: 20,
  24. ),
  25. Expanded(child: _widgetTimeLine()),
  26. ],
  27. ),
  28. Positioned(
  29. top: 0,
  30. left: 8,
  31. child: Container(
  32. color: Colors.white,
  33. width: 16,
  34. height: 24,
  35. child: Column(
  36. children: [
  37. Container(
  38. width: 16,
  39. height: 16,
  40. decoration: BoxDecoration(
  41. borderRadius: BorderRadius.circular(
  42. 16,
  43. ),
  44. color: Colors.green,
  45. ),
  46. ),
  47. ],
  48. ),
  49. ),
  50. ),
  51. ],
  52. ),
  53. );
  54. }
  55. Widget _widgetTimeLine() {
  56. return Container(
  57. width: double.infinity,
  58. padding: const EdgeInsets.only(
  59. left: 12,
  60. right: 8,
  61. ),
  62. margin: const EdgeInsets.only(
  63. bottom: 8,
  64. ),
  65. decoration: BoxDecoration(
  66. border: Border(
  67. left: BorderSide(color: Colors.blue),
  68. ),
  69. ),
  70. child: Column(
  71. children: [
  72. Row(
  73. mainAxisAlignment: MainAxisAlignment.start,
  74. children: [
  75. Text(
  76. '${item.activityTypeDescription ?? ''} - ',
  77. style: StylesText.body5,
  78. ),
  79. Text(
  80. '${item.executeDate?.format_DDMMYY()}',
  81. style: StylesText.caption3.copyWith(),
  82. )
  83. ],
  84. ),
  85. const SizedBox(
  86. height: 8,
  87. ),
  88. _widgetItemInfoCompleted(
  89. title: 'Mô tả',
  90. actionDate: item.description ?? '',
  91. location: item.location ?? '',
  92. ),
  93. ],
  94. ),
  95. );
  96. }
  97. Widget _widgetItemInfoCompleted({
  98. required String title,
  99. required String actionDate,
  100. String? location,
  101. }) {
  102. return Container(
  103. padding: const EdgeInsets.all(8),
  104. decoration: BoxDecoration(
  105. borderRadius: BorderRadius.circular(8),
  106. color: AppColors.background1,
  107. ),
  108. child: Column(
  109. mainAxisAlignment: MainAxisAlignment.start,
  110. crossAxisAlignment: CrossAxisAlignment.start,
  111. children: [
  112. Row(
  113. children: [
  114. Expanded(
  115. child: Text(
  116. title,
  117. style: StylesText.caption2.copyWith(
  118. color: AppColors.neutral1,
  119. ),
  120. ),
  121. ),
  122. Text(
  123. actionDate,
  124. style: StylesText.caption3.copyWith(
  125. color: AppColors.neutral1,
  126. ),
  127. ),
  128. ],
  129. ),
  130. Padding(
  131. padding: const EdgeInsets.symmetric(vertical: 8.0),
  132. child: Text(
  133. location ?? '',
  134. style: StylesText.caption3.copyWith(
  135. color: AppColors.neutral1,
  136. ),
  137. ),
  138. ),
  139. ],
  140. ),
  141. );
  142. }
  143. }