Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Add primitives #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add primitives #6

wants to merge 2 commits into from

Conversation

esDotDev
Copy link

@esDotDev esDotDev commented Feb 13, 2022

Added some value types for easily rebuilding the view when data changes.

  • ReactiveInt
  • ReactiveBool
  • ReactiveString
  • ReactiveDouble
  • ReactiveValue<T>

Address this issue: #2

Tweaked the example to make use of the bool reactive for showPassword:

class ReactiveLoginLogic extends Reactive {
  ReactiveLoginLogic(ReactiveHost host) : super(host);
  late final ReactiveTextEditingController _email = ReactiveTextEditingController(host);
  late final ReactiveTextEditingController _password = ReactiveTextEditingController(host);
  late final ReactiveBool _showPasswordReactive = ReactiveBool(host); // rebuilds when changed

  TextEditingController get emailCtrl => _email.ctrl;
  TextEditingController get passwordCtrl => _password.ctrl;
  bool get showPassword => _showPasswordReactive.value;

  // Login logic
  void submit() {}

  void toggleShowPassword() => _showPasswordReactive.value = !showPassword;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant