Skip to content

Commit

Permalink
doc: Update widget descriptions for RtConsumer, RtMultiProvider, …
Browse files Browse the repository at this point in the history
…`RtProvider`, `RtSelector`, and `RtSignalWatcher`.
  • Loading branch information
CarLeonDev committed Aug 15, 2024
1 parent 6928b93 commit a14cbf1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion website/src/content/docs/widgets/rt_consumer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ RtConsumer<T>({
- `key`: An optional <HT>`Key`</HT> to use for identifying the widget.
- `id`: An optional identifier for the dependency.
If omitted, the dependency will be located by its type(<HT>`T`</HT>).
- `child`: An optional <HT>`Widget`</HT> that is independent of the <HT>`RtConsumer`</HT>.
- `child`: An optional <HT>`Widget`</HT> that remains static while the widget tree is rebuilt.
It is passed to the <HM>`builder`</HM> function if it is defined.
- `listenAll`: A boolean that determines whether to listen to all states provided by the <HT>`T`</HT> dependency.
If set to <HN>`true`</HN>, the <HM>`listenStates`</HM> function is ignored.
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/widgets/rt_multi_provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RtMultiProvider(

- `providers`: A list of <HT>`RtProvider`</HT> widgets that are to be wrapped by the <HT>`RtMultiProvider`</HT>.
- `key`: An optional <HT>`Key`</HT> to use for identifying the widget.
- `child`: An optional <HT>`Widget`</HT> which is independent of the <HT>`RtMultiProvider`</HT>.
- `child`: An optional <HT>`Widget`</HT> that remains static while the widget tree is rebuilt.
It is passed to the <HM>`builder`</HM> function if it is defined.
- <HM>`builder`</HM>: An optional function which builds a widget depending on the <HT>`RtMultiProvider`</HT>. If it not defined, the <HT>`child`</HT> widget is returned.
It receives the following arguments:
Expand Down
5 changes: 3 additions & 2 deletions website/src/content/docs/widgets/rt_provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ The <HT>`RtProvider`</HT> class has three constructors, each catering to differe
If omitted, the dependency will be located by its type(<HT>`T`</HT>).
- `mode`: The mode of the dependency injection. By default, it uses the builder mode(<HE>`DependecyMode.builder`</HE>).
Learn more about the [dependency modes](/reactter/core_concepts/dependency_injection/#dependency-modes).
- `child`: An optional <HT>`Widget`</HT> which is independent of the <HT>`RtProvider`</HT>.
- `child`: An optional <HT>`Widget`</HT> that remains static while the widget tree is rebuilt.
It is passed to the <HM>`builder`</HM> function if it is defined.
- <HM>`builder`</HM>: An optional function which builds a widget based on the dependency. If it not defined, the <HT>`child`</HT> widget is returned.
- <HM>`builder`</HM>: An optional function which builds a widget based on the dependency.
If it not defined, the <HT>`child`</HT> widget is returned.
It receives the following arguments:
- `context`: The <HM>`BuildContext`</HM> of the widget. A handle to the location of <HT>`RtProvider`</HT> in the widget tree.
- `instance`: The instance of the <HT>`T`</HT> dependency. It is available only to default constructor.
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/widgets/rt_selector.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RtSelector<T, V>({

- `key`: An optional <HT>`Key`</HT> to use for identifying the widget.
- `id`: An optional <HT>`String`</HT> to identify the selector.
- `child`: An optional <HT>`Widget`</HT> which is independent of the <HT>`RtSelector`</HT>.
- `child`: An optional <HT>`Widget`</HT> that remains static while the widget tree is rebuilt.
If defined, it is passed to the <HM>`builder`</HM> function.
- <HM>`selector`</HM>: A function that computes a value <HT>`V`</HT> from one or more states and listens for changes to rebuild the widget tree when the value computed changes.
It receives the following arguments:
Expand Down
7 changes: 3 additions & 4 deletions website/src/content/docs/widgets/rt_signal_watcher.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import counterCode from '@/examples/rt_signal_watcher/lib/counter.dart?raw';
import counterViewCode from '@/examples/rt_signal_watcher/lib/counter_view.dart?raw';
import mainCode from '@/examples/rt_signal_watcher/lib/main.dart?raw';

The <HT><a href="https://pub.dev/documentation/flutter_reactter/latest/flutter_reactter/RtSignalWatcher-class.html">`RtSignalWatcher`</a></HT> widget that provides a mechanism to rebuild a widget tree whenever a <HT>`Signal`</HT> within its scope changes.
The <HT><a href="https://pub.dev/documentation/flutter_reactter/latest/flutter_reactter/RtSignalWatcher-class.html">`RtSignalWatcher`</a></HT> widget provides a mechanism to rebuild a widget tree whenever a <HT>`Signal`</HT> within its scope changes.
It acts as a listener for all <HT>`Signal`</HT> instances within its subtree, triggering a rebuild when any of these signals emit new values.

:::caution
It is not recommended to use <HT>`RtSignalWatcher`</HT> with a widget tree where it may contain a considerable number of arbitrary unchecked signals.
Because <HT>`RtSignalWatcher`</HT> will listen any signals in the widget tree, regardless of its level, this could result in needless rebuilds that negatively affect performance.

For more granular control and performance optimization, consider using <HT>[`RtConsumer`](/reactter/widgets/rt_consumer)</HT>, <HT>[`RtSelector`](/reactter/widgets/rt_selector)</HT>, <HM>[`BuildContext.watch`](/reactter/extensions/builder_context_watch)</HM>, <HM>[`BuildContext.select`](/reactter/extensions/builder_context_select)</HM> instead to listen for specific states and rebuild parts of the widget tree that require it.
For more granular control and performance optimization, consider using <HT>[`RtWatcher`](/reactter/widgets/rt_watcher)</HT>, <HT>[`RtConsumer`](/reactter/widgets/rt_consumer)</HT>, <HT>[`RtSelector`](/reactter/widgets/rt_selector)</HT>, <HM>[`BuildContext.watch`](/reactter/extensions/builder_context_watch)</HM>, <HM>[`BuildContext.select`](/reactter/extensions/builder_context_select)</HM> instead to listen for specific states and rebuild parts of the widget tree that require it.
:::

## Syntax
Expand All @@ -39,7 +39,7 @@ RtSignalWatcher({
## Properties

- `key`: An optional <HT>`Key`</HT> to use for identifying the widget.
- `child`: An optional <HT>`Widget`</HT> that is independent of the <HT>`RtSignalWatcher`</HT>.
- `child`: An optional <HT>`Widget`</HT> that remains static while the widget tree is rebuilt.
It is passed to the <HM>`builder`</HM> function if it is defined.
- <HM>`builder`</HM>: A required function that builds a widget tree based on the current state of the signals.
It receives the following arguments:
Expand All @@ -50,7 +50,6 @@ RtSignalWatcher({

The following example demonstrates how to use the <HT>`RtSignalWatcher`</HT> widget to listen for changes in a <HT>`Signal`</HT> and rebuild the widget tree accordingly.


<CodeTabs>
<ZappButton path="examples/rt_signal_watcher"/>

Expand Down

0 comments on commit a14cbf1

Please sign in to comment.