- πΈ 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.
hypetro's Introduction
hypetro's People
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.