CupertinoApp class

An application that uses Cupertino design.

A convenience widget that wraps a number of widgets that are commonly required for an iOS-design targeting application. It builds upon a WidgetsApp by iOS specific defaulting such as fonts and scrolling physics.

The CupertinoApp configures the top-level Navigator to search for routes in the following order:

  1. For the / route, the home property, if non-null, is used.

  2. Otherwise, the routes table is used, if it has an entry for the route.

  3. Otherwise, onGenerateRoute is called, if provided. It should return a non-null value for any valid route not handled by home and routes.

  4. Finally if all else fails onUnknownRoute is called.

If home, routes, onGenerateRoute, and onUnknownRoute are all null, and builder is not null, then no Navigator is created.

This widget also configures the observer of the top-level Navigator (if any) to perform Hero animations.

Use this widget with caution on Android since it may produce behaviors Android users are not expecting such as:

  • Pages will be dismissible via a back swipe.
  • Scrolling past extremities will trigger iOS-style spring overscrolls.
  • The San Francisco font family is unavailable on Android and can result in undefined font behavior.

See also:

  • CupertinoPageScaffold, which provides a standard page layout default with nav bars.
  • Navigator, which is used to manage the app's stack of pages.
  • CupertinoPageRoute, which defines an app page that transitions in an iOS-specific way.
  • WidgetsApp, which defines the basic app elements but does not depend on the Cupertino library.


CupertinoApp({Key key, GlobalKey<NavigatorState> navigatorKey, Widget home, CupertinoThemeData theme, Map<String, WidgetBuilder> routes: const {}, String initialRoute, RouteFactory onGenerateRoute, RouteFactory onUnknownRoute, List<NavigatorObserver> navigatorObservers: const [], TransitionBuilder builder, String title: '', GenerateAppTitle onGenerateTitle, Color color, Locale locale, Iterable<LocalizationsDelegate> localizationsDelegates, LocaleListResolutionCallback localeListResolutionCallback, LocaleResolutionCallback localeResolutionCallback, Iterable<Locale> supportedLocales: const [Locale('en', 'US')], bool showPerformanceOverlay: false, bool checkerboardRasterCacheImages: false, bool checkerboardOffscreenLayers: false, bool showSemanticsDebugger: false, bool debugShowCheckedModeBanner: true })
Creates a CupertinoApp. [...]


builder TransitionBuilder
A builder for inserting widgets above the Navigator but below the other widgets created by the WidgetsApp widget, or for replacing the Navigator entirely. [...]
checkerboardOffscreenLayers bool
Turns on checkerboarding of layers rendered to offscreen bitmaps.
checkerboardRasterCacheImages bool
Turns on checkerboarding of raster cache images.
color Color
The primary color to use for the application in the operating system interface. [...]
debugShowCheckedModeBanner bool
Turns on a little "DEBUG" banner in checked mode to indicate that the app is in checked mode. This is on by default (in checked mode), to turn it off, set the constructor argument to false. In release mode this has no effect. [...]
home Widget
The widget for the default route of the app (Navigator.defaultRouteName, which is /). [...]
initialRoute String
The name of the first route to show, if a Navigator is built. [...]
locale Locale
The initial locale for this app's Localizations widget is based on this value. [...]
localeListResolutionCallback LocaleListResolutionCallback
This callback is responsible for choosing the app's locale when the app is started, and when the user changes the device's locale. [...]
localeResolutionCallback LocaleResolutionCallback
null [...]
localizationsDelegates Iterable<LocalizationsDelegate>
The delegates for this app's Localizations widget. [...]
A key to use when building the Navigator. [...]
The list of observers for the Navigator created for this app. [...]
onGenerateRoute RouteFactory
The route generator callback used when the app is navigated to a named route. [...]
onGenerateTitle GenerateAppTitle
If non-null this callback function is called to produce the app's title string, otherwise title is used. [...]
onUnknownRoute RouteFactory
Called when onGenerateRoute fails to generate a route, except for the initialRoute. [...]
routes Map<String, WidgetBuilder>
The application's top-level routing table. [...]
showPerformanceOverlay bool
Turns on a performance overlay. [...]
showSemanticsDebugger bool
Turns on an overlay that shows the accessibility information reported by the framework.
supportedLocales Iterable<Locale>
The list of locales that this app has been localized for. [...]
theme CupertinoThemeData
The top-level CupertinoTheme styling. [...]
title String
A one-line description used by the device to identify the app for the user. [...]
hashCode int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


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


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

Static Methods

createCupertinoHeroController() HeroController
The HeroController used for Cupertino page transitions. [...]