third commit
This commit is contained in:
@@ -125,7 +125,7 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
|
||||
);
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: _bottomBar(cart.grandTotal, state, cart.isEmpty),
|
||||
bottomNavigationBar: _bottomBar(controller, state, cart.grandTotal),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -557,7 +557,15 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ Bottom bar
|
||||
Widget _bottomBar(double total, PaymentState state, bool cartEmpty) {
|
||||
Widget _bottomBar(
|
||||
PaymentController controller,
|
||||
PaymentState state,
|
||||
double total,
|
||||
) {
|
||||
// A cash sale cannot complete until the cashier says what was handed over.
|
||||
final canComplete = controller.canConfirm;
|
||||
final reason = controller.blockedReason;
|
||||
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
@@ -599,13 +607,45 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
|
||||
],
|
||||
),
|
||||
).animate().shake(duration: 300.ms, hz: 3),
|
||||
if (reason != null && state.error == null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: AppSpacing.sm),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.info_outline_rounded,
|
||||
size: 15, color: AppColors.textTertiary),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: Text(
|
||||
reason,
|
||||
style: const TextStyle(
|
||||
fontSize: 12.5,
|
||||
color: AppColors.textTertiary,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (state.activeMethod.needsChange)
|
||||
TextButton(
|
||||
onPressed: () => _setCash(controller.balanceDue),
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size(0, 30),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.md,
|
||||
),
|
||||
),
|
||||
child: const Text('Exact',
|
||||
style: TextStyle(fontSize: 12.5)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PrimaryButton(
|
||||
label: 'Complete Sale',
|
||||
icon: Icons.check_circle_outline_rounded,
|
||||
large: true,
|
||||
tone: ButtonTone.success,
|
||||
busy: state.isProcessing,
|
||||
onPressed: cartEmpty ? null : _confirm,
|
||||
onPressed: canComplete ? _confirm : null,
|
||||
trailing: Text(
|
||||
Formatters.money(total),
|
||||
style: AppTypography.money(19, color: Colors.white),
|
||||
|
||||
Reference in New Issue
Block a user