2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 18:25:26 +00:00

Add snackbar with icon

- stock adjust
- part edit
- location edit
This commit is contained in:
Oliver Walters
2021-02-10 23:51:38 +11:00
parent ce2a866384
commit c8c056f96d
7 changed files with 154 additions and 34 deletions

33
lib/widget/snacks.dart Normal file
View File

@ -0,0 +1,33 @@
/*
* Display a snackbar with:
*
* a) Text on the left
* b) Icon on the right
*
* | Text <icon> |
*/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
void showSnackIcon(GlobalKey<ScaffoldState> key, String text, {IconData icon, bool success}) {
// If icon not specified, use the success status
if (icon == null) {
icon = (success == true) ? FontAwesomeIcons.checkCircle : FontAwesomeIcons.timesCircle;
}
key.currentState.showSnackBar(
SnackBar(
content: Row(
children: [
Text(text),
Spacer(),
FaIcon(icon)
]
),
)
);
}