Skip to content

Commit 9b85b48

Browse files
committed
added slider and ratingbar widget
1 parent 652bfd3 commit 9b85b48

18 files changed

+211
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
slug: ratingbar
3+
title: RatingBar
4+
tags: []
5+
description: Learn how to add RatingBar in your FlutterFlow app.
6+
sidebar_position: 5
7+
---
8+
9+
# RatingBar
10+
11+
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.
12+
13+
## Adding a RatingBar to Your Project
14+
15+
Here's an example of how you can use the RatingBar widget in your project:
16+
17+
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**.
18+
2. Now add one **Image** widget inside the column and set its **Width** property to **inf** and **Height** property to 200.
19+
3. 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.
20+
4. Add another **Text** widget. Change the **name** to **Item Description** and the **Theme Style** to **Subtitle 2.** Set the **Left Padding** to 10.
21+
5. Finally, add the **RatingBar** widget from the **Form Elements** tab or add it directly from the widget tree.
22+
23+
![](../../imgs/ratingbar-demo.gif)
24+
25+
### Collectings Ratings from Users (Interactive RatingBar)
26+
27+
To collect ratings from users:
28+
29+
1. Select **RatingBar** from the widget tree or from the canvas area.
30+
2. Move to the Property Editor and scroll down to the **Rating Bar Properties** section.
31+
3. Find the **Interactive** property and checkmark it (click on it).
32+
33+
![collect-ratings](../../imgs/collect-ratings.gif)
34+
35+
### Setting The Rating Value
36+
37+
The Rating can be set by inputting an amount or set from a variable. This is only for a RatingBar that is not interactive.
38+
39+
To manually set the Rating value for the RatingBar:
40+
41+
1. Select **RatingBar** from the widget tree or from the canvas area.
42+
2. Move to the Property Editor and scroll down to the **Rating Bar Properties** section.
43+
3. Find the **Rating** property and change the default value.
44+
45+
:::info
46+
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.
47+
:::
48+
49+
![set-rating-value](../../imgs/set-rating-value.gif)
50+
51+
### Customize the Icon
52+
53+
Here's an example of how you can customize the icons appearing in the RatingBar:
54+
55+
1. Select **RatingBar** from the widget tree or from the canvas area.
56+
2. Move to the Property Editor and scroll down to the **Rating Bar Properties** section.
57+
3. Find the **Icon Count** property and change the value to 10.
58+
4. Set the **Icon Size** property to 30.
59+
5. Find the **Icon Selector** property below, Click on the **Start Rounded** button, then search and select the icon name with **FontAwesome.smile**.
60+
61+
![customize-icon](../../imgs/customize-icon.gif)
62+
63+
### Changing the Rated/Unrated Color
64+
65+
To change the rated and unrated color (color for icons that are not filled in) for the RatingBar:
66+
67+
1. Select **RatingBar** from the widget tree or from the canvas area.
68+
2. Move to the Property Editor and scroll down to the **Rating Bar Properties** section.
69+
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.
70+
4. Similarly, set the **Unrated** **Color** as well.
71+
72+
![changing-ratingbar-color](../../imgs/changing-ratingbar-color.gif)
73+
74+
### Add Padding between Icons
75+
76+
To add padding between icons:
77+
78+
1. Select **RatingBar** from the widget tree or from the canvas area.
79+
2. Move to the Property Editor and scroll down to the **Rating Bar Properties** section.
80+
3. Find the **Icon Padding** property and enter the values.
81+
82+
:::info
83+
Use the Lock button to change the Left, Top, Right and Bottom padding all at the same time. Unlocking will allow you to modify each value separately.
84+
:::
85+
86+
![ratingbar-adding-padding-between-icons](../../imgs/ratingbar-adding-padding-between-icons.gif)
87+
88+
### Changing the Axis
89+
90+
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.
91+
92+
To change the Axis:
93+
94+
1. Select **RatingBar** from the widget tree or from the canvas area.
95+
2. Move to the Property Editor and scroll down to the **Rating Bar Properties** section.
96+
3. Find the **Axis** dropdown and change it to **Vertical**.
97+
98+
![ratingbar-change-axis](../../imgs/ratingbar-change-axis.gif)
99+
100+
## Trigger action on change
101+
102+
See how to [trigger an action when a selection changes](../../../../../resources/ui-building-blocks/widgets/widget-commonalities#trigger-action-on-selection-change) on this widget.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
slug: slider
3+
title: Slider
4+
tags: []
5+
description: Learn how to add Slider in your FlutterFlow app.
6+
sidebar_position: 4
7+
---
8+
9+
# Slider
10+
11+
The Slider widget is used to select a single value from a range of values. You define the min and max value for the slider, and users can choose the value between the specified range by dragging the slider thumb (sliding circle).
12+
13+
For example, you can use the Slider widget to allow users to set the volume, set the donation amount, etc.
14+
15+
## Adding Slider
16+
17+
Let's build an example of using the Slider widget and retrieve its value in a Text widget.
18+
19+
![Slider widget](../../imgs/slider-demo.gif)
20+
21+
The steps to build the example are as follows:
22+
23+
1. First, add the **Slider** widget from the **Form Elements** tab or add it directly from the widget tree.
24+
2. Now, add the **Text** widget to display the slider value.
25+
3. Keep the **Text** widget selected, Move to the properties panel, and click on the **Set from Variable**. This will open a new panel.
26+
1. Set **Source** to **Widget State**.
27+
2. Set the **Available Options** to **Slider**. If you add multiple sliders, the names would be like Slider1, Slider2, and so on.
28+
3. Set the **Number Format Option** if you wish to.
29+
4. Click **Confirm**.
30+
31+
![Slider demo](../../imgs/adding-slider.gif)
32+
33+
## Setting initial value
34+
35+
Sometimes you might want to display the slider with the default value. For example, showing the volume slider with the audible volume value. You can do so by setting the initial value for the Slider.
36+
37+
![slider-set-initial-value](../../imgs/slider-set-initial-value.gif)
38+
39+
## Customization
40+
41+
You can customize the appearance and behavior of the widget using the various properties available under the properties panel.
42+
43+
### Setting platform type
44+
45+
You can set the platform type to *Adaptive or Android* for **this widget. Selecting the Adaptive type will display the widget in its native style. That means the widget will show iOS-style rendering when running on iOS devices and Android-style rendering when running on Android devices.
46+
47+
To set the platform type:
48+
49+
1. Select the **Slider** widget from the widget tree or the canvas area.
50+
2. Move to the properties panel and open the **Platform** section.
51+
3. Set the **Platform Type** among the **Android** or **Adaptive**.
52+
53+
![Setting platform type](../../imgs/set-platform-type.gif)
54+
55+
### Defining slider range
56+
57+
You can define the slider range by setting the min and max values.
58+
59+
To set the min and max values:
60+
61+
1. Select the **Slider** widget from the widget tree or the canvas area.
62+
2. Move to the properties panel and scroll down to the **Slider Properties** section.
63+
3. Find the **Min** property and enter the value. This will be the start value of the range.
64+
4. Find the **Max** property and enter the value. This will be the end value of the range.
65+
66+
![Defining slider range](../../imgs/slider-range.gif)
67+
68+
### Setting step size
69+
70+
By default, you can move and stop the slider thumb at any place on the slider track. To make the slider thumb stop at a specific interval, you can set the step size value.
71+
72+
:::info
73+
If the range is not evenly divisible by the step size, the slider thumb will stop at the closest value in the range.
74+
:::
75+
76+
To set the step size:
77+
78+
1. Select the **Slider** widget from the widget tree or the canvas area.
79+
2. Move to the properties panel and scroll down to the **Slider Properties** section.
80+
3. Find the **Step Size** property and enter the value.
81+
82+
![Setting step size](../../imgs/slider-step-size.gif)
83+
84+
### Changing color
85+
86+
To change the slider colors:
87+
88+
1. Select the **Slider** widget from the widget tree or the canvas area.
89+
2. Move to the properties panel and scroll down to the **Slider Properties** section.
90+
3. To change the active color, find the **Active Color** property, click on the box next to the already selected color, select the color, and then click **Use Color** or click on an already selected color ****and enter a Hex Code directly. You can also choose the color by clicking the **Palette** and **Simple** button.
91+
4. To change the inactive color, find the **Inactive Color** property, click on the box next to the already selected color, select the color, and then click **Use Color** or click on an already selected color ****and enter a Hex Code directly. You can also choose the color by clicking the **Palette** and **Simple** button.
92+
93+
![Changing color](../../imgs/slider-color.gif)
94+
95+
### Showing slider value
96+
97+
You can show the slider value while moving the slider thumb on the track. The value appears as a tooltip above the slider thumb.
98+
99+
To show the slider value:
100+
101+
1. Select the **Slider** widget from the widget tree or the canvas area.
102+
2. Move to the properties panel and scroll down to the **Slider Properties** section.
103+
3. Find the **Show Value** property and turn on the toggle.
104+
105+
![Showing slider value](../../imgs/showing-slider-value.gif)
106+
107+
## Trigger action on change
108+
109+
See how to [trigger an action when a selection changes](../../../../../resources/ui-building-blocks/widgets/widget-commonalities#trigger-action-on-selection-change) on this widget.
1.8 MB
Loading
6.34 MB
Loading
3.82 MB
Loading
3.76 MB
Loading
3.76 MB
Loading
2.81 MB
Loading
3.22 MB
Loading
1.22 MB
Loading

0 commit comments

Comments
 (0)