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.

60 lines
1.7KB

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