bot_toast 2.4.1
bot_toast: ^2.4.1 copied to clipboard

A really easy to use flutter toast library.Easy to use and feature rich.

BotToast 🤖 #

A really easy to use flutter toast library!

Build Status codecov

Language: English | 中文简体 #

🐲Overview #

  • In the true sense of Toast, you can call it whenever you need it, without any restrictions! (This is his most important feature, different from other Toast libraries)

  • Feature-rich, support for displaying notifications, text, loading, attachments, etc. Toast

  • Support for popping up various custom Toasts, or you can pop up any Widget as long as it meets the requirements of the flutter code.

  • Api is easy to use, basically has no necessary parameters (including BuildContext), basically all optional parameters

  • Pure flutter implementation, it is not easy to bring compatibility problems

🐼Online Demo #

Online demo (Web effects may be biased, the actual effect is subject to the mobile phone)

🐳Example #

Sample project

🐺Renderings #

NotificationAttachedCustomAnimation
NotificationAttachedCustomAnimation
LoadingTextCustomWidget
LoadingTextCustomWidget

🐮Getting started #

1. add dependencies into you project pubspec.yaml file

dependencies:
     bot_toast: ^2.4.1

2. import BotToast lib

import 'package:bot_toast/bot_toast.dart';

3. initialization BotToast

//1. wrap MaterialApp with BotToastInit
BotToastInit(
  child:MaterialApp(
      title: 'BotToast Demo',
      navigatorObservers: [BotToastNavigatorObserver()],//2.registered route observer
      home: XxxxPage(),
  )
);

4. use BotToast

BotToast.showText(text:"xxxx");  //popup a text toast;
BotToast.showSimpleNotification(title: "init"); // popup a sample notification toast;
BotToast.showLoading(); //popup a sample loading toast
//popup a attachments toast
BotToast.showAttachedWidget(
    attachedWidget: (_) => Card(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Icon(
              Icons.favorite,
              color: Colors.redAccent,
            ),
          ),
        ),
    duration: Duration(seconds: 2),
    target: Offset(520, 520));

🐼2.0 version #

Major changes:

  • Support for custom Toast animation and animation duration

  • Add the showAnimationWidget method, which can be used to highly customize an animated Toast🤩

  • Modified the initialization method to make it more versatile. 1.x version upgrade to 2.0 modification needs manual modification to adapt

  • Remove the reInit method and the two deprecated enumerations PreferDirection.Below and PreferDirection.Upside

  • More detailed version 2.0 changes, click to view

1.x version upgrade to 2.x version

  • Modify the location used by BotInit, Now wrap your MaterialApp with BotToastInit instead of XxxPage

change:

///1.x.x version initialization method
MaterialApp(
      title: 'BotToast Demo',
      navigatorObservers: [BotToastNavigatorObserver()],
      home: BotToastInit(  
          child: XxxxPage()
      ),
    );

to:

///2.x.x version initialization method
///Wrap your MaterialApp with BotToastInit
BotToastInit(
  child:MaterialApp(
      title: 'BotToast Demo',
      navigatorObservers: [BotToastNavigatorObserver()],
      home: XxxxPage(),
  )
);
  • Modify the warpWidget parameter of the showEnhancedWidget method (note that this step is not necessary, depending on whether you have used showEnhancedWidget, if not used, this step can be omitted)

change:

///1.x.x version
showEnhancedWidget(
  ...
  warpWidget:(widget)=>XxxWrap(child:widget);
  ...
)

to:

///2.x.x version
showEnhancedWidget(
  ...
  warpWidget:(cancel,widget)=>XxxWrap(child:widget);
  ...
)

📃Documentation #

Documentation

517
likes
100
pub points
97%
popularity

A really easy to use flutter toast library.Easy to use and feature rich.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on bot_toast