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

flutter_device_emulator 封面
插件详情v0.0.3

flutter_device_emulator

实时预览您的 Flutter 小部件在多个设备屏幕上的显示效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
45
喜欢数
0
Pub 分数
150

安装插件

flutter pub add flutter_device_emulator

插件介绍

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

Flutter 设备模拟器是一款工具,可让开发者实时预览其 Flutter 小部件在各种设备屏幕尺寸和方向上的显示效果。它支持包括 Android、iOS、Web、macOS、Windows 和 Linux 在内的多个平台,能够在无需物理设备的情况下实现一致的 UI 测试。该软件包可无缝集成到开发工作流程中,在设计迭代过程中提供即时视觉反馈。它特别有助于确保响应式布局和跨平台兼容性。

适合场景

  • 实时小部件预览
  • 跨平台 UI 测试
  • 响应式设计验证
  • 快速原型设计
  • 设计一致性检查
  • 屏幕尺寸模拟

主要特点

  • 实时设备预览
  • 多个设备模板
  • 支持所有主要平台
  • 实时布局更新
  • 与 Flutter 的轻松集成
  • 方向切换

适合对象

  • UI/UX 设计师
  • Flutter 开发者
  • 跨平台应用测试人员
  • 原型开发团队
  • 前端工程师

使用建议

  • 某些功能需要手动设置
  • 仅限视觉预览(无运行时交互)
  • 可能会影响低端机器的性能
  • 不是物理设备测试的替代品
  • 无内置主题或区域设置模拟

原始 README

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

flutter_device_emulator

Pub Version License: MIT

A Flutter package to emulate different device screens and layouts, making it easier to preview and test your app on various device types and resolutions directly within your Flutter app or development environment.

flutter_device_emulator demo

Features

  • Emulate multiple device screen sizes and resolutions
  • Switch between device types (phone, tablet, etc.)
  • Preview your app in different orientations
  • Easy integration with your existing Flutter project
  • Customizable device frames and backgrounds

Installation

Add the following to your pubspec.yaml:

dependencies:
  flutter_device_emulator: latest_version

Then run:

flutter pub get

Usage

Import the package and wrap your app or widget with the emulator:

import 'package:flutter_device_emulator/flutter_device_emulator.dart';

DeviceEmulator(
  builder: (context) => SafeArea(child: HomePage()),
)
Example

See the example/ directory for a complete sample app demonstrating usage and available features.

API Reference

DeviceEmulator

The main widget to wrap your app for device emulation. Provides controls for device type, orientation, theme, and text direction.

Constructor:

DeviceEmulator({
  required WidgetBuilder builder,
  bool enableThemeToggle = true,
  bool enableOrientationToggle = true,
  bool enableLanguageToggle = true,
  Key? key,
})

Parameters:

  • builder (required): A function that builds the widget tree to be emulated inside the device frame.
  • enableThemeToggle (default: true): If true, shows a button to toggle between light and dark themes.
  • enableOrientationToggle (default: true): If true, shows a button to toggle between portrait and landscape orientations.
  • enableLanguageToggle (default: true): If true, shows a button to toggle between left-to-right and right-to-left text directions.
  • key: Optional widget key.

Features:

  • Device selector: Choose from a list of common devices to emulate.
  • Theme toggle: Switch between light and dark modes.
  • Orientation toggle: Switch between portrait and landscape.
  • Text direction toggle: Switch between LTR and RTL layouts.
  • Screenshot: Capture the current emulated screen (web only).

Example:

DeviceEmulator(
  builder: (context) => SafeArea(child: HomePage()),
)

For detailed API documentation, see the source code in lib/.

Contributing

Contributions are welcome! Please open issues or submit pull requests for bug fixes, features, or improvements.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a pull request

License

This project is licensed under the MIT License.

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。