搜尋分類、套件與程式碼儲存庫

套件詳情v1.1.0

design_grid

依照設計師的構想實現設計。可使用經典的響應式設計網格方法,或選擇 Material Design 網版。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
71
喜歡數
36
Pub 分數
160

安裝套件

flutter pub add design_grid

套件介紹

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

Design Grid 是一個 Flutter 套件,幫助開發者精確實現設計師的意圖。它支援傳統的響應式網格佈局以及 Material Design 的佈局系統,為 UI 建構提供彈性。透過直覺的 API,簡化跨平台的對齊、間距與響應式行為。非常適合希望在設計原型與最終應用介面之間維持視覺一致性之團隊。此套件與所有主要的 Flutter 平台相容,確保跨平台的可靠性。

適用情境

  • 從 Figma 或 Sketch 實現像素級精確的設計
  • 為多種螢幕尺寸建構響應式版面
  • 將 Material Design 指南整合到自訂 UI 中
  • 在小部件之間創建一致的間距和對齊
  • 確保多平台應用中的設計保真度

主要特色

  • 支援經典響應式網格
  • 內建的 Material Design 排版支援
  • 跨平台相容性
  • 靈活的間距和對齊工具
  • 與現有 Flutter 項目輕鬆整合

適合對象

  • 與設計師緊密合作的前端開發人員
  • 重視設計準確性的團隊
  • 需要在不同裝置上保持一致 UI 的專案
  • 使用 Material Design 原則的開發者
  • 針對多個平台的應用程式

使用建議

  • 需要了解網格系統
  • 複雜佈局可能需要額外的樣式
  • 最佳搭配設計系統文件使用
  • 不是完整的UI框架——補充現有的組件
  • 超出網格結構的自訂功能有限

原始 README

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

Build Status

Implement designs just like in Figma. Arrange your widgets in a grid and make your designer happy.

Design Grid streamlines your workflow and saves time. Easily configure multiple devices and screen sizes while reducing boilerplate code. Its user-friendly design makes integration effortless, allowing you to focus on your project's core.

The classic use-case of implementing a colum-based design. Use ResponsiveDesignGrid to implement a bootstrap-like design system where every element has a different column-span based on breakpoints.

Need to implement a design based on the strict rules of Material Layout? Use the MaterialDesignGrid to get an exact implementation of the Material Design Layout guide.

🔗 Table of Contents

✨ Features

Responsive Design Grid

Implement a column-based design with different column-spans for every breakpoint. Responsive design grid widgets can be indefinitely nested. Create small and clean widgets that use ResponsiveDesignGrid for layout. They will fit, no matter how deeply nested you use them.

You can customize:

  • Breakpoints
  • Column-spacing
  • Row-spacing
  • Grid-padding
  • Amount of columns

Material Design Grid

Implement a design based on the Material Design guidelines. Material Design Grid is not meant to be used nested.

You can customize:

  • Breakpoints
  • Column-spacing
  • Row-spacing
  • Grid-padding
  • Amount of columns per breakpoint

🎉 Getting started

Decide whether you need to use the ResponsiveDesignGrid or the MaterialDesignGrid. Speak with your designer to build a common understanding.

🏗️ Usage

Responsive Design Grid

ResponsiveDesignGridConfig is required only once in your app, it provides the ResponsiveDesignGridTheme. You can however always add an extra ResponsiveDesignGridTheme widget if you really need to. Beware, that this is not recommended.

You can nest design grids indefinitely. To keep performance high, make sure to nest them directly in a ResponsiveDesignGridItem. If you get any errors, you might have to pass the parameter shouldCalculateLayout: true to the ResponsiveDesignGrid widget. This might happen most likely when the design grid does not get the full width of the app, or if you nested it inside another ResponsiveDesignGridItem and it doesn't get the full width there.

ResponsiveDesignGridRow widget will wrap its children, your rows should have as little children as possible. Avoid large Rows since this will impact performance.

Basic Usage
@override
Widget build(BuildContext context){
    return ResponsiveDesignGridConfig(
        child: ResponsiveDesignGrid(
            children: [
                ResponsiveDesignGridRow(
                    children: [
                        ResponsiveDesignGridItem(
                            columns: ResponsiveDesignGridColumns(
                                small: 12,
                                medium: 10,
                                large: 8,
                                extraLarge: 6,
                            ),
                            child: Placeholder(),
                        ),
                    ],
                )
            ],
        ),
    );
}
Adjusting Breakpoints

To change the default breakpoints values, you can use the breakpoints property in ResponsiveDesignGridConfig constructor which takes an instance of ResponsiveDesignGridBreakpoints class.

@override
Widget build(BuildContext context){
    return ResponsiveDesignGridConfig(
            breakpoints: const ResponsiveDesignGridBreakpoints(
            small: 375,
            medium: 768,
            large: 1280,
            extraLarge: 1920,
        ),
        child: ResponsiveDesignGrid(
            children: [
                ResponsiveDesignGridRow(
                    children: [
                        ResponsiveDesignGridItem(
                            columns: ResponsiveDesignGridColumns(
                                small: 12,
                                medium: 10,
                                large: 8,
                                extraLarge: 6,
                            ),
                            child: Placeholder(),
                        ),
                    ],
                )
            ],
        ),
    );
}
Customizing the grid

To change the amount of columns, the column spacing, the row spacing or the grid padding, you can use the theme property in ResponsiveDesignGridConfig constructor which takes an instance of ResponsiveDesignGridThemeData class.

@override
Widget build(BuildContext context){
    return ResponsiveDesignGridConfig(
        theme: ResponsiveDesignGridThemeData(
            columns: 12,
            columnSpacing: 16.0,
            rowSpacing: 16.0,
            gridPadding:16.0,
        ),
        child: ResponsiveDesignGrid(
            children: [
                ResponsiveDesignGridRow(
                    children: [
                        ResponsiveDesignGridItem(
                            columns: ResponsiveDesignGridColumns(
                                small: 12,
                                medium: 10,
                                large: 8,
                                extraLarge: 6,
                            ),
                            child: Placeholder(),
                        ),
                    ],
                )
            ],
        ),
    );
}
Material Design Grid

MaterialDesignGridTheme is required only once in your app, above the MaterialDesignGrid widget.

MaterialDesignGrid is not meant to be used nested due to material specifications.

MaterialDesignGridRow widget will wrap its children, you should size your rows as small as possible. Avoid large Rows since this will impact performance.

@override
Widget build(BuildContext context) {
    return MaterialDesignGridTheme(
        child: MaterialDesignGrid(
            children: [
                MaterialDesignGridRow(
                    children: [
                        MaterialDesignGridItem(
                            columns: 4,
                            child: Placeholder(),
                        ),
                    ],
                )
            ],
        ),
    );
}

📚 Additional information

All classes and exposed properties are well documented. If you find the documentation to be lacking, please create an issue 😊

Implementing a custom design grid approach

The base widgets used for both the ResponsiveDesignGrid as well as the MaterialDesignGrid can be found in lib/src/widgets. You can extend those to create your super-fancy very own custom design grid implementation 🥳.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。