Code Monkey home page Code Monkey logo

buzz's Introduction

Buzz

Opinionated modern event-based application development framework.

Built on top of dart-event-bus.

Installation

buzz: 0.1.0

Initialization

Buzz.init(
  navigator: MyAppNavigator(),
  rootAppRoute: '/',
);

Learn more how to create the required instance of the Navigator component.

Fire Events

By default the framework supports firing three base class events:

  • UiEvent
  • Command
    • NavigationCommand
  • AppEvent

Find pre-defined out-of-the-box supported events here.

UiEvents

The library comes with a few pre-defined UiEvents you can find here.

For example, when a button/label is tapped:

ElevatedButton(
  onPressed: () {
    Buzz.fire(OnTapped());
  },
  child: Text('Tap me!'),
)

Commands

TODO: Add

AppEvents

TODO: Add

Listen Events

Use the on method from the Buzz instance to get a Stream to listen events of a specific class type.

Here is how you can add a listener for NavigationCommand's:

Buzz.on<NavigationCommand>().listen((navigationCommand) {
  //TODO: Implement navigation command handler
  print(navigationCommand);
});

Customization

Include the Buzz events dashboard

First enable the withDebugDashboard flag from the init method:

Buzz.init(
  withDebugDashboard: true,
  navigator: MyAppNavigator(),
  rootAppRoute: '/',
);

Now you can use the EventsDashboardPage widget. Here is an example on how to declare a route when using Get:

GetPage(
  name: EventsDashboardPage.routeName,
  page: () => const EventsDashboardPage(),
  transition: Transition.fadeIn,
),

Finally, navigate to the events dashboard by running:

Buzz.fire(GoToBuzzEventsDashboard());

or add a custom button that fires the UiEvent already setup during library initialization:

Buzz.fire(GoToBuzzDashboardButtonTapped());

Upcoming Features

  • Default navigator using Flutter Navigator 2.0 instead of Get.

Test Coverage

brew install lcov
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html

buzz's People

Contributors

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