detect method

T? detect(
  1. bool activated, {
  2. bool enabled = true,
  3. bool error = false,
  4. bool focused = false,
  5. bool hover = false,
  6. bool valid = false,
})

Implementation

T? detect(
  bool activated, {
  bool enabled = true,
  bool error = false,
  bool focused = false,
  bool hover = false,
  bool valid = false,
}) {
  if (enabled) {
    if (hover) {
      return this.hover ?? secondary ?? primary;
    } else if (error) {
      if (focused) {
        return this.error ?? secondary ?? primary;
      } else {
        return primary ?? this.error;
      }
    } else if (valid) {
      if (focused) {
        return this.valid ?? secondary ?? primary;
      } else {
        return primary ?? this.valid;
      }
    } else if (activated) {
      return secondary ?? primary;
    } else {
      return primary;
    }
  } else {
    return disable ?? ternary ?? primary;
  }
}