onChange static method

void onChange([
  1. ColorSwatch<int?>? value
])

Implementation

static void onChange([ColorSwatch<int?>? value]) {
  //
  if (value == null) {
    final swatch = Prefs.getInt('colorTheme', -1);
    // If never set in the first place, ignore
    if (swatch > -1) {
      // value = ColorPicker.colors[swatch];
      // ColorPicker.colorSwatch = value;
    }
  } else {
    // Prefs.setInt('colorTheme', ColorPicker.colors.indexOf(value));
  }

  if (value == null) {
    return;
  }

  /// Assign the colour to the floating button as well.
  App.themeData = ThemeData(
    primaryColor: value,
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: value,
    ),
  );

  App.iOSTheme = value;

  // Rebuild the state.
  _state?.refresh();
}