Skip to the workspace
Pebellslearn by building
Widgets  ›  Lesson

Styled Widgets: Material and Cupertino

Styled Widgets 12 minFlutter ships two design-language widget sets, Material for Google's design system and Cupertino for Apple's iOS look, and a theme styles Material widgets from one place.

flutter / Styled Widgets: Material and Cupertino

Explore each scene at your own pace.

01 · The rule

The rule

Styled Widgets: Material and Cupertino

Sprout works, but every screen is plain. You could colour each button by hand, and then change twenty places when the brand colour changes. Flutter instead ships complete, styled widget sets, and a theme that dresses them all from one spot.

The rule

Material for Google's look, Cupertino for Apple's; theme once, not per widget.

Material widgets follow Google's Material Design and work on every platform. An app built with them starts with MaterialApp:

MaterialApp(
  theme: ThemeData(
    colorScheme: ColorScheme.fromSeed(seedColor: Colors.green),
  ),
  home: Scaffold(
    appBar: AppBar(title: const Text('Sprout')),
    body: const PlantList(),
    floatingActionButton: FloatingActionButton(
      onPressed: addPlant,
      child: const Icon(Icons.add),
    ),
  ),
);

Scaffold gives the page structure: app bar, body, floating button, drawers, snack bars. ColorScheme.fromSeed builds a whole palette from one colour, and every Material widget reads its colours from it.

Cupertino widgets copy the look and feel of iOS: CupertinoApp, CupertinoPageScaffold, CupertinoNavigationBar, CupertinoButton, CupertinoSwitch. Choose them when an app should feel native on iPhone. Some Material widgets offer an adaptive constructor, such as Switch.adaptive, which draws an iOS switch on Apple platforms and a Material one elsewhere.

In your own widgets, read the theme rather than hard-coding colours:

final green = Theme.of(context).colorScheme.primary;
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.