initState method
override
This method is called when this object is inserted into the tree.
Here, it also adds this object as an observer in WidgetsBinding instance and initializes various fields related to the theme, contrast, and brightness of the app.
Implementation
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
// Set the initial brightness with the system's current brightness from the first view of the platform dispatcher.
_platformBrightness = MediaQueryData.fromView(PlatformDispatcher.instance.views.first).platformBrightness;
// Set the initial theme mode.
_themeMode = widget.initialThemeMode;
// Set the initial contrast.
_contrast = widget.initialContrast;
// Sets the initial rounded.
_rounded = widget.initialRounded;
// Apply the initial contrast to the theme data.
_zetaThemeData = widget.initialZetaThemeData.apply(contrast: _contrast);
// Set the initial light [ThemeData].
_lightThemeData = widget.initialLightThemeData;
// Set the initial light [ThemeData].
_darkThemeData = widget.initialDarkThemeData;
}