TwinPlatformState class
What the platform reports about the device, before it is combined with
the window size into TwinScreenData.
Also used to fake a device in tests:
TwinScreenScope(
platformOverride: TwinPlatformState(
deviceType: TwinDeviceType.foldable,
posture: TwinPosture.halfOpened,
displayFeatures: [
DisplayFeature(
bounds: Rect.fromLTWH(345, 0, 0, 829),
type: DisplayFeatureType.fold,
state: DisplayFeatureState.postureHalfOpened,
),
],
),
child: MyApp(),
)
- Annotations
Constructors
-
TwinPlatformState({TwinDeviceType deviceType = TwinDeviceType.unknown, TwinPosture posture = TwinPosture.unknown, double? hingeAngle, List<
DisplayFeature> displayFeatures = const <DisplayFeature>[], int? rotationQuarterTurns, TwinDataSource source = TwinDataSource.fallback}) -
Creates a platform state.
const
-
TwinPlatformState.fromMap(Map<
Object?, Object?> map) -
Parses the map sent by the native side over the platform channel.
factory
Properties
- deviceType → TwinDeviceType
-
The hardware type as far as the platform can tell.
final
-
displayFeatures
→ List<
DisplayFeature> -
Display features the platform reports but Flutter does not, in logical
pixels in the window's coordinate space.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- hingeAngle → double?
-
The hinge angle in degrees, or null without a sensor.
final
- posture → TwinPosture
-
The hinge posture, from the hinge sensor or the web posture API.
final
- rotationQuarterTurns → int?
-
How far the display is rotated from its natural orientation, in
clockwise quarter turns. Used to tell book foldables from flip phones.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → TwinDataSource
-
Where this state came from.
final
Methods
-
copyWith(
{TwinDeviceType? deviceType, TwinPosture? posture, ValueGetter< double?> ? hingeAngle, List<DisplayFeature> ? displayFeatures, ValueGetter<int?> ? rotationQuarterTurns, TwinDataSource? source}) → TwinPlatformState - Returns a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- fallback → const TwinPlatformState
- The state used where no platform code runs: an ordinary device.