File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments