feat: dukung penjualan produk per timbangan
Produk kini punya cara jual `unit` (cacah) atau `weight` (timbangan), mengikuti kontrak backend di docs/integration-weight-based-products.md. - tipe SellBy, domain/infrastructure unit baru, dan endpoint /api/v1/units - dialog input berat saat produk timbangan ditambahkan ke keranjang - tiap penimbangan jadi baris keranjang sendiri; total baris dihitung berat x harga satuan, sedangkan produk cacah tetap digabung - request ke backend mengirim quantity 1 dan membawa berat - migrasi DB v3: kolom sell_by, unit_id, unit_name, unit_abbreviation di tabel products supaya satuan tetap tampil saat offline - tampilan keranjang, struk, split bill, void, dan refund memakai berat - test/weight_based_products_test.dart menutup perilaku di atas (9 test) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import '../../../application/order/order_form/order_form_bloc.dart';
|
||||
import '../../../application/payment_method/payment_method_loader/payment_method_loader_bloc.dart';
|
||||
import '../../../application/table/table_loader/table_loader_bloc.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/product/product.dart';
|
||||
import '../../../injection.dart';
|
||||
import '../../components/spaces/space.dart';
|
||||
import '../../components/toast/flushbar.dart';
|
||||
@@ -86,14 +87,7 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
tag: 'checkout_screen',
|
||||
child: BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||
builder: (context, state) {
|
||||
final price = state.items.fold(
|
||||
0,
|
||||
(previousValue, element) =>
|
||||
previousValue +
|
||||
(element.product.price.toInt() +
|
||||
(element.variant?.priceModifier.toInt() ?? 0)) *
|
||||
element.quantity,
|
||||
);
|
||||
final price = state.items.cartTotal.toInt();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.white,
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../../domain/product/product.dart';
|
||||
import '../../../../../components/button/button.dart';
|
||||
import '../../../../../components/card/order_menu.dart';
|
||||
import '../../../../../components/spaces/space.dart';
|
||||
@@ -21,15 +22,7 @@ class HomeRightPanel extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||
builder: (context, state) {
|
||||
final price = state.items.isEmpty
|
||||
? 0.0
|
||||
: state.items
|
||||
.map(
|
||||
(e) =>
|
||||
(e.product.price + (e.variant?.priceModifier ?? 0)) *
|
||||
e.quantity,
|
||||
)
|
||||
.reduce((value, element) => value + element);
|
||||
final price = state.items.cartTotal;
|
||||
log('🛒 Total Price: $price');
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
@@ -87,8 +80,12 @@ class HomeRightPanel extends StatelessWidget {
|
||||
: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
itemBuilder: (context, index) =>
|
||||
OrderMenu(data: state.items[index]),
|
||||
itemBuilder: (context, index) => OrderMenu(
|
||||
// Baris berbobot bisa dihapus satu per satu, jadi
|
||||
// state tiap baris harus terikat ke identitasnya.
|
||||
key: ValueKey(state.items[index].lineId),
|
||||
data: state.items[index],
|
||||
),
|
||||
separatorBuilder: (context, index) =>
|
||||
const SpaceHeight(1.0),
|
||||
itemCount: state.items.length,
|
||||
|
||||
+8
-23
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../../domain/product/product.dart';
|
||||
import '../../../../../components/spaces/space.dart';
|
||||
|
||||
class SuccessAddItemOrderRightPanel extends StatelessWidget {
|
||||
@@ -86,14 +87,7 @@ class SuccessAddItemOrderRightPanel extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Text(
|
||||
(checkoutState.items.fold(
|
||||
0,
|
||||
(previousValue, element) =>
|
||||
previousValue +
|
||||
(element.product.price.toInt() +
|
||||
(element.variant?.priceModifier.toInt() ?? 0)) *
|
||||
element.quantity,
|
||||
)).toString().currencyFormatRpV2,
|
||||
checkoutState.items.cartTotal.toInt().toString().currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
@@ -165,15 +159,10 @@ class SuccessAddItemOrderRightPanel extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
(checkoutState.items.fold(
|
||||
0,
|
||||
(previousValue, element) =>
|
||||
previousValue +
|
||||
(element.product.price.toInt() +
|
||||
(element.variant?.priceModifier.toInt() ??
|
||||
0)) *
|
||||
element.quantity,
|
||||
)).toString().currencyFormatRpV2,
|
||||
checkoutState.items.cartTotal
|
||||
.toInt()
|
||||
.toString()
|
||||
.currencyFormatRpV2,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
@@ -270,7 +259,7 @@ class SuccessAddItemOrderRightPanel extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${item.quantity}x',
|
||||
(item.isWeighted ? item.quantityLabel : "${item.quantity}x"),
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
@@ -279,11 +268,7 @@ class SuccessAddItemOrderRightPanel extends StatelessWidget {
|
||||
),
|
||||
const SpaceHeight(8),
|
||||
Text(
|
||||
((item.product.price.toInt() +
|
||||
(item.variant?.priceModifier.toInt() ?? 0)) *
|
||||
item.quantity)
|
||||
.toString()
|
||||
.currencyFormatRpV2,
|
||||
item.lineTotal.toInt().toString().currencyFormatRpV2,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ class SuccessOrderRightPanel extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${item.quantity}x',
|
||||
(item.isWeighted ? item.quantityLabel : "${item.quantity}x"),
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -211,7 +211,9 @@ class OrderList extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'x${product.quantity}',
|
||||
(product.isWeighted
|
||||
? product.quantityLabel
|
||||
: "x${product.quantity}"),
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.primary,
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ class PaymentSuccessRightPanel extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${item.quantity}x',
|
||||
(item.isWeighted ? item.quantityLabel : "${item.quantity}x"),
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ class PaymentSuccessSplitBillRightPanel extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${item.quantity}x',
|
||||
(item.isWeighted ? item.quantityLabel : "${item.quantity}x"),
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -65,7 +65,9 @@ class PaymentLeftPanel extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'Qty: ${item.quantity} | ${item.productVariantName}',
|
||||
item.isWeighted
|
||||
? '${item.quantityLabel} | ${item.productVariantName}'
|
||||
: 'Qty: ${item.quantity} | ${item.productVariantName}',
|
||||
style: AppStyle.sm,
|
||||
),
|
||||
trailing: Text(
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ class RefundSuccessRightPanel extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${item.quantity}x',
|
||||
(item.isWeighted ? item.quantityLabel : "${item.quantity}x"),
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -62,7 +62,9 @@ class RefundLeftPanel extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Qty: ${item.quantity} x Rp ${item.unitPrice.currencyFormatRpV2} ',
|
||||
item.isWeighted
|
||||
? item.quantityPriceLabel
|
||||
: 'Qty: ${item.quantity} x ${item.unitPrice.currencyFormatRpV2}',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
|
||||
@@ -160,7 +160,9 @@ class SplitBillLeftPanel extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Qty: ${item.quantity} x Rp ${item.unitPrice.currencyFormatRpV2} ',
|
||||
item.isWeighted
|
||||
? item.quantityPriceLabel
|
||||
: 'Qty: ${item.quantity} x ${item.unitPrice.currencyFormatRpV2}',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
|
||||
@@ -332,97 +332,148 @@ class _SplitBillRightPanelState extends State<SplitBillRightPanel> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${item.unitPrice.currencyFormatRpV2} per item',
|
||||
item.isWeighted
|
||||
? '${item.unitPrice.currencyFormatRpV2} per ${item.unitLabel}'
|
||||
: '${item.unitPrice.currencyFormatRpV2} per item',
|
||||
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (selectedQty > 0) {
|
||||
setState(() {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.itemQuantityChanged(
|
||||
itemId: item.id,
|
||||
quantity: selectedQty - 1,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: selectedQty > 0 ? AppColor.primary : AppColor.border,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
size: 16,
|
||||
color: selectedQty > 0
|
||||
? Colors.white
|
||||
: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 40,
|
||||
height: 32,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'$selectedQty',
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (selectedQty < maxQty) {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.itemQuantityChanged(
|
||||
itemId: item.id,
|
||||
quantity: selectedQty + 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: selectedQty < maxQty
|
||||
? AppColor.primary
|
||||
: AppColor.border,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 16,
|
||||
color: selectedQty < maxQty
|
||||
? Colors.white
|
||||
: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Baris berbobot hanya punya dua keadaan: belum dibayar atau lunas.
|
||||
// Tidak ada nilai di antaranya, jadi stepper diganti tombol pilih.
|
||||
if (item.isWeighted)
|
||||
_buildWeightedLineSelector(item, selectedQty > 0, maxQty)
|
||||
else
|
||||
_buildQuantityStepper(item, selectedQty, maxQty),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWeightedLineSelector(OrderItem item, bool selected, int maxQty) {
|
||||
final canSelect = selected || maxQty > 0;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (!canSelect) return;
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.itemQuantityChanged(
|
||||
itemId: item.id,
|
||||
quantity: selected ? 0 : 1,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? AppColor.primary : Colors.transparent,
|
||||
border: Border.all(
|
||||
color: canSelect ? AppColor.primary : AppColor.border,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
selected ? Icons.check_circle : Icons.radio_button_unchecked,
|
||||
size: 16,
|
||||
color: selected ? Colors.white : AppColor.textSecondary,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
selected ? 'Dibayar' : 'Bayar baris',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: selected ? Colors.white : AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildQuantityStepper(OrderItem item, int selectedQty, int maxQty) {
|
||||
return Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (selectedQty > 0) {
|
||||
setState(() {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.itemQuantityChanged(
|
||||
itemId: item.id,
|
||||
quantity: selectedQty - 1,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: selectedQty > 0 ? AppColor.primary : AppColor.border,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
size: 16,
|
||||
color: selectedQty > 0 ? Colors.white : AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 40,
|
||||
height: 32,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'$selectedQty',
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (selectedQty < maxQty) {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.itemQuantityChanged(
|
||||
itemId: item.id,
|
||||
quantity: selectedQty + 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: selectedQty < maxQty ? AppColor.primary : AppColor.border,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 16,
|
||||
color: selectedQty < maxQty
|
||||
? Colors.white
|
||||
: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRowButtonSplit() {
|
||||
switch (widget.state.order.splitType) {
|
||||
case 'AMOUNT':
|
||||
@@ -510,7 +561,10 @@ class _SplitBillRightPanelState extends State<SplitBillRightPanel> {
|
||||
splitItems.add(
|
||||
originalItem.copyWith(
|
||||
quantity: quantity,
|
||||
totalPrice: (originalItem.unitPrice) * quantity,
|
||||
// Baris berbobot dibayar penuh; nilainya sudah weight x harga.
|
||||
totalPrice: originalItem.isWeighted
|
||||
? originalItem.totalPrice
|
||||
: (originalItem.unitPrice) * quantity,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ class VoidProductCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'Qty: ${item.quantity}',
|
||||
item.isWeighted
|
||||
? item.quantityLabel
|
||||
: 'Qty: ${item.quantity}',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blue[700],
|
||||
@@ -112,65 +114,13 @@ class VoidProductCard extends StatelessWidget {
|
||||
),
|
||||
|
||||
if (canSelect) ...[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Decrease Button
|
||||
InkWell(
|
||||
onTap: onTapDecrease,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
size: 16,
|
||||
color: voidQty > 0
|
||||
? AppColor.primary
|
||||
: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Quantity Display
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border.symmetric(
|
||||
vertical: BorderSide(color: AppColor.border),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'$voidQty',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Increase Button
|
||||
InkWell(
|
||||
onTap: onTapIncrease,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 16,
|
||||
color: voidQty < (item.quantity)
|
||||
? AppColor.primary
|
||||
: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Baris berbobot bersifat utuh: dibatalkan seluruhnya atau
|
||||
// tidak sama sekali, jadi yang ditawarkan tombol pilih baris
|
||||
// — bukan stepper jumlah.
|
||||
if (item.isWeighted)
|
||||
_buildLineSelector()
|
||||
else
|
||||
_buildQuantityStepper(),
|
||||
const SpaceWidth(20),
|
||||
],
|
||||
// Price
|
||||
@@ -195,7 +145,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
'Void: ${((item.unitPrice) * voidQty).currencyFormatRpV2}',
|
||||
'Void: ${(item.isWeighted ? item.totalPrice : (item.unitPrice) * voidQty).currencyFormatRpV2}',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontSize: 12,
|
||||
color: AppColor.error,
|
||||
@@ -214,4 +164,97 @@ class VoidProductCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Pilih atau lepas satu baris berbobot secara utuh.
|
||||
Widget _buildLineSelector() {
|
||||
final selected = voidQty > 0;
|
||||
|
||||
return InkWell(
|
||||
onTap: selected ? onTapDecrease : onTapIncrease,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? AppColor.primary : Colors.transparent,
|
||||
border: Border.all(
|
||||
color: selected ? AppColor.primary : AppColor.border,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
selected ? Icons.check_circle : Icons.radio_button_unchecked,
|
||||
size: 16,
|
||||
color: selected ? AppColor.white : AppColor.textSecondary,
|
||||
),
|
||||
const SpaceWidth(6),
|
||||
Text(
|
||||
selected ? 'Dipilih' : 'Pilih baris',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: selected ? AppColor.white : AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildQuantityStepper() {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Decrease Button
|
||||
InkWell(
|
||||
onTap: onTapDecrease,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
size: 16,
|
||||
color: voidQty > 0 ? AppColor.primary : Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Quantity Display
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border.symmetric(
|
||||
vertical: BorderSide(color: AppColor.border),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'$voidQty',
|
||||
style: AppStyle.sm.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
|
||||
// Increase Button
|
||||
InkWell(
|
||||
onTap: onTapIncrease,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 16,
|
||||
color: voidQty < (item.quantity)
|
||||
? AppColor.primary
|
||||
: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user