搜尋套件、儲存庫與 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開發者
  • 重視跨裝置測試的團隊
  • 初學者學習響應式設計
  • 遠端開發工作流程
  • 針對多種裝置類型的應用程式

使用建議

  • 不模擬實際硬體行為
  • 僅限視覺預覽,無法進行完整功能測試
  • 無執行時效能指標
  • 佈局變更需要手動重新整理
  • 不是物理設備測試的替代品

原始 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。