Skip to main content

Posts

Showing posts from May, 2021

flutter - How to change TextButton background color

Flutter - TextButton Background Color The TextButton class represents a material design text button. The flutter developers can use text buttons on toolbars, in dialogs, or in line with other content. Text buttons do not have visible borders. The flutter developers should avoid using text buttons where they would blend in with other content such as in the middle of lists. The TextButton style can be overridden with its style parameter. The following flutter application development tutorial will demonstrate how we can set a background color for the TextButton. We will change the TextButton widget’s default background color. Here we will use the TextButton class’s styleFrom() method to change the TextButton’s default background color. The TextButton class’s styleFrom() method is a static convenience method that constructs a text button ButtonStyle given simple values. By default, TextButton class styleFrom() method returns a ButtonStyle that doesn't ...

flutter - How to create OutlinedButton with icon

Flutter - OutlinedButton Icon The OutlinedButton class represents a material design outlined button that is essentially a TextButton with an outlined border. The outlined buttons are medium-emphasis buttons. In a flutter application, the OutlinedButtons contain actions that are important, but they are not the primary action in an app. An OutlinedButton widget’s default style is defined by defaultStyleOf. The flutter application developers can override the OutlinedButton’s style with its style parameter. An OutlinedButton has a default ButtonStyle.side which defines the appearance of the outline. The flutter app developers can specify an OutlinedButton's shape and the appearance of its outline by specifying both the ButtonStyle.shape and ButtonStyle.side properties. The following flutter application development tutorial will demonstrate how to create an OutlinedButton widget with an icon. Here we will use the OutlinedButton.icon() constructor to create a...

flutter - How to change OutlinedButton border radius

Flutter - OutlinedButton Border Radius The OutlinedButton class represents a material design outlined button that is essentially a TextButton with an outlined border. The outlined buttons are medium-emphasis buttons. In a flutter application, the OutlinedButtons contain actions that are important, but they are not the primary action in an app. An OutlinedButton widget’s default style is defined by defaultStyleOf. The flutter application developers can override the OutlinedButton’s style with its style parameter. An OutlinedButton has a default ButtonStyle.side which defines the appearance of the outline. The flutter app developers can specify an OutlinedButton's shape and the appearance of its outline by specifying both the ButtonStyle.shape and ButtonStyle.side properties. The following flutter application development tutorial will demonstrate how to set or change the OutlinedButton widget’s border-radius. That means how we can make rounded corners Out...

flutter - How to change OutlinedButton border color

Flutter - OutlinedButton Border Color The OutlinedButton class represents a material design outlined button that is essentially a TextButton with an outlined border. The outlined buttons are medium-emphasis buttons. In a flutter application, the OutlinedButtons contain actions that are important, but they are not the primary action in an app. An OutlinedButton widget’s default style is defined by defaultStyleOf. The flutter application developers can override the OutlinedButton’s style with its style parameter. An OutlinedButton has a default ButtonStyle.side which defines the appearance of the outline. The flutter app developers can specify an OutlinedButton's shape and the appearance of its outline by specifying both the ButtonStyle.shape and ButtonStyle.side properties. The following flutter application development tutorial will demonstrate how to set or change the OutlinedButton widget’s border color. Here we will use the OutlinedButton class’s styl...

flutter - How to use OutlinedButton

Flutter OutlinedButton The OutlinedButton class represents a material design Outlined Button that is essentially a TextButton with an outlined border. The Outlined buttons are medium-emphasis buttons. In a flutter application, the OutlinedButtons contain actions that are important, but they are not the primary action in an app. An OutlinedButton widget’s default style is defined by defaultStyleOf. The flutter application developers can override the OutlinedButton’s style with its style parameter. An OutlinedButton has a default ButtonStyle.side which defines the appearance of the outline. The flutter app developers can specify an OutlinedButton's shape and the appearance of its outline by specifying both the ButtonStyle.shape and ButtonStyle.side properties. The OutlinedButton() constructor creates an OutlinedButton. And the OutlinedButton.icon() constructor creates a text button from a pair of widgets that serve as the button's icon and labe...

flutter - How to use TextField

Flutter TextField The TextField class represents a material design text field. The TextField widget lets the user enter text, either with a hardware keyboard or with an onscreen keyboard. The TextField calls the onChanged callback whenever the user changes the text in the field. The flutter developers can control the text that is displayed in the TextField using the controller. The controller allows developers to set an initial value. The controller can also control the selection and composing region and observe changes to the text, selection, and composing region. The flutter developers can use TextField decoration property to control the decoration, for example by adding a label or an icon. The flutter developers can read the value from a TextField widget to use the onSubmitted callback. The onSubmitted callback is applied to TextField's current value when the user finishes editing. The flutter app developers can always read t...

flutter - How to use IconButton

Flutter IconButton The IconButton class represents a material design icon button. IconButton is a picture printed on a material widget that reacts to touches by filling with color. The flutter developers commonly used the Icon buttons in the AppBar actions field, but IconButtons can be used in many other places as well. The flutter app developers can leave the onPressed callback null to disable an IconButton, then it will not react to touch. The IconButton class has several useful properties such as alignment, autofocus, color, disabledColor, focusColor, highlightColor, hoverColor, icon, iconSize, isSelected, onPressed, padding, selectedIcon, splashColor, style, and tooltip. The IconButton class’s alignment property defines how the icon is positioned within the IconButton. The color property defines the color to use for the icon inside the button if the icon is enabled. The icon property defines the icon to display inside the button. The ic...

flutter - How to use ElevatedButton

Flutter ElevatedButton The ElevatedButton class represents a material design elevated button. The flutter developers can use elevated buttons to add dimension to otherwise mostly flat layouts such as in long busy lists of content, or in wide spaces. The flutter developers should avoid using elevated buttons on already-elevated content such as dialogs or cards. An ElevatedButton widget is a label child displayed on a Material widget whose Material.elevation increases when the button is pressed. The label's Text and Icon widgets are displayed in style's ButtonStyle.foregroundColor and the button's filled background is the ButtonStyle.backgroundColor. The ElevatedButton widget's default style is defined by defaultStyleOf. The style of this ElevatedButton can be overridden with its style parameter. The static styleFrom method is a convenient way to create an ElevatedButton ButtonStyle from simple values. If the ElevatedButto...

flutter - How to underline Text

Flutter - Text Style Underline The Text widget displays a string of text with a single style in a flutter app. But depending on the layout constraints the string might break across multiple lines or might all be displayed on the same line. The style argument is optional in a Text instance. When the style argument is omitted then the text will use the style from the closest enclosing DefaultTextStyle. By default, the Text is not selectable. But flutter developers can make a Text selectable by wrapping a subtree with a SelectionArea widget. In the following flutter application development tutorial, we will demonstrate how we can underline text. Here we will use the TextStyle class decoration property to decorate the Text by putting an underline. The TextStyle class represents an immutable style describing how to format and paint text. The TextStyle class decoration property is used to apply decorations to paint near the text such as an underline. The f...