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.

65 lines
1.7KB

  1. // ignore_for_file: public_member_api_docs, sort_constructors_first
  2. import 'package:flutter/material.dart';
  3. import 'package:farm_tpf/presentation/screens/codes/models/stamp.dart';
  4. import '../../../../themes/app_colors.dart';
  5. import '../../../../themes/styles_text.dart';
  6. import 'package:farm_tpf/utils/formatter.dart';
  7. class ItemCode extends StatelessWidget {
  8. final Stamp item;
  9. final Function onPressed;
  10. ItemCode({
  11. Key? key,
  12. required this.item,
  13. required this.onPressed,
  14. }) : super(key: key);
  15. @override
  16. Widget build(BuildContext context) {
  17. var expiredDate = item.expiredDate?.format_DDMMYY().toString() ?? '';
  18. var quantity = item.quantity;
  19. var status = 'mới';
  20. switch (item.status) {
  21. case 'NEW':
  22. status = 'mới';
  23. break;
  24. default:
  25. }
  26. return GestureDetector(
  27. onTap: () {
  28. onPressed();
  29. },
  30. child: Container(
  31. padding: EdgeInsets.all(8),
  32. margin: EdgeInsets.symmetric(vertical: 4, horizontal: 8),
  33. decoration: BoxDecoration(
  34. borderRadius: BorderRadius.circular(10),
  35. border: Border.all(
  36. color: Colors.grey.shade200,
  37. width: 1,
  38. ),
  39. color: AppColors.primary1.withOpacity(0.3),
  40. ),
  41. child: Column(
  42. crossAxisAlignment: CrossAxisAlignment.start,
  43. children: [
  44. Text(
  45. item.description ?? '',
  46. style: StylesText.body1,
  47. ),
  48. const SizedBox(
  49. height: 8,
  50. ),
  51. Text(
  52. '$expiredDate - $quantity tem - $status',
  53. style: StylesText.body6,
  54. ),
  55. ],
  56. ),
  57. ),
  58. );
  59. }
  60. }