flutter-freaccess-hub/lib/shared/utils/snackbar_util.dart

26 lines
919 B
Dart

import 'package:flutter/material.dart';
import 'package:hub/shared/utils/limited_text_size.dart';
import '../../flutter_flow/flutter_flow_theme.dart';
class SnackBarUtil {
static void showSnackBar(BuildContext context, String text, {bool isError = false}) {
double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
text,
overflow: TextOverflow.clip,
style: TextStyle(color: FlutterFlowTheme.of(context).info, fontSize: limitedBodyFontSize),
),
backgroundColor: isError ? FlutterFlowTheme.of(context).error : FlutterFlowTheme.of(context).success,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}
}