changeUI method

bool changeUI(
  1. String? ui
)

Explicitly change to a particular interface.

Implementation

bool changeUI(String? ui) {
  // Allow to chang the interface in the first place.
  bool change = _allowChangeUI;

  if (change) {
    // The parameter may be null
    change = ui != null && ui.isNotEmpty;
  }

  if (change) {
    ui = ui!.trim();
    // Must be a recognized interface design
    change = ui == 'Material' || ui == 'Cupertino';
  }

  if (change) {
    //
    if (ui == 'Material') {
      _useMaterial = true;
      _useCupertino = false;
      _switchUI = !UniversalPlatform.isAndroid;
    } else {
      _useMaterial = false;
      _useCupertino = true;
      _switchUI = UniversalPlatform.isAndroid;
    }
    // Reload the whole App so it works in testing
    reload();
  }
  return change;
}