28 lines
739 B
Dart
28 lines
739 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../flutter_flow/flutter_flow_theme.dart';
|
|
|
|
class SnackBarUtil {
|
|
|
|
|
|
static void showSnackBar(BuildContext context, String text, {bool isError = false}) {
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
content: Text(
|
|
text,
|
|
style: TextStyle(color: FlutterFlowTheme.of(context).info),
|
|
),
|
|
backgroundColor: isError
|
|
? FlutterFlowTheme.of(context).error
|
|
: FlutterFlowTheme.of(context).success,
|
|
duration: const Duration(seconds: 3),
|
|
behavior: SnackBarBehavior.floating,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(30),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
|
|
} |