Icon Button & Outline Button& New Buttons in Flutter | الزراير في فلاتر

Published: 27 June 2021
on channel: Sec it Developers
921
28

IconButton class Null safety
A material design icon button.

An icon button is a picture printed on a Material widget that reacts to touches by filling with color (ink).

Icon buttons are commonly used in the AppBar.actions field, but they can be used in many other places as well.

If the onPressed callback is null, then the button will be disabled and will not react to touch.

Requires one of its ancestors to be a Material widget.

The hit region of an icon button will, if possible, be at least kMinInteractiveDimension pixels in size, regardless of the actual iconSize, to satisfy the touch target size requirements in the Material Design specification. The alignment controls how the icon itself is positioned within the hit region.

OutlinedButton class Null safety
A Material Design "Outlined Button"; essentially a TextButton with an outlined border.

Outlined buttons are medium-emphasis buttons. They contain actions that are important, but they aren’t the primary action in an app.

An outlined button is a label child displayed on a (zero elevation) Material widget. The label's Text and Icon widgets are displayed in the style's ButtonStyle.foregroundColor and the outline's weight and color are defined by ButtonStyle.side. The button reacts to touches by filling with the style's ButtonStyle.backgroundColor.

The outlined button's default style is defined by defaultStyleOf. The style of this outline button can be overridden with its style parameter. The style of all text buttons in a subtree can be overridden with the OutlinedButtonTheme and the style of all of the outlined buttons in an app can be overridden with the Theme's ThemeData.outlinedButtonTheme property.

ElevatedButton class Null safety
A Material Design "elevated button".

Use elevated buttons to add dimension to otherwise mostly flat layouts, e.g. in long busy lists of content, or in wide spaces. Avoid using elevated buttons on already-elevated content such as dialogs or cards.

An elevated button 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 elevated button's default style is defined by defaultStyleOf. The style of this elevated button can be overridden with its style parameter. The style of all elevated buttons in a subtree can be overridden with the ElevatedButtonTheme, and the style of all of the elevated buttons in an app can be overridden with the Theme's ThemeData.elevatedButtonTheme property.

The static styleFrom method is a convenient way to create a elevated button ButtonStyle from simple values.

If onPressed and onLongPress callbacks are null, then the button will be disabled.

TextButton class Null safety
A Material Design "Text Button".

Use text buttons on toolbars, in dialogs, or inline with other content but offset from that content with padding so that the button's presence is obvious. Text buttons do not have visible borders and must therefore rely on their position relative to other content for context. In dialogs and cards, they should be grouped together in one of the bottom corners. Avoid using text buttons where they would blend in with other content, for example in the middle of lists.

A text button is a label child displayed on a (zero elevation) Material widget. The label's Text and Icon widgets are displayed in the style's ButtonStyle.foregroundColor. The button reacts to touches by filling with the style's ButtonStyle.backgroundColor.

The text button's default style is defined by defaultStyleOf. The style of this text button can be overridden with its style parameter. The style of all text buttons in a subtree can be overridden with the TextButtonTheme and the style of all of the text buttons in an app can be overridden with the Theme's ThemeData.textButtonTheme property.

The static styleFrom method is a convenient way to create a text button ButtonStyle from simple values.

If the onPressed and onLongPress callbacks are null, then this button will be disabled, it will not react to touch.
New Buttons and Button Themes
Summary
A new set of basic material button widgets and themes have been added to Flutter. The original classes have been deprecated and will eventually be removed. The overall goal is to make buttons more flexible, and easier to configure via constructor parameters or themes.


#sec_it_developers
#flutter_course_in_arabic
our community
facebook page : https://bit.ly/3vtKu2h
facebook group : https://bit.ly/3vtKIGF
facebook profile : https://bit.ly/3x2PkF2
telegram channel : https://bit.ly/2TJBlVO