Git Product home page Git Product logo

hypetro's Introduction

🧭 Elijah Luckey (he/his)

Hi there πŸ‘‹

  • πŸ’Έ Currently working on a self-hosted budgeting tool (ask me about it!)
  • 🌱 Creating with Dart & Flutter.
  • πŸ•ΈοΈ Creating with Nx & Angular.
  • ⚑ Love music, films, and cooking.

Luckey-Elijah's Detail card

hypetro's People

Contributors

luckey-elijah avatar

Watchers

 avatar  avatar

hypetro's Issues

Expose `buildWhen` option through `ViewController`

The BlocBuilder class has an buildWhen parameter. I should be able to use that buildWhen parameter in the ViewController class that wraps BlocBuilder.

There are two primary interfaces I can think of:


Example 1: pass buildWhen through ViewController super constructor

class MyViewController extends ViewController<MyBloc, MyState, MyView, MyViewModel> {
  const MyViewController({Key? key})
      : super(
          key: key,
          // pass in here
          buildWhen: (previous, current) => previous != current,
        );

  @override
  MyView buildView(
    BuildContext context,
    MyBloc bloc,
    MyViewModel viewModel,
  ) {
    return MyView(
      actions: MyViewActions(bloc),
      viewModel: viewModel,
    );
  }

  @override
  MyViewModel stateToViewModel(MyState state) {
    return MyViewModel(state.todos);
  }
}

Example 2: override a buildWhen method from the base ViewController class

class MyViewController extends ViewController<MyBloc, MyState, MyView, MyViewModel> {
  const MyViewController({Key? key}) : super(key: key);

  @override
  MyView buildView(
    BuildContext context,
    MyBloc bloc,
    MyViewModel viewModel,
  ) {
    return MyView(
      actions: MyViewActions(bloc),
      viewModel: viewModel,
    );
  }

  @override
  MyViewModel stateToViewModel(MyState state) {
    return MyViewModel(state.Mys);
  }

  @override
  bool buildWhen(MyState previous, MyState current) {
    // TODO: implement buildWhen
  }
}

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.