From 80d652f1a506befb0a5bc18643c77fd572c49623 Mon Sep 17 00:00:00 2001 From: Wase-Zahin Date: Fri, 5 Jan 2024 16:10:52 +0800 Subject: [PATCH] feat: Add documentation for GetBuilder widget --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index be419c9a9..9d9fa72f7 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ - [Local State Widgets](#local-state-widgets) - [ValueBuilder](#valuebuilder) - [ObxValue](#obxvalue) + - [GetBuilder](#getbuilder) - [Useful tips](#useful-tips) - [GetView](#getview) - [GetResponsiveView](#getresponsiveview) @@ -834,6 +835,29 @@ ObxValue((data) => Switch( ), ``` +#### GetBuilder + +The `GetBuilder` widget is used to control and update the UI based on changes in the state managed by a specific controller. Any changes to +the state of the controller will trigger a rebuild of the UI within the `GetBuilder` widget, ensuring that the UI stays reactive and in sync +with the controller's state. + +```dart +GetBuilder( + init: Controller(), + builder: (controller) { + return Column( + children: [ + Text('Value: ${controller.value}'), + ElevatedButton( + onPressed: () => controller.increment(), + child: Text('Increment'), + ), + ], + ); + }, +), +``` + ## Useful tips `.obs`ervables (also known as _Rx_ Types) have a wide variety of internal methods and operators.