RatingBar

The RatingBar widget is used to show a rating or collect ratings from users (this is an interactive RatingBar). For example, you can use the RatingBar widget inside an e-commerce app to show ratings for a product.

Adding a RatingBar to Your Project

Here's an example of how you can use the RatingBar widget in your project:

  1. First, drag the Column widget from the Layout Elements tab (in the Widget Panel) or add it directly from the widget tree. Set its Cross Axis Alignment to Start.

  2. Add a Text widget (Inside the Column). Change the name to Item Name and the Theme Style to Title 1. Set the Left Padding to 10.

  3. Add another Text widget. Change the name to Item Description and the Theme Style to Subtitle 2. Set the Left Padding to 10.

  4. Finally, add the RatingBar widget from the Form Elements tab or add it directly from the widget tree.

Collectings Ratings from Users (Interactive RatingBar)

To collect ratings from users:

  1. Select RatingBar from the widget tree or from the canvas area.

  2. Move to the Property Editor and scroll down to the Rating Bar Properties section.

  3. Find the Interactive property and checkmark it (click on it).

  4. Set an Initial Rating (typically 0).

Changing the Properties

The Properties Panel can be used to customize the appearance and behavior of your widget.

Add Padding

Here are the instructions on how to add padding.

Adjust the Alignment

Here are the instructions on adjusting the alignment.

Setting The Rating Value

The Rating can be set by inputting an amount or set from a variable. This is only for a RatingBar that is not interactive. To manually set the Rating value for the RatingBar:

  1. Select RatingBar from the widget tree or from the canvas area.

  2. Move to the Property Editor and scroll down to the Rating Bar Properties section.

  3. Find the Rating property and change the default value.

You can also enter the value in decimal such as 1.5. When a decimal is used, a portion of the icon will be colored.

Customize the Icon

Here's an example of how you can customize the icons appearing in the RatingBar:

  1. Select RatingBar from the widget tree or from the canvas area.

  2. Move to the Property Editor and scroll down to the Rating Bar Properties section.

  3. Find the Icon Count property and change the value to 10.

  4. Set the Icon Size property to 30.

  5. Find the Icon Selector property below, Click on the Start Rounded button, then search and select the icon name with FontAwesome.smile.

Changing the Rated/Unrated Color

To change the rated and unrated color (color for icons that are not filled in) for the RatingBar:

  1. Select RatingBar from the widget tree or from the canvas area.

  2. Move to the Property Editor and scroll down to the Rating Bar Properties section.

  3. Now, find the Rated Color property, Click on the box next to Secondary, select the color, and then click Use Selected Color or click on Secondary and enter a Hex Code directly. You can also choose the color by clicking on the Palette and Simple button.

  4. Similarly, set the Unrated Color as well.

Add Padding between Icons

To add padding between icons:

  1. Select RatingBar from the widget tree or from the canvas area.

  2. Move to the Property Editor and scroll down to the Rating Bar Properties section.

  3. Find the Icon Padding property and enter the values.

Changing the Axis

In a very rare case, you may want to make all icons (inside the RatingBar) appear vertically. This can be done using the Axis property.

To change the Axis:

  1. Select RatingBar from the widget tree or from the canvas area.

  2. Move to the Property Editor and scroll down to the Rating Bar Properties section.

  3. Find the Axis dropdown and change it to Vertical.

Set color dynamically

See how to set a color from variable to any color property of this widget.

Trigger action on change

See how to trigger an action when a selection changes on this widget.

Show/Hide RatingBar

Please find the instructions to show/hide the widget here

Last updated