flutter_device_preview icon indicating copy to clipboard operation
flutter_device_preview copied to clipboard

Device Preview as a target platform

Open aloisdeniel opened this issue 3 years ago • 2 comments

I'm currently thinking about defining Device Preview as a target platform instead of an embedded widget. This would basically launch the app as an inner view.

Concept

image

Instead of compiling the application as a macOS (or Windows), it would launch it as an embedded view in a macOS Device Preview application.

Ideally, this Device Preview shell app would be developed with Flutter to make it cross platform!

Advantages

No configuration needed for users, just choosing Device Preview as a target platform.

This would also simplify a lot of device preview implementation by implementing the platform elements instead of relying only on MediaQuery.

It would also allow simulating system events, and even overriding plugins to create simulations (push, ...).

The problem

I have absolutely no idea how to achieve that. I know that I would have to create a fork of Flutter engine and tweak the default macos/windows targets to embed the application.

aloisdeniel avatar Mar 11 '21 19:03 aloisdeniel

There is this bug https://github.com/flutter/flutter/issues/65067 talking about custom devices. That could also help your idea.

xvrh avatar Mar 12 '21 08:03 xvrh

Not quiet this, but I recently did a different entry point and wrote some plugins which I can use to load in pages on the fly with mocks. Might potentially be nice to add some docs as making another entry point for simulation and calling via -d lib\main_simulate.dart for example is a good quick win for some teams.

SKLn-Rad avatar Jun 08 '21 16:06 SKLn-Rad