is an animated alert info to replace default snack bar
Add info_plus to your pubspec.yaml as a dependency
dependencies: info_plus:0.0.1Import the package
import 'package:info_plus/info_plus.dart';To display an alert
InfoPlus.show(
context: context,
text: 'Message to be displayed',
);Different type of alert to change the icon and color
- TypeInfo.info
- TypeInfo.success
- TypeInfo.warning
- TypeInfo.error
to change the type of alert use typeInfo param
InfoPlus.show(
context: context,
text: 'Message to be displayed',
typeInfo: TypeInfo.success,
);| Light theme | Dark theme | |
|---|---|---|
| info | ![]() |
![]() |
| success | ![]() |
![]() |
| warning | ![]() |
![]() |
| error | ![]() |
![]() |
or change the icon by passing the icon as IconData
InfoPlus.show(
context: context,
text: 'Message to be displayed',
icon: Icons.person,
);to change the icon color use iconColor
InfoPlus.show(
context: context,
text: 'Message to be displayed',
icon: Icons.person,
iconColor: Colors.amber,
);by default the alert apear from the top, to diplsay the alert from bottom use position parm MessagePosition.bottom
InfoPlus.show(
context: context,
text: 'Message to be displayed',
position: MessagePosition.bottom,
);the padding param is use to indicate the exact padding from top if the alert is MessagePosition.top or bottom padding if is MessagePosition.bottom
To add action use action as string and actionCallback as function
InfoPlus.show(
context: context,
text: 'Message to be displayed',
action: 'Cancel',
actionCallback: () {
//Handle action on callback
},
);The default color depend of ThemeMode of the Widget.
if the current ThemeMode is Lightthe alert use dark theme. Otherwise use light theme.
backgroundColor: to change the backgroud color of alert by default is surface color of opposite theme.textColor: the text color of the message by default is onSurface color of opposite theme.actionColor: the text color of the action by default is TextButton color color of opposite theme.
duration : The duration in seconde for alert will be display by default 3 seondes
to dispose the alert swipe the widget on horizantal direction.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.








