feat: syn product
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/core/constants/variables.dart';
|
||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||
import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
||||
|
||||
@@ -52,7 +51,7 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.0)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
child:
|
||||
// Icon(
|
||||
// Icons.fastfood,
|
||||
@@ -60,14 +59,23 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
// color: AppColors.primary,
|
||||
// ),
|
||||
CachedNetworkImage(
|
||||
imageUrl: widget.data.product.image!.contains('http')
|
||||
? widget.data.product.image!
|
||||
: '${Variables.baseUrl}/${widget.data.product.image}',
|
||||
imageUrl: widget.data.product.name!.contains('http')
|
||||
? widget.data.product.name!
|
||||
: '${Variables.baseUrl}/${widget.data.product.name}',
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
fit: BoxFit.cover,
|
||||
errorWidget: (context, url, error) =>
|
||||
const Icon(Icons.error),
|
||||
errorWidget: (context, url, error) => Container(
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.disabled.withOpacity(0.4),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.image,
|
||||
color: AppColors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Row(
|
||||
@@ -86,8 +94,7 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(widget.data.product.price!.toIntegerFromText
|
||||
.currencyFormatRp),
|
||||
Text(widget.data.product.price!.currencyFormatRp),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -139,8 +146,7 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
SizedBox(
|
||||
width: 80.0,
|
||||
child: Text(
|
||||
(widget.data.product.price!.toIntegerFromText *
|
||||
widget.data.quantity)
|
||||
(widget.data.product.price! * widget.data.quantity)
|
||||
.currencyFormatRp,
|
||||
textAlign: TextAlign.right,
|
||||
style: const TextStyle(
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/core/constants/variables.dart';
|
||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||
import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
||||
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
|
||||
|
||||
@@ -43,9 +42,9 @@ class ProductCard extends StatelessWidget {
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: data.image!.contains('http')
|
||||
? data.image!
|
||||
: '${Variables.baseUrl}/${data.image}',
|
||||
imageUrl: data.name!.contains('http')
|
||||
? data.name!
|
||||
: '${Variables.baseUrl}/${data.name}',
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: 120,
|
||||
@@ -76,7 +75,7 @@ class ProductCard extends StatelessWidget {
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
data.category?.name ?? '-',
|
||||
'-',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.grey,
|
||||
@@ -90,7 +89,7 @@ class ProductCard extends StatelessWidget {
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
data.price!.toIntegerFromText.currencyFormatRp,
|
||||
data.price!.currencyFormatRp,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
|
||||
Reference in New Issue
Block a user