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

media_query_preview 표지
패키지 상세v0.1.0

media_query_preview

이 패키지는 사용자 정의 기기, 밝기 및 텍스트 크기를 지원하여 다양한 기기와 조건에서 UI 미리보기를 가능하게 합니다. 개발용이며, 생산 환경에는 적합하지 않습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
14
좋아요
3
Pub 점수
140

패키지 설치

flutter pub add media_query_preview

패키지 개요

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

MediaQueryPreview는 다양한 기기, 화면 크기, 밝기 수준 및 텍스트 확대 비율에서 실시간 UI 미리보기를 가능하게 하는 개발 도구입니다. 실제 장치에 배포하지 않고도 앱이 다양한 구성에서 어떻게 보일지 시각적으로 확인할 수 있도록 도와줍니다. 이 패키지는 사용자 정의 기기 정의를 지원하며, 생산 환경이 아닌 개발 워크플로우 전용으로 설계되었습니다. Flutter의 MediaQuery와 원활하게 통합되어 디자인 및 테스트 단계에서 빠른 반복을 가능하게 합니다.

사용 사례

  • 반응형 레이아웃 테스트
  • 다른 장치 화면 시뮬레이션
  • 접근성 설정 조정
  • 다양한 조건 하에서 UI 동작 검증
  • UI 개발 워크플로우 간소화

주요 기능

  • 사용자 정의 장치 구성 지원
  • 화면 크기 변경 실시간 미리보기
  • 조절 가능한 밝기 및 텍스트 크기
  • 크로스 플랫폼 호환성
  • 기존 플러터 프로젝트와의 간편한 통합

적합한 대상

  • 디자인 단계의 플러터 개발자
  • 반응형 UI에 집중하는 팀
  • 접근성 테스트
  • 빠른 프로토타이핑

고려 사항

  • 생산 사용을 위한 것이 아님
  • 사용자 정의 장치를 위해 수동 설정이 필요합니다
  • 개발 환경에 한정
  • 강한 사용 시 성능에 영향을 미칠 수 있습니다
  • 실기기 테스트를 대체하지 않습니다

원본 README

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

pub package GitHub deployments

Have you ever experienced your UI breaking when the font size is too large or the screen size of the device is small? Checking for these issues can be a hassle.

This package allows you to preview how your implemented UI will appear on various devices with different screen sizes, text scales, and brightness.

It was inspired by device_preview.

Media Query Preview

Features

This package provides the following features:

  • Preview your UI on various devices with different screen sizes, text scales, and brightness.
  • In addition to pre-defined devices like PreviewDevice.iPhone5_5inch and PreviewDevice.android6_7inch, you can create custom PreviewDevice instances.
  • Preview your UI when the keyboard is displayed.
  • Manipulate each preview individually.
  • Friendly with riverpod.

Demo

Check out the demo at https://kingu-dev.github.io/media_query_preview.

Usage

If you are using riverpod, you can do the following.

// Initialize Provider
final container = ProviderContainer();

final previewDevices = [
  [
    PreviewDevice.iPhone5_5inch(
      textScaleFactor: 0.5,
    ),
    PreviewDevice.iPhone5_5inch(),
    PreviewDevice.iPhone5_5inch(
      brightness: Brightness.dark,
    ),
    PreviewDevice.iPhone5_5inch(
      textScaleFactor: 1.5,
    ),
  ],
  [
    PreviewDevice.iPhone6_7inch(
      textScaleFactor: 0.5,
    ),
    PreviewDevice.iPhone6_7inch(),
    PreviewDevice.iPhone6_7inch(
      brightness: Brightness.dark,
    ),
    PreviewDevice.iPhone6_7inch(
      textScaleFactor: 1.5,
    ),
  ],
  [
    PreviewDevice.android6_7inch(
      textScaleFactor: 0.5,
    ),
    PreviewDevice.android6_7inch(),
    PreviewDevice.android6_7inch(
      brightness: Brightness.dark,
    ),
    PreviewDevice.android6_7inch(
      textScaleFactor: 1.5,
    ),
  ]
];

runApp(
  MediaQueryPreview(
    previewDevices: previewDevices,
    builder: (_, previewDevice) {
      // If you want to change the theme based on the targetPlatform,
      // you can get the targetPlatform from [previewDevice.targetPlatform].
      return UncontrolledProviderScope(
        container: container,
        child: const MyApp(),
      );
    },
  ),
);

If you are not using riverpod, it is even simpler.

runApp(
  MediaQueryPreview(
    previewDevices: previewDevices,
    builder: (_, previewDevice) {
      // If you want to change the theme based on the targetPlatform,
      // you can get the targetPlatform from [previewDevice.targetPlatform].
      return const MyApp();
    },
  ),
);

Attention

  • It is recommended to use this package only development. Please do not use it in production.
  • This package allows you to display multiple instances of the Widget you implemented at the same time, which may lead to poor performance or issues with state management.
  • If you manage GlobalKey with global variables, they will be shared across each preview, which can lead to errors or unintended behavior. Since the widget trees of each preview are independent, it is recommended to generate a separate GlobalKey for each tree.

Future

If you have Apple Vision Pro, you can use it as a "Designed for iPad" app. This is the future!

Vision Pro

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

아직 데이터가 없습니다.