83 lines
2.5 KiB
Dart
83 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:gap/gap.dart';
|
|
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class ItemCardWidget extends StatelessWidget {
|
|
final String imageUrl;
|
|
final String text;
|
|
final double price;
|
|
final double quantity;
|
|
|
|
const ItemCardWidget(
|
|
{super.key, required this.imageUrl, required this.text, required this.price, required this.quantity});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
const double imageSize = 180;
|
|
const Color fontColor = Color.fromRGBO(0, 0, 0, 1);
|
|
|
|
return Card(
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Image.network(imageUrl,
|
|
fit: BoxFit.cover,
|
|
width: imageSize,
|
|
height: imageSize / 1.4,
|
|
cacheWidth: (imageSize * MediaQuery.of(context).devicePixelRatio).round()),
|
|
const Gap(8),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
TextWidget(
|
|
text: text,
|
|
size: 10,
|
|
color: Colors.black,
|
|
bold: true,
|
|
),
|
|
TextWidget(
|
|
text: text,
|
|
size: 16,
|
|
color: Colors.black,
|
|
)
|
|
],
|
|
),
|
|
const Gap(
|
|
92,
|
|
color: Colors.red,
|
|
),
|
|
TextWidget(
|
|
text: quantity.toStringAsFixed(0),
|
|
size: 12,
|
|
color: const Color.fromRGBO(39, 39, 39, 1),
|
|
)
|
|
]),
|
|
),
|
|
const Gap(8),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(
|
|
children: [
|
|
Image.asset('assets/php_logo.webp',
|
|
fit: BoxFit.cover, height: 12, cacheWidth: (10 * MediaQuery.of(context).devicePixelRatio).round()),
|
|
const Gap(4),
|
|
TextWidget(
|
|
text: NumberFormat.currency(locale: "en_US", symbol: "").format(price),
|
|
size: 14,
|
|
bold: true,
|
|
color: fontColor,
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
));
|
|
}
|
|
}
|