Protected against bots by Yandex SmartCaptcha. Data processing policy
Button
An interactive element based on InkWell that reacts to taps and hover.
Site only.
Button
exists only on the site: the app has no such element, and markup with it silently draws nothing there (the analyzer flags it as an unknown element). For a button that works both in the app and on the site, use
`ElevatedButton`
or the buttons from the
Material buttons
page; for a tappable area of any look —
`InkWell`
.
Type:
single-child
Button onPressed:"navigate:/home"
Text "Tap"
Parameters
| Parameter | Type | Description |
|---|---|---|
onPressed
|
callback | Called on tap |
onHover
|
callback | Called when the cursor hovers |
onExit
|
callback | Called when the cursor leaves |
Callback kinds
-
Changing variables:
{opacity:0.7}— sets the values of reactive variables -
Action:
"navigate:/home"— calls an action, for example a move to another page
Examples
A link button with animation
Animation @opacity:0.4
Button onHover:{opacity:1.0} onExit:{opacity:0.4} onPressed:"navigate:/home"
Text "Hover over me"
A button with scaling
Animation @scale:1.0
Button onHover:{scale:1.05} onExit:{scale:1.0} onPressed:"navigate:/details"
SizedBox width:200 height:60
Center
Text "Learn more"
ElevatedButton
A Material button with style and elevation support.
Type:
single-child
ElevatedButton onPressed:"form:submit"
Text "Send"
Parameters
| Parameter | Type | Description |
|---|---|---|
onPressed
|
callback | Called on tap |
onHover
|
callback | Called when the cursor hovers |
onExit
|
callback | Called when the cursor leaves |
#style
Button styling.
| Parameter | Type | Description |
|---|---|---|
backgroundColor
|
color | Background color |
disabledBackgroundColor
|
color | Background color when disabled |
shadowColor
|
color | Shadow color |
elevation
|
double | Shadow height |
Nested in
#style
:
-
#padding— padding inside the button (all,symmetric,only,fromLTRB) -
#shape— the button's shape (roundedwith its own#borderRadius,stadium…)
ElevatedButton onPressed:"form:submit"
#style backgroundColor:#6C63FF elevation:4
#padding symmetric horizontal:24 vertical:12
#shape rounded
#borderRadius circular 8
Text "Send"
See also
- Animation — animation when interacting with a button