Skip to main content

Posts

Flutter BottomNavigationBar

BottomNavigationBar A material widget that's displayed at the bottom of an application. Which shows around three to five items and it includes labels and icons. BottomNavigationBar allows you to select one item at a time and quickly navigate to a given page. Properties of the BottomNavigationBar : items: It defines the list of BottomNavigationBar Items to display the bottom navigation bar. currentIndex: It determines the current active bottom navigation bar item on the screen. onTap: It is called when we tapped one of the items on the screen. iconSize: It is used to specify the size of all bottom navigation item icons. fixedColor: It is used to set the color of the selected item. If we have not set a color to the icon or title, it will be shown. type: It determines the layout and behavior of a bottom navigation bar. It behaves in two different ways that are:  1. fixed: Default it is fixed and If it is null, it will use fixed. 2. shifting: It will use shifting where w...
Recent posts

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...

Form and TextFormField in Flutter

What is Form? Flutter provides a Form widget to create a form in which we can get the data from users. The form is widget acts as a container for grouping and validating multiple form fields. the form can contain TextFormField, buttons, text, images, and many more. When creating the form, provide a GlobalKey. This uniquely identifies the Form and allows validation of the form in a later step. Inside this class, we define a global key as _formKey. This key holds a FormState and can use to retrieve the form widget.  What is TextFormField ? The form widget uses child widget TextFormField to provide the users to enter the text field. This widget renders a material design text field and also allows us to display validation errors when they occur. So, here we are creating an example of form validation with the use of  TextFormField.  Now, let's start with an example we are doing step by step implementation for Form and TextFormField. 1. Create the Form widg...

Flutter SingleChildScrollView

What is SingleChildScrollView? To create a simple vertical ScrollView which can contain different types of widgets with different behavior we would use SingleChildScrollView Widget.SingleChildScrollView Widget is a box that can scroll a single widget. Widget In the below example code snippet we are creating a function called _createContainer() that accepts Color and text as an argument and it returns Container() widget with height: 200 pixels. We will reuse this widget many times in the Column. Without SingleChildScrollView Now we are creating a Column widget and add some containers to it with the use of creating widget function _createContainer(). If you run this code snippet in your app, the column will look like this as shown in the image below. With SingleChildScrollView Now we are wrapping the Column widget with a SingleChildScrollView scrolling widget, the information on the page should scroll and not showing any error. If you run this code snippet in your app, the colu...