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.

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