mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
70 lines
1.8 KiB
Dart
70 lines
1.8 KiB
Dart
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
void showMessage(BuildContext context, String message) {
|
|
Scaffold.of(context).showSnackBar(SnackBar(
|
|
content: Text(message),
|
|
));
|
|
}
|
|
|
|
void showErrorDialog(BuildContext context, String title, String description) {
|
|
showDialog(
|
|
context: context,
|
|
child: SimpleDialog(
|
|
title: ListTile(
|
|
title: Text("Error"),
|
|
leading: FaIcon(FontAwesomeIcons.exclamationCircle),
|
|
),
|
|
children: <Widget>[
|
|
ListTile(
|
|
title: Text(title),
|
|
subtitle: Text(description)
|
|
)
|
|
]
|
|
)
|
|
);
|
|
}
|
|
|
|
void showProgressDialog(BuildContext context, String title, String description) {
|
|
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
child: SimpleDialog(
|
|
title: Text(title),
|
|
children: <Widget>[
|
|
CircularProgressIndicator(),
|
|
Text(description),
|
|
],
|
|
)
|
|
);
|
|
}
|
|
|
|
void hideProgressDialog(BuildContext context) {
|
|
Navigator.pop(context);
|
|
}
|
|
|
|
void showFormDialog(BuildContext context, String title, {GlobalKey<FormState> key, List<Widget> fields, List<Widget> actions}) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return AlertDialog(
|
|
title: Text(title),
|
|
actions: actions,
|
|
content: Form(
|
|
key: key,
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: fields
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
);
|
|
} |