Flutter UI Widgets

Nov 9 2021 · Dart 2.14, Flutter 2.5, VS Code 1.61

Part 1: Flutter UI Widgets

08. Style Your App with Themes

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 07. Use the FutureBuilder Widget Next episode: 09. Add Navigation & SliverAppBar

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Themes are used to share color, font and design styles in your apps. By default, Flutter provides us with a default theme when we use the MaterialApp. This theme has the light and dark version. Currently, it is set to the light theme. It has a primary color of blue as seen in the AppBar, BottomNavigation bar and the FloatingActionButton.

...
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
themeMode: ThemeMode.dark,
...
final lightTheme = ThemeData();
...
theme: lightTheme.copyWith(
  colorScheme: lightTheme.colorScheme.copyWith(
    primary: Colors.red,
    secondary: Colors.green,
  ),
),
...
textTheme: TextTheme(
  headline5: TextStyle(fontSize: 24),
),
style: Theme.of(context).textTheme.headline5,
style: Theme.of(context).textTheme.headline5.copyWith(
  fontStyle: FontStyle.italic,
  color: Colors.grey[600],
),
fontFamily: 'Lato'
final darkTheme = ThemeData(
  brightness: Brightness.dark,
);
...
darkTheme: darkTheme