dynamic_theme 1.0.0

  • README.md
  • Example
  • Installing
  • Versions
  • new87


Dynamically changing your theme without hassle

This packages manages changing your theme during runtime and persiting that theme.

I wrote a medium post about this, check it out here!

Include in your project

      url: git://github.com/Norbert515/dynamic_theme.git

run packages get and import it

import 'package:dynamic_theme/dynamic_theme.dart';

if you want the dialog:

import 'package:dynamic_theme/theme_switcher_widgets.dart';

If you are not able to import it, restart your IDE see: https://github.com/flutter/flutter/issues/17016


Wrap your material app like this:

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return new DynamicTheme(
      defaultBrightness: Brightness.light,
      data: (brightness) => new ThemeData(
        primarySwatch: Colors.indigo,
        brightness: brightness,
      themedWidgetBuilder: (context, theme) {
        return new MaterialApp(
          title: 'Flutter Demo',
          theme: theme,
          home: new MyHomePage(title: 'Flutter Demo Home Page'),

Change the theme like this:

  void changeBrightness() {
    DynamicTheme.of(context).setBrightness(Theme.of(context).brightness == Brightness.dark? Brightness.light: Brightness.dark);
  void changeColor() {
    DynamicTheme.of(context).setThemeData(new ThemeData(
        primaryColor: Theme.of(context).primaryColor == Colors.indigo? Colors.red: Colors.indigo

When changing the brightness with setBrightness, it is additionally stored in the shared preferences.

Also included

A dialog widget to change the brightness!

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.



A new Flutter example.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dynamic_theme: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:dynamic_theme/dynamic_theme.dart';
Version Uploaded Documentation Archive
1.0.0 Nov 4, 2018 Go to the documentation of dynamic_theme 1.0.0 Download dynamic_theme 1.0.0 archive
0.0.1 Nov 4, 2018 Go to the documentation of dynamic_theme 0.0.1 Download dynamic_theme 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
flutter 0.0.0
shared_preferences ^0.4.1 0.4.3
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies