feat: New Open Tab dialog with search and optional customer email. Drinks are now grouped per order. Payments trigger cha-ching and money rain.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -6,6 +9,7 @@ import '../../l10n/app_localizations.dart';
|
||||
import '../../models/payment_method.dart';
|
||||
import '../../utils/money.dart';
|
||||
import '../../viewmodels/bar_screen_view_model.dart';
|
||||
import '../widgets/money_rain.dart';
|
||||
import '../widgets/slide_confirm.dart';
|
||||
|
||||
Future<void> confirmCloseTab(BuildContext context) async {
|
||||
@@ -73,6 +77,9 @@ Future<void> confirmCloseTab(BuildContext context) async {
|
||||
|
||||
try {
|
||||
await viewModel.closeSelectedTab(paymentMethod: paymentMethod);
|
||||
_playChaChing();
|
||||
// Make it rain, but only once in a hundred tabs.
|
||||
if (context.mounted && Random().nextInt(25) == 0) showMoneyRain(context);
|
||||
} catch (_) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
@@ -81,6 +88,16 @@ Future<void> confirmCloseTab(BuildContext context) async {
|
||||
}
|
||||
}
|
||||
|
||||
final _chaChingPlayer = AudioPlayer();
|
||||
|
||||
/// Plays the till sound once a tab is paid; a sound that fails to play never
|
||||
/// gets in the way of closing the tab.
|
||||
void _playChaChing() {
|
||||
_chaChingPlayer
|
||||
.play(AssetSource('Cha-Ching.mp3'))
|
||||
.catchError((Object e) => debugPrint('Could not play cha-ching: $e'));
|
||||
}
|
||||
|
||||
const _payconiqQrAsset = 'assets/payconiq/qr.png';
|
||||
|
||||
/// Shows the Payconiq QR code for the customer to scan. Resolves to true
|
||||
|
||||
Reference in New Issue
Block a user