ThemeNotifier constructor

ThemeNotifier(
  1. ThemeData _themeData
)

Implementation

ThemeNotifier(this._themeData) {
  // load the library
  if (libraryLoader == null) {
    libraryLoader = Completer();
    fonts.loadLibrary().then((value) => libraryLoader!.complete(true));
  }

  // wait for the library to load
  if (!libraryLoader!.isCompleted) {
    // set the theme
    libraryLoader!.future.whenComplete(() {
      var brightness = System.currentApp?.brightness ?? FmlEngine.defaultBrightness;
      var color = System.currentApp?.color ?? FmlEngine.defaultColor;
      var font = System.currentApp?.font ?? FmlEngine.defaultFont;
      setTheme(brightness: brightness, color: color, font: font);
    });
  }
}