flutter_love 0.2.0 copy "flutter_love: ^0.2.0" to clipboard
flutter_love: ^0.2.0 copied to clipboard

Provide flutter widgets handle common use case with love state management library

flutter_love #

Build Status Coverage Status Pub

flutter_love provide flutter widgets handle common use case with love state management library.

React* Widgets #

React* Widgets are combination of react* operators and widget builder.

  1. ReactState will react to system's whole state change, then trigger a build with widget builder:

    ...
    
    final System<int, CounterEvent> _system = ...; // store system somewhere
    
    ...
    
    @override
    Widget build(BuildContext context) {
      return ReactState<int, CounterEvent>(
        system: _system,
        builder: (context, state, dispatch) {
          return CounterPage(
            title: 'Use React Widget Page',
            count: state,
            onIncreasePressed: () => dispatch(Increment()),
          );
        }
      );
    }
    
  2. React will react to system's partial state change, then trigger a build with widget builder:

    ...
    
    final System<int, CounterEvent> _system = ...; // store system somewhere
    
    ...
    
    @override
    Widget build(BuildContext context) {
      return React<int, CounterEvent, bool>(
        system: _system,
        value: (state) => state.isOdd, // map state to value
        builder: (context, isOdd, dispatch) {
          return TextButton(
            onPressed: () => dispatch(Increment()),
            child: Text('isOdd: $isOdd'),
          );
        },
      );
    }
    

License #

The MIT License (MIT)

0
likes
130
pub points
6%
popularity

Publisher

unverified uploader

Provide flutter widgets handle common use case with love state management library

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, love

More

Packages that depend on flutter_love