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.

178 lines
4.9KB

  1. import 'package:farm_tpf/presentation/custom_widgets/app_bar_widget.dart';
  2. import 'package:farm_tpf/presentation/custom_widgets/button/second_button.dart';
  3. import 'package:farm_tpf/presentation/screens/codes/update_activity_page.dart';
  4. import 'package:farm_tpf/presentation/screens/codes/widgets/item_code_timeline.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:get/get.dart';
  7. import '../../../themes/styles_text.dart';
  8. class CodeDetailPage extends StatefulWidget {
  9. const CodeDetailPage({super.key});
  10. @override
  11. State<CodeDetailPage> createState() => _CodeDetailPageState();
  12. }
  13. class _CodeDetailPageState extends State<CodeDetailPage> {
  14. @override
  15. Widget build(BuildContext context) {
  16. return Scaffold(
  17. appBar: AppBarWidget(
  18. action: IconButton(
  19. onPressed: () {
  20. Get.to(() => UpdateActivityPage(
  21. stampCode: 'AC_494D9D90',
  22. ));
  23. },
  24. icon: Icon(
  25. Icons.edit,
  26. color: Colors.blue,
  27. ),
  28. ),
  29. ),
  30. body: Padding(
  31. padding: const EdgeInsets.all(8.0),
  32. child: Column(
  33. children: [
  34. Expanded(
  35. child: SingleChildScrollView(
  36. child: Column(
  37. children: [
  38. _itemCodeDetail(
  39. title: 'Tên sản phẩm',
  40. detail: 'Cà rốt',
  41. titleStyle: StylesText.body4,
  42. detailStyle: StylesText.body4.copyWith(
  43. color: Colors.blue,
  44. ),
  45. ),
  46. _itemCodeDetail(title: 'Mô tả', detail: 'detail'),
  47. _itemCodeDetail(title: 'Số lượng tem', detail: 'detail'),
  48. _itemCodeDetail(title: 'Trạng thái', detail: 'detail'),
  49. _itemCodeDetail(title: 'Hạn sử dụng', detail: 'detail'),
  50. _itemCodeDetail(title: 'Mẫu tem', detail: 'detail'),
  51. Text(
  52. 'Timeline hoạt động',
  53. style: StylesText.body1,
  54. ),
  55. _timelineWidget(),
  56. ],
  57. ),
  58. ),
  59. ),
  60. const SizedBox(
  61. height: 8,
  62. ),
  63. // Container(
  64. // width: 100,
  65. // height: 100,
  66. // color: Colors.red,
  67. // ),
  68. _actionButtonWidget(),
  69. ],
  70. ),
  71. ),
  72. );
  73. }
  74. Widget _timelineWidget() {
  75. return ListView.builder(
  76. itemBuilder: (context, index) {
  77. return ItemCodeTimeline(
  78. onPressed: () {},
  79. );
  80. },
  81. itemCount: 20,
  82. physics: NeverScrollableScrollPhysics(),
  83. shrinkWrap: true,
  84. );
  85. }
  86. Widget _actionButtonWidget() {
  87. return Wrap(
  88. spacing: 8,
  89. children: [
  90. Row(
  91. children: [
  92. Expanded(
  93. child: SecondButton(
  94. onPressed: () {},
  95. title: 'Kích hoạt toàn bộ',
  96. borderColor: Colors.blue,
  97. textColor: Colors.blue,
  98. width: double.infinity,
  99. height: 40,
  100. ),
  101. ),
  102. Expanded(
  103. child: SecondButton(
  104. onPressed: () {},
  105. title: 'Huỷ toàn bộ',
  106. borderColor: Colors.red,
  107. textColor: Colors.white,
  108. color: Colors.red,
  109. width: double.infinity,
  110. height: 40,
  111. ),
  112. ),
  113. ],
  114. ),
  115. const SizedBox(
  116. height: 8,
  117. ),
  118. Row(
  119. children: [
  120. Expanded(
  121. child: SecondButton(
  122. onPressed: () {},
  123. title: 'Cập nhật hoạt động',
  124. borderColor: Colors.green,
  125. textColor: Colors.green,
  126. width: double.infinity,
  127. height: 40,
  128. ),
  129. ),
  130. Expanded(
  131. child: SecondButton(
  132. onPressed: () {},
  133. title: 'In / Xuất file',
  134. borderColor: Colors.cyan,
  135. textColor: Colors.white,
  136. color: Colors.cyan,
  137. width: double.infinity,
  138. height: 40,
  139. ),
  140. ),
  141. ],
  142. ),
  143. ],
  144. );
  145. }
  146. Widget _itemCodeDetail({
  147. required String title,
  148. required String detail,
  149. TextStyle? titleStyle,
  150. TextStyle? detailStyle,
  151. }) {
  152. return Padding(
  153. padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
  154. child: Row(
  155. children: [
  156. Expanded(
  157. child: Text(
  158. title,
  159. style: titleStyle ?? StylesText.body6,
  160. ),
  161. ),
  162. Text(
  163. detail,
  164. style: detailStyle ?? StylesText.body6,
  165. )
  166. ],
  167. ),
  168. );
  169. }
  170. }