搜尋套件、儲存庫與 APP 分類

responsive_ui 封面
套件詳情v3.0.1

responsive_ui

responsive ui Flutter 套件可協助您建立響應式與巢狀響應式組件。適用於 Android、iOS 與 Web,支援直向與橫向模式。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
481
喜歡數
104
Pub 分數
160

安裝套件

flutter pub add responsive_ui

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

responsive_ui 套件簡化了在 Flutter 中跨多個平台和螢幕方向建立適應性佈局的過程。它讓開發者能夠建立可響應且可嵌套的響應式組件,這些組件能自動調整至不同裝置尺寸,包含 Android、iOS、Web、macOS、Windows 與 Linux。該套件內建支援直向與橫向模式,確保無需手動處理媒體查詢即可實現一致的使用者介面體驗。此套件非常適合需要彈性、可擴展設計的應用程式。

適用情境

  • 跨平台移動和網頁應用
  • 自適應版面適用於平板電腦和桌面裝置
  • 嵌套的響應式組件
  • 根據螢幕尺寸動態調整使用者介面
  • 支援多種方向的應用程式
  • 響應式儀表板

主要特色

  • 支援所有主要平台
  • 自動方向適應
  • 嵌套的響應式小部件結構
  • 簡化響應式設計邏輯
  • 與媒體查詢相容
  • 跨裝置的一致性使用者介面

適合對象

  • 開發跨平台應用的開發者
  • 需要響應式佈局但不需要複雜代碼的團隊
  • 針對多種螢幕尺寸的專案
  • UI密集型應用
  • 需要可擴展性的設計系統

使用建議

  • 可能需要學習新的小部件模式
  • 超出內建響應式邏輯的自訂功能有限
  • 深度嵌套結構可能帶來的效能影響
  • 未針對高度動態的執行時間佈局變更進行優化
  • 最適合靜態或可預測的響應式需求

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Responsive UI

Pub

responsive_ui package helps you to create a responsive widget and Nested responsive widgets. Works on all Platforms.

Getting Started

Live demo : https://bharathraj-e.github.io/responsive_ui/ Have a look!

It works as same as Bootstrap / Materialize Row Column method, Splitting screen into 12 columns and placing widget by combining column based on screen size.

    Responsive(
        children: <Widget>[
            Div(
                division:Division(
                    colS: 5,
                    offsetL: 2,
                ),
                child: Card(child: Icon(Icons.game))
            ),
            Div(
                division:Division(
                    colS: 12,
                    colM: 6,
                    colL: 4,
                ),  
                child: Text('responsive ui')
            )          
        ]
    )

Widgets

The Responsive UI Package contains two simple widgets.

  1. Div()
  2. Responsive()

1. Div()

Arguments inputs if null / default to
child Widget required
division Division if null defaluts to Division()

Divison() intakes column sizes and offSets.

Arguments inputs if null / default to
colXS (int) 0-12 12
colS (int) 0-12 colXS value
colM (int) 0-12 ColS value
colL (int) 0-12 ColM value
colXL (int) 0-12 ColL value
offsetXS (int) 0-12 0
offsetS (int) 0-12 0
offsetM (int) 0-12 0
offsetL (int) 0-12 0
offsetXL (int) 0-12 0
(XS = Extra Small, S = small, M = medium, L = large, XL = Extra Large)
  • 0 - 0.0 width (gone) (replaced with SizedBox.shrink())

  • 12 - full width (provided by parent widget not screen width)

  • Parent widget should not be a horizontal scroll type widget

  • To offset, simply add offsetS / offsetM / offsetL to the Div() widget with colS / colM / colL respectively.

  • Offset works for their respective column sizes.

2. Responsive()

Responsive intakes List<Widget> or List<Div> with default column/screen size for each widget can be declared.

Arguments inputs if null / default
children List / List
not null / required / empty[]
alignment WrapAlignment WrapAlignment.start
runAlignment WrapAlignment WrapAlignment.start
crossAxisAlignment WrapCrossAlignment WrapCrossAlignment.start
runSpacing double 0.0

Note

  • Responsive widget is a Wrap widget.

  • Responsive & Div() widget need Finite width to work.

  • Div() works with vertical scroll not in horizontal scroll, as it calculations are base on width only.

  • Div() works as expected when it placed as a direct child of Responsive() widget's children.

  • Sum of the offset and the respective col should be <= to 12

Nested Responsive

Place a Responsive() widget into a Div().

The nested Responsive() widget takes the width provided by parent Div() widget and not the screen width

sample

Screen Types

Type Default Size
Xtra small < 375.0
Small 375.0 - 596.0
Medium 596.0 - 897.0
Large 897.0 - 1232.0
Xtra Large >1232.0

Override / Set your default size

Yes, now you can set your own breakpoints, that applies to all the Responsive & Div widgets.

void main() {
  // sample 1
  Responsive.setGlobalBreakPoints(400.0, 600.0, 997.0, 1380.0);
  // Sample 2 
  Responsive.setGlobalBreakPoints(0, 596.0, 897.0, 1232.0);
  // Since the first value is 0 : colXS is always neglected
  runApp(const MyApp());
}

responsive_ui is made simply using Wrap() and LayoutBuilder() with a bits of logics.



Buy Me A Coffee

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。