alert_info 0.0.2 copy "alert_info: ^0.0.2" to clipboard
alert_info: ^0.0.2 copied to clipboard

Alert info is flutter package to display an animated alert info, warning, succes or error message from the top or bottom

Alert Info #

is an animated alert info to replace default snackbar

Preview

Installation #

Add alert_info to your pubspec.yaml as a dependacy

dependencies: alert_info:0.0.2

Usage #

Import the package

import 'package:alert_info/alert_info.dart';

To display an alert

AlertInfo.show(
    context: context,
    text: 'Message to be displayed',
);

TypeInfo (Optinal) #

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

AlertInfo.show(
    context: context,
    text: 'Message to be displayed',
    typeInfo: TypeInfo.success,
);
Light theme Dark theme
info Preview Preview
success Preview Preview
warning Preview Preview
error Preview Preview

or change the icon by passing the icon as IconData

AlertInfo.show(
    context: context,
    text: 'Message to be displayed',
    icon: Icons.person,
);

to change the icon color use iconColor

AlertInfo.show(
    context: context,
    text: 'Message to be displayed',
    icon: Icons.person,
    iconColor: Colors.amber,
);

Alert position and padding (Optinal) #

by default the alert apear from the top, to diplsay the alert from bottom use position parm MessagePosition.bottom

AlertInfo.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

Alert with Action (Optinal) #

To add action use action as string and actionCallback as function

AlertInfo.show(
    context: context,
    text: 'Message to be displayed',
    action: 'Cancel',
    actionCallback: () {
        //Handle action on callback
    },
);

Decortaion (Optinal) #

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 and dismiss (Optinal) #

duration : The duration in seconde for alert will be display by default 3 seondes

to dispose the alert swipe the widget on horizantal direction.

Contributing #

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License #

MIT

10
likes
150
points
81
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

Alert info is flutter package to display an animated alert info, warning, succes or error message from the top or bottom

Repository (GitHub)

Topics

#snackbar #toast #message #alert

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on alert_info