- 25 September, 2023
- FlutterHQ.com
38 Flutter code samples, examples and snippets for the cupertino-library
Get a better understanding on how to user the cupertino-library with our list of code-samples, examples and snippets.
Latest samples and snippets for cupertino
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.
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.
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.
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.
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.
Cupertino:SlidingSegmentedControl
snippet.packages.flutter.lib.src.cupertino.sliding_segmented_control.362
-
snippet.packages.flutter.lib.src.cupertino.sliding_segmented_control.362
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.
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.
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: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].
Cupertino:SearchField
snippet.packages.flutter.lib.src.cupertino.search_field.27
-
snippet.packages.flutter.lib.src.cupertino.search_field.27
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}
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].
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`.
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].
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.
Cupertino:ContextMenu
snippet.packages.flutter.lib.src.cupertino.context_menu.160
-
snippet.packages.flutter.lib.src.cupertino.context_menu.160
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:
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.
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.
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.
Cupertino:TabScaffold
snippet.packages.flutter.lib.src.cupertino.tab_scaffold.146
-
snippet.packages.flutter.lib.src.cupertino.tab_scaffold.146
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}
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: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
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.