2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-08-04 03:31:35 +00:00

Update Requirements (#541)
Some checks failed
Android / build (push) Has been cancelled
CI / test (push) Has been cancelled
iOS / build (push) Has been cancelled

* Update package requiremenst

* github workflow updates

* ios build updates

* Theme adjustments

* Further updates

* Fix typo

* Deprecated imperative apply of Flutter's Gradle plugins

Ref: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply

* Refactor wedge scanner

* Add context checks

* Adjust behaviour if testing

* Further refactoring

* Moar checks

* Logic fix

* Fix for wedge scanner test

* Fix for barcode processing

* Fix

* Yet another fix
This commit is contained in:
Oliver
2024-10-01 12:25:11 +10:00
committed by GitHub
parent 29948e5809
commit d990508237
28 changed files with 519 additions and 582 deletions

View File

@@ -39,13 +39,32 @@ bool debugContains(String msg, {bool raiseAssert = true}) {
}
}
if (!result) {
print("Debug does not contain expected string: '${msg}'");
}
if (raiseAssert) {
assert(result);
}
return result;
}
bool isTesting() {
return Platform.environment.containsKey("FLUTTER_TEST");
}
bool hasContext() {
try {
return !isTesting() && OneContext.hasContext;
} catch (error) {
return false;
}
}
/*
* Display a debug message if we are in testing mode, or running in debug mode
*/
@@ -83,7 +102,7 @@ Future<void> playAudioFile(String path) async {
// Debug message for unit testing
debug("Playing audio file: '${path}'");
if (!OneContext.hasContext) {
if (!hasContext()) {
return;
}
@@ -117,21 +136,13 @@ String renderCurrency(double? amount, String currency, {int decimals = 2}) {
if (currency.isEmpty) return "-";
CurrencyFormatterSettings backupSettings = CurrencyFormatterSettings(
symbol: "\$",
symbolSide: SymbolSide.left,
);
CurrencyFormat fmt = CurrencyFormat.fromCode(currency.toLowerCase()) ?? CurrencyFormat.usd;
String value = CurrencyFormatter.format(
amount,
CurrencyFormatter.majors[currency.toLowerCase()] ?? backupSettings
fmt
);
// If we were not able to determine the currency
if (!CurrencyFormatter.majors.containsKey(currency.toLowerCase())) {
value += " ${currency}";
}
return value;
}