2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-07-01 11:20:41 +00:00

Format Code and Add Format Checks to CI (#643)

* Remove unused lib/generated/i18n.dart

* Use `fvm dart format .`

* Add contributing guidelines

* Enforce dart format

* Add `dart format off` directive to generated files
This commit is contained in:
Ben Hagen
2025-06-24 01:55:01 +02:00
committed by GitHub
parent e9db6532e4
commit 4444884afa
100 changed files with 5332 additions and 5592 deletions

View File

@ -8,8 +8,13 @@ import "package:inventree/l10.dart";
/*
* Display a configurable 'snackbar' at the bottom of the screen
*/
void showSnackIcon(String text, {IconData? icon, Function()? onAction, bool? success, String? actionText}) {
void showSnackIcon(
String text, {
IconData? icon,
Function()? onAction,
bool? success,
String? actionText,
}) {
debug("showSnackIcon: '${text}'");
// Escape quickly if we do not have context
@ -34,7 +39,6 @@ void showSnackIcon(String text, {IconData? icon, Function()? onAction, bool? suc
if (icon == null && onAction == null) {
icon = TablerIcons.circle_check;
}
} else if (success != null && success == false) {
backgroundColor = Colors.deepOrange;
@ -45,35 +49,32 @@ void showSnackIcon(String text, {IconData? icon, Function()? onAction, bool? suc
String _action = actionText ?? L10().details;
List<Widget> childs = [
Text(text),
Spacer(),
];
List<Widget> childs = [Text(text), Spacer()];
if (icon != null) {
childs.add(Icon(icon));
}
OneContext().showSnackBar(builder: (context) => SnackBar(
content: GestureDetector(
child: Row(
children: childs
OneContext().showSnackBar(
builder: (context) => SnackBar(
content: GestureDetector(
child: Row(children: childs),
onTap: () {
ScaffoldMessenger.of(context!).hideCurrentSnackBar();
},
),
onTap: () {
ScaffoldMessenger.of(context!).hideCurrentSnackBar();
},
backgroundColor: backgroundColor,
action: onAction == null
? null
: SnackBarAction(
label: _action,
onPressed: () {
// Immediately dismiss the notification
ScaffoldMessenger.of(context!).hideCurrentSnackBar();
onAction();
},
),
duration: Duration(seconds: onAction == null ? 5 : 10),
),
backgroundColor: backgroundColor,
action: onAction == null ? null : SnackBarAction(
label: _action,
onPressed: () {
// Immediately dismiss the notification
ScaffoldMessenger.of(context!).hideCurrentSnackBar();
onAction();
}
),
duration: Duration(seconds: onAction == null ? 5 : 10),
)
);
}
}