flutter_love 0.2.0
flutter_love: ^0.2.0 copied to clipboard
Provide flutter widgets handle common use case with love state management library
flutter_love #
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.
-
ReactStatewill 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()), ); } ); } -
Reactwill 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)