Skip to main content

Posts

Showing posts from October, 2021

Flutter RadioButton and Checkbox

RadioButton Radio Button is a material widget that is used as an option button where the user can select only one option from a group of options. We can use it in cases where the user has to select a single value from a set of values. If one radio button is selected then we cannot select the other radio buttons in the same group. we are taking an example of gender selection. title : It is used to specify the radio button label. groupValue : It is used to specify the currently selected item for the radio button group. value : It specifies the backhand value, which is represented by a radio button. onChanged : It will be called whenever the user selects the radio button. ThemeData : You want to change the theme and give primary color and swatch color as a theme it will be used in the whole application. activeColor : When you select the radio button at that time color shows which is defined in the activeColor property. tileColor : This property

Dropdown In Flutter

Dropdown We use the Dropdown Button to display any Dropdown List item as we can change its style according to the requirement. We can customize the dropDown widget with given properties like background color, hint, items, and many more. Let’s see some of the properties of the dropdown button for example. 1. Items We will use this property to define items displayed in the dropdown list as text values. We can define the items directly or we can define using a list. Firstly we can see how to define items directly. We are declaring one global variable and set value 1 so in the dropDown value, we can not see an empty value. and with the use of DropdownMenuItem() we can see the value of that particular item. Let's see the example of how to use items directly:- The second way is to use items property as a list of values and set that values in the Text widget. 2. Value We will use value property to set the selected it