const constructure
This commit is contained in:
@@ -43,7 +43,7 @@ class VoidSuccessPage extends StatelessWidget {
|
||||
flex: 35,
|
||||
child: VoidSuccessLeftPanel(state: state),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
const SpaceWidth(16),
|
||||
Expanded(
|
||||
flex: 65,
|
||||
child: VoidSuccessRightPanel(state: state),
|
||||
|
||||
+14
-10
@@ -22,14 +22,14 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColor.secondaryLight, AppColor.secondaryDark],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -39,14 +39,18 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
BoxShadow(
|
||||
color: AppColor.secondaryDark.withOpacity(0.2),
|
||||
blurRadius: 20,
|
||||
offset: Offset(0, 10),
|
||||
offset: const Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Icon(Icons.check_rounded, color: Colors.white, size: 60),
|
||||
child: const Icon(
|
||||
Icons.check_rounded,
|
||||
color: Colors.white,
|
||||
size: 60,
|
||||
),
|
||||
),
|
||||
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
Text(
|
||||
'Void Berhasil!',
|
||||
style: AppStyle.h1.copyWith(
|
||||
@@ -55,7 +59,7 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
Text(
|
||||
state.voidType.isAll
|
||||
? 'Seluruh pesanan telah dibatalkan dengan sukses'
|
||||
@@ -66,7 +70,7 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -75,7 +79,7 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
'Informasi Pesanan',
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
_buildInfoRow(
|
||||
icon: Icons.receipt_long,
|
||||
label: 'Order ID',
|
||||
@@ -139,7 +143,7 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
child: AppElevatedButton.outlined(
|
||||
onPressed: () {
|
||||
context.read<VoidFormBloc>().add(
|
||||
VoidFormEvent.clearState(),
|
||||
const VoidFormEvent.clearState(),
|
||||
);
|
||||
context.router.replaceAll([const MainRoute()]);
|
||||
},
|
||||
@@ -167,7 +171,7 @@ class VoidSuccessLeftPanel extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
label: 'Cetak Struk',
|
||||
icon: Icon(Icons.print_rounded, color: AppColor.white),
|
||||
icon: const Icon(Icons.print_rounded, color: AppColor.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+9
-9
@@ -79,7 +79,7 @@ class VoidSuccessRightPanel extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceWidth(6),
|
||||
const SpaceWidth(6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
state.voidReason ?? '',
|
||||
@@ -121,13 +121,13 @@ class VoidSuccessRightPanel extends StatelessWidget {
|
||||
color: AppColor.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.payments_rounded,
|
||||
size: 16,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Text(
|
||||
'Total Void',
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
|
||||
@@ -192,7 +192,7 @@ class VoidSuccessRightPanel extends StatelessWidget {
|
||||
color: AppColor.primaryWithOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.restaurant_rounded,
|
||||
color: AppColor.primary,
|
||||
size: 28,
|
||||
@@ -281,9 +281,9 @@ class VoidSuccessRightPanel extends StatelessWidget {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: AppColor.border)),
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -298,13 +298,13 @@ class VoidSuccessRightPanel extends StatelessWidget {
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: AppColor.primary,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
const SpaceWidth(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -313,7 +313,7 @@ class VoidSuccessRightPanel extends StatelessWidget {
|
||||
'Detail Void',
|
||||
style: AppStyle.xxl.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
'Ringkasan item yang divoid',
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
|
||||
@@ -28,7 +28,7 @@ class VoidPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
(f) => AppFlushbar.showOrderFailureToast(context, f),
|
||||
(success) {
|
||||
if (context.mounted) {
|
||||
context.router.replace(VoidSuccessRoute());
|
||||
context.router.replace(const VoidSuccessRoute());
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -40,12 +40,12 @@ class VoidPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
child: BlocBuilder<VoidFormBloc, VoidFormState>(
|
||||
builder: (context, state) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Row(
|
||||
children: [
|
||||
// Left Panel - Order Details & Items
|
||||
Expanded(flex: 3, child: VoidLeftPanel(state: state)),
|
||||
SpaceWidth(24),
|
||||
const SpaceWidth(24),
|
||||
// Right Panel - Void Configuration
|
||||
Expanded(flex: 2, child: VoidRightPanel(state: state)),
|
||||
],
|
||||
|
||||
@@ -36,8 +36,8 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(width: 1, color: AppColor.border),
|
||||
),
|
||||
@@ -48,8 +48,12 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.receipt_long, color: AppColor.primary, size: 24),
|
||||
SpaceWidth(12),
|
||||
const Icon(
|
||||
Icons.receipt_long,
|
||||
color: AppColor.primary,
|
||||
size: 24,
|
||||
),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -71,7 +75,10 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: _getStatusColor(
|
||||
widget.state.order.status,
|
||||
@@ -95,18 +102,18 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
thumbVisibility: true,
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
padding: EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
const Icon(
|
||||
Icons.shopping_cart,
|
||||
color: AppColor.primary,
|
||||
size: 20,
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Text(
|
||||
'Produk Pesanan (${widget.state.pendingItems.length})',
|
||||
style: AppStyle.lg.copyWith(
|
||||
@@ -116,7 +123,7 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
...List.generate(widget.state.pendingItems.length, (index) {
|
||||
final item = widget.state.pendingItems[index];
|
||||
@@ -158,7 +165,7 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildSummaryRow(
|
||||
@@ -173,7 +180,7 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
// 'Diskon:',
|
||||
// '- ${(widget.state.order.discountAmount).currencyFormatRpV2}',
|
||||
// ),
|
||||
Divider(thickness: 1),
|
||||
const Divider(thickness: 1),
|
||||
_buildSummaryRow(
|
||||
'Total:',
|
||||
(widget.state.order.totalAmount).currencyFormatRpV2,
|
||||
@@ -203,7 +210,7 @@ class _VoidLeftPanelState extends State<VoidLeftPanel> {
|
||||
bool isVoid = false,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
@@ -25,7 +25,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 12),
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColor.primary.withOpacity(0.1) : Colors.white,
|
||||
border: Border.all(
|
||||
@@ -35,7 +35,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
@@ -58,11 +58,11 @@ class VoidProductCard extends StatelessWidget {
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 2,
|
||||
),
|
||||
@@ -78,7 +78,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Text(
|
||||
(item.unitPrice).currencyFormatRpV2,
|
||||
style: AppStyle.sm.copyWith(
|
||||
@@ -89,9 +89,9 @@ class VoidProductCard extends StatelessWidget {
|
||||
),
|
||||
if (item.notes.isNotEmpty)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 2,
|
||||
),
|
||||
@@ -124,7 +124,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
InkWell(
|
||||
onTap: onTapDecrease,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
size: 16,
|
||||
@@ -137,11 +137,11 @@ class VoidProductCard extends StatelessWidget {
|
||||
|
||||
// Quantity Display
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border.symmetric(
|
||||
vertical: BorderSide(color: AppColor.border),
|
||||
),
|
||||
@@ -158,7 +158,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
InkWell(
|
||||
onTap: onTapIncrease,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 16,
|
||||
@@ -171,7 +171,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SpaceWidth(20),
|
||||
const SpaceWidth(20),
|
||||
],
|
||||
// Price
|
||||
Column(
|
||||
@@ -186,7 +186,7 @@ class VoidProductCard extends StatelessWidget {
|
||||
),
|
||||
if (isSelected)
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
|
||||
@@ -40,8 +40,8 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(width: 1, color: AppColor.border),
|
||||
),
|
||||
@@ -68,7 +68,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
thumbVisibility: true,
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
padding: EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -79,7 +79,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
VoidRadio(
|
||||
voidType: widget.state.voidType,
|
||||
value: VoidType.all,
|
||||
@@ -87,14 +87,14 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
subtitle: "Batalkan pesanan lengkap dan semua item",
|
||||
onChanged: (VoidType? value) {
|
||||
context.read<VoidFormBloc>().add(
|
||||
VoidFormEvent.clearSelectedItem(),
|
||||
const VoidFormEvent.clearSelectedItem(),
|
||||
);
|
||||
context.read<VoidFormBloc>().add(
|
||||
VoidFormEvent.voidTypeChanged(value!),
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
VoidRadio(
|
||||
voidType: widget.state.voidType,
|
||||
value: VoidType.item,
|
||||
@@ -107,12 +107,12 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
|
||||
// Selected Items Summary (only show for item void)
|
||||
if (widget.state.voidType.isItem) ...[
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.state.selectedItemQuantities.isEmpty
|
||||
? AppColor.warning.withOpacity(0.1)
|
||||
@@ -142,7 +142,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
: AppColor.success,
|
||||
size: 20,
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.state.selectedItemQuantities.isEmpty
|
||||
@@ -166,9 +166,11 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
.state
|
||||
.selectedItemQuantities
|
||||
.isNotEmpty) ...[
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 150),
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: 150,
|
||||
),
|
||||
child: Scrollbar(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
@@ -188,10 +190,10 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
item.id == entry.key,
|
||||
);
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
margin: const EdgeInsets.only(
|
||||
bottom: 8,
|
||||
),
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius:
|
||||
@@ -247,9 +249,9 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(height: 16, thickness: 1),
|
||||
const Divider(height: 16, thickness: 1),
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.error,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
@@ -282,7 +284,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
],
|
||||
),
|
||||
),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
],
|
||||
|
||||
Text(
|
||||
@@ -292,7 +294,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
AppTextFormField(
|
||||
label: 'Harap berikan alasan untuk membatalkan...',
|
||||
showLabel: false,
|
||||
@@ -303,7 +305,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(32),
|
||||
const SpaceHeight(32),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -312,7 +314,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
|
||||
// Action Buttons
|
||||
Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -321,7 +323,7 @@ class _VoidRightPanelState extends State<VoidRightPanel> {
|
||||
label: 'Batal',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
onPressed: _canProcessVoid() ? _processVoid : null,
|
||||
|
||||
Reference in New Issue
Block a user