rd-android-app/lib/widgets/inventory_product_card.dart
2025-02-06 16:32:23 +05:30

118 lines
3.9 KiB
Dart

import 'package:cheminova/models/InventoryManagementResponse.dart';
import 'package:cheminova/models/product_model.dart';
import 'package:cheminova/screens/inventory/inventory_product_detail_screen.dart';
import 'package:cheminova/screens/inventory/update_stock_screen.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
class InventoryProductCard extends StatelessWidget {
final Products product;
const InventoryProductCard({
super.key,
required this.product,
});
@override
Widget build(BuildContext context) {
return Card(
child: Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Container(
height: Get.height * 0.15,
width: Get.width * 0.30,
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset(
"assets/images/new_product.jpeg",
//'assets/images/product.png'
).image,
fit: BoxFit.cover,
),
),
),
),
),
const SizedBox(
width: 10,
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
product.name ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: GoogleFonts.roboto(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(
"Stock: ${product.stock ?? 0}",
style: GoogleFonts.roboto(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
ElevatedButton(
onPressed: () => Get.to(
() => InventoryProductDetailScreen(
product: product,
),
),
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: const Color(0xFF004791),
padding:
const EdgeInsets.symmetric(horizontal: 18, vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: Text(
"Details",
style: GoogleFonts.roboto(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
),
ElevatedButton(
onPressed: () => Get.to(
() => UpdateStockScreen(
product: product,
),
),
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: const Color(0xFF00784C),
padding:
const EdgeInsets.symmetric(horizontal: 18, vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: Text(
"Update",
style: GoogleFonts.roboto(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
),
],
),
)
],
),
);
}
}