搜索插件、代码仓与 APP 分类

插件详情v0.9.6

device_simulator

DeviceSimulator 允许您轻松测试您的 Flutter 应用程序在不同屏幕分辨率和平台上的表现。

近 30 天下载
80
喜欢数
177
Pub 分数
40

安装插件

flutter pub add device_simulator

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

DeviceSimulator 是一个 Flutter 包,使开发者能够在开发环境中直接测试其应用程序在各种屏幕分辨率和平台上的表现。它提供了一个易于使用的界面来模拟不同的设备,有助于确保响应式设计和一致的用户体验。该包支持动态预览调整,无需物理设备或复杂的设置。非常适合在 UI 开发过程中快速迭代,通过模拟真实设备行为来提高测试效率。

适合场景

  • 测试响应式布局
  • 在多个设备上预览应用外观
  • 在不同屏幕尺寸上验证 UI 一致性
  • 快速UI原型设计
  • 跨平台兼容性检查
  • 调试布局问题

主要特点

  • 实时设备模拟
  • 对多种屏幕分辨率的支持
  • 轻松集成到Flutter项目中
  • 动态预览更新
  • 所需配置最少
  • 平台无关设计

适合对象

  • 专注于UI/UX的Flutter开发者
  • 重视跨设备测试的团队
  • 初学者学习响应式设计
  • 远程开发工作流程
  • 面向多种设备类型的 App

使用建议

  • 不模拟实际硬件行为
  • 仅限视觉预览,无法进行完整功能测试
  • 无运行时性能指标
  • 布局更改需要手动刷新
  • 不是物理设备测试的替代品

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

DeviceSimulator

DeviceSimulator allows you to easily test your Flutter app for different screen resolutions and platforms. If you use this package, please consider downloading the Newsvoice app and giving us a five star review. Thanks!

Device Simulator demo

With DeviceSimulator you will be able to get a quick look at what your app would look like on all iOS / iPadOS devices and a selection of common Android devices. In addition, there is a screenshot mode that makes it really easy to take screens in different resolutions for App Store and Google Play.

Getting Started

This project was born out of the frustration of testing apps on multiple devices to make sure that the layout looked good in all resolutions. DeviceSimulator will let you quickly emulate different device types. It works best if you run it on an iPad Pro, but it also works well on the iOS Simulator and smaller tablets.

To learn more about designing for multiple resolutions, check out the Medium article that I wrote on the topic.

Add DeviceSimulator to your widget tree

It's really easy to add DeviceSimulator to your app. Simply add it to the root of your widget tree, right under your App widget. Build the rest of the widget tree as you would normally do. This is a minimal example:

import 'package:flutter/material.dart';
import 'package:device_simulator/device_simulator.dart';

const bool debugEnableDeviceSimulator = true;

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'DeviceSimulator demo',
      home: DeviceSimulator(
        brightness: Brightness.dark,
        enable: debugEnableDeviceSimulator,
        child: Scaffold(
          appBar: AppBar(
            title: Text('DeviceSimulator Demo'),
          ),
          body: Center(
            child: Text('Hello multiple resolutions!'),
          ),
        ),
      ),
    );
  }
}
Known issues & limitations
  • Hero animations may be broken while having the DeviceSimulator enabled. It will not affect the production ready app.
  • It's currently only possible to use the home route of MaterialApp. To get around this limitation, you can place another Navigator as a child to MaterialApp.
Caveats

I built DeviceSimulator for my own needs and it's working great for me, but it's not heavily tested and provided as is. Feedback and pull requests are most welcome.

Enjoy! / Vik

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。