패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.9.9

device_preview_plus

다른 기기에서 Flutter 앱의 모양과 성능을 추정합니다

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.4만
좋아요
75
Pub 점수
150

패키지 설치

flutter pub add device_preview_plus

패키지 개요

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

Device Preview Plus는 개발자가 Flutter 앱이 다양한 디바이스에서 어떻게 보이고 동작하는지 개발 환경 내에서 직접 시뮬레이션할 수 있도록 해줍니다. 화면 크기, 방향 및 플랫폼별 UI 동작을 포함한 정확한 기기별 렌더링을 제공합니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 크로스플랫폼 테스트에 이상적입니다. 실시간 미리보기 조정과 사용자 정의 가능한 기기 프로파일을 통해 물리적 기기를 필요로 하지 않고도 UI 검증을 간소화합니다.

사용 사례

  • 기기 간 반응형 레이아웃 테스트
  • 다양한 화면 크기에서 UI 일관성 검증
  • 개발 중에 장치 고유의 동작을 시뮬레이션하는 것
  • 장치 프로필 간 빠르게 전환
  • 다른 운영 체제에서 앱의 외관 미리 보기

주요 기능

  • 실시간 장치 시뮬레이션
  • 모든 주요 플랫폼 지원
  • 사용자 지정 가능한 장치 프로필
  • 방향 및 스케일 조정
  • Flutter 개발 도구와의 통합
  • 크로스 플랫폼 UI 테스트

적합한 대상

  • 크로스 플랫폼 앱을 구축하는 Flutter 개발자
  • 빠른 UI 검증이 필요한 팀
  • 디자이너와 개발자들이 협력하는 방식
  • 일관된 기기 미리보기가 필요한 프로젝트

고려 사항

  • 대규모 프로젝트에서 성능에 영향을 줄 수 있습니다
  • 사용자 정의 장치에 대한 수동 구성이 필요합니다
  • 시각적 시뮬레이션에 국한됨(완전한 런타임 테스트는 아님)
  • 물리적 장치 테스트의 대체가 아님
  • 개발 중에 가장 잘 사용되며, 프로덕션에서는 사용하지 마십시오.

원본 README

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

Device Preview for Flutter

pub package docs MIT License GitHub Actions Codacy Badge style: flutter_lints

Github-sponsors BuyMeACoffee Ko-Fi LiberaPay Patreon PayPal

This is a fork of device_preview to keep it up to date with newer Flutter versions.

For users migrating from the device_preview package the only changes required are changing your pubspec.yaml file to point to device_preview_plus and changing any import statements to point to the updated package:device_preview_plus\device_preview_plus.dart.

Device Preview for Flutter

Approximate how your app looks and performs on another device. Main features:

  • Preview any device from any device
  • Change the device orientation
  • Dynamic system configuration (language, dark mode, text scaling factor, ...)
  • Freeform device with adjustable resolution and safe areas
  • Keep the application state
  • Plugin system (Screenshot, File explorer, ...)
  • Customizable plugins

Getting Started

Add this to your project's pubspec.yaml file:

dependencies:
  device_preview_plus: ^2.9.4

Usage

Wrap your app's root widget in a DevicePreview and make sure to :

  • Set your app's useInheritedMediaQuery to true.
  • Set your app's builder to DevicePreview.appBuilder.
  • Set your app's locale to DevicePreview.locale(context).

Make sure to override the previous properties as described. If not defined, MediaQuery won't be simulated for the selected device.

import 'package:device_preview_plus/device_preview_plus.dart';

void main() => runApp(
  DevicePreview(
    enabled: !kReleaseMode,
    builder: (context) => MyApp(), // Wrap your app
  ),
);

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      useInheritedMediaQuery: true,
      locale: DevicePreview.locale(context),
      builder: DevicePreview.appBuilder,
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      home: const HomePage(),
    );
  }
}

Demo

Open the demo

Limitations

Think of Device Preview as a first-order approximation of how your app looks and feels on a mobile device. With Device Mode you don't actually run your code on a mobile device. You simulate the mobile user experience from your laptop, desktop or tablet.

There are some aspects of mobile devices that Device Preview will never be able to simulate. When in doubt, your best bet is to actually run your app on a real device.

카테고리

의존성

의존성 목록 7 개

소스 저장소

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