|
- // ignore_for_file: public_member_api_docs, sort_constructors_first
- import 'package:flutter/material.dart';
-
- import 'package:farm_tpf/presentation/screens/codes/models/stamp.dart';
-
- import '../../../../themes/app_colors.dart';
- import '../../../../themes/styles_text.dart';
- import 'package:farm_tpf/utils/formatter.dart';
-
- class ItemCode extends StatelessWidget {
- final Stamp item;
- final Function onPressed;
- ItemCode({
- Key? key,
- required this.item,
- required this.onPressed,
- }) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- var expiredDate = item.expiredDate?.format_DDMMYY().toString() ?? '';
- var quantity = item.quantity;
- var status = 'mới';
- switch (item.status) {
- case 'NEW':
- status = 'mới';
- break;
- default:
- }
- return GestureDetector(
- onTap: () {
- onPressed();
- },
- child: Container(
- padding: EdgeInsets.all(8),
- margin: EdgeInsets.symmetric(vertical: 4, horizontal: 8),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10),
- border: Border.all(
- color: Colors.grey.shade200,
- width: 1,
- ),
- color: AppColors.primary1.withOpacity(0.3),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- item.description ?? '',
- style: StylesText.body1,
- ),
- const SizedBox(
- height: 8,
- ),
- Text(
- '$expiredDate - $quantity tem - $status',
- style: StylesText.body6,
- ),
- ],
- ),
- ),
- );
- }
- }
|