getFoldPosture static method

FoldPosture? getFoldPosture(
  1. SystemInfo info
)

Implementation

static FoldPosture? getFoldPosture(SystemInfo info) {
  for (final feature in info.displayFeatures) {
    if (feature.type == ui.DisplayFeatureType.fold ||
        feature.type == ui.DisplayFeatureType.hinge) {
      switch (feature.state) {
        case ui.DisplayFeatureState.postureFlat:
          return FoldPosture.flat;
        case ui.DisplayFeatureState.postureHalfOpened:
          return FoldPosture.halfOpened;
        default:
          return FoldPosture.unknown;
      }
    }
  }
  return null;
}