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
150
points
1.26k
downloads

Publisher

unverified uploader

Weekly Downloads

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

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, love

More

Packages that depend on flutter_love