foldable_ext 0.3.0
foldable_ext: ^0.3.0 copied to clipboard
Test Flutter layouts on Android foldables, including the Galaxy Z Fold. Preview iPhone Duo window size, safe areas, and the fold in debug builds.
0.3.0 #
-
EmulatedMediaQuery:MediaQuerylookups that give the emulated window above the scope and in code that reads the view.windowOfandfromViewstand in forMediaQueryData.fromView. -
Add a screenshot of the fold and keep-clear overlay.
0.2.1 #
- Shorter README that covers install, usage, settings and known gaps.
- Releases publish to pub.dev from GitHub Actions when a version tag is pushed.
0.2.0 #
Device emulation: with division mode on, an app under FoldDivisionScope on an Android foldable
renders as it does on an iPhone Duo.
EmulatedDeviceandEmulatedDeviceState, a device profile with one set of metrics per window: size, safe area, fold axis and centre, occlusions.EmulatedDevice.iphoneDuois built in. Several of its numbers are unverified against hardware, and every number is a field.FoldDivisionConfig.device(defaultEmulatedDevice.iphoneDuo) andFoldDivisionConfig.matchWindowSize(default true).copyWithtakesclearDevice.FoldDivisionScopelays its child out at the window size of the device, scaled to fit the real safe area over black, with hit testing through the scale.MediaQueryunder it reports the emulated size, safe area, pixel ratio, keyboard inset and display features. WithmatchWindowSizeoff the window keeps its real size and takes the emulated safe area.DuoMediaQuery,FoldDivision.divisionOf,marginsOf,keepClearRectOfand the overlay work in the coordinates of the emulated window. The division sits on the fold of the profile and the occlusions of the profile areocclusionregions.FoldDivision.isEmulatingDevice,emulatedDeviceOf,emulationOfandwindowRectOf.selectEmulatedWindow,emulateDeviceData,placeEmulatedWindow,emulatedViewInsetsandmergeSafeArea, the pure functions behind the scope.FoldDivisionOverlaydraws the occlusions and the safe area edges of the emulated device, withocclusionColorandsafeAreaColor.- The example app has a switch for
matchWindowSize, shows the emulated window and blurs the list under its top bar.
Changed:
-
With the default config, a
FoldDivisionScopeon an Android foldable in a debug build now emulates the iPhone Duo window. Setdeviceto null (copyWith(clearDevice: true)) for the 0.1.0 behaviour: the real window with the division on the hinge. -
The hinge angle decides the posture whenever the sensor has given one. The state Android attaches to the fold is used only with no angle. In 0.1.0 that state came first.
Fixed:
-
The emulated window is composited into a buffer of its own size, so a
BackdropFilterat its edge no longer blurs the black around the window into the app. -
An open device whose fold Android does not list (a foldable emulator at 180 degrees) is rendered as the inner display, and a fold listed as flat at 90 degrees reads
partiallyOpen. -
Display feature bounds are read as logical pixels, which is what the engine reports. They were divided by the device pixel ratio a second time, which put the division at a fraction of the real fold position on a device.
0.1.0 #
First release.
- Android implementation of the
foldableplatform interface.Foldable,FoldableProvider,DuoMediaQueryandFoldAwareBuilderreport the fold of an Android foldable. - Division mode:
FoldDivision.configturns the Android hinge into an iPhone Duo style division, 40 logical pixels across by default, with a choice between following the posture and staying active on a flat device. FoldDivisionScope, aFoldableProviderwith division mode and the overlay wired in.FoldDivisionOverlay, a debug overlay that draws the division rect and its keep-clear margins.FoldDivision.divisionOf,marginsOfandkeepClearRectOffor reading the division and its margins from aBuildContext.- Android plugin that reads the hinge angle from
Sensor.TYPE_HINGE_ANGLE(API 30 and later), with no dependencies. - Exports everything in
package:foldable/foldable.dart. - Supports Flutter 3.24 and later.
Not yet checked on a real foldable or on an emulator foldable profile.
