Git Product home page Git Product logo

bot_toast's Introduction

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!

  • 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 simple and easy to use

  • Pure flutter implementation

🐼Online Demo

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

🐳Example

Sample project

🐺Renderings

Notification Attached CustomAnimation
Notification Attached CustomAnimation
Loading Text CustomWidget
Loading Text CustomWidget

🐮Getting started

1. add dependencies into you project pubspec.yaml file

dependencies:
     bot_toast: ^3.0.5 
#    bot_toast: ^4.0.0 #null safety

2. import BotToast lib

import 'package:bot_toast/bot_toast.dart';

3. initialization BotToast

MaterialApp(
      title: 'BotToast Demo',
      builder: BotToastInit(), //1. call BotToastInit
      navigatorObservers: [BotToastNavigatorObserver()], //2. registered route observer
      home: XxxxPage(),
  )

or

//Warning: Don't arbitrarily adjust the position of calling the BotToastInit function 
final botToastBuilder = BotToastInit();  //1. call BotToastInit 
MaterialApp(
      title: 'BotToast Demo',
      builder: (context, child) {
        child = myBuilder(context,child);  //do something
        child = botToastBuilder(context,child); 
        return child;
      }, 
      navigatorObservers: [BotToastNavigatorObserver()], //2. registered route observer
      home: XxxxPage(),
  )

4. use BotToast

var cancel = BotToast.showText(text:"xxxx");  //popup a text toast;
...
cancel();  //close
var cancel = BotToast.showSimpleNotification(title: "init"); // popup a notification toast;
...
cancel();  //close
var cancel = BotToast.showLoading(); //popup a loading toast
...
cancel();  //close
//popup a attachments toast
var cancel = BotToast.showAttachedWidget(
    attachedBuilder: (_) => Card(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Icon(
              Icons.favorite,
              color: Colors.redAccent,
            ),
          ),
        ),
    duration: Duration(seconds: 2),
    target: Offset(520, 520));
...
cancel();  //close
//custom api
var cancel = BotToast.showCustomNotification(...)
var cancel = BotToast.showCustomText(...)
var cancel = BotToast.showCustomLoading(...)
var cancel = BotToast.showAnimationWidget(...)
...
cancel();  //close

🐼3.0 version

Major changes:

  • Reimplemented the underlying initialization logic, the code is simpler and more general, and no longer depends on Navigator

  • Modify the initialization method

2.x version upgrade to 3.x version

change:

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

to:

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

📃Documentation

Documentation

bot_toast's People

Contributors

mmmzq avatar dingyang666 avatar lhamycodes avatar danagbemava avatar pedrolemoz avatar vatsaltanna avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.