custom_state 0.0.1 custom_state: ^0.0.1 copied to clipboard
Custom state is a flutter widget can access ui with custom state
Getting started #
Add dependency to your pubspec.yaml:
custom_state: 'any'
Usage #
Import packages:
import 'package:custom_state/custom_state.dart';
CustomView: #
CustomStateView<bool>(
key: stateKey,
stateBuilder: (context, states, customState) {
if (states.contains(true)) {
return Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
);
} else {
return Text(
'$_counter',
style: Theme.of(context)
.textTheme
.headline4
?.apply(color: Colors.redAccent),
);
}
},
),
- Change state
final GlobalKey<CustomState<bool>> stateKey = GlobalKey();
...
stateKey.currentState?.replaceCustomState({even});
Features and bugs #
Please file feature requests and bugs at the issue tracker.