パッケージ、リポジトリ、アプリカテゴリを検索

simple_grid のカバー
パッケージ詳細v0.1.5

simple_grid

Bootstrap を参考にしたダイナミックグリッドで、グリッドレイアウトを記述するために使用できます。このパッケージはMediaQueryのみを使用しており、レンダリングについて心配する必要はありません。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
955
いいね数
79
Pub ポイント
160

パッケージをインストール

flutter pub add simple_grid

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Simple Grid は、Flutter向けのレスポンシブグリッドレイアウトパッケージであり、Bootstrapからインスピレーションを得ています。MediaQueryを使用して、柔軟でダイナミックなグリッドシステムを定義できるようにし、さまざまな画面サイズやプラットフォーム間でレイアウトがスムーズに適応されるようにしています。このパッケージは複雑な計算を抽象化することで、手動レンダリングの心配なく直感的なグリッド定義を可能にし、モバイル、Web、デスクトップアプリにおいて一貫性があり拡張可能なインターフェースの構築に最適です。

用途

  • 応答性のあるダッシュボードの構築
  • アダプティブカードレイアウトの作成
  • マルチカラムフォームの設計
  • クロスプラットフォームUIの開発
  • フローティングコンテンツグリッドの実装

主な機能

  • MediaQuery を活用した応答性
  • Bootstrap を参考にした構文
  • 手動レンダリングは不要です
  • クロスプラットフォーム対応
  • シンプルな宣言型グリッド定義

適している対象

  • 初心者のFlutter開発者
  • レスポンシブUIデザイナー
  • クロスプラットフォームアプリ作成者
  • ラピッドプロトタイピングチーム
  • レイアウトに焦点を当てたプロジェクト

注意事項

  • グリッド構造を超えるカスタマイズは限られている
  • MediaQueryの正確さに依存
  • 非常に複雑なレイアウトには適していません
  • 高度なデザインには追加のスタイリングが必要になる場合があります
  • 標準グリッドパターンに最適

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Indonesian documentation is here

Introduction

pub package build

Inspired by bootstrap , This is dynamic grid layout that you can use Like a bootstrap grid, but the size following material UI break points. You can also customize your break point like here. This package purely using mediaquery, don't worry about the render.

Simple Demo

code example here

Order Demo

code example here

Grid Explanation

Bootstrap, material-ui or another web-grid always use 12 size. Here is the image example:

Classes

There are 4 classes that you have to now, these are:

  1. SpGrid is the container of grid, more information here
  2. SpGridItem is the children of SpGrid, more information here
  3. SpGridSize is the class that you can declare the maximum of the screen size, more information here
  4. SpOrder, this class is a sort class. when you use 1 of it's value, the value will create an ordering when the screen on the value condition. more information here

Example

SpGrid(width: MediaQuery.of(context).size.width, children: [
  SpGridItem(
    xs: 12,
    sm: 6,
    md: 4,
    lg: 3,
    child: Container(
      color: Colors.blue,
      height: 200,
    ),
  ),
  SpGridItem(
    xs: 12,
    sm: 6,
    md: 4,
    lg: 3,
    child: Container(
      color: Colors.green,
      height: 200,
    ),
  ),
  SpGridItem(
    xs: 12,
    sm: 6,
    md: 4,
    lg: 3,
    child: Container(
      color: Colors.yellow,
      height: 200,
    ),
  ),
  SpGridItem(
    xs: 12,
    sm: 6,
    md: 4,
    lg: 3,
    child: Container(
      color: Colors.purple,
      height: 200,
    ),
  ),
]);

Order Example

import 'package:flutter/material.dart';
import 'package:simple_grid/simple_grid.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Simple_grid',
      theme: ThemeData(
        brightness: Brightness.dark,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("SIMPLE GRID EXAMPLE"),
      ),
      body: SpGrid(
        width: MediaQuery.of(context).size.width,
        spacing: 10,
        runSpacing: 10,
        children: [
          SpGridItem(
            xs: 12,
            md: 6,
            order: SpOrder(sm: 1, xs: 1),
            child: Container(
              height: 200,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    "Hello!",
                    style: TextStyle(fontSize: 40),
                    textAlign: TextAlign.center,
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  Text(
                    "I'm John Doe and I Love Programming",
                    style: TextStyle(fontSize: 25),
                    textAlign: TextAlign.center,
                  ),
                ],
              ),
            ),
          ),
          SpGridItem(
            xs: 12,
            md: 6,
            order: SpOrder(sm: 0, xs: 0),
            child: Container(
              height: 200,
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: NetworkImage(
                          "https://raw.githubusercontent.com/nggepe/simple_grid/master/doc/john.png"))),
            ),
          ),
        ],
      ),
    );
  }
}

Customize Break Point

SpGrid(
  width: MediaQuery.of(context).size.width,
  gridSize: SpGridSize(xs: 0, sm: 500, md: 768, lg: 980, xl: 1200),
  children:[],
)

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。