In current Age, All mobile App have duel theme. Here we introduce change App theme dynamically. Theme change on button click.

You can Download Source Code via Github.

Implement theme

Light theme

static final ThemeData lightTheme = ThemeData(
    primaryColor: UtilsImporter().colorUtils.primarycolor,
    primaryColorLight: Colors.white,
    primaryColorDark: Colors.black,
    brightness: Brightness.light,
    inputDecorationTheme: InputDecorationTheme(
        focusedBorder: UnderlineInputBorder(
            borderSide: BorderSide(
                color: UtilsImporter().colorUtils.primarycolor))),
  );

Dark theme

static final ThemeData darkTheme = ThemeData(
    primaryColor: UtilsImporter().colorUtils.primarycolor,
    primaryColorLight: Colors.black,
    primaryColorDark: Colors.white,
    brightness: Brightness.dark,
    inputDecorationTheme: InputDecorationTheme(
        focusedBorder: UnderlineInputBorder(
            borderSide: BorderSide(
                color: UtilsImporter().colorUtils.primarycolor))),
  );

Change theme

onTap: () {
                    if (isDarkThemeMode == true) {
                      setState(() {
                        isDarkThemeMode = false;
                      });

                      _changeTheme(context, MyThemeKeys.LIGHT);
                    } else {
                      setState(() {
                        isDarkThemeMode = true;
                      });

                      _changeTheme(context, MyThemeKeys.DARK);
                    }
                  },


 void _changeTheme(BuildContext buildContext, MyThemeKeys key) {
    CustomTheme.instanceOf(buildContext).changeTheme(key);
  }

You can Download Source Code via Github.