split bill
This commit is contained in:
parent
7961c9d8c5
commit
6b42cd86ff
@ -0,0 +1,85 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart' hide Order;
|
||||
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/types/split_type.dart';
|
||||
import '../../../domain/customer/customer.dart';
|
||||
import '../../../domain/order/order.dart';
|
||||
|
||||
part 'split_bill_form_event.dart';
|
||||
part 'split_bill_form_state.dart';
|
||||
part 'split_bill_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class SplitBillFormBloc extends Bloc<SplitBillFormEvent, SplitBillFormState> {
|
||||
SplitBillFormBloc() : super(SplitBillFormState.initial()) {
|
||||
on<SplitBillFormEvent>(_onSplitBillFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onSplitBillFormEvent(
|
||||
SplitBillFormEvent event,
|
||||
Emitter<SplitBillFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
setOrder: (e) async {
|
||||
List<OrderItem> pendingItems = e.order.orderItems
|
||||
.where((item) => item.status == 'pending')
|
||||
.toList();
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
order: e.order,
|
||||
pendingItems: pendingItems,
|
||||
splitType: e.order.splitType.isEmpty
|
||||
? SplitType.amount
|
||||
: e.order.splitType.toSplitType(),
|
||||
),
|
||||
);
|
||||
},
|
||||
customerChanged: (e) async {
|
||||
emit(state.copyWith(customer: e.customer));
|
||||
},
|
||||
customerNameChanged: (e) async {
|
||||
emit(state.copyWith(customerName: e.customerName));
|
||||
},
|
||||
splitTypeChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
splitType: e.splitType,
|
||||
totalAmount: 0,
|
||||
selectedProducts: {},
|
||||
),
|
||||
);
|
||||
},
|
||||
itemQuantityChanged: (e) async {
|
||||
final newQuantities = Map<String, int>.from(state.selectedProducts);
|
||||
|
||||
if (e.quantity > 0) {
|
||||
newQuantities[e.itemId] = e.quantity;
|
||||
} else {
|
||||
newQuantities.remove(e.itemId);
|
||||
}
|
||||
|
||||
// Recalculate total price
|
||||
int newTotal = 0;
|
||||
for (var entry in newQuantities.entries) {
|
||||
final item = state.pendingItems.firstWhere(
|
||||
(item) => item.id == entry.key,
|
||||
);
|
||||
newTotal += item.unitPrice.toInt() * entry.value;
|
||||
}
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
selectedProducts: newQuantities,
|
||||
totalAmount: newTotal,
|
||||
),
|
||||
);
|
||||
},
|
||||
amountChanged: (e) async {
|
||||
emit(state.copyWith(totalAmount: e.amount));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,17 @@
|
||||
part of 'split_bill_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SplitBillFormEvent with _$SplitBillFormEvent {
|
||||
const factory SplitBillFormEvent.setOrder(Order order) = _SetOrder;
|
||||
const factory SplitBillFormEvent.customerChanged(Customer customer) =
|
||||
_CustomerChanged;
|
||||
const factory SplitBillFormEvent.customerNameChanged(String customerName) =
|
||||
_CustomerNameChanged;
|
||||
const factory SplitBillFormEvent.splitTypeChanged(SplitType splitType) =
|
||||
_SplitTypeChanged;
|
||||
const factory SplitBillFormEvent.itemQuantityChanged({
|
||||
required String itemId,
|
||||
required int quantity,
|
||||
}) = _ItemQuantityChanged;
|
||||
const factory SplitBillFormEvent.amountChanged(int amount) = _AmountChanged;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
part of 'split_bill_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SplitBillFormState with _$SplitBillFormState {
|
||||
factory SplitBillFormState({
|
||||
required Order order,
|
||||
required List<OrderItem> pendingItems,
|
||||
Customer? customer,
|
||||
required String customerName,
|
||||
required SplitType splitType,
|
||||
required Map<String, int> selectedProducts,
|
||||
@Default(0) int totalAmount,
|
||||
@Default(false) bool isConfirming,
|
||||
}) = _SplitBillFormState;
|
||||
|
||||
factory SplitBillFormState.initial() => SplitBillFormState(
|
||||
order: Order.empty(),
|
||||
pendingItems: [],
|
||||
customerName: '',
|
||||
splitType: SplitType.amount,
|
||||
selectedProducts: {},
|
||||
);
|
||||
}
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../domain/table/table.dart';
|
||||
import '../types/split_type.dart';
|
||||
import '../types/void_type.dart';
|
||||
|
||||
part 'build_context_extension.dart';
|
||||
|
||||
@ -39,12 +39,23 @@ extension StringX on String {
|
||||
|
||||
VoidType toVoidType() {
|
||||
switch (this) {
|
||||
case 'all':
|
||||
case 'ALL':
|
||||
return VoidType.all;
|
||||
case 'item':
|
||||
case 'ITEM':
|
||||
return VoidType.item;
|
||||
default:
|
||||
return VoidType.unknown;
|
||||
}
|
||||
}
|
||||
|
||||
SplitType toSplitType() {
|
||||
switch (this) {
|
||||
case 'AMOUNT':
|
||||
return SplitType.amount;
|
||||
case 'ITEM':
|
||||
return SplitType.item;
|
||||
default:
|
||||
return SplitType.unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
lib/common/types/split_type.dart
Normal file
12
lib/common/types/split_type.dart
Normal file
@ -0,0 +1,12 @@
|
||||
enum SplitType { amount, item, unknown }
|
||||
|
||||
extension SplitTypeX on SplitType {
|
||||
String toStringType() => switch (this) {
|
||||
SplitType.amount => 'AMOUNT',
|
||||
SplitType.item => 'ITEM',
|
||||
SplitType.unknown => 'unknown',
|
||||
};
|
||||
|
||||
bool get isAmount => this == SplitType.amount;
|
||||
bool get isItem => this == SplitType.item;
|
||||
}
|
||||
@ -30,6 +30,8 @@ import 'package:apskel_pos_flutter_v2/application/payment_method/payment_method_
|
||||
as _i952;
|
||||
import 'package:apskel_pos_flutter_v2/application/product/product_loader/product_loader_bloc.dart'
|
||||
as _i13;
|
||||
import 'package:apskel_pos_flutter_v2/application/split_bill/split_bill_form/split_bill_form_bloc.dart'
|
||||
as _i334;
|
||||
import 'package:apskel_pos_flutter_v2/application/sync/sync_bloc.dart' as _i741;
|
||||
import 'package:apskel_pos_flutter_v2/application/table/table_form/table_form_bloc.dart'
|
||||
as _i248;
|
||||
@ -126,6 +128,7 @@ extension GetItInjectableX on _i174.GetIt {
|
||||
preResolve: true,
|
||||
);
|
||||
gh.factory<_i13.CheckoutFormBloc>(() => _i13.CheckoutFormBloc());
|
||||
gh.factory<_i334.SplitBillFormBloc>(() => _i334.SplitBillFormBloc());
|
||||
gh.singleton<_i487.DatabaseHelper>(() => databaseDi.databaseHelper);
|
||||
gh.lazySingleton<_i361.Dio>(() => dioDi.dio);
|
||||
gh.lazySingleton<_i800.AppRouter>(() => autoRouteDi.appRouter);
|
||||
|
||||
@ -96,7 +96,9 @@ class OrderRightPanel extends StatelessWidget {
|
||||
SpaceWidth(8),
|
||||
AppElevatedButton.outlined(
|
||||
onPressed: () {
|
||||
// context.push(SplitBillPage(order: orderDetail!));
|
||||
context.router.push(
|
||||
SplitBillRoute(order: state.selectedOrder!),
|
||||
);
|
||||
},
|
||||
label: 'Split Bill',
|
||||
icon: Icon(Icons.calculate_outlined),
|
||||
|
||||
42
lib/presentation/pages/split_bill/split_bill_page.dart
Normal file
42
lib/presentation/pages/split_bill/split_bill_page.dart
Normal file
@ -0,0 +1,42 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../application/split_bill/split_bill_form/split_bill_form_bloc.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/order/order.dart';
|
||||
import '../../../injection.dart';
|
||||
import 'widgets/split_bill_left_panel.dart';
|
||||
import 'widgets/split_bill_right_panel.dart';
|
||||
|
||||
@RoutePage()
|
||||
class SplitBillPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
final Order order;
|
||||
const SplitBillPage({super.key, required this.order});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.background,
|
||||
body: SafeArea(
|
||||
child: BlocBuilder<SplitBillFormBloc, SplitBillFormState>(
|
||||
builder: (context, state) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(flex: 2, child: SplitBillLeftPanel(state: state)),
|
||||
Expanded(flex: 4, child: SplitBillRightPanel(state: state)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrappedRoute(BuildContext context) => BlocProvider(
|
||||
create: (_) =>
|
||||
getIt<SplitBillFormBloc>()..add(SplitBillFormEvent.setOrder(order)),
|
||||
child: this,
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,229 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../../application/split_bill/split_bill_form/split_bill_form_bloc.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/order/order.dart';
|
||||
import '../../../components/border/dashed_border.dart';
|
||||
import '../../../components/page/page_title.dart';
|
||||
import '../../../components/spaces/space.dart';
|
||||
|
||||
class SplitBillLeftPanel extends StatelessWidget {
|
||||
final SplitBillFormState state;
|
||||
const SplitBillLeftPanel({super.key, required this.state});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: AppColor.white),
|
||||
child: Column(
|
||||
children: [
|
||||
PageTitle(
|
||||
title: 'Ringkasan Pesanan',
|
||||
subtitle: state.order.orderNumber,
|
||||
),
|
||||
SpaceHeight(16),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
itemCount: state.pendingItems.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildOrderItem(state.pendingItems[index]);
|
||||
},
|
||||
),
|
||||
),
|
||||
DashedDivider(color: AppColor.border),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
if (state.order.subtotal != state.order.totalAmount) ...[
|
||||
_buildSummaryItem(
|
||||
title: 'Subtotal',
|
||||
value: state.order.subtotal.currencyFormatRpV2,
|
||||
),
|
||||
if ((state.order.taxAmount) > 0)
|
||||
_buildSummaryItem(
|
||||
title: 'Pajax',
|
||||
value: state.order.taxAmount.currencyFormatRpV2,
|
||||
),
|
||||
if ((state.order.discountAmount) > 0)
|
||||
_buildSummaryItem(
|
||||
title: 'Diskon',
|
||||
value: state.order.discountAmount.currencyFormatRpV2,
|
||||
),
|
||||
SpaceHeight(8),
|
||||
],
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total terbayar',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state.order.totalPaid.currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(4),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Sisa Tagihan',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.error,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state.order.remainingAmount.currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.error,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(6),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total Pembayaran',
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state.order.totalAmount.currencyFormatRpV2,
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Row _buildSummaryItem({required String title, required String value}) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(title, style: AppStyle.md.copyWith(color: AppColor.textSecondary)),
|
||||
Text(value, style: AppStyle.md.copyWith(color: AppColor.textSecondary)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderItem(OrderItem item) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.productName,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
if (item.productVariantName.isNotEmpty)
|
||||
Text(
|
||||
item.productVariantName,
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Qty: ${item.quantity} x Rp ${item.unitPrice.currencyFormatRpV2} ',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item.totalPrice.currencyFormatRpV2,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if ((item.paidQuantity) > 1) ...[
|
||||
SpaceHeight(6),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.primary),
|
||||
),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '${item.paidQuantity} ',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'dari ',
|
||||
style: AppStyle.sm.copyWith(color: AppColor.primary),
|
||||
),
|
||||
TextSpan(
|
||||
text: '${item.quantity} ',
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'kuantiti telah dibayar.',
|
||||
style: AppStyle.sm.copyWith(color: AppColor.primary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,547 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../application/split_bill/split_bill_form/split_bill_form_bloc.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../common/types/split_type.dart';
|
||||
import '../../../../domain/order/order.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import '../../../components/field/field.dart';
|
||||
import '../../../components/spaces/space.dart';
|
||||
import '../../../components/toast/flushbar.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
|
||||
class SplitBillRightPanel extends StatefulWidget {
|
||||
final SplitBillFormState state;
|
||||
const SplitBillRightPanel({super.key, required this.state});
|
||||
|
||||
@override
|
||||
State<SplitBillRightPanel> createState() => _SplitBillRightPanelState();
|
||||
}
|
||||
|
||||
class _SplitBillRightPanelState extends State<SplitBillRightPanel> {
|
||||
final TextEditingController _customerController = TextEditingController();
|
||||
final TextEditingController _amountController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_customerController.addListener(() {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.customerNameChanged(_customerController.text),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_customerController.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Split Bill',
|
||||
style: AppStyle.h5.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
_buildCustomer(context),
|
||||
SpaceHeight(16),
|
||||
_buildRowButtonSplit(),
|
||||
SpaceHeight(16),
|
||||
Container(
|
||||
child: widget.state.splitType.isItem
|
||||
? _buildPerProductSplit()
|
||||
: _buildPerAmountSplit(),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildBottom(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottom() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: AppColor.white),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppElevatedButton.outlined(
|
||||
onPressed: () => context.router.maybePop(),
|
||||
label: 'Batal',
|
||||
),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
onPressed: () => _confirmSplit(),
|
||||
label: 'Konfirmasi Split',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPerAmountSplit() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Masukkan Jumlah yang Akan Dibayar',
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Split Bill',
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'Jumlah yang akan dibayar:',
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _amountController,
|
||||
keyboardType: TextInputType.number,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
onChanged: (value) {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.amountChanged(
|
||||
int.tryParse(value) ?? 0,
|
||||
),
|
||||
);
|
||||
// setState(() {
|
||||
// splitAmount = int.tryParse(value) ?? 0;
|
||||
// });
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: '0',
|
||||
prefixText: 'Rp ',
|
||||
prefixStyle: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total yang dibayar:',
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
widget.state.totalAmount.currencyFormatRpV2,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Sisa bill:',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
(widget.state.order.remainingAmount -
|
||||
widget.state.totalAmount)
|
||||
.currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPerProductSplit() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Pilih Produk untuk Split',
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border.all(color: AppColor.border),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Split Bill',
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
ListView.builder(
|
||||
itemCount: widget.state.pendingItems.length,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildProductSplitItem(
|
||||
widget.state.pendingItems[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1,
|
||||
color: AppColor.border,
|
||||
margin: EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total Split:',
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
widget.state.totalAmount.currencyFormatRpV2,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProductSplitItem(OrderItem item) {
|
||||
int selectedQty = widget.state.selectedProducts[item.id] ?? 0;
|
||||
int maxQty = (item.quantity) - (item.paidQuantity);
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 12),
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: selectedQty > 0
|
||||
? AppColor.primary.withOpacity(0.1)
|
||||
: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: selectedQty > 0 ? AppColor.primary : AppColor.border,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.productName,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
if (item.productVariantName.isNotEmpty)
|
||||
Text(
|
||||
item.productVariantName,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${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: 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: () {
|
||||
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':
|
||||
return _buildSplitTypeButton('Per Jumlah', SplitType.amount);
|
||||
case 'ITEM':
|
||||
return _buildSplitTypeButton('Per Produk', SplitType.item);
|
||||
default:
|
||||
return Row(
|
||||
children: [
|
||||
_buildSplitTypeButton('Per Produk', SplitType.item),
|
||||
SizedBox(width: 16),
|
||||
_buildSplitTypeButton('Per Jumlah', SplitType.amount),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildSplitTypeButton(String title, SplitType type) {
|
||||
bool isSelected = widget.state.splitType == type;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_amountController.clear();
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.splitTypeChanged(type),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColor.primary : Colors.transparent,
|
||||
border: Border.all(
|
||||
color: isSelected ? AppColor.primary : AppColor.border,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? AppColor.white : AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCustomer(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: CustomerAutocomplete(
|
||||
controller: _customerController,
|
||||
selectedCustomer: widget.state.customer,
|
||||
onSelected: (customer) {
|
||||
context.read<SplitBillFormBloc>().add(
|
||||
SplitBillFormEvent.customerChanged(customer!),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _confirmSplit() {
|
||||
if (widget.state.splitType.isItem) {
|
||||
int splitTotal = widget.state.totalAmount;
|
||||
if (splitTotal > 0) {
|
||||
List<OrderItem> splitItems = [];
|
||||
widget.state.selectedProducts.forEach((itemId, quantity) {
|
||||
OrderItem? originalItem = widget.state.pendingItems.firstWhere(
|
||||
(item) => item.id == itemId,
|
||||
orElse: () => OrderItem.empty(),
|
||||
);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (originalItem != null && originalItem.id != null) {
|
||||
splitItems.add(
|
||||
originalItem.copyWith(
|
||||
quantity: quantity,
|
||||
totalPrice: (originalItem.unitPrice) * quantity,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
context.router.push(
|
||||
PaymentRoute(
|
||||
order: widget.state.order.copyWith(
|
||||
orderItems: splitItems,
|
||||
subtotal: splitTotal,
|
||||
totalAmount: splitTotal,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
AppFlushbar.showError(context, "Pilih minimal satu produk untuk split");
|
||||
}
|
||||
} else {
|
||||
int totalAmount =
|
||||
(widget.state.order.totalAmount) - (widget.state.order.totalPaid);
|
||||
|
||||
if (widget.state.totalAmount > 0 &&
|
||||
widget.state.totalAmount <= totalAmount) {
|
||||
context.router.push(
|
||||
PaymentRoute(
|
||||
order: widget.state.order.copyWith(
|
||||
subtotal: widget.state.totalAmount,
|
||||
totalAmount: widget.state.totalAmount,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (widget.state.totalAmount > totalAmount) {
|
||||
AppFlushbar.showError(
|
||||
context,
|
||||
"Jumlah split tidak boleh melebihi total bill",
|
||||
);
|
||||
} else {
|
||||
AppFlushbar.showError(context, "Total bayar harus lebih dari 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,5 +41,8 @@ class AppRouter extends RootStackRouter {
|
||||
// Void
|
||||
AutoRoute(page: VoidRoute.page),
|
||||
AutoRoute(page: VoidSuccessRoute.page),
|
||||
|
||||
// Split Bill
|
||||
AutoRoute(page: SplitBillRoute.page),
|
||||
];
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
// coverage:ignore-file
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:apskel_pos_flutter_v2/domain/order/order.dart' as _i20;
|
||||
import 'package:apskel_pos_flutter_v2/domain/order/order.dart' as _i21;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/auth/login/login_page.dart'
|
||||
as _i4;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/checkout/checkout_page.dart'
|
||||
@ -25,101 +25,103 @@ import 'package:apskel_pos_flutter_v2/presentation/pages/main/pages/report/repor
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/main/pages/setting/setting_page.dart'
|
||||
as _i10;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/main/pages/table/table_page.dart'
|
||||
as _i15;
|
||||
as _i16;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/order_page.dart'
|
||||
as _i6;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/pages/success_add_item_order/success_add_item_order_page.dart'
|
||||
as _i12;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/pages/success_order/success_order_page.dart'
|
||||
as _i13;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/pages/success_order/success_order_page.dart'
|
||||
as _i14;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/payment/pages/payment_success/payment_success_page.dart'
|
||||
as _i8;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/payment/payment_page.dart'
|
||||
as _i7;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/splash/splash_page.dart'
|
||||
as _i11;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/split_bill/split_bill_page.dart'
|
||||
as _i12;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/sync/sync_page.dart'
|
||||
as _i14;
|
||||
as _i15;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/void/pages/void_success/void_success_page.dart'
|
||||
as _i17;
|
||||
as _i18;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/void/void_page.dart'
|
||||
as _i16;
|
||||
import 'package:auto_route/auto_route.dart' as _i18;
|
||||
import 'package:flutter/material.dart' as _i19;
|
||||
as _i17;
|
||||
import 'package:auto_route/auto_route.dart' as _i19;
|
||||
import 'package:flutter/material.dart' as _i20;
|
||||
|
||||
/// generated route for
|
||||
/// [_i1.CheckoutPage]
|
||||
class CheckoutRoute extends _i18.PageRouteInfo<void> {
|
||||
const CheckoutRoute({List<_i18.PageRouteInfo>? children})
|
||||
class CheckoutRoute extends _i19.PageRouteInfo<void> {
|
||||
const CheckoutRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(CheckoutRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CheckoutRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i18.WrappedRoute(child: const _i1.CheckoutPage());
|
||||
return _i19.WrappedRoute(child: const _i1.CheckoutPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i2.CustomerPage]
|
||||
class CustomerRoute extends _i18.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i18.PageRouteInfo>? children})
|
||||
class CustomerRoute extends _i19.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(CustomerRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CustomerRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i18.WrappedRoute(child: const _i2.CustomerPage());
|
||||
return _i19.WrappedRoute(child: const _i2.CustomerPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i3.HomePage]
|
||||
class HomeRoute extends _i18.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i18.PageRouteInfo>? children})
|
||||
class HomeRoute extends _i19.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(HomeRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i18.WrappedRoute(child: const _i3.HomePage());
|
||||
return _i19.WrappedRoute(child: const _i3.HomePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i4.LoginPage]
|
||||
class LoginRoute extends _i18.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i18.PageRouteInfo>? children})
|
||||
class LoginRoute extends _i19.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(LoginRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LoginRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i18.WrappedRoute(child: const _i4.LoginPage());
|
||||
return _i19.WrappedRoute(child: const _i4.LoginPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i5.MainPage]
|
||||
class MainRoute extends _i18.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i18.PageRouteInfo>? children})
|
||||
class MainRoute extends _i19.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(MainRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'MainRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i5.MainPage();
|
||||
@ -129,11 +131,11 @@ class MainRoute extends _i18.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i6.OrderPage]
|
||||
class OrderRoute extends _i18.PageRouteInfo<OrderRouteArgs> {
|
||||
class OrderRoute extends _i19.PageRouteInfo<OrderRouteArgs> {
|
||||
OrderRoute({
|
||||
_i19.Key? key,
|
||||
_i20.Key? key,
|
||||
required String status,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
List<_i19.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
OrderRoute.name,
|
||||
args: OrderRouteArgs(key: key, status: status),
|
||||
@ -142,11 +144,11 @@ class OrderRoute extends _i18.PageRouteInfo<OrderRouteArgs> {
|
||||
|
||||
static const String name = 'OrderRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<OrderRouteArgs>();
|
||||
return _i18.WrappedRoute(
|
||||
return _i19.WrappedRoute(
|
||||
child: _i6.OrderPage(key: args.key, status: args.status),
|
||||
);
|
||||
},
|
||||
@ -156,7 +158,7 @@ class OrderRoute extends _i18.PageRouteInfo<OrderRouteArgs> {
|
||||
class OrderRouteArgs {
|
||||
const OrderRouteArgs({this.key, required this.status});
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
final String status;
|
||||
|
||||
@ -168,11 +170,11 @@ class OrderRouteArgs {
|
||||
|
||||
/// generated route for
|
||||
/// [_i7.PaymentPage]
|
||||
class PaymentRoute extends _i18.PageRouteInfo<PaymentRouteArgs> {
|
||||
class PaymentRoute extends _i19.PageRouteInfo<PaymentRouteArgs> {
|
||||
PaymentRoute({
|
||||
_i19.Key? key,
|
||||
required _i20.Order order,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
_i20.Key? key,
|
||||
required _i21.Order order,
|
||||
List<_i19.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
PaymentRoute.name,
|
||||
args: PaymentRouteArgs(key: key, order: order),
|
||||
@ -181,11 +183,11 @@ class PaymentRoute extends _i18.PageRouteInfo<PaymentRouteArgs> {
|
||||
|
||||
static const String name = 'PaymentRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<PaymentRouteArgs>();
|
||||
return _i18.WrappedRoute(
|
||||
return _i19.WrappedRoute(
|
||||
child: _i7.PaymentPage(key: args.key, order: args.order),
|
||||
);
|
||||
},
|
||||
@ -195,9 +197,9 @@ class PaymentRoute extends _i18.PageRouteInfo<PaymentRouteArgs> {
|
||||
class PaymentRouteArgs {
|
||||
const PaymentRouteArgs({this.key, required this.order});
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
final _i20.Order order;
|
||||
final _i21.Order order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -207,11 +209,11 @@ class PaymentRouteArgs {
|
||||
|
||||
/// generated route for
|
||||
/// [_i8.PaymentSuccessPage]
|
||||
class PaymentSuccessRoute extends _i18.PageRouteInfo<PaymentSuccessRouteArgs> {
|
||||
class PaymentSuccessRoute extends _i19.PageRouteInfo<PaymentSuccessRouteArgs> {
|
||||
PaymentSuccessRoute({
|
||||
_i19.Key? key,
|
||||
_i20.Key? key,
|
||||
required String orderId,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
List<_i19.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
PaymentSuccessRoute.name,
|
||||
args: PaymentSuccessRouteArgs(key: key, orderId: orderId),
|
||||
@ -220,11 +222,11 @@ class PaymentSuccessRoute extends _i18.PageRouteInfo<PaymentSuccessRouteArgs> {
|
||||
|
||||
static const String name = 'PaymentSuccessRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<PaymentSuccessRouteArgs>();
|
||||
return _i18.WrappedRoute(
|
||||
return _i19.WrappedRoute(
|
||||
child: _i8.PaymentSuccessPage(key: args.key, orderId: args.orderId),
|
||||
);
|
||||
},
|
||||
@ -234,7 +236,7 @@ class PaymentSuccessRoute extends _i18.PageRouteInfo<PaymentSuccessRouteArgs> {
|
||||
class PaymentSuccessRouteArgs {
|
||||
const PaymentSuccessRouteArgs({this.key, required this.orderId});
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
final String orderId;
|
||||
|
||||
@ -246,13 +248,13 @@ class PaymentSuccessRouteArgs {
|
||||
|
||||
/// generated route for
|
||||
/// [_i9.ReportPage]
|
||||
class ReportRoute extends _i18.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i18.PageRouteInfo>? children})
|
||||
class ReportRoute extends _i19.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(ReportRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ReportRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i9.ReportPage();
|
||||
@ -262,13 +264,13 @@ class ReportRoute extends _i18.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i10.SettingPage]
|
||||
class SettingRoute extends _i18.PageRouteInfo<void> {
|
||||
const SettingRoute({List<_i18.PageRouteInfo>? children})
|
||||
class SettingRoute extends _i19.PageRouteInfo<void> {
|
||||
const SettingRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(SettingRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SettingRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i10.SettingPage();
|
||||
@ -278,13 +280,13 @@ class SettingRoute extends _i18.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.SplashPage]
|
||||
class SplashRoute extends _i18.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i18.PageRouteInfo>? children})
|
||||
class SplashRoute extends _i19.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(SplashRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SplashRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i11.SplashPage();
|
||||
@ -293,28 +295,67 @@ class SplashRoute extends _i18.PageRouteInfo<void> {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.SuccessAddItemOrderPage]
|
||||
class SuccessAddItemOrderRoute extends _i18.PageRouteInfo<void> {
|
||||
const SuccessAddItemOrderRoute({List<_i18.PageRouteInfo>? children})
|
||||
/// [_i12.SplitBillPage]
|
||||
class SplitBillRoute extends _i19.PageRouteInfo<SplitBillRouteArgs> {
|
||||
SplitBillRoute({
|
||||
_i20.Key? key,
|
||||
required _i21.Order order,
|
||||
List<_i19.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
SplitBillRoute.name,
|
||||
args: SplitBillRouteArgs(key: key, order: order),
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'SplitBillRoute';
|
||||
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<SplitBillRouteArgs>();
|
||||
return _i19.WrappedRoute(
|
||||
child: _i12.SplitBillPage(key: args.key, order: args.order),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class SplitBillRouteArgs {
|
||||
const SplitBillRouteArgs({this.key, required this.order});
|
||||
|
||||
final _i20.Key? key;
|
||||
|
||||
final _i21.Order order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SplitBillRouteArgs{key: $key, order: $order}';
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i13.SuccessAddItemOrderPage]
|
||||
class SuccessAddItemOrderRoute extends _i19.PageRouteInfo<void> {
|
||||
const SuccessAddItemOrderRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(SuccessAddItemOrderRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SuccessAddItemOrderRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i12.SuccessAddItemOrderPage();
|
||||
return const _i13.SuccessAddItemOrderPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i13.SuccessOrderPage]
|
||||
class SuccessOrderRoute extends _i18.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
/// [_i14.SuccessOrderPage]
|
||||
class SuccessOrderRoute extends _i19.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
SuccessOrderRoute({
|
||||
_i19.Key? key,
|
||||
required _i20.Order order,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
_i20.Key? key,
|
||||
required _i21.Order order,
|
||||
List<_i19.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
SuccessOrderRoute.name,
|
||||
args: SuccessOrderRouteArgs(key: key, order: order),
|
||||
@ -323,12 +364,12 @@ class SuccessOrderRoute extends _i18.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
|
||||
static const String name = 'SuccessOrderRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<SuccessOrderRouteArgs>();
|
||||
return _i18.WrappedRoute(
|
||||
child: _i13.SuccessOrderPage(key: args.key, order: args.order),
|
||||
return _i19.WrappedRoute(
|
||||
child: _i14.SuccessOrderPage(key: args.key, order: args.order),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -337,9 +378,9 @@ class SuccessOrderRoute extends _i18.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
class SuccessOrderRouteArgs {
|
||||
const SuccessOrderRouteArgs({this.key, required this.order});
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
final _i20.Order order;
|
||||
final _i21.Order order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -348,44 +389,44 @@ class SuccessOrderRouteArgs {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i14.SyncPage]
|
||||
class SyncRoute extends _i18.PageRouteInfo<void> {
|
||||
const SyncRoute({List<_i18.PageRouteInfo>? children})
|
||||
/// [_i15.SyncPage]
|
||||
class SyncRoute extends _i19.PageRouteInfo<void> {
|
||||
const SyncRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(SyncRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SyncRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i18.WrappedRoute(child: const _i14.SyncPage());
|
||||
return _i19.WrappedRoute(child: const _i15.SyncPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i15.TablePage]
|
||||
class TableRoute extends _i18.PageRouteInfo<void> {
|
||||
const TableRoute({List<_i18.PageRouteInfo>? children})
|
||||
/// [_i16.TablePage]
|
||||
class TableRoute extends _i19.PageRouteInfo<void> {
|
||||
const TableRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(TableRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'TableRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i18.WrappedRoute(child: const _i15.TablePage());
|
||||
return _i19.WrappedRoute(child: const _i16.TablePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i16.VoidPage]
|
||||
class VoidRoute extends _i18.PageRouteInfo<VoidRouteArgs> {
|
||||
/// [_i17.VoidPage]
|
||||
class VoidRoute extends _i19.PageRouteInfo<VoidRouteArgs> {
|
||||
VoidRoute({
|
||||
_i19.Key? key,
|
||||
required _i20.Order order,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
_i20.Key? key,
|
||||
required _i21.Order order,
|
||||
List<_i19.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
VoidRoute.name,
|
||||
args: VoidRouteArgs(key: key, order: order),
|
||||
@ -394,12 +435,12 @@ class VoidRoute extends _i18.PageRouteInfo<VoidRouteArgs> {
|
||||
|
||||
static const String name = 'VoidRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<VoidRouteArgs>();
|
||||
return _i18.WrappedRoute(
|
||||
child: _i16.VoidPage(key: args.key, order: args.order),
|
||||
return _i19.WrappedRoute(
|
||||
child: _i17.VoidPage(key: args.key, order: args.order),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -408,9 +449,9 @@ class VoidRoute extends _i18.PageRouteInfo<VoidRouteArgs> {
|
||||
class VoidRouteArgs {
|
||||
const VoidRouteArgs({this.key, required this.order});
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
final _i20.Order order;
|
||||
final _i21.Order order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -419,17 +460,17 @@ class VoidRouteArgs {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i17.VoidSuccessPage]
|
||||
class VoidSuccessRoute extends _i18.PageRouteInfo<void> {
|
||||
const VoidSuccessRoute({List<_i18.PageRouteInfo>? children})
|
||||
/// [_i18.VoidSuccessPage]
|
||||
class VoidSuccessRoute extends _i19.PageRouteInfo<void> {
|
||||
const VoidSuccessRoute({List<_i19.PageRouteInfo>? children})
|
||||
: super(VoidSuccessRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'VoidSuccessRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
static _i19.PageInfo page = _i19.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i17.VoidSuccessPage();
|
||||
return const _i18.VoidSuccessPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user