- 29 May, 2023
- FlutterHQ.com
Flutter code samples and snippets
Supercharge your flutter development using our list of 440 code-samples and snippets.
Latest samples and snippets
Material:RangeSlider
snippet.packages.flutter.lib.src.material.range_slider.21
-
snippet.packages.flutter.lib.src.material.range_slider.21
Cupertino:App
snippet.packages.flutter.lib.src.cupertino.app.361
-
snippet.packages.flutter.lib.src.cupertino.app.361
Material:ReorderableList
sample.packages.flutter.lib.src.material.reorderable_list.42
-
sample.packages.flutter.lib.src.material.reorderable_list.42
While a drag is underway, the widget returned by the [proxyDecorator]
serves as a "proxy" (a substitute) for the item in the list. The proxy is
created with the original list item as its child. The [proxyDecorator]
in this example is similar to the default one except that it changes the
proxy item's background color.
Material:DatePicker
sample.packages.flutter.lib.src.material.date_picker.119
-
sample.packages.flutter.lib.src.material.date_picker.119
This sample demonstrates how to create a restorable Material date picker.
This is accomplished by enabling state restoration by specifying
[MaterialApp.restorationScopeId] and using [Navigator.restorablePush] to
push [DatePickerDialog] when the button is tapped.
Cupertino:Switch
snippet.packages.flutter.lib.src.cupertino.switch.17
-
snippet.packages.flutter.lib.src.cupertino.switch.17
Material:Tooltip
sample.packages.flutter.lib.src.material.tooltip.70
-
sample.packages.flutter.lib.src.material.tooltip.70
This example shows how [Tooltip] can be shown manually with [TooltipTriggerMode.manual]
by calling the [TooltipState.ensureTooltipVisible] function.
Material:Slider
snippet.packages.flutter.lib.src.material.slider.23
-
snippet.packages.flutter.lib.src.material.slider.23
Services:TextInput
snippet.packages.flutter.lib.src.services.text_input.1204
-
snippet.packages.flutter.lib.src.services.text_input.1204
Material:Radio
sample.packages.flutter.lib.src.material.radio.32
-
sample.packages.flutter.lib.src.material.radio.32
Here is an example of Radio widgets wrapped in ListTiles, which is similar
to what you could get with the RadioListTile widget.
The currently selected character is passed into `groupValue`, which is
maintained by the example's `State`. In this case, the first `Radio`
will start off selected because `_character` is initialized to
`SingingCharacter.lafayette`.
If the second radio button is pressed, the example's state is updated
with `setState`, updating `_character` to `SingingCharacter.jefferson`.
This causes the buttons to rebuild with the updated `groupValue`, and
therefore the selection of the second button.
Requires one of its ancestors to be a [Material] widget.
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.233
-
sample.packages.flutter.lib.src.widgets.transitions.233
The following code implements the [ScaleTransition] as seen in the video
above:
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2868
-
sample.packages.flutter.lib.src.material.input_decorator.2868
This example shows how the prefix icon alignment can be changed using [Align] with
a fixed `widthFactor` and `heightFactor`.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1559
-
snippet.packages.flutter.lib.src.material.colors.1559
Widgets:WidgetSpan
snippet.packages.flutter.lib.src.widgets.widget_span.30
-
snippet.packages.flutter.lib.src.widgets.widget_span.30
Material:Drawer
snippet.packages.flutter.lib.src.material.drawer.75
-
snippet.packages.flutter.lib.src.material.drawer.75
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.5358
-
sample.packages.flutter.lib.src.widgets.basic.5358
This example uses the [Flow] widget to create a menu that opens and closes
as it is interacted with, shown above. The color of the button in the menu
changes to indicate which one has been selected.
Material:ProgressIndicatorTheme
snippet.packages.flutter.lib.src.material.progress_indicator_theme.142
-
snippet.packages.flutter.lib.src.material.progress_indicator_theme.142
Services:SystemChrome
sample.packages.flutter.lib.src.services.system_chrome.563
-
sample.packages.flutter.lib.src.services.system_chrome.563
The following example creates a widget that changes the status bar color
to a random value on Android.
Painting:BoxDecoration
snippet.packages.flutter.lib.src.painting.box_decoration.44
-
snippet.packages.flutter.lib.src.painting.box_decoration.44
Widgets:Actions
sample.packages.flutter.lib.src.widgets.actions.584
-
sample.packages.flutter.lib.src.widgets.actions.584
This example creates a custom [Action] subclass `ModifyAction` for modifying
a model, and another, `SaveAction` for saving it.
This example demonstrates passing arguments to the [Intent] to be carried to
the [Action]. Actions can get data either from their own construction (like
the `model` in this example), or from the intent passed to them when invoked
(like the increment `amount` in this example).
This example also demonstrates how to use Intents to limit a widget's
dependencies on its surroundings. The `SaveButton` widget defined in this
example can invoke actions defined in its ancestor widgets, which can be
customized to match the part of the widget tree that it is in. It doesn't
need to know about the `SaveAction` class, only the `SaveIntent`, and it
only needs to know about a value notifier, not the entire model.
Material:TextFormField
sample.packages.flutter.lib.src.material.text_form_field.73
-
sample.packages.flutter.lib.src.material.text_form_field.73
This example shows how to move the focus to the next field when the user
presses the SPACE key.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.767
-
snippet.packages.flutter.lib.src.material.colors.767
Rendering:CustomLayout
snippet.packages.flutter.lib.src.rendering.custom_layout.71
-
snippet.packages.flutter.lib.src.rendering.custom_layout.71
Cupertino:Icons
snippet.packages.flutter.lib.src.cupertino.icons.33
-
snippet.packages.flutter.lib.src.cupertino.icons.33
Material:TextFormField
snippet.packages.flutter.lib.src.material.text_form_field.55
-
snippet.packages.flutter.lib.src.material.text_form_field.55
Painting:StrutStyle
snippet.packages.flutter.lib.src.painting.strut_style.134
-
snippet.packages.flutter.lib.src.painting.strut_style.134
Painting:ImageProvider
snippet.packages.flutter.lib.src.painting.image_provider.235
-
snippet.packages.flutter.lib.src.painting.image_provider.235
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1099
-
snippet.packages.flutter.lib.src.material.colors.1099
Widgets:PageView
snippet.packages.flutter.lib.src.widgets.page_view.702
-
snippet.packages.flutter.lib.src.widgets.page_view.702
Material:InkDecoration
snippet.packages.flutter.lib.src.material.ink_decoration.53
-
snippet.packages.flutter.lib.src.material.ink_decoration.53
Widgets:Navigator
sample.packages.flutter.lib.src.widgets.navigator.2116
-
sample.packages.flutter.lib.src.widgets.navigator.2116
Typical usage is as follows:
Material:About
sample.packages.flutter.lib.src.material.about.46
-
sample.packages.flutter.lib.src.material.about.46
This sample shows two ways to open [AboutDialog]. The first one
uses an [AboutListTile], and the second uses the [showAboutDialog] function.
Widgets:ImplicitAnimations
sample.packages.flutter.lib.src.widgets.implicit_animations.580
-
sample.packages.flutter.lib.src.widgets.implicit_animations.580
The following example (depicted above) transitions an AnimatedContainer
between two states. It adjusts the `height`, `width`, `color`, and
[alignment] properties when tapped.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.6578
-
sample.packages.flutter.lib.src.widgets.basic.6578
The following sample has an [AbsorbPointer] widget wrapping the button on
top of the stack, which absorbs pointer events, preventing its child button
__and__ the button below it in the stack from receiving the pointer events.
Widgets:ScrollView
snippet.packages.flutter.lib.src.widgets.scroll_view.28
-
snippet.packages.flutter.lib.src.widgets.scroll_view.28
Widgets:ScrollController
snippet.packages.flutter.lib.src.widgets.scroll_controller.277
-
snippet.packages.flutter.lib.src.widgets.scroll_controller.277
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1017
-
snippet.packages.flutter.lib.src.material.colors.1017
Material:Colors
snippet.packages.flutter.lib.src.material.colors.439
-
snippet.packages.flutter.lib.src.material.colors.439
Cupertino:Dialog
sample.packages.flutter.lib.src.cupertino.dialog.177
-
sample.packages.flutter.lib.src.cupertino.dialog.177
This sample shows how to use a [CupertinoAlertDialog].
The [CupertinoAlertDialog] shows an alert with a set of two choices
when [CupertinoButton] is pressed.
Material:RefreshIndicator
sample.packages.flutter.lib.src.material.refresh_indicator.75
-
sample.packages.flutter.lib.src.material.refresh_indicator.75
This example shows how [RefreshIndicator] can be triggered in different ways.
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1369
-
sample.packages.flutter.lib.src.material.scaffold.1369
This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] and a
[FloatingActionButton]. The [body] is a [Text] placed in a [Center] in order
to center the text within the [Scaffold]. The [FloatingActionButton] is
centered and docked within the [BottomAppBar] using
[FloatingActionButtonLocation.centerDocked]. The [FloatingActionButton] is
connected to a callback that increments a counter.

Material:IconButton
sample.packages.flutter.lib.src.material.icon_button.85
-
sample.packages.flutter.lib.src.material.icon_button.85
In this sample the icon button's background color is defined with an [Ink]
widget whose child is an [IconButton]. The icon button's filled background
is a light shade of blue, it's a filled circle, and it's as big as the
button is.

Foundation:Annotations
snippet.packages.flutter.lib.src.foundation.annotations.6
-
snippet.packages.flutter.lib.src.foundation.annotations.6
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2389
-
sample.packages.flutter.lib.src.material.input_decorator.2389
This sample shows how to style a `TextField` with a prefixIcon that changes color
based on the `MaterialState`. The color defaults to gray, be blue while focused
and red if in an error state.
Gestures:PointerSignalResolver
sample.packages.flutter.lib.src.gestures.pointer_signal_resolver.40
-
sample.packages.flutter.lib.src.gestures.pointer_signal_resolver.40
Here is an example that demonstrates the effect of not using the resolver
versus using it.
When this example is set to _not_ use the resolver, then triggering the
mouse wheel over the outer box will cause only the outer box to change
color, but triggering the mouse wheel over the inner box will cause _both_
the outer and the inner boxes to change color (because they're both
receiving the event).
When this example is set to _use_ the resolver, then only the box located
directly under the cursor will change color when the mouse wheel is
triggered.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.116
-
snippet.packages.flutter.lib.src.material.colors.116
Material:ChipTheme
snippet.packages.flutter.lib.src.material.chip_theme.66
-
snippet.packages.flutter.lib.src.material.chip_theme.66
Material:CircleAvatar
snippet.packages.flutter.lib.src.material.circle_avatar.11
-
snippet.packages.flutter.lib.src.material.circle_avatar.11
Painting:ImageProvider
snippet.packages.flutter.lib.src.painting.image_provider.516
-
snippet.packages.flutter.lib.src.painting.image_provider.516
Material:ListTile
snippet.packages.flutter.lib.src.material.list_tile.121
-
snippet.packages.flutter.lib.src.material.list_tile.121
Services:SystemChrome
snippet.packages.flutter.lib.src.services.system_chrome.546
-
snippet.packages.flutter.lib.src.services.system_chrome.546
Cupertino:Refresh
sample.packages.flutter.lib.src.cupertino.refresh.268
-
sample.packages.flutter.lib.src.cupertino.refresh.268
When the user scrolls past [refreshTriggerPullDistance],
this sample shows the default iOS pull to refresh indicator for 1 second and
adds a new item to the top of the list view.
Painting:ContinuousRectangleBorder
snippet.packages.flutter.lib.src.painting.continuous_rectangle_border.19
-
snippet.packages.flutter.lib.src.painting.continuous_rectangle_border.19
Widgets:Image
sample.packages.flutter.lib.src.widgets.image.762
-
sample.packages.flutter.lib.src.widgets.image.762
The following sample demonstrates how to use this builder to implement an
image that fades in once it's been loaded.
This sample contains a limited subset of the functionality that the
[FadeInImage] widget provides out of the box.
Material:TextField
snippet.packages.flutter.lib.src.material.text_field.707
-
snippet.packages.flutter.lib.src.material.text_field.707
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1313
-
snippet.packages.flutter.lib.src.material.colors.1313
Painting:BoxBorder
snippet.packages.flutter.lib.src.painting.box_border.13
-
snippet.packages.flutter.lib.src.painting.box_border.13
Material:AppBar
sample.packages.flutter.lib.src.material.app_bar.1391
-
sample.packages.flutter.lib.src.material.app_bar.1391
This sample shows a [SliverAppBar] and it's behavior when using the
[pinned], [snap] and [floating] parameters.
Painting:ImageProvider
snippet.packages.flutter.lib.src.painting.image_provider.1012
-
snippet.packages.flutter.lib.src.painting.image_provider.1012
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.510
-
sample.packages.flutter.lib.src.widgets.transitions.510
The following code implements the [FadeTransition] using
the Flutter logo:
Painting:ImageResolution
snippet.packages.flutter.lib.src.painting.image_resolution.127
-
snippet.packages.flutter.lib.src.painting.image_resolution.127
Material:Scaffold
snippet.packages.flutter.lib.src.material.scaffold.32
-
snippet.packages.flutter.lib.src.material.scaffold.32
Widgets:SingleChildScrollView
sample.packages.flutter.lib.src.widgets.single_child_scroll_view.126
-
sample.packages.flutter.lib.src.widgets.single_child_scroll_view.126
In this example, the column becomes either as big as viewport, or as big as
the contents, whichever is biggest.
Material:Card
sample.packages.flutter.lib.src.material.card.24
-
sample.packages.flutter.lib.src.material.card.24
This sample shows creation of a [Card] widget that shows album information
and two actions.
Foundation:Licenses
snippet.packages.flutter.lib.src.foundation.licenses.74
-
snippet.packages.flutter.lib.src.foundation.licenses.74
Material:Colors
snippet.packages.flutter.lib.src.material.colors.603
-
snippet.packages.flutter.lib.src.material.colors.603
Material:Dialog
sample.packages.flutter.lib.src.material.dialog.1024
-
sample.packages.flutter.lib.src.material.dialog.1024
This sample demonstrates how to use [showDialog] to display a dialog box.
Widgets:Container
snippet.packages.flutter.lib.src.widgets.container.13
-
snippet.packages.flutter.lib.src.widgets.container.13
Material:MaterialState
snippet.packages.flutter.lib.src.material.material_state.133
-
snippet.packages.flutter.lib.src.material.material_state.133
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1755
-
sample.packages.flutter.lib.src.material.scaffold.1755
When the [Scaffold] is actually created in the same `build` function, the
`context` argument to the `build` function can't be used to find the
[Scaffold] (since it's "above" the widget being returned in the widget
tree). In such cases, the following technique with a [Builder] can be used
to provide a new scope with a [BuildContext] that is "under" the
[Scaffold]:
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1811
-
snippet.packages.flutter.lib.src.material.colors.1811
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.1615
-
sample.packages.flutter.lib.src.widgets.basic.1615
In this example, the image is stretched to fill the entire [Container], which would
not happen normally without using FittedBox.
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.414
-
sample.packages.flutter.lib.src.widgets.transitions.414
This code defines a widget that uses [SizeTransition] to change the size
of [FlutterLogo] continually. It is built with a [Scaffold]
where the internal widget has space to change its size.
Material:MaterialState
sample.packages.flutter.lib.src.material.material_state.379
-
sample.packages.flutter.lib.src.material.material_state.379
This example defines a subclass of [RoundedRectangleBorder] and an
implementation of [MaterialStateOutlinedBorder], that resolves to
[RoundedRectangleBorder] when its widget is selected.
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.655
-
snippet.packages.flutter.lib.src.painting.edge_insets.655
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1515
-
snippet.packages.flutter.lib.src.material.colors.1515
Cupertino:Colors
snippet.packages.flutter.lib.src.cupertino.colors.15
-
snippet.packages.flutter.lib.src.cupertino.colors.15
Widgets:Form
sample.packages.flutter.lib.src.widgets.form.22
-
sample.packages.flutter.lib.src.widgets.form.22
This example shows a [Form] with one [TextFormField] to enter an email
address and an [ElevatedButton] to submit the form. A [GlobalKey] is used here
to identify the [Form] and validate input.

Material:ProgressIndicator
sample.packages.flutter.lib.src.material.progress_indicator.251
-
sample.packages.flutter.lib.src.material.progress_indicator.251
This example shows a [LinearProgressIndicator] with a changing value.
Painting:BoxFit
snippet.packages.flutter.lib.src.painting.box_fit.125
-
snippet.packages.flutter.lib.src.painting.box_fit.125
Material:Dialog
sample.packages.flutter.lib.src.material.dialog.1045
-
sample.packages.flutter.lib.src.material.dialog.1045
This sample demonstrates how to create a restorable Material dialog. This is
accomplished by enabling state restoration by specifying
[MaterialApp.restorationScopeId] and using [Navigator.restorablePush] to
push [DialogRoute] when the button is tapped.
{@macro flutter.widgets.RestorationManager}
Material:ListTile
snippet.packages.flutter.lib.src.material.list_tile.204
-
snippet.packages.flutter.lib.src.material.list_tile.204
Material:Card
sample.packages.flutter.lib.src.material.card.45
-
sample.packages.flutter.lib.src.material.card.45
This sample shows creation of [Card] widgets for elevated, filled and
outlined types, as described in: https://m3.material.io/components/cards/overview
Material:Dialog
sample.packages.flutter.lib.src.material.dialog.232
-
sample.packages.flutter.lib.src.material.dialog.232
This demo shows a [TextButton] which when pressed, calls [showDialog]. When called, this method
displays a Material dialog above the current contents of the app and returns
a [Future] that completes when the dialog is dismissed.
Rendering:DebugOverflowIndicator
snippet.packages.flutter.lib.src.rendering.debug_overflow_indicator.54
-
snippet.packages.flutter.lib.src.rendering.debug_overflow_indicator.54
Services:PlatformChannel
snippet.packages.flutter.lib.src.services.platform_channel.200
-
snippet.packages.flutter.lib.src.services.platform_channel.200
Material:NavigationRail
sample.packages.flutter.lib.src.material.navigation_rail.41
-
sample.packages.flutter.lib.src.material.navigation_rail.41
This example shows a [NavigationRail] used within a Scaffold with 3
[NavigationRailDestination]s. The main content is separated by a divider
(although elevation on the navigation rail can be used instead). The
`_selectedIndex` is updated by the `onDestinationSelected` callback.
Cupertino:TextFormFieldRow
sample.packages.flutter.lib.src.cupertino.text_form_field_row.74
-
sample.packages.flutter.lib.src.cupertino.text_form_field_row.74
This example shows how to move the focus to the next field when the user
presses the SPACE key.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1061
-
snippet.packages.flutter.lib.src.material.colors.1061
Material:CheckboxListTile
sample.packages.flutter.lib.src.material.checkbox_list_tile.74
-
sample.packages.flutter.lib.src.material.checkbox_list_tile.74

Here is an example of a custom labeled checkbox widget, called
LinkedLabelCheckbox, that includes an interactive [RichText] widget that
handles tap gestures.
Material:Search
snippet.packages.flutter.lib.src.material.search.112
-
snippet.packages.flutter.lib.src.material.search.112
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.320
-
sample.packages.flutter.lib.src.widgets.transitions.320
The following code implements the [RotationTransition] as seen in the video
above:
Animation:Curves
sample.packages.flutter.lib.src.animation.curves.470
-
sample.packages.flutter.lib.src.animation.curves.470
This example shows how to use a [Curve2D] to modify the position of a widget
so that it can follow an arbitrary path.
Painting:StrutStyle
snippet.packages.flutter.lib.src.painting.strut_style.158
-
snippet.packages.flutter.lib.src.painting.strut_style.158
Widgets:GestureDetector
snippet.packages.flutter.lib.src.widgets.gesture_detector.52
-
snippet.packages.flutter.lib.src.widgets.gesture_detector.52
Animation:AnimationController
snippet.packages.flutter.lib.src.animation.animation_controller.20
-
snippet.packages.flutter.lib.src.animation.animation_controller.20
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2347
-
sample.packages.flutter.lib.src.material.input_decorator.2347
This sample shows how to style a `TextField` using an `InputDecorator`. The
TextField displays a "send message" icon to the left of the input area,
which is surrounded by a border an all sides. It displays the `hintText`
inside the input area to help the user understand what input is required. It
displays the `helperText` and `counterText` below the input area.

Widgets:Image
snippet.packages.flutter.lib.src.widgets.image.263
-
snippet.packages.flutter.lib.src.widgets.image.263
Material:OutlinedButton
sample.packages.flutter.lib.src.material.outlined_button.52
-
sample.packages.flutter.lib.src.material.outlined_button.52
Here is an example of a basic [OutlinedButton].
Material:Autocomplete
sample.packages.flutter.lib.src.material.autocomplete.23
-
sample.packages.flutter.lib.src.material.autocomplete.23
This example shows how to create an Autocomplete widget with a custom type.
Try searching with text from the name or email field.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.2205
-
sample.packages.flutter.lib.src.widgets.basic.2205
This example shows a [CustomMultiChildLayout] widget being used to lay out
colored blocks from start to finish in a cascade that has some overlap.
It responds to changes in [Directionality] by re-laying out its children.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.781
-
sample.packages.flutter.lib.src.widgets.basic.781
This example shows a [ClipRRect] that adds round corners to an image.
Material:ReorderableList
sample.packages.flutter.lib.src.material.reorderable_list.124
-
sample.packages.flutter.lib.src.material.reorderable_list.124
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1683
-
snippet.packages.flutter.lib.src.material.colors.1683
Material:CheckboxListTile
sample.packages.flutter.lib.src.material.checkbox_list_tile.45
-
sample.packages.flutter.lib.src.material.checkbox_list_tile.45

This widget shows a checkbox that, when checked, slows down all animations
(including the animation of the checkbox itself getting checked!).
This sample requires that you also import 'package:flutter/scheduler.dart',
so that you can reference [timeDilation].
Material:App
snippet.packages.flutter.lib.src.material.app.629
-
snippet.packages.flutter.lib.src.material.app.629
Material:ButtonStyle
sample.packages.flutter.lib.src.material.button_style.110
-
sample.packages.flutter.lib.src.material.button_style.110
This sample shows how to create each of the Material 3 button types with Flutter.
Material:Radio
snippet.packages.flutter.lib.src.material.radio.199
-
snippet.packages.flutter.lib.src.material.radio.199
Cupertino:DatePicker
sample.packages.flutter.lib.src.cupertino.date_picker.206
-
sample.packages.flutter.lib.src.cupertino.date_picker.206
This sample shows how to implement CupertinoDatePicker with different picker modes.
We can provide intiial dateTime value for the picker to display. When user changes
the drag the date or time wheels, the picker will call onDateTimeChanged callback.
CupertinoDatePicker can be displayed directly on a screen or in a popup.
Widgets:ValueListenableBuilder
snippet.packages.flutter.lib.src.widgets.value_listenable_builder.49
-
snippet.packages.flutter.lib.src.widgets.value_listenable_builder.49
Material:ThemeData
snippet.packages.flutter.lib.src.material.theme_data.170
-
snippet.packages.flutter.lib.src.material.theme_data.170
Material:ListTile
sample.packages.flutter.lib.src.material.list_tile.517
-
sample.packages.flutter.lib.src.material.list_tile.517
Here is an example of using a [StatefulWidget] to keep track of the
selected index, and using that to set the `selected` property on the
corresponding [ListTile].
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.6196
-
sample.packages.flutter.lib.src.widgets.basic.6196
This example makes a [Container] react to being entered by a mouse
pointer, showing a count of the number of entries and exits.
Widgets:TweenAnimationBuilder
sample.packages.flutter.lib.src.widgets.tween_animation_builder.65
-
sample.packages.flutter.lib.src.widgets.tween_animation_builder.65
This example shows an [IconButton] that "zooms" in when the widget first
builds (its size smoothly increases from 0 to 24) and whenever the button
is pressed, it smoothly changes its size to the new target value of either
48 or 24.
Material:Dialog
snippet.packages.flutter.lib.src.material.dialog.22
-
snippet.packages.flutter.lib.src.material.dialog.22
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.351
-
snippet.packages.flutter.lib.src.painting.edge_insets.351
Material:NavigationBar
sample.packages.flutter.lib.src.material.navigation_bar.38
-
sample.packages.flutter.lib.src.material.navigation_bar.38
This example shows a [NavigationBar] as it is used within a [Scaffold]
widget. The [NavigationBar] has three [NavigationDestination] widgets
and the [selectedIndex] is set to index 0. The `onDestinationSelected` callback
changes the selected item's index and displays a corresponding widget in the body of the [Scaffold].
Cupertino:NavBar
sample.packages.flutter.lib.src.cupertino.nav_bar.227
-
sample.packages.flutter.lib.src.cupertino.nav_bar.227
This example shows a [CupertinoNavigationBar] placed in a [CupertinoPageScaffold].
Since [backgroundColor]'s opacity is not 1.0, there is a blur effect and
content slides underneath.
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.112
-
sample.packages.flutter.lib.src.material.scaffold.112
Typical usage of the [ScaffoldMessenger.of] function is to call it in
response to a user gesture or an application state change.
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.868
-
sample.packages.flutter.lib.src.widgets.transitions.868
The following code implements the [AlignTransition] as seen in the video
above:
Widgets:ScrollPhysics
snippet.packages.flutter.lib.src.widgets.scroll_physics.20
-
snippet.packages.flutter.lib.src.widgets.scroll_physics.20
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.3212
-
sample.packages.flutter.lib.src.widgets.basic.3212
Widgets:Navigator
sample.packages.flutter.lib.src.widgets.navigator.2038
-
sample.packages.flutter.lib.src.widgets.navigator.2038
Typical usage is as follows:
Widgets:Routes
snippet.packages.flutter.lib.src.widgets.routes.30
-
snippet.packages.flutter.lib.src.widgets.routes.30
Material:FlexibleSpaceBar
sample.packages.flutter.lib.src.material.flexible_space_bar.58
-
sample.packages.flutter.lib.src.material.flexible_space_bar.58
This sample application demonstrates the different features of the
[FlexibleSpaceBar] when used in a [SliverAppBar]. This app bar is configured
to stretch into the overscroll space, and uses the
[FlexibleSpaceBar.stretchModes] to apply `fadeTitle`, `blurBackground` and
`zoomBackground`. The app bar also makes use of [CollapseMode.parallax] by
default.
Material:ThemeData
sample.packages.flutter.lib.src.material.theme_data.1064
-
sample.packages.flutter.lib.src.material.theme_data.1064
This sample shows how to create and use a subclass of [ThemeExtension] that
defines two colors.
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.384
-
snippet.packages.flutter.lib.src.painting.edge_insets.384
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.82
-
sample.packages.flutter.lib.src.material.scaffold.82
Here is an example of showing a [SnackBar] when the user presses a button.
Material:Chip
snippet.packages.flutter.lib.src.material.chip.480
-
snippet.packages.flutter.lib.src.material.chip.480
Animation:Animation
snippet.packages.flutter.lib.src.animation.animation.11
-
snippet.packages.flutter.lib.src.animation.animation.11
Material:Radio
sample.packages.flutter.lib.src.material.radio.169
-
sample.packages.flutter.lib.src.material.radio.169
This example shows how to enable deselecting a radio button by setting the
[toggleable] attribute.
Widgets:DefaultTextEditingShortcuts
snippet.packages.flutter.lib.src.widgets.default_text_editing_shortcuts.67
-
snippet.packages.flutter.lib.src.widgets.default_text_editing_shortcuts.67
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.1130
-
sample.packages.flutter.lib.src.widgets.basic.1130
This example shows how to use a [PhysicalShape] on a centered [SizedBox]
to clip it to a rounded rectangle using a [ShapeBorderClipper] and give it
an orange color along with a shadow.
Widgets:Navigator
sample.packages.flutter.lib.src.widgets.navigator.4420
-
sample.packages.flutter.lib.src.widgets.navigator.4420
Typical usage is as follows:
Material:SwitchListTile
sample.packages.flutter.lib.src.material.switch_list_tile.54
-
sample.packages.flutter.lib.src.material.switch_list_tile.54

This widget shows a switch that, when toggled, changes the state of a [bool]
member field called `_lights`.
Material:TooltipTheme
snippet.packages.flutter.lib.src.material.tooltip_theme.225
-
snippet.packages.flutter.lib.src.material.tooltip_theme.225
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.673
-
sample.packages.flutter.lib.src.widgets.transitions.673
The following code implements the [PositionedTransition] as seen in the video
above:
Material:Colors
snippet.packages.flutter.lib.src.material.colors.521
-
snippet.packages.flutter.lib.src.material.colors.521
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1748
-
sample.packages.flutter.lib.src.material.scaffold.1748
Typical usage of the [Scaffold.of] function is to call it from within the
`build` method of a child of a [Scaffold].
Material:TimePicker
snippet.packages.flutter.lib.src.material.time_picker.36
-
snippet.packages.flutter.lib.src.material.time_picker.36
Widgets:DefaultTextEditingShortcuts
snippet.packages.flutter.lib.src.widgets.default_text_editing_shortcuts.26
-
snippet.packages.flutter.lib.src.widgets.default_text_editing_shortcuts.26
Material:TextButton
sample.packages.flutter.lib.src.material.text_button.54
-
sample.packages.flutter.lib.src.material.text_button.54
This sample shows how to render a disabled TextButton, an enabled TextButton
and lastly a TextButton with gradient background.
Material:DatePicker
sample.packages.flutter.lib.src.material.date_picker.918
-
sample.packages.flutter.lib.src.material.date_picker.918
This sample demonstrates how to create a restorable Material date range picker.
This is accomplished by enabling state restoration by specifying
[MaterialApp.restorationScopeId] and using [Navigator.restorablePush] to
push [DateRangePickerDialog] when the button is tapped.
Material:ThemeData
snippet.packages.flutter.lib.src.material.theme_data.202
-
snippet.packages.flutter.lib.src.material.theme_data.202
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1764
-
snippet.packages.flutter.lib.src.material.colors.1764
Material:ExpansionTile
sample.packages.flutter.lib.src.material.expansion_tile.36
-
sample.packages.flutter.lib.src.material.expansion_tile.36
This example demonstrates different configurations of ExpansionTile.
Rendering:ProxyBox
snippet.packages.flutter.lib.src.rendering.proxy_box.3263
-
snippet.packages.flutter.lib.src.rendering.proxy_box.3263
Material:TextTheme
snippet.packages.flutter.lib.src.material.text_theme.289
-
snippet.packages.flutter.lib.src.material.text_theme.289
Cupertino:SlidingSegmentedControl
snippet.packages.flutter.lib.src.cupertino.sliding_segmented_control.362
-
snippet.packages.flutter.lib.src.cupertino.sliding_segmented_control.362
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.3121
-
sample.packages.flutter.lib.src.widgets.basic.3121
This example shows a [FlutterLogo] widget when the `_offstage` member field
is false, and hides it without any room in the parent when it is true. When
offstage, this app displays a button to get the logo size, which will be
displayed in a [SnackBar].
Material:Stepper
sample.packages.flutter.lib.src.material.stepper.177
-
sample.packages.flutter.lib.src.material.stepper.177
An example the shows how to use the [Stepper], and the [Stepper] UI
appearance.
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.672
-
snippet.packages.flutter.lib.src.painting.edge_insets.672
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.367
-
snippet.packages.flutter.lib.src.painting.edge_insets.367
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1477
-
snippet.packages.flutter.lib.src.material.colors.1477
Services:MouseCursor
sample.packages.flutter.lib.src.services.mouse_cursor.164
-
sample.packages.flutter.lib.src.services.mouse_cursor.164
This sample creates a rectangular region that is wrapped by a [MouseRegion]
with a system mouse cursor. The mouse pointer becomes an I-beam when
hovering over the region.
Material:Feedback
snippet.packages.flutter.lib.src.material.feedback.34
-
snippet.packages.flutter.lib.src.material.feedback.34
Material:SwitchListTile
sample.packages.flutter.lib.src.material.switch_list_tile.97
-
sample.packages.flutter.lib.src.material.switch_list_tile.97

Here is an example of a custom LabeledSwitch widget, but you can easily
make your own configurable widget.
Painting:Gradient
snippet.packages.flutter.lib.src.painting.gradient.882
-
snippet.packages.flutter.lib.src.painting.gradient.882
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.330
-
snippet.packages.flutter.lib.src.painting.edge_insets.330
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.576
-
sample.packages.flutter.lib.src.widgets.transitions.576
Creates a [CustomScrollView] with a [SliverFixedExtentList] that uses a
[SliverFadeTransition] to fade the list in and out.
Material:NavigationRail
sample.packages.flutter.lib.src.material.navigation_rail.50
-
sample.packages.flutter.lib.src.material.navigation_rail.50
This sample shows the creation of [NavigationRail] widget used within a Scaffold with 3
[NavigationRailDestination]s, as described in: https://m3.material.io/components/navigation-rail/overview
Material:Divider
sample.packages.flutter.lib.src.material.divider.27
-
sample.packages.flutter.lib.src.material.divider.27
This sample shows how to display a Divider between an orange and blue box
inside a column. The Divider is 20 logical pixels in height and contains a
vertically centered black line that is 5 logical pixels thick. The black
line is indented by 20 logical pixels.

Painting:Gradient
snippet.packages.flutter.lib.src.painting.gradient.586
-
snippet.packages.flutter.lib.src.painting.gradient.586
Material:Feedback
snippet.packages.flutter.lib.src.material.feedback.62
-
snippet.packages.flutter.lib.src.material.feedback.62
Material:SliderTheme
snippet.packages.flutter.lib.src.material.slider_theme.72
-
snippet.packages.flutter.lib.src.material.slider_theme.72
Material:Scrollbar
sample.packages.flutter.lib.src.material.scrollbar.46
-
sample.packages.flutter.lib.src.material.scrollbar.46
When [thumbVisibility] is true, the scrollbar thumb will remain visible
without the fade animation. This requires that a [ScrollController] is
provided to controller, or that the [PrimaryScrollController] is available.
When a [ScrollView.scrollDirection] is [Axis.horizontal], it is recommended
that the [Scrollbar] is always visible, since scrolling in the horizontal
axis is less discoverable.
Widgets:Async
sample.packages.flutter.lib.src.widgets.async.509
-
sample.packages.flutter.lib.src.widgets.async.509
This sample shows a [FutureBuilder] that displays a loading spinner while it
loads data. It displays a success icon and text if the [Future] completes
with a result, or an error icon and text if the [Future] completes with an
error. Assume the `_calculation` field is set by pressing a button elsewhere
in the UI.
Material:ToggleButtons
sample.packages.flutter.lib.src.material.toggle_buttons.32
-
sample.packages.flutter.lib.src.material.toggle_buttons.32
This example showcase [ToggleButtons] in various configurations.
Cupertino:App
snippet.packages.flutter.lib.src.cupertino.app.84
-
snippet.packages.flutter.lib.src.cupertino.app.84
Material:SwitchListTile
sample.packages.flutter.lib.src.material.switch_list_tile.80
-
sample.packages.flutter.lib.src.material.switch_list_tile.80

Here is an example of a custom labeled radio widget, called
LinkedLabelRadio, that includes an interactive [RichText] widget that
handles tap gestures.
Widgets:Basic
snippet.packages.flutter.lib.src.widgets.basic.74
-
snippet.packages.flutter.lib.src.widgets.basic.74
Widgets:ImplicitAnimations
sample.packages.flutter.lib.src.widgets.implicit_animations.1770
-
sample.packages.flutter.lib.src.widgets.implicit_animations.1770
Creates a [CustomScrollView] with a [SliverFixedExtentList] and a
[FloatingActionButton]. Pressing the button animates the lists' opacity.
Material:ChipInput
snippet.packages.flutter.lib.src.material.chip_input.32
-
snippet.packages.flutter.lib.src.material.chip_input.32
Material:AppBar
snippet.packages.flutter.lib.src.material.app_bar.240
-
snippet.packages.flutter.lib.src.material.app_bar.240
Cupertino:DatePicker
sample.packages.flutter.lib.src.cupertino.date_picker.1499
-
sample.packages.flutter.lib.src.cupertino.date_picker.1499
This example shows a [CupertinoTimerPicker] that returns a countdown duration.
Material:RadioListTile
sample.packages.flutter.lib.src.material.radio_list_tile.204
-
sample.packages.flutter.lib.src.material.radio_list_tile.204
This example shows how to enable deselecting a radio button by setting the
[toggleable] attribute.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.2770
-
sample.packages.flutter.lib.src.widgets.basic.2770
This sample shows a [FractionallySizedBox] whose one child is 50% of
the box's size per the width and height factor parameters, and centered
within that box by the alignment parameter.
Material:MaterialStateMixin
snippet.packages.flutter.lib.src.material.material_state_mixin.78
-
snippet.packages.flutter.lib.src.material.material_state_mixin.78
Painting:TextSpan
snippet.packages.flutter.lib.src.painting.text_span.126
-
snippet.packages.flutter.lib.src.painting.text_span.126
Painting:Gradient
snippet.packages.flutter.lib.src.painting.gradient.856
-
snippet.packages.flutter.lib.src.painting.gradient.856
Material:Tooltip
sample.packages.flutter.lib.src.material.tooltip.36
-
sample.packages.flutter.lib.src.material.tooltip.36
This example show a basic [Tooltip] which has a [Text] as child.
[message] contains your label to be shown by the tooltip when
the child that Tooltip wraps is hovered over on web or desktop. On mobile,
the tooltip is shown when the widget is long pressed.
Material:Checkbox
sample.packages.flutter.lib.src.material.checkbox.30
-
sample.packages.flutter.lib.src.material.checkbox.30
This example shows how you can override the default theme of
of a [Checkbox] with a [MaterialStateProperty].
In this example, the checkbox's color will be `Colors.blue` when the [Checkbox]
is being pressed, hovered, or focused. Otherwise, the checkbox's color will
be `Colors.red`.
Material:Tooltip
sample.packages.flutter.lib.src.material.tooltip.61
-
sample.packages.flutter.lib.src.material.tooltip.61
This example shows a rich [Tooltip] that specifies the [richMessage]
parameter instead of the [message] parameter (only one of these may be
non-null. Any [InlineSpan] can be specified for the [richMessage] attribute,
including [WidgetSpan].
Material:Dropdown
sample.packages.flutter.lib.src.material.dropdown.802
-
sample.packages.flutter.lib.src.material.dropdown.802
This sample shows a `DropdownButton` with a large arrow icon,
purple text style, and bold purple underline, whose value is one of "One",
"Two", "Free", or "Four".

Material:MaterialState
sample.packages.flutter.lib.src.material.material_state.298
-
sample.packages.flutter.lib.src.material.material_state.298
This example defines a subclass of [MaterialStateBorderSide], that resolves
to a red border side when its widget is selected.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1231
-
snippet.packages.flutter.lib.src.material.colors.1231
Services:TextFormatter
snippet.packages.flutter.lib.src.services.text_formatter.283
-
snippet.packages.flutter.lib.src.services.text_formatter.283
Cupertino:Dialog
sample.packages.flutter.lib.src.cupertino.dialog.453
-
sample.packages.flutter.lib.src.cupertino.dialog.453
This sample shows how to use a [CupertinoActionSheet].
The [CupertinoActionSheet] shows a modal popup that slides in from the
bottom when [CupertinoButton] is pressed.
Widgets:AnimatedCrossFade
snippet.packages.flutter.lib.src.widgets.animated_cross_fade.15
-
snippet.packages.flutter.lib.src.widgets.animated_cross_fade.15
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.125
-
sample.packages.flutter.lib.src.material.scaffold.125
Sometimes [SnackBar]s are produced by code that doesn't have ready access
to a valid [BuildContext]. One such example of this is when you show a
SnackBar from a method outside of the `build` function. In these
cases, you can assign a [GlobalKey] to the [ScaffoldMessenger]. This
example shows a key being used to obtain the [ScaffoldMessengerState]
provided by the [MaterialApp].
Cupertino:App
snippet.packages.flutter.lib.src.cupertino.app.389
-
snippet.packages.flutter.lib.src.cupertino.app.389
Foundation:Assertions
snippet.packages.flutter.lib.src.foundation.assertions.14
-
snippet.packages.flutter.lib.src.foundation.assertions.14
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1358
-
sample.packages.flutter.lib.src.material.scaffold.1358
This example shows a [Scaffold] with a blueGrey [backgroundColor], [body]
and [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in
order to center the text within the [Scaffold]. The [FloatingActionButton]
is connected to a callback that increments a counter.

Material:Colors
snippet.packages.flutter.lib.src.material.colors.977
-
snippet.packages.flutter.lib.src.material.colors.977
Painting:InlineSpan
snippet.packages.flutter.lib.src.painting.inline_span.168
-
snippet.packages.flutter.lib.src.painting.inline_span.168
Material:Icons
snippet.packages.flutter.lib.src.material.icons.121
-
snippet.packages.flutter.lib.src.material.icons.121
Cupertino:PageScaffold
sample.packages.flutter.lib.src.cupertino.page_scaffold.22
-
sample.packages.flutter.lib.src.cupertino.page_scaffold.22
This example shows a [CupertinoPageScaffold] with a [ListView] as a [child].
The [CupertinoButton] is connected to a callback that increments a counter.
The [backgroundColor] can be changed.
Cupertino:App
snippet.packages.flutter.lib.src.cupertino.app.67
-
snippet.packages.flutter.lib.src.cupertino.app.67
Widgets:Navigator
sample.packages.flutter.lib.src.widgets.navigator.4544
-
sample.packages.flutter.lib.src.widgets.navigator.4544
Typical usage is as follows:
Physics:GravitySimulation
snippet.packages.flutter.lib.src.physics.gravity_simulation.10
-
snippet.packages.flutter.lib.src.physics.gravity_simulation.10
Material:PopupMenu
snippet.packages.flutter.lib.src.material.popup_menu.24
-
snippet.packages.flutter.lib.src.material.popup_menu.24
Material:CheckboxListTile
sample.packages.flutter.lib.src.material.checkbox_list_tile.91
-
sample.packages.flutter.lib.src.material.checkbox_list_tile.91

Here is an example of a custom LabeledCheckbox widget, but you can easily
make your own configurable widget.
Material:RangeSlider
sample.packages.flutter.lib.src.material.range_slider.37
-
sample.packages.flutter.lib.src.material.range_slider.37

This range values are in intervals of 20 because the Range Slider has 5
divisions, from 0 to 100. This means are values are split between 0, 20, 40,
60, 80, and 100. The range values are initialized with 40 and 80 in this demo.
Cupertino:BottomTabBar
sample.packages.flutter.lib.src.cupertino.bottom_tab_bar.49
-
sample.packages.flutter.lib.src.cupertino.bottom_tab_bar.49
This example shows a [CupertinoTabBar] placed in a [CupertinoTabScaffold].
Semantics:Semantics
snippet.packages.flutter.lib.src.semantics.semantics.2099
-
snippet.packages.flutter.lib.src.semantics.semantics.2099
Material:App
snippet.packages.flutter.lib.src.material.app.147
-
snippet.packages.flutter.lib.src.material.app.147
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1616
-
sample.packages.flutter.lib.src.material.scaffold.1616
To disable the drawer edge swipe, set the
[Scaffold.endDrawerEnableOpenDragGesture] to false. Then, use
[ScaffoldState.openEndDrawer] to open the drawer and [Navigator.pop] to
close it.
Material:RadioListTile
sample.packages.flutter.lib.src.material.radio_list_tile.47
-
sample.packages.flutter.lib.src.material.radio_list_tile.47

This widget shows a pair of radio buttons that control the `_character`
field. The field is of the type `SingingCharacter`, an enum.
Material:Card
sample.packages.flutter.lib.src.material.card.34
-
sample.packages.flutter.lib.src.material.card.34
This sample shows creation of a [Card] widget that can be tapped. When
tapped this [Card]'s [InkWell] displays an "ink splash" that fills the
entire card.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1143
-
snippet.packages.flutter.lib.src.material.colors.1143
Cupertino:SearchField
snippet.packages.flutter.lib.src.cupertino.search_field.27
-
snippet.packages.flutter.lib.src.cupertino.search_field.27
Widgets:Framework
snippet.packages.flutter.lib.src.widgets.framework.34
-
snippet.packages.flutter.lib.src.widgets.framework.34
Rendering:Binding
snippet.packages.flutter.lib.src.rendering.binding.22
-
snippet.packages.flutter.lib.src.rendering.binding.22
Widgets:Navigator
sample.packages.flutter.lib.src.widgets.navigator.1290
-
sample.packages.flutter.lib.src.widgets.navigator.1290
The following example demonstrates how a nested [Navigator] can be used to
present a standalone user registration journey.
Even though this example uses two [Navigator]s to demonstrate nested
[Navigator]s, a similar result is possible using only a single [Navigator].
Run this example with `flutter run --route=/signup` to start it with
the signup flow instead of on the home page.
Material:SliderTheme
snippet.packages.flutter.lib.src.material.slider_theme.242
-
snippet.packages.flutter.lib.src.material.slider_theme.242
Painting:ShapeDecoration
snippet.packages.flutter.lib.src.painting.shape_decoration.34
-
snippet.packages.flutter.lib.src.painting.shape_decoration.34
Material:Chip
snippet.packages.flutter.lib.src.material.chip.528
-
snippet.packages.flutter.lib.src.material.chip.528
Painting:StrutStyle
snippet.packages.flutter.lib.src.painting.strut_style.242
-
snippet.packages.flutter.lib.src.painting.strut_style.242
Widgets:NestedScrollView
sample.packages.flutter.lib.src.widgets.nested_scroll_view.114
-
sample.packages.flutter.lib.src.widgets.nested_scroll_view.114
This simple example shows a [NestedScrollView] whose header contains a
floating [SliverAppBar]. By using the [floatHeaderSlivers] property, the
floating behavior is coordinated between the outer and inner [Scrollable]s,
so it behaves as it would in a single scrollable.
Widgets:Image
snippet.packages.flutter.lib.src.widgets.image.568
-
snippet.packages.flutter.lib.src.widgets.image.568
Material:Colors
snippet.packages.flutter.lib.src.material.colors.811
-
snippet.packages.flutter.lib.src.material.colors.811
Widgets:ImplicitAnimations
snippet.packages.flutter.lib.src.widgets.implicit_animations.20
-
snippet.packages.flutter.lib.src.widgets.implicit_animations.20
Painting:Gradient
snippet.packages.flutter.lib.src.painting.gradient.91
-
snippet.packages.flutter.lib.src.painting.gradient.91
Material:Chip
snippet.packages.flutter.lib.src.material.chip.343
-
snippet.packages.flutter.lib.src.material.chip.343
Material:TabController
sample.packages.flutter.lib.src.material.tab_controller.88
-
sample.packages.flutter.lib.src.material.tab_controller.88
This example shows how to listen to page updates in [TabBar] and [TabBarView]
when using [DefaultTabController].
Widgets:ImplicitAnimations
sample.packages.flutter.lib.src.widgets.implicit_animations.793
-
sample.packages.flutter.lib.src.widgets.implicit_animations.793
The following code implements the [AnimatedPadding] widget, using a [curve] of
[Curves.easeInOut].
Animation:Tween
snippet.packages.flutter.lib.src.animation.tween.14
-
snippet.packages.flutter.lib.src.animation.tween.14
Cupertino:Route
sample.packages.flutter.lib.src.cupertino.route.1253
-
sample.packages.flutter.lib.src.cupertino.route.1253
This sample demonstrates how to create a restorable Cupertino dialog. This is
accomplished by enabling state restoration by specifying
[CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
push [CupertinoDialogRoute] when the [CupertinoButton] is tapped.
{@macro flutter.widgets.RestorationManager}
Material:FloatingActionButton
sample.packages.flutter.lib.src.material.floating_action_button.74
-
sample.packages.flutter.lib.src.material.floating_action_button.74
This sample shows the creation of [FloatingActionButton] widget in the typical location in a Scaffold,
as described in: https://m3.material.io/components/floating-action-button/overview
Material:AppBar
sample.packages.flutter.lib.src.material.app_bar.104
-
sample.packages.flutter.lib.src.material.app_bar.104
This sample shows an [AppBar] with two simple actions. The first action
opens a [SnackBar], while the second action navigates to a new page.
Widgets:Binding
snippet.packages.flutter.lib.src.widgets.binding.105
-
snippet.packages.flutter.lib.src.widgets.binding.105
Rendering:SliverGrid
sample.packages.flutter.lib.src.rendering.sliver_grid.287
-
sample.packages.flutter.lib.src.rendering.sliver_grid.287
Here is an example using the [mainAxisExtent] property. On a device with a
screen width of 800.0, it creates a GridView with each tile with a width of
200.0 and a height of 150.0.
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1592
-
sample.packages.flutter.lib.src.material.scaffold.1592
To disable the drawer edge swipe, set the
[Scaffold.drawerEnableOpenDragGesture] to false. Then, use
[ScaffoldState.openDrawer] to open the drawer and [Navigator.pop] to close
it.
Widgets:Actions
snippet.packages.flutter.lib.src.widgets.actions.194
-
snippet.packages.flutter.lib.src.widgets.actions.194
Material:ChipChoice
snippet.packages.flutter.lib.src.material.chip_choice.23
-
snippet.packages.flutter.lib.src.material.chip_choice.23
Material:Dialog
sample.packages.flutter.lib.src.material.dialog.240
-
sample.packages.flutter.lib.src.material.dialog.240
This sample shows the creation of [AlertDialog], as described in:
https://m3.material.io/components/dialogs/overview
Material:AppBar
snippet.packages.flutter.lib.src.material.app_bar.326
-
snippet.packages.flutter.lib.src.material.app_bar.326
Material:AppBar
sample.packages.flutter.lib.src.material.app_bar.128
-
sample.packages.flutter.lib.src.material.app_bar.128
Widgets:PageView
snippet.packages.flutter.lib.src.widgets.page_view.48
-
snippet.packages.flutter.lib.src.widgets.page_view.48
Cupertino:NavBar
sample.packages.flutter.lib.src.cupertino.nav_bar.566
-
sample.packages.flutter.lib.src.cupertino.nav_bar.566
This example shows [CupertinoSliverNavigationBar] in action inside a [CustomScrollView].
Widgets:Scrollbar
snippet.packages.flutter.lib.src.widgets.scrollbar.1112
-
snippet.packages.flutter.lib.src.widgets.scrollbar.1112
Animation:TweenSequence
snippet.packages.flutter.lib.src.animation.tween_sequence.10
-
snippet.packages.flutter.lib.src.animation.tween_sequence.10
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.5038
-
sample.packages.flutter.lib.src.widgets.basic.5038
This example shows how to use an [Expanded] widget in a [Row] with multiple
children expanded, utilizing the [flex] factor to prioritize available space.

Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.153
-
sample.packages.flutter.lib.src.widgets.transitions.153
The following code implements the [SlideTransition] as seen in the video
above:
Material:Colors
snippet.packages.flutter.lib.src.material.colors.647
-
snippet.packages.flutter.lib.src.material.colors.647
Widgets:ImplicitAnimations
sample.packages.flutter.lib.src.widgets.implicit_animations.879
-
sample.packages.flutter.lib.src.widgets.implicit_animations.879
The following code implements the [AnimatedAlign] widget, using a [curve] of
[Curves.fastOutSlowIn].
Widgets:SingleChildScrollView
sample.packages.flutter.lib.src.widgets.single_child_scroll_view.89
-
sample.packages.flutter.lib.src.widgets.single_child_scroll_view.89
In this example, the children are spaced out equally, unless there's no more
room, in which case they stack vertically and scroll.
When using this technique, [Expanded] and [Flexible] are not useful, because
in both cases the "available space" is infinite (since this is in a viewport).
The next section describes a technique for providing a maximum height constraint.
Material:Banner
sample.packages.flutter.lib.src.material.banner.58
-
sample.packages.flutter.lib.src.material.banner.58
Banners placed directly into the widget tree are static.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1269
-
snippet.packages.flutter.lib.src.material.colors.1269
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.389
-
sample.packages.flutter.lib.src.material.scaffold.389
Here is an example of showing a [MaterialBanner] when the user presses a button.
Material:ThemeData
sample.packages.flutter.lib.src.material.theme_data.66
-
sample.packages.flutter.lib.src.material.theme_data.66
This sample shows how to create and use a subclass of [ThemeExtension] that
defines two colors.
Widgets:RestorationProperties
snippet.packages.flutter.lib.src.widgets.restoration_properties.35
-
snippet.packages.flutter.lib.src.widgets.restoration_properties.35
Cupertino:Scrollbar
sample.packages.flutter.lib.src.cupertino.scrollbar.54
-
sample.packages.flutter.lib.src.cupertino.scrollbar.54
When [thumbVisibility] is true, the scrollbar thumb will remain visible without the
fade animation. This requires that a [ScrollController] is provided to controller,
or that the [PrimaryScrollController] is available. [isAlwaysShown] is
deprecated in favor of `thumbVisibility`.
Material:FloatingActionButton
sample.packages.flutter.lib.src.material.floating_action_button.81
-
sample.packages.flutter.lib.src.material.floating_action_button.81
This sample shows the creation of all the variants of [FloatingActionButton] widget as
described in: https://m3.material.io/components/floating-action-button/overview
Material:InkDecoration
snippet.packages.flutter.lib.src.material.ink_decoration.77
-
snippet.packages.flutter.lib.src.material.ink_decoration.77
Material:ElevatedButton
sample.packages.flutter.lib.src.material.elevated_button.50
-
sample.packages.flutter.lib.src.material.elevated_button.50
This sample produces an enabled and a disabled ElevatedButton.
Widgets:Navigator
snippet.packages.flutter.lib.src.widgets.navigator.29
-
snippet.packages.flutter.lib.src.widgets.navigator.29
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2397
-
sample.packages.flutter.lib.src.material.input_decorator.2397
This sample shows how to style a `TextField` with a prefixIcon that changes color
based on the `MaterialState` through the use of `ThemeData`. The color defaults
to gray, be blue while focused and red if in an error state.
Rendering:Box
snippet.packages.flutter.lib.src.rendering.box.707
-
snippet.packages.flutter.lib.src.rendering.box.707
Widgets:NestedScrollView
sample.packages.flutter.lib.src.widgets.nested_scroll_view.59
-
sample.packages.flutter.lib.src.widgets.nested_scroll_view.59
This example shows a [NestedScrollView] whose header is the combination of a
[TabBar] in a [SliverAppBar] and whose body is a [TabBarView]. It uses a
[SliverOverlapAbsorber]/[SliverOverlapInjector] pair to make the inner lists
align correctly, and it uses [SafeArea] to avoid any horizontal disturbances
(e.g. the "notch" on iOS when the phone is horizontal). In addition,
[PageStorageKey]s are used to remember the scroll position of each tab's
list.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.108
-
snippet.packages.flutter.lib.src.material.colors.108
Widgets:Actions
sample.packages.flutter.lib.src.widgets.actions.144
-
sample.packages.flutter.lib.src.widgets.actions.144
This sample implements a custom text input field that handles the
[DeleteCharacterIntent] intent, as well as a US telephone number input
widget that consists of multiple text fields for area code, prefix and line
number. When the backspace key is pressed, the phone number input widget
sends the focus to the preceding text field when the currently focused
field becomes empty.
Material:TextTheme
snippet.packages.flutter.lib.src.material.text_theme.399
-
snippet.packages.flutter.lib.src.material.text_theme.399
Material:FloatingActionButton
sample.packages.flutter.lib.src.material.floating_action_button.54
-
sample.packages.flutter.lib.src.material.floating_action_button.54
This example shows how to display a [FloatingActionButton] in a
[Scaffold], with a pink [backgroundColor] and a thumbs up [Icon].

Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.3230
-
sample.packages.flutter.lib.src.widgets.basic.3230
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1859
-
snippet.packages.flutter.lib.src.material.colors.1859
Cupertino:Button
sample.packages.flutter.lib.src.cupertino.button.30
-
sample.packages.flutter.lib.src.cupertino.button.30
This sample shows produces an enabled and disabled [CupertinoButton] and
[CupertinoButton.filled].
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2616
-
sample.packages.flutter.lib.src.material.input_decorator.2616
It's possible to override the label style for just the error state, or
just the default state, or both.
In this example the [labelStyle] is specified with a [MaterialStateProperty]
which resolves to a text style whose color depends on the decorator's
error state.
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.1022
-
sample.packages.flutter.lib.src.widgets.transitions.1022
This code defines a widget that spins a green square continually. It is
built with an [AnimatedBuilder] and makes use of the [child] feature to
avoid having to rebuild the [Container] each time.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1727
-
snippet.packages.flutter.lib.src.material.colors.1727
Material:ReorderableList
sample.packages.flutter.lib.src.material.reorderable_list.203
-
sample.packages.flutter.lib.src.material.reorderable_list.203
Rendering:CustomPaint
snippet.packages.flutter.lib.src.rendering.custom_paint.73
-
snippet.packages.flutter.lib.src.rendering.custom_paint.73
Material:Time
snippet.packages.flutter.lib.src.material.time.34
-
snippet.packages.flutter.lib.src.material.time.34
Material:BottomNavigationBar
sample.packages.flutter.lib.src.material.bottom_navigation_bar.98
-
sample.packages.flutter.lib.src.material.bottom_navigation_bar.98
This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
widget. The [BottomNavigationBar] has three [BottomNavigationBarItem]
widgets, which means it defaults to [BottomNavigationBarType.fixed], and
the [currentIndex] is set to index 0. The selected item is
amber. The `_onItemTapped` function changes the selected item's index
and displays a corresponding message in the center of the [Scaffold].
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2894
-
sample.packages.flutter.lib.src.material.input_decorator.2894
This example shows the differences between two `TextField` widgets when
[prefixIconConstraints] is set to the default value and when one is not.
Note that [isDense] must be set to true to be able to
set the constraints smaller than 48px.
If null, [BoxConstraints] with a minimum width and height of 48px is
used.
Foundation:Binding
snippet.packages.flutter.lib.src.foundation.binding.23
-
snippet.packages.flutter.lib.src.foundation.binding.23
Widgets:PageStorage
sample.packages.flutter.lib.src.widgets.page_storage.140
-
sample.packages.flutter.lib.src.widgets.page_storage.140
This sample shows how to explicitly use a [PageStorage] to
store the states of its children pages. Each page includes a scrollable
list, whose position is preserved when switching between the tabs thanks to
the help of [PageStorageKey].
Widgets:App
snippet.packages.flutter.lib.src.widgets.app.1048
-
snippet.packages.flutter.lib.src.widgets.app.1048
Painting:ImageStream
snippet.packages.flutter.lib.src.painting.image_stream.68
-
snippet.packages.flutter.lib.src.painting.image_stream.68
Material:ListTile
sample.packages.flutter.lib.src.material.list_tile.261
-
sample.packages.flutter.lib.src.material.list_tile.261
Here is an example of a custom list item that resembles a YouTube-related
video list item created with [Expanded] and [Container] widgets.

Material:Slider
sample.packages.flutter.lib.src.material.slider.42
-
sample.packages.flutter.lib.src.material.slider.42

The Sliders value is part of the Stateful widget subclass to change the value
setState was called.
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2990
-
sample.packages.flutter.lib.src.material.input_decorator.2990
This example shows how the suffix icon alignment can be changed using [Align] with
a fixed `widthFactor` and `heightFactor`.
Material:RadioListTile
sample.packages.flutter.lib.src.material.radio_list_tile.73
-
sample.packages.flutter.lib.src.material.radio_list_tile.73

Here is an example of a custom labeled radio widget, called
LinkedLabelRadio, that includes an interactive [RichText] widget that
handles tap gestures.
Material:ChipFilter
snippet.packages.flutter.lib.src.material.chip_filter.24
-
snippet.packages.flutter.lib.src.material.chip_filter.24
Widgets:Image
sample.packages.flutter.lib.src.widgets.image.802
-
sample.packages.flutter.lib.src.widgets.image.802
The following sample uses [loadingBuilder] to show a
[CircularProgressIndicator] while an image loads over the network.
Cupertino:TextField
sample.packages.flutter.lib.src.cupertino.text_field.143
-
sample.packages.flutter.lib.src.cupertino.text_field.143
This example shows how to set the initial value of the `CupertinoTextField` using
a [controller] that already contains some text.
Widgets:Actions
sample.packages.flutter.lib.src.widgets.actions.391
-
sample.packages.flutter.lib.src.widgets.actions.391
This example shows how ActionListener handles adding and removing of
the [listener] in the widget lifecycle.
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.263
-
sample.packages.flutter.lib.src.material.scaffold.263
Here is an example of showing a [SnackBar] when the user presses a button.
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2379
-
sample.packages.flutter.lib.src.material.input_decorator.2379
This sample shows how to style a `TextField` with a round border and
additional text before and after the input area. It displays "Prefix" before
the input area, and "Suffix" after the input area.

Material:Autocomplete
sample.packages.flutter.lib.src.material.autocomplete.16
-
sample.packages.flutter.lib.src.material.autocomplete.16
This example shows how to create a very basic Autocomplete widget using the
default UI.
Material:Tabs
sample.packages.flutter.lib.src.material.tabs.579
-
sample.packages.flutter.lib.src.material.tabs.579
[TabBar] can also be implemented by using a [TabController] which provides more options
to control the behavior of the [TabBar] and [TabBarView]. This can be used instead of
a [DefaultTabController], demonstrated below.
Rendering:Object
snippet.packages.flutter.lib.src.rendering.object.2825
-
snippet.packages.flutter.lib.src.rendering.object.2825
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.6320
-
sample.packages.flutter.lib.src.widgets.basic.6320
The following example shows a widget that hides its content one second
after being hovered, and also exposes the enter and exit callbacks.
Because the widget conditionally creates the `MouseRegion`, and leaks the
hover state, it needs to take the restriction into consideration. In this
case, since it has access to the event that triggers the disappearance of
the `MouseRegion`, it simply trigger the exit callback during that event
as well.
Material:Dropdown
sample.packages.flutter.lib.src.material.dropdown.1011
-
sample.packages.flutter.lib.src.material.dropdown.1011
This sample shows a `DropdownButton` with a button with [Text] that
corresponds to but is unique from [DropdownMenuItem].
Material:AnimatedIcons
snippet.packages.flutter.lib.src.material.animated_icons.animated_icons.13
-
snippet.packages.flutter.lib.src.material.animated_icons.animated_icons.13
Cupertino:ContextMenu
snippet.packages.flutter.lib.src.cupertino.context_menu.160
-
snippet.packages.flutter.lib.src.cupertino.context_menu.160
Material:InkWell
sample.packages.flutter.lib.src.material.ink_well.1200
-
sample.packages.flutter.lib.src.material.ink_well.1200
Tap the container to cause it to grow. Then, tap it again and hold before
the widget reaches its maximum size to observe the clipped ink splash.
Material:AppBar
snippet.packages.flutter.lib.src.material.app_bar.1374
-
snippet.packages.flutter.lib.src.material.app_bar.1374
Material:BottomNavigationBar
sample.packages.flutter.lib.src.material.bottom_navigation_bar.109
-
sample.packages.flutter.lib.src.material.bottom_navigation_bar.109
This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
widget. The [BottomNavigationBar] has four [BottomNavigationBarItem]
widgets, which means it defaults to [BottomNavigationBarType.shifting], and
the [currentIndex] is set to index 0. The selected item is amber in color.
With each [BottomNavigationBarItem] widget, backgroundColor property is
also defined, which changes the background color of [BottomNavigationBar],
when that item is selected. The `_onItemTapped` function changes the
selected item's index and displays a corresponding message in the center of
the [Scaffold].
Material:Divider
sample.packages.flutter.lib.src.material.divider.190
-
sample.packages.flutter.lib.src.material.divider.190
This sample shows how to display a [VerticalDivider] between a purple and orange box
inside a [Row]. The [VerticalDivider] is 20 logical pixels in width and contains a
horizontally centered black line that is 1 logical pixels thick. The grey
line is indented by 20 logical pixels.
Material:ExpansionPanel
sample.packages.flutter.lib.src.material.expansion_panel.184
-
sample.packages.flutter.lib.src.material.expansion_panel.184
Here is a simple example of how to implement ExpansionPanelList.radio.
Painting:ImageProvider
snippet.packages.flutter.lib.src.painting.image_provider.1000
-
snippet.packages.flutter.lib.src.painting.image_provider.1000
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.806
-
sample.packages.flutter.lib.src.widgets.transitions.806
The following code implements the [DecoratedBoxTransition] as seen in the video
above:
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1395
-
snippet.packages.flutter.lib.src.material.colors.1395
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.1039
-
sample.packages.flutter.lib.src.widgets.transitions.1039
The following example implements a simple counter that utilizes an
[AnimatedBuilder] to limit rebuilds to only the [Text] widget. The current count
is stored in a [ValueNotifier], which rebuilds the [AnimatedBuilder]'s contents
when its value is changed.
Material:FloatingActionButtonLocation
sample.packages.flutter.lib.src.material.floating_action_button_location.453
-
sample.packages.flutter.lib.src.material.floating_action_button_location.453
This is an example of a user-defined [FloatingActionButtonLocation].
The example shows a [Scaffold] with an [AppBar], a [BottomAppBar], and a
[FloatingActionButton] using a custom [FloatingActionButtonLocation].
The new [FloatingActionButtonLocation] is defined
by extending [StandardFabLocation] with two mixins,
[FabEndOffsetX] and [FabFloatOffsetY], and overriding the
[getOffsetX] method to adjust the FAB's x-coordinate, creating a
[FloatingActionButtonLocation] slightly different from
[FloatingActionButtonLocation.endFloat].
Material:ChipTheme
snippet.packages.flutter.lib.src.material.chip_theme.125
-
snippet.packages.flutter.lib.src.material.chip_theme.125
Services:TextFormatter
snippet.packages.flutter.lib.src.services.text_formatter.274
-
snippet.packages.flutter.lib.src.services.text_formatter.274
Widgets:Image
sample.packages.flutter.lib.src.widgets.image.822
-
sample.packages.flutter.lib.src.widgets.image.822
The following sample uses [errorBuilder] to show a '😢' in place of the
image that fails to load, and prints the error to the console.
Widgets:Sliver
snippet.packages.flutter.lib.src.widgets.sliver.20
-
snippet.packages.flutter.lib.src.widgets.sliver.20
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2359
-
sample.packages.flutter.lib.src.material.input_decorator.2359
This sample shows how to style a "collapsed" `TextField` using an
`InputDecorator`. The collapsed `TextField` surrounds the hint text and
input area with a border, but does not add padding around them.

Cupertino:Slider
snippet.packages.flutter.lib.src.cupertino.slider.17
-
snippet.packages.flutter.lib.src.cupertino.slider.17
Material:ListTile
snippet.packages.flutter.lib.src.material.list_tile.236
-
snippet.packages.flutter.lib.src.material.list_tile.236
Cupertino:TabScaffold
snippet.packages.flutter.lib.src.cupertino.tab_scaffold.22
-
snippet.packages.flutter.lib.src.cupertino.tab_scaffold.22
Cupertino:SegmentedControl
sample.packages.flutter.lib.src.cupertino.segmented_control.63
-
sample.packages.flutter.lib.src.cupertino.segmented_control.63
This example shows a [CupertinoSegmentedControl] with an enum type.
The callback provided to [onValueChanged] should update the state of
the parent [StatefulWidget] using the [State.setState] method, so that
the parent gets rebuilt; for example:
Widgets:Scrollbar
snippet.packages.flutter.lib.src.widgets.scrollbar.969
-
snippet.packages.flutter.lib.src.widgets.scrollbar.969
Material:InkDecoration
sample.packages.flutter.lib.src.material.ink_decoration.110
-
sample.packages.flutter.lib.src.material.ink_decoration.110
Wrapping the [Ink] in a clipping widget directly will not work since the
[Material] it will be printed on is responsible for clipping.
In this example the image is not being clipped as expected. This is because
it is being rendered onto the Scaffold body Material, which isn't wrapped in
the [ClipRRect].
Material:SnackBar
sample.packages.flutter.lib.src.material.snack_bar.167
-
sample.packages.flutter.lib.src.material.snack_bar.167
Here is an example of a customized [SnackBar]. It utilizes
[behavior], [shape], [padding], [width], and [duration] to customize the
location, appearance, and the duration for which the [SnackBar] is visible.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.851
-
snippet.packages.flutter.lib.src.material.colors.851
Widgets:Navigator
sample.packages.flutter.lib.src.widgets.navigator.2200
-
sample.packages.flutter.lib.src.widgets.navigator.2200
Typical usage is as follows:
Material:RadioListTile
sample.packages.flutter.lib.src.material.radio_list_tile.90
-
sample.packages.flutter.lib.src.material.radio_list_tile.90

Here is an example of a custom LabeledRadio widget, but you can easily
make your own configurable widget.
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.3071
-
sample.packages.flutter.lib.src.material.input_decorator.3071
This example shows the differences between two `TextField` widgets when
[suffixIconConstraints] is set to the default value and when one is not.
Note that [isDense] must be set to true to be able to
set the constraints smaller than 48px.
If null, [BoxConstraints] with a minimum width and height of 48px is
used.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.6506
-
sample.packages.flutter.lib.src.widgets.basic.6506
The following sample has an [IgnorePointer] widget wrapping the `Column`
which contains a button.
When [ignoring] is set to `true` anything inside the `Column` can
not be tapped. When [ignoring] is set to `false` anything
inside the `Column` can be tapped.
Widgets:NestedScrollView
sample.packages.flutter.lib.src.widgets.nested_scroll_view.338
-
sample.packages.flutter.lib.src.widgets.nested_scroll_view.338
[NestedScrollViewState] can be obtained using a [GlobalKey].
Using the following setup, you can access the inner scroll controller
using `globalKey.currentState.innerController`.
Material:TextField
sample.packages.flutter.lib.src.material.text_field.180
-
sample.packages.flutter.lib.src.material.text_field.180
This sample shows how to get a value from a TextField via the [onSubmitted]
callback.
Rendering:Layer
snippet.packages.flutter.lib.src.rendering.layer.108
-
snippet.packages.flutter.lib.src.rendering.layer.108
Material:ReorderableList
sample.packages.flutter.lib.src.material.reorderable_list.26
-
sample.packages.flutter.lib.src.material.reorderable_list.26
Material:BottomAppBar
snippet.packages.flutter.lib.src.material.bottom_app_bar.15
-
snippet.packages.flutter.lib.src.material.bottom_app_bar.15
Material:Colors
snippet.packages.flutter.lib.src.material.colors.685
-
snippet.packages.flutter.lib.src.material.colors.685
Services:KeyboardKey
sample.packages.flutter.lib.src.services.keyboard_key.50
-
sample.packages.flutter.lib.src.services.keyboard_key.50
This example shows how to detect if the user has selected the logical "Q"
key and handle the key if they have.
Material:FloatingActionButton
sample.packages.flutter.lib.src.material.floating_action_button.63
-
sample.packages.flutter.lib.src.material.floating_action_button.63
This example shows how to make an extended [FloatingActionButton] in a
[Scaffold], with a pink [backgroundColor], a thumbs up [Icon] and a
[Text] label that reads "Approve".

Material:ExpansionPanel
sample.packages.flutter.lib.src.material.expansion_panel.147
-
sample.packages.flutter.lib.src.material.expansion_panel.147
Here is a simple example of how to implement ExpansionPanelList.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1643
-
snippet.packages.flutter.lib.src.material.colors.1643
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.3196
-
sample.packages.flutter.lib.src.widgets.basic.3196
This examples shows how AspectRatio sets width when its parent's width
constraint is infinite. Since its parent's allowed height is a fixed value,
the actual width is determined via the given AspectRatio.
Since the height is fixed at 100.0 in this example and the aspect ratio is
set to 16 / 9, the width should then be 100.0 / 9 * 16.
Material:MaterialState
sample.packages.flutter.lib.src.material.material_state.613
-
sample.packages.flutter.lib.src.material.material_state.613
This example shows how you can override the default text and icon
color (the "foreground color") of a [TextButton] with a
[MaterialStateProperty]. In this example, the button's text color
will be `Colors.blue` when the button is being pressed, hovered,
or focused. Otherwise, the text color will be `Colors.red`.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.6059
-
sample.packages.flutter.lib.src.widgets.basic.6059
This example makes a [Container] react to being touched, showing a count of
the number of pointer downs and ups.
Widgets:Icon
snippet.packages.flutter.lib.src.widgets.icon.123
-
snippet.packages.flutter.lib.src.widgets.icon.123
Material:ListTile
snippet.packages.flutter.lib.src.material.list_tile.179
-
snippet.packages.flutter.lib.src.material.list_tile.179
Widgets:GestureDetector
sample.packages.flutter.lib.src.widgets.gesture_detector.142
-
sample.packages.flutter.lib.src.widgets.gesture_detector.142
This example uses a [Container] that wraps a [GestureDetector] widget which
detects a tap.
Since the [GestureDetector] does not have a child, it takes on the size of its
parent, making the entire area of the surrounding [Container] clickable. When
tapped, the [Container] turns yellow by setting the `_color` field. When
tapped again, it goes back to white.
Cupertino:Slider
sample.packages.flutter.lib.src.cupertino.slider.39
-
sample.packages.flutter.lib.src.cupertino.slider.39
This example shows how to show the current slider value as it changes.
Widgets:ReorderableList
snippet.packages.flutter.lib.src.widgets.reorderable_list.27
-
snippet.packages.flutter.lib.src.widgets.reorderable_list.27
Material:TextSelectionTheme
snippet.packages.flutter.lib.src.material.text_selection_theme.123
-
snippet.packages.flutter.lib.src.material.text_selection_theme.123
Cupertino:Picker
sample.packages.flutter.lib.src.cupertino.picker.42
-
sample.packages.flutter.lib.src.cupertino.picker.42
This example shows a [CupertinoPicker] that displays a list of fruits on a wheel for
selection.
Widgets:Scrollbar
snippet.packages.flutter.lib.src.widgets.scrollbar.1030
-
snippet.packages.flutter.lib.src.widgets.scrollbar.1030
Material:TextField
snippet.packages.flutter.lib.src.material.text_field.163
-
snippet.packages.flutter.lib.src.material.text_field.163
Widgets:Actions
sample.packages.flutter.lib.src.widgets.actions.1035
-
sample.packages.flutter.lib.src.widgets.actions.1035
This example shows how keyboard interaction can be added to a custom control
that changes color when hovered and focused, and can toggle a light when
activated, either by touch or by hitting the `X` key on the keyboard when
the "And Me" button has the keyboard focus (be sure to use TAB to move the
focus to the "And Me" button before trying it out).
This example defines its own key binding for the `X` key, but in this case,
there is also a default key binding for [ActivateAction] in the default key
bindings created by [WidgetsApp] (the parent for [MaterialApp], and
[CupertinoApp]), so the `ENTER` key will also activate the buttons.
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.322
-
snippet.packages.flutter.lib.src.painting.edge_insets.322
Cupertino:Scrollbar
sample.packages.flutter.lib.src.cupertino.scrollbar.44
-
sample.packages.flutter.lib.src.cupertino.scrollbar.44
This sample shows a [CupertinoScrollbar] that fades in and out of view as scrolling occurs.
The scrollbar will fade into view as the user scrolls, and fade out when scrolling stops.
The `thickness` of the scrollbar will animate from 6 pixels to the `thicknessWhileDragging` of 10
when it is dragged by the user. The `radius` of the scrollbar thumb corners will animate from 34
to the `radiusWhileDragging` of 0 when the scrollbar is being dragged by the user.
Material:Stepper
sample.packages.flutter.lib.src.material.stepper.260
-
sample.packages.flutter.lib.src.material.stepper.260
Creates a stepper control with custom buttons.
Material:SelectableText
snippet.packages.flutter.lib.src.material.selectable_text.146
-
snippet.packages.flutter.lib.src.material.selectable_text.146
Material:App
snippet.packages.flutter.lib.src.material.app.119
-
snippet.packages.flutter.lib.src.material.app.119
Material:Colors
snippet.packages.flutter.lib.src.material.colors.933
-
snippet.packages.flutter.lib.src.material.colors.933
Foundation:Isolates
snippet.packages.flutter.lib.src.foundation.isolates.53
-
snippet.packages.flutter.lib.src.foundation.isolates.53
Material:TabController
snippet.packages.flutter.lib.src.material.tab_controller.12
-
snippet.packages.flutter.lib.src.material.tab_controller.12
Painting:TextStyle
snippet.packages.flutter.lib.src.painting.text_style.28
-
snippet.packages.flutter.lib.src.painting.text_style.28
Material:InkDecoration
sample.packages.flutter.lib.src.material.ink_decoration.121
-
sample.packages.flutter.lib.src.material.ink_decoration.121
One solution would be to deliberately wrap the [Ink.image] in a [Material].
This makes sure the Material that the image is painted on is also responsible
for clipping said content.
Material:ListTile
sample.packages.flutter.lib.src.material.list_tile.270
-
sample.packages.flutter.lib.src.material.list_tile.270
Here is an example of an article list item with multiline titles and
subtitles. It utilizes [Row]s and [Column]s, as well as [Expanded] and
[AspectRatio] widgets to organize its layout.

Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.732
-
sample.packages.flutter.lib.src.widgets.transitions.732
The following code implements the [RelativePositionedTransition] as seen in the video
above:
Material:BottomAppBar
sample.packages.flutter.lib.src.material.bottom_app_bar.36
-
sample.packages.flutter.lib.src.material.bottom_app_bar.36
This example shows the [BottomAppBar], which can be configured to have a notch using the
[BottomAppBar.shape] property. This also includes an optional [FloatingActionButton], which illustrates
the [FloatingActionButtonLocation]s in relation to the [BottomAppBar].
Material:Scrollbar
sample.packages.flutter.lib.src.material.scrollbar.38
-
sample.packages.flutter.lib.src.material.scrollbar.38
This sample shows a [Scrollbar] that executes a fade animation as scrolling
occurs. The Scrollbar will fade into view as the user scrolls, and fade out
when scrolling stops.
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.766
-
sample.packages.flutter.lib.src.widgets.basic.766
This example shows various [ClipRRect]s applied to containers.
Material:Checkbox
snippet.packages.flutter.lib.src.material.checkbox.171
-
snippet.packages.flutter.lib.src.material.checkbox.171
Cupertino:TabScaffold
snippet.packages.flutter.lib.src.cupertino.tab_scaffold.146
-
snippet.packages.flutter.lib.src.cupertino.tab_scaffold.146
Material:ProgressIndicator
sample.packages.flutter.lib.src.material.progress_indicator.462
-
sample.packages.flutter.lib.src.material.progress_indicator.462
This example shows a [CircularProgressIndicator] with a changing value.
Material:ThemeData
snippet.packages.flutter.lib.src.material.theme_data.908
-
snippet.packages.flutter.lib.src.material.theme_data.908
Material:InkSparkle
snippet.packages.flutter.lib.src.material.ink_sparkle.52
-
snippet.packages.flutter.lib.src.material.ink_sparkle.52
Cupertino:FormRow
snippet.packages.flutter.lib.src.cupertino.form_row.43
-
snippet.packages.flutter.lib.src.cupertino.form_row.43
Widgets:Icon
snippet.packages.flutter.lib.src.widgets.icon.37
-
snippet.packages.flutter.lib.src.widgets.icon.37
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1351
-
snippet.packages.flutter.lib.src.material.colors.1351
Material:Switch
snippet.packages.flutter.lib.src.material.switch.279
-
snippet.packages.flutter.lib.src.material.switch.279
Material:Tabs
sample.packages.flutter.lib.src.material.tabs.572
-
sample.packages.flutter.lib.src.material.tabs.572
This sample shows the implementation of [TabBar] and [TabBarView] using a [DefaultTabController].
Each [Tab] corresponds to a child of the [TabBarView] in the order they are written.
Material:Chip
sample.packages.flutter.lib.src.material.chip.222
-
sample.packages.flutter.lib.src.material.chip.222
This sample shows how to use [onDeleted] to remove an entry when the
delete button is tapped.
Material:ChipAction
snippet.packages.flutter.lib.src.material.chip_action.33
-
snippet.packages.flutter.lib.src.material.chip_action.33
Material:MaterialStateMixin
snippet.packages.flutter.lib.src.material.material_state_mixin.26
-
snippet.packages.flutter.lib.src.material.material_state_mixin.26
Widgets:SlottedRenderObjectWidget
sample.packages.flutter.lib.src.widgets.slotted_render_object_widget.30
-
sample.packages.flutter.lib.src.widgets.slotted_render_object_widget.30
This example uses the [SlottedMultiChildRenderObjectWidgetMixin] in
combination with the [SlottedContainerRenderObjectMixin] to implement a
widget that provides two slots: topLeft and bottomRight. The widget arranges
the children in those slots diagonally.
Material:Banner
sample.packages.flutter.lib.src.material.banner.64
-
sample.packages.flutter.lib.src.material.banner.64
MaterialBanner's can also be presented through a [ScaffoldMessenger].
Here is an example where ScaffoldMessengerState.showMaterialBanner() is used to show the MaterialBanner.
Painting:ImageCache
snippet.packages.flutter.lib.src.painting.image_cache.49
-
snippet.packages.flutter.lib.src.painting.image_cache.49
Material:Switch
snippet.packages.flutter.lib.src.material.switch.238
-
snippet.packages.flutter.lib.src.material.switch.238
Material:SnackBar
sample.packages.flutter.lib.src.material.snack_bar.160
-
sample.packages.flutter.lib.src.material.snack_bar.160
Here is an example of a [SnackBar] with an [action] button implemented using
[SnackBarAction].
Widgets:FadeInImage
snippet.packages.flutter.lib.src.widgets.fade_in_image.15
-
snippet.packages.flutter.lib.src.widgets.fade_in_image.15
Widgets:Spacer
snippet.packages.flutter.lib.src.widgets.spacer.21
-
snippet.packages.flutter.lib.src.widgets.spacer.21
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.1347
-
sample.packages.flutter.lib.src.material.scaffold.1347
This example shows a [Scaffold] with a [body] and [FloatingActionButton].
The [body] is a [Text] placed in a [Center] in order to center the text
within the [Scaffold]. The [FloatingActionButton] is connected to a
callback that increments a counter.

Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.6311
-
sample.packages.flutter.lib.src.widgets.basic.6311
The following example shows a blue rectangular that turns yellow when
hovered. Since the hover state is completely contained within a widget
that unconditionally creates the `MouseRegion`, you can ignore the
aforementioned restriction.
Material:IconButton
sample.packages.flutter.lib.src.material.icon_button.44
-
sample.packages.flutter.lib.src.material.icon_button.44
This sample shows an `IconButton` that uses the Material icon "volume_up" to
increase the volume.

Material:BottomSheet
sample.packages.flutter.lib.src.material.bottom_sheet.656
-
sample.packages.flutter.lib.src.material.bottom_sheet.656
This example demonstrates how to use `showModalBottomSheet` to display a
bottom sheet that obscures the content behind it when a user taps a button.
It also demonstrates how to close the bottom sheet using the [Navigator]
when a user taps on a button inside the bottom sheet.
Material:NavigationRail
sample.packages.flutter.lib.src.material.navigation_rail.312
-
sample.packages.flutter.lib.src.material.navigation_rail.312
This example shows how to use this animation to create a [FloatingActionButton]
that animates itself between the normal and extended states of the
[NavigationRail].
An instance of `MyNavigationRailFab` is created for [NavigationRail.leading].
Pressing the FAB button toggles the "extended" state of the [NavigationRail].
Material:Colors
snippet.packages.flutter.lib.src.material.colors.895
-
snippet.packages.flutter.lib.src.material.colors.895
Material:Colors
snippet.packages.flutter.lib.src.material.colors.483
-
snippet.packages.flutter.lib.src.material.colors.483
Widgets:Routes
sample.packages.flutter.lib.src.widgets.routes.2015
-
sample.packages.flutter.lib.src.widgets.routes.2015
This sample demonstrates how to create a restorable dialog. This is
accomplished by enabling state restoration by specifying
[WidgetsApp.restorationScopeId] and using [Navigator.restorablePush] to
push [RawDialogRoute] when the button is tapped.
{@macro flutter.widgets.RestorationManager}
Material:Dropdown
sample.packages.flutter.lib.src.material.dropdown.1036
-
sample.packages.flutter.lib.src.material.dropdown.1036
This sample shows a `DropdownButton` with a dropdown button text style
that is different than its menu items.
Painting:EdgeInsets
snippet.packages.flutter.lib.src.painting.edge_insets.314
-
snippet.packages.flutter.lib.src.painting.edge_insets.314
Material:App
snippet.packages.flutter.lib.src.material.app.103
-
snippet.packages.flutter.lib.src.material.app.103
Painting:TextSpan
snippet.packages.flutter.lib.src.painting.text_span.37
-
snippet.packages.flutter.lib.src.painting.text_span.37
Rendering:SliverGrid
sample.packages.flutter.lib.src.rendering.sliver_grid.279
-
sample.packages.flutter.lib.src.rendering.sliver_grid.279
Here is an example using the [childAspectRatio] property. On a device with a
screen width of 800.0, it creates a GridView with each tile with a width of
200.0 and a height of 100.0.
Material:PopupMenu
sample.packages.flutter.lib.src.material.popup_menu.973
-
sample.packages.flutter.lib.src.material.popup_menu.973
This example shows a menu with four items, selecting between an enum's
values and setting a `_selectedMenu` field based on the selection
Cupertino:Route
sample.packages.flutter.lib.src.cupertino.route.1147
-
sample.packages.flutter.lib.src.cupertino.route.1147
This sample demonstrates how to create a restorable Cupertino modal route.
This is accomplished by enabling state restoration by specifying
[CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
push [CupertinoModalPopupRoute] when the [CupertinoButton] is tapped.
{@macro flutter.widgets.RestorationManager}
Material:Dialog
sample.packages.flutter.lib.src.material.dialog.1030
-
sample.packages.flutter.lib.src.material.dialog.1030
This sample shows the creation of [showDialog], as described in:
https://m3.material.io/components/dialogs/overview
Animation:Animations
snippet.packages.flutter.lib.src.animation.animations.15
-
snippet.packages.flutter.lib.src.animation.animations.15
Widgets:GestureDetector
sample.packages.flutter.lib.src.widgets.gesture_detector.134
-
sample.packages.flutter.lib.src.widgets.gesture_detector.134
This example contains a black light bulb wrapped in a [GestureDetector]. It
turns the light bulb yellow when the "TURN LIGHT ON" button is tapped by
setting the `_lights` field, and off again when "TURN LIGHT OFF" is tapped.
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.28
-
sample.packages.flutter.lib.src.widgets.transitions.28
This code defines a widget called `Spinner` that spins a green square
continually. It is built with an [AnimatedWidget].
Foundation:StackFrame
snippet.packages.flutter.lib.src.foundation.stack_frame.18
-
snippet.packages.flutter.lib.src.foundation.stack_frame.18
Cupertino:SlidingSegmentedControl
sample.packages.flutter.lib.src.cupertino.sliding_segmented_control.288
-
sample.packages.flutter.lib.src.cupertino.sliding_segmented_control.288
This example shows a [CupertinoSlidingSegmentedControl] with an enum type.
The callback provided to [onValueChanged] should update the state of
the parent [StatefulWidget] using the [State.setState] method, so that
the parent gets rebuilt; for example:
Cupertino:App
snippet.packages.flutter.lib.src.cupertino.app.114
-
snippet.packages.flutter.lib.src.cupertino.app.114
Widgets:Basic
sample.packages.flutter.lib.src.widgets.basic.5029
-
sample.packages.flutter.lib.src.widgets.basic.5029
This example shows how to use an [Expanded] widget in a [Column] so that
its middle child, a [Container] here, expands to fill the space.

Material:SelectableText
snippet.packages.flutter.lib.src.material.selectable_text.130
-
snippet.packages.flutter.lib.src.material.selectable_text.130
Material:Tooltip
sample.packages.flutter.lib.src.material.tooltip.45
-
sample.packages.flutter.lib.src.material.tooltip.45
This example covers most of the attributes available in Tooltip.
`decoration` has been used to give a gradient and borderRadius to Tooltip.
`height` has been used to set a specific height of the Tooltip.
`preferBelow` is false, the tooltip will prefer showing above [Tooltip]'s child widget.
However, it may show the tooltip below if there's not enough space
above the widget.
`textStyle` has been used to set the font size of the 'message'.
`showDuration` accepts a Duration to continue showing the message after the long
press has been released or the mouse pointer exits the child widget.
`waitDuration` accepts a Duration for which a mouse pointer has to hover over the child
widget before the tooltip is shown.
Material:Scaffold
sample.packages.flutter.lib.src.material.scaffold.2287
-
sample.packages.flutter.lib.src.material.scaffold.2287
This example demonstrates how to use `showBottomSheet` to display a
bottom sheet when a user taps a button. It also demonstrates how to
close a bottom sheet using the Navigator.
Widgets:Text
snippet.packages.flutter.lib.src.widgets.text.15
-
snippet.packages.flutter.lib.src.widgets.text.15
Widgets:RestorationProperties
sample.packages.flutter.lib.src.widgets.restoration_properties.23
-
sample.packages.flutter.lib.src.widgets.restoration_properties.23
A [StatefulWidget] that has a restorable [int] property.
Material:MaterialState
sample.packages.flutter.lib.src.material.material_state.204
-
sample.packages.flutter.lib.src.material.material_state.204
This example defines a mouse cursor that resolves to
[SystemMouseCursors.forbidden] when its widget is disabled.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.729
-
snippet.packages.flutter.lib.src.material.colors.729
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1184
-
snippet.packages.flutter.lib.src.material.colors.1184
Material:App
snippet.packages.flutter.lib.src.material.app.657
-
snippet.packages.flutter.lib.src.material.app.657
Widgets:NestedScrollView
sample.packages.flutter.lib.src.widgets.nested_scroll_view.144
-
sample.packages.flutter.lib.src.widgets.nested_scroll_view.144
This simple example shows a [NestedScrollView] whose header contains a
snapping, floating [SliverAppBar]. _Without_ setting any additional flags,
e.g [NestedScrollView.floatHeaderSlivers], the [SliverAppBar] will animate
in and out without floating. The [SliverOverlapAbsorber] and
[SliverOverlapInjector] maintain the proper alignment between the two
separate scroll views.
Widgets:ImplicitAnimations
sample.packages.flutter.lib.src.widgets.implicit_animations.1017
-
sample.packages.flutter.lib.src.widgets.implicit_animations.1017
The following example transitions an AnimatedPositioned
between two states. It adjusts the `height`, `width`, and
[Positioned] properties when tapped.
Widgets:App
snippet.packages.flutter.lib.src.widgets.app.1097
-
snippet.packages.flutter.lib.src.widgets.app.1097
Cupertino:TextFormFieldRow
snippet.packages.flutter.lib.src.cupertino.text_form_field_row.60
-
snippet.packages.flutter.lib.src.cupertino.text_form_field_row.60
Cupertino:SearchField
snippet.packages.flutter.lib.src.cupertino.search_field.58
-
snippet.packages.flutter.lib.src.cupertino.search_field.58
Widgets:DraggableScrollableSheet
snippet.packages.flutter.lib.src.widgets.draggable_scrollable_sheet.249
-
snippet.packages.flutter.lib.src.widgets.draggable_scrollable_sheet.249
Material:Colors
snippet.packages.flutter.lib.src.material.colors.565
-
snippet.packages.flutter.lib.src.material.colors.565
Foundation:Diagnostics
snippet.packages.flutter.lib.src.foundation.diagnostics.15
-
snippet.packages.flutter.lib.src.foundation.diagnostics.15
Material:DataTable
sample.packages.flutter.lib.src.material.data_table.323
-
sample.packages.flutter.lib.src.material.data_table.323
This sample shows how to display a [DataTable] with three columns: name, age, and
role. The columns are defined by three [DataColumn] objects. The table
contains three rows of data for three example users, the data for which
is defined by three [DataRow] objects.

Material:Divider
snippet.packages.flutter.lib.src.material.divider.11
-
snippet.packages.flutter.lib.src.material.divider.11
Painting:Borders
snippet.packages.flutter.lib.src.painting.borders.40
-
snippet.packages.flutter.lib.src.painting.borders.40
Services:KeyboardKey
sample.packages.flutter.lib.src.services.keyboard_key.3497
-
sample.packages.flutter.lib.src.services.keyboard_key.3497
This example shows how to detect if the user has selected the physical key
to the right of the CAPS LOCK key.
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2580
-
sample.packages.flutter.lib.src.material.input_decorator.2580
This example shows a `TextField` with a [Text.rich] widget as the [label].
The widget contains multiple [Text] widgets with different [TextStyle]'s.
Widgets:Image
snippet.packages.flutter.lib.src.widgets.image.277
-
snippet.packages.flutter.lib.src.widgets.image.277
Cupertino:ContextMenu
sample.packages.flutter.lib.src.cupertino.context_menu.85
-
sample.packages.flutter.lib.src.cupertino.context_menu.85
This sample shows a very simple CupertinoContextMenu for an empty red
100x100 Container. Simply long press on it to open.
Material:DataTable
sample.packages.flutter.lib.src.material.data_table.335
-
sample.packages.flutter.lib.src.material.data_table.335
This sample shows how to display a [DataTable] with alternate colors per
row, and a custom color for when the row is selected.
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2646
-
sample.packages.flutter.lib.src.material.input_decorator.2646
It's possible to override the label style for just the error state, or
just the default state, or both.
In this example the [floatingLabelStyle] is specified with a
[MaterialStateProperty] which resolves to a text style whose color depends
on the decorator's error state.
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1433
-
snippet.packages.flutter.lib.src.material.colors.1433
Material:Colors
snippet.packages.flutter.lib.src.material.colors.1599
-
snippet.packages.flutter.lib.src.material.colors.1599
Painting:Gradient
sample.packages.flutter.lib.src.painting.gradient.352
-
sample.packages.flutter.lib.src.painting.gradient.352
This sample draws a picture with a gradient sweeping through different
colors, by having a [Container] display a [BoxDecoration] with a
[LinearGradient].
Painting:StrutStyle
snippet.packages.flutter.lib.src.painting.strut_style.199
-
snippet.packages.flutter.lib.src.painting.strut_style.199
Widgets:Async
sample.packages.flutter.lib.src.widgets.async.370
-
sample.packages.flutter.lib.src.widgets.async.370
This sample shows a [StreamBuilder] that listens to a Stream that emits bids
for an auction. Every time the StreamBuilder receives a bid from the Stream,
it will display the price of the bid below an icon. If the Stream emits an
error, the error is displayed below an error icon. When the Stream finishes
emitting bids, the final price is displayed.
Material:Icons
snippet.packages.flutter.lib.src.material.icons.168
-
snippet.packages.flutter.lib.src.material.icons.168
Widgets:Localizations
snippet.packages.flutter.lib.src.widgets.localizations.14
-
snippet.packages.flutter.lib.src.widgets.localizations.14
Widgets:Transitions
sample.packages.flutter.lib.src.widgets.transitions.932
-
sample.packages.flutter.lib.src.widgets.transitions.932
The following code implements the [DefaultTextStyleTransition] that shows
a transition between thick blue font and thin red font.
Material:InputDecorator
sample.packages.flutter.lib.src.material.input_decorator.2369
-
sample.packages.flutter.lib.src.material.input_decorator.2369
This sample shows how to create a `TextField` with hint text, a red border
on all sides, and an error message. To display a red border and error
message, provide `errorText` to the `InputDecoration` constructor.

Widgets:ImplicitAnimations
sample.packages.flutter.lib.src.widgets.implicit_animations.1559
-
sample.packages.flutter.lib.src.widgets.implicit_animations.1559
This code defines a widget that uses [AnimatedSlide] to translate a [FlutterLogo]
up or down by the amount of it's height with each press of the corresponding button.
Widgets:Binding
snippet.packages.flutter.lib.src.widgets.binding.163
-
snippet.packages.flutter.lib.src.widgets.binding.163