2025-07-30 22:38:44 +07:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
|
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../core/constants/colors.dart';
|
|
|
|
|
import '../bloc/checkout/checkout_bloc.dart';
|
|
|
|
|
|
|
|
|
|
class TaxDialog extends StatelessWidget {
|
|
|
|
|
const TaxDialog({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: Stack(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
const Text(
|
|
|
|
|
'PAJAK PB1',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primary,
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
onPressed: () => context.pop(),
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.cancel,
|
|
|
|
|
color: AppColors.primary,
|
|
|
|
|
size: 30.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
content: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
BlocBuilder<CheckoutBloc, CheckoutState>(
|
|
|
|
|
builder: (context, state) {
|
|
|
|
|
return state.maybeWhen(
|
|
|
|
|
initial: () => const SizedBox(),
|
|
|
|
|
loading: () => const Center(child: CircularProgressIndicator()),
|
2025-08-06 18:47:20 +07:00
|
|
|
loaded: (
|
|
|
|
|
data,
|
|
|
|
|
a,
|
|
|
|
|
b,
|
|
|
|
|
c,
|
|
|
|
|
tax,
|
|
|
|
|
d,
|
|
|
|
|
e,
|
|
|
|
|
f,
|
|
|
|
|
g,
|
|
|
|
|
orderType,
|
|
|
|
|
deliveryType,
|
|
|
|
|
) =>
|
|
|
|
|
ListTile(
|
2025-07-30 22:38:44 +07:00
|
|
|
title: const Text('PB1'),
|
|
|
|
|
subtitle: Text('tarif pajak ($tax%)'),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
textColor: AppColors.primary,
|
|
|
|
|
trailing: Checkbox(
|
|
|
|
|
value: tax > 0,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
context.read<CheckoutBloc>().add(
|
|
|
|
|
CheckoutEvent.addTax(tax > 0 ? 0 : tax),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
context.pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
orElse: () => const SizedBox(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|