mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
* 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
29 lines
607 B
Dart
29 lines
607 B
Dart
import "package:flutter_gen/gen_l10n/app_localizations.dart";
|
|
import "package:flutter_gen/gen_l10n/app_localizations_en.dart";
|
|
|
|
import "package:one_context/one_context.dart";
|
|
import "package:flutter/material.dart";
|
|
|
|
import "package:inventree/helpers.dart";
|
|
|
|
// Shortcut function to reduce boilerplate!
|
|
I18N L10()
|
|
{
|
|
// Testing mode - ignore context
|
|
if (!hasContext()) {
|
|
return I18NEn();
|
|
}
|
|
|
|
BuildContext? _ctx = OneContext().context;
|
|
|
|
if (_ctx != null) {
|
|
I18N? i18n = I18N.of(_ctx);
|
|
|
|
if (i18n != null) {
|
|
return i18n;
|
|
}
|
|
}
|
|
|
|
// Fallback for "null" context
|
|
return I18NEn();
|
|
} |