분류, 패키지 및 저장소 검색

패키지 상세v0.3.4

simulator

Flutter용(단순한) 기기 시뮬레이터. 다중 플랫폼 UI 개발을 쉽게 만듭니다

30일 다운로드
180
좋아요
31
Pub 점수
60

패키지 설치

flutter pub add simulator

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

시뮬레이터는 기본적인 기기 시뮬레이션을 넘어서 Flutter용으로 유연하게 사용할 수 있는 도구로, 개발자가 다중 플랫폼 사용자 인터페이스를 쉽게 테스트하고 미리 보는 데 도움을 줍니다. 다양한 기기와 화면 크기에서 앱이 어떻게 보이는지 직관적으로 시각화할 수 있도록 해주며, UI 개발 과정을 간소화합니다. 화면 캡처 및 스크린샷 기능을 지원함으로써 디자인과 테스트 워크플로우를 강화합니다. 물리적 기기를 필요로 하지 않고도 플랫폼 간 일관된 경험을 보장하기 위해 원활한 통합을 설계했습니다.

사용 사례

  • 반응형 레이아웃 테스트
  • 여러 기기에서 앱 외관 미리 보기
  • 문서용 스크린샷 캡처
  • 다중 플랫폼 UI 일관성 검증
  • UI 디자인 검토 간소화
  • 개발 주기 가속화

주요 기능

  • 다중 기기 시뮬레이션
  • 실시간 화면 미리보기
  • 내장 스크린샷 캡처
  • 크로스 플랫폼 UI 검증
  • Flutter 프로젝트에의 간편한 통합
  • 다른 화면 밀도 지원

적합한 대상

  • 반응형 UI를 구축하는 Flutter 개발자
  • 일관된 크로스플랫폼 디자인에 집중하는 팀
  • 디자이너와 개발자들이 협력하는 방식
  • 자주 UI 테스트가 필요한 프로젝트

고려 사항

  • 물리적 장치 테스트를 대체하지 않습니다
  • UI 시뮬레이션에 국한되며, 전체 앱 동작은 아님
  • 고급 기능을 사용하려면 추가 설정이 필요할 수 있습니다
  • 생산 배포를 위한 것이 아님

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

simulator

Pub Publisher Pub Version

Warning: This is a work in progress and may contain bugs. Use at your own risk.

A device simulator for Flutter. Run your app on the desktop, and simulate a device of your choice. Perfect for rapid development of multi-platform user interfaces.

Image 1     Image 2

Why?

In my experience, developing a multi-platform app is a pain. You have to constantly switch between devices to see how your app looks and behaves. This is especially true for mobile gestures and keyboard input. This package aims to solve this problem by providing a way to simulate a device on the desktop. It's not perfect, but it's a start. I personally find that I'm much more productive when using this package.

Another benefit is that building and hot-refreshing the app is much faster on the desktop. This is especially true for complex UIs.

However, this package is not a replacement for testing on real devices. It's just a tool to make development easier.

Features

  • Simulate your app on a bunch of Android and iOS devices (list below).
  • Pixel-perfect screenshotting of the simulated device. Great for creating marketing images.
  • Simulate the device keyboard.
  • Synthesize mobile gestures (tap, drag, pinch, etc.) with a mouse.
  • Quickly enable various Flutter debug flags.
  • Complete MediaQuery and system locale control.
  • Ability to add custom modules.

In progress:

  • Device rotations (works, but is buggy).
  • Video recording of the simulated device.
  • Make it easier to intercept system calls.
  • Improve the locale module.

Supported devices

  • iPhone 15
  • iPhone 15 Plus
  • iPhone 15 Pro
  • iPhone 15 Pro Max
  • iPhone SE (gen 3)
  • Pixel phones (from 2 to 7, with a and XL variants)

Usage

  1. Add the package to your pubspec.yaml:
dependencies:
  simulator: ^0.3.2

Note: this package only works in Debug mode. The entire code of the package should be tree-shaken away in Release mode.

  1. Create an entrypoint for the simulator. It should be a separate file from your main entrypoint. For example, main.simulator.dart:
import 'package:simulator/simulator.dart';

void main() {
  runSimulatorApp(MyApp());
}

Note: if you have code that uses FlutterWidgetsBinding.ensureInitialized(), you should replace it with SimulatorFlutterWidgetsBinding.ensureInitialized(). This makes sure that the simulator initializes its bindings.

Now you can run the simulator with flutter run -t lib/main.simulator.dart. Make sure that the simulator is ran for the desktop platform.

macOS

The minimum macOS deployment target is 10.15.0.

See https://github.com/macosui/macos_window_utils.dart?tab=readme-ov-file#getting-started for more information on how to change the minimum deployment target.

Built-in modules

Screenshot module

Allows you to take a screenshot of the simulated device (or just the app). By default, the screenshots are saved to the temporary directory.

Screenshot module

Device module

Allows you to pick a device to simulate. The device is picked from a list of supported devices.

Device module

Keyboard module

Allows you to simulate the device keyboard. When the system call to show the keyboard is intercepted, the keyboard is shown in the simulator instead. You can choose between no keyboard, an iOS or an Android keyboard (or auto-detect based on the platform).

Keyboard module

Gestures module

Allows you to simulate mobile gestures with a mouse. The main feature is the conversion of mouse events to touch gestures in the simulator view. You can also simulate a zoom gesture by enabling it and holding the Ctrl key.

Gestures module

VM module

Shows the heap usage for all of the isolates in the VM. It also allows you to fire the memory pressure event (didHaveMemoryPressure()).

VM module

Debug module

Allows you to enable various Flutter debug flags. You can enable the performance overlay, the debug banner, the repaint rainbow, and the slow animations.

Additionally, includes some custom debugging flags:

  • Pointer area highlight - highlights and shows the size of the pointer area of GestureDetector widgets when hovered.

  • Visualize view paddings - shows the view paddings and insets applied to the app.

Debug module

Locale module

Allows you to control the system locale. This is work-in-progress and will be improved.

Locale module

MediaQuery module

Allows you to set the MediaQuery properties for the app. This is transparent to the app and appears like host device properties.

MediaQuery module

Custom modules

More documentation soon. If curious, check the lib/src/modules directory.

Contacts

For any questions, feel free to contact me at:

  • kk.erzhan@gmail.com

카테고리

의존성

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.