feat: product image and printer type
This commit is contained in:
@@ -59,9 +59,10 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
// color: AppColors.primary,
|
||||
// ),
|
||||
CachedNetworkImage(
|
||||
imageUrl: widget.data.product.name!.contains('http')
|
||||
? widget.data.product.name!
|
||||
: '${Variables.baseUrl}/${widget.data.product.name}',
|
||||
imageUrl: (widget.data.product.imageUrl ?? '')
|
||||
.contains('http')
|
||||
? widget.data.product.imageUrl!
|
||||
: '${Variables.baseUrl}/${widget.data.product.imageUrl}',
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
fit: BoxFit.cover,
|
||||
|
||||
@@ -42,9 +42,9 @@ class ProductCard extends StatelessWidget {
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: data.name!.contains('http')
|
||||
? data.name!
|
||||
: '${Variables.baseUrl}/${data.name}',
|
||||
imageUrl: (data.imageUrl ?? "").contains('http')
|
||||
? data.imageUrl!
|
||||
: '${Variables.baseUrl}/${data.imageUrl}',
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: 120,
|
||||
|
||||
@@ -28,9 +28,9 @@ class DetailProductDialog extends StatelessWidget {
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: product.name!.contains('http')
|
||||
? product.name!
|
||||
: '${Variables.baseUrl}/${product.name}',
|
||||
imageUrl: (product.imageUrl ?? "").contains('http')
|
||||
? product.imageUrl!
|
||||
: '${Variables.baseUrl}/${product.imageUrl}',
|
||||
fit: BoxFit.cover,
|
||||
width: 120,
|
||||
height: 120,
|
||||
|
||||
@@ -296,23 +296,20 @@ class _FormProductDialogState extends State<FormProductDialog> {
|
||||
return;
|
||||
}
|
||||
|
||||
// log("isBestSeller: $isBestSeller");
|
||||
// final String name = nameController!.text;
|
||||
// final int stock =
|
||||
// stockController!.text.toIntegerFromText;
|
||||
log("isBestSeller: $isBestSeller");
|
||||
final String name = nameController!.text;
|
||||
final int stock =
|
||||
stockController!.text.toIntegerFromText;
|
||||
|
||||
// final Product product = widget.product!.copyWith(
|
||||
// name: name,
|
||||
// price: priceValue.toString(),
|
||||
// stock: stock,
|
||||
// categoryId: selectCategory!.id!,
|
||||
// isFavorite: isBestSeller ? 1 : 0,
|
||||
// printerType: printType,
|
||||
// );
|
||||
final Product product = widget.product!.copyWith(
|
||||
name: name,
|
||||
price: priceValue,
|
||||
printerType: printType,
|
||||
);
|
||||
|
||||
// context.read<UpdateProductBloc>().add(
|
||||
// UpdateProductEvent.updateProduct(
|
||||
// product, imageFile));
|
||||
context.read<UpdateProductBloc>().add(
|
||||
UpdateProductEvent.updateProduct(
|
||||
product, imageFile));
|
||||
},
|
||||
label: 'Ubah Produk',
|
||||
);
|
||||
@@ -354,33 +351,30 @@ class _FormProductDialogState extends State<FormProductDialog> {
|
||||
orElse: () {
|
||||
return Button.filled(
|
||||
onPressed: () {
|
||||
// if (selectCategory == null) {
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// const SnackBar(
|
||||
// content: Text('Please select a category'),
|
||||
// backgroundColor: Colors.red,
|
||||
// ),
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
if (selectCategory == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Please select a category'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// log("isBestSeller: $isBestSeller");
|
||||
// final String name = nameController!.text;
|
||||
log("isBestSeller: $isBestSeller");
|
||||
final String name = nameController!.text;
|
||||
|
||||
// final int stock =
|
||||
// stockController!.text.toIntegerFromText;
|
||||
// final Product product = Product(
|
||||
// name: name,
|
||||
// price: priceValue.toString(),
|
||||
// stock: stock,
|
||||
// categoryId: selectCategory!.id!,
|
||||
// isFavorite: isBestSeller ? 1 : 0,
|
||||
// image: imageFile!.path,
|
||||
// printerType: printType,
|
||||
// );
|
||||
// context.read<AddProductBloc>().add(
|
||||
// AddProductEvent.addProduct(
|
||||
// product, imageFile!));
|
||||
final int stock =
|
||||
stockController!.text.toIntegerFromText;
|
||||
final Product product = Product(
|
||||
name: name,
|
||||
price: priceValue,
|
||||
imageUrl: imageFile!.path,
|
||||
printerType: printType,
|
||||
);
|
||||
context.read<AddProductBloc>().add(
|
||||
AddProductEvent.addProduct(
|
||||
product, imageFile!));
|
||||
},
|
||||
label: 'Simpan Produk',
|
||||
);
|
||||
|
||||
@@ -36,9 +36,9 @@ class MenuProductItem extends StatelessWidget {
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: data.name!.contains('http')
|
||||
? data.name!
|
||||
: '${Variables.baseUrl}/${data.name}',
|
||||
imageUrl: (data.imageUrl ?? '').contains('http')
|
||||
? data.imageUrl!
|
||||
: '${Variables.baseUrl}/${data.imageUrl}',
|
||||
fit: BoxFit.cover,
|
||||
errorWidget: (context, url, error) => Container(
|
||||
width: double.infinity,
|
||||
|
||||
Reference in New Issue
Block a user