feat: product variant
This commit is contained in:
@@ -95,7 +95,11 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(widget.data.product.price!.currencyFormatRp),
|
||||
Text((widget.data.product.price! +
|
||||
(widget.data.variant?.priceModifier ?? 0))
|
||||
.currencyFormatRp),
|
||||
if (widget.data.variant != null)
|
||||
Text(widget.data.variant?.name ?? ""),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -104,9 +108,8 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context
|
||||
.read<CheckoutBloc>()
|
||||
.add(CheckoutEvent.removeItem(widget.data.product));
|
||||
context.read<CheckoutBloc>().add(CheckoutEvent.removeItem(
|
||||
widget.data.product, widget.data.variant));
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
@@ -127,9 +130,12 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context
|
||||
.read<CheckoutBloc>()
|
||||
.add(CheckoutEvent.addItem(widget.data.product));
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.addItem(
|
||||
widget.data.product,
|
||||
widget.data.variant,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
@@ -147,7 +153,8 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
SizedBox(
|
||||
width: 80.0,
|
||||
child: Text(
|
||||
(widget.data.product.price! * widget.data.quantity)
|
||||
(widget.data.product.price! * widget.data.quantity +
|
||||
(widget.data.variant?.priceModifier ?? 0))
|
||||
.currencyFormatRp,
|
||||
textAlign: TextAlign.right,
|
||||
style: const TextStyle(
|
||||
@@ -179,9 +186,12 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
const SpaceWidth(16.0),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context
|
||||
.read<CheckoutBloc>()
|
||||
.add(CheckoutEvent.deleteItem(widget.data.product));
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.deleteItem(
|
||||
widget.data.product,
|
||||
widget.data.variant,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
|
||||
Reference in New Issue
Block a user