A material design "flat button".

A flat button is a section printed on a Material widget that reacts to touches by filling with color.

Use flat 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. Flat buttons intentionally 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 flat buttons where they would blend in with other content, for example in the middle of lists.

Material design flat buttons have an all-caps label, some internal padding, and some defined dimensions. To have a part of your application be interactive, with ink splashes, without also committing to these stylistic choices, consider using InkWell instead.

If the onPressed callback is null, then the button will be disabled, will not react to touch, and will be colored as specified by the disabledColor property instead of the color property. If you are trying to change the button's color and it is not having any effect, check that you are passing a non-null onPressed handler.

Requires one of its ancestors to be a Material widget.

See also:



FlatButton({Key key, @required VoidCallback onPressed, Color textColor, Color disabledTextColor, Color color, Color highlightColor, Color splashColor, Color disabledColor, ButtonTextTheme textTheme, Brightness colorBrightness, @required Widget child })
Creates a flat button. [...]


child Widget
The widget below this widget in the tree. [...]
color Color
The primary color of the button, as printed on the Material, while it is in its default (unpressed, enabled) state. [...]
colorBrightness Brightness
The theme brightness to use for this button. [...]
disabledColor Color
The color of the button when the button is disabled. Buttons are disabled by default. To enable a button, set its onPressed property to a non-null value.
disabledTextColor Color
The color to use for this button's text when the button cannot be pressed. [...]
enabled bool
Whether the button is enabled or disabled. Buttons are disabled by default. To enable a button, set its onPressed property to a non-null value.
highlightColor Color
The secondary color of the button when the button is in the down (pressed) state. The higlight color is represented as a solid color that is overlaid over the button color (if any). If the highlight color has transparency, the button color will show through. The highlight fades in quickly as the button is held down. [...]
onPressed VoidCallback
The callback that is called when the button is tapped or otherwise activated. [...]
splashColor Color
The primary color of the button when the button is in the down (pressed) state. The splash is represented as a circular overlay that appears above the highlightColor overlay. The splash overlay has a center point that matches the hit point of the user touch event. The splash overlay will expand to fill the button area if the touch is held for long enough time. If the splash color has transparency then the highlight and button color will show through. [...]
textColor Color
The color to use for this button's text. [...]
textTheme ButtonTextTheme
The color scheme to use for this button's text. [...]
hashCode int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder description) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by toStringDeep. [...]
toString() String
Returns a string representation of this object.
toStringDeep([String prefixLineOne = '', String prefixOtherLines ]) String
Returns a string representation of this node and its descendants. [...]
toStringShallow([String joiner = ', ' ]) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(other) bool
The equality operator. [...]