Skip to content

Commit dfa020a

Browse files
committed
add snackbar component
1 parent b0950e8 commit dfa020a

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

lib/Components/flood_snackbar.dart

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import 'package:flutter/material.dart';
2+
3+
enum SnackbarType {
4+
information,
5+
caution,
6+
success,
7+
}
8+
9+
SnackBar addFloodSnackBar(
10+
SnackbarType snackbarType,
11+
String title,
12+
String ctaText,
13+
) {
14+
return SnackBar(
15+
backgroundColor: snackbarType == SnackbarType.success
16+
? Colors.greenAccent
17+
: snackbarType == SnackbarType.information
18+
? Colors.lightBlueAccent
19+
: Colors.orange,
20+
content: Row(
21+
children: [
22+
Icon(
23+
snackbarType == SnackbarType.success
24+
? Icons.check_circle
25+
: snackbarType == SnackbarType.information
26+
? Icons.lightbulb_outline
27+
: Icons.warning_outlined,
28+
color: Colors.white,
29+
size: 20,
30+
),
31+
SizedBox(
32+
width: 8,
33+
),
34+
Text(
35+
title,
36+
style: TextStyle(
37+
color: Colors.white,
38+
),
39+
),
40+
],
41+
),
42+
action: SnackBarAction(
43+
label: ctaText,
44+
textColor: Colors.white,
45+
onPressed: () {},
46+
),
47+
);
48+
}

0 commit comments

Comments
 (0)