device_simulator icon indicating copy to clipboard operation
device_simulator copied to clipboard

Working on changes

Open avioli opened this issue 4 years ago • 0 comments

Hi Viktor,

Thank you for the great plugin.

I've forked and started working on some changes I needed, but will be happy to contribute back once finished and if you are interested in pulling:

  • Silently disable the device simulator, when the screen width/height is considered small;
DeviceSimulator(
  silentlyDisableOnSmallDevices: true,
  ...
);
  • Support predetermined initial platform;
DeviceSimulator(
  initialPlatform: TargetPlatform.android,
  ...
);
  • Move all specs to the DeviceSpecification class and export it;
DeviceSpecification.iosSpecs = [
  DeviceSpecification.iPhoneSE,
  DeviceSpecification.iPhone8,
  DeviceSpecification.iPhone8Plus,
  DeviceSpecification.iPhoneX,
  DeviceSpecification.iPhoneXsMax,
  DeviceSpecification.iPadAir,
  DeviceSpecification.iPadPro10,
  DeviceSpecification.iPadPro11,
  DeviceSpecification.iPadPro12,
  DeviceSpecification.iPadPro12_3Gen,
];
DeviceSpecification.androidSpecs = [
  DeviceSpecification.androidOne,
  DeviceSpecification.nexus5,
  DeviceSpecification.motorolaG7,
  DeviceSpecification.galaxyS8,
  DeviceSpecification.nexus4,
  DeviceSpecification.nexus6,
  DeviceSpecification.pixel3,
  DeviceSpecification.pixel3XL,
  DeviceSpecification.galaxyNote4,
  DeviceSpecification.xperiaC4,
  DeviceSpecification.nexus7,
  DeviceSpecification.nexus9,
  DeviceSpecification.nexus10,
];
  • Support predetermined list of supported specifications;
DeviceSimulator(
  specs: [DeviceSpecification.androidOne, DeviceSpecification.iPhoneSE],
  ...
);
  • Support hiding the screenshot button;
DeviceSimulator(
  enableScreenshots: false,
  ...
);
  • Experiment wrapping the whole Material/Cupertino App with the DeviceSimulator;
// currently working:
DeviceSimulator(
  child: MaterialApp(...),
  ...
);
// but thinking of achieving:
void main() {
  DeviceSimulator.runApp(MyApp(), specs: [DeviceSpecification.androidOne, DeviceSpecification.iPhoneSE]);
}
  • Hide the platform buttons if the predetermined list doesn't include any devices for the platform;
  • Absorb pointer events in the status bar and multitask/nav bars;
  • Use "fake corners" for web rendering, since using ClipRRect within another is currently broken;

I'm open to discussion.

avioli avatar Aug 14 '20 07:08 avioli