2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-15 03:35:28 +00:00

Refactor audio file player

- Do not play if there is no context available (e.g. unit testing)
This commit is contained in:
Oliver Walters
2022-05-22 08:23:20 +10:00
parent e424a3cf7b
commit f13b04d029
7 changed files with 94 additions and 50 deletions

View File

@ -1,6 +1,6 @@
import "package:audioplayers/audioplayers.dart";
import "package:flutter/material.dart";
import "package:font_awesome_flutter/font_awesome_flutter.dart";
import "package:inventree/helpers.dart";
import "package:one_context/one_context.dart";
import "package:inventree/l10.dart";
@ -108,8 +108,7 @@ Future<void> showServerError(String title, String description) async {
final bool tones = await InvenTreeSettingsManager().getValue(INV_SOUNDS_SERVER, true) as bool;
if (tones) {
final player = AudioCache();
player.play("sounds/server_error.mp3");
playAudioFile("sounds/server_error.mp3");
}
showSnackIcon(