カテゴリー・パッケージ・リポジトリを検索

styled_widget のカバー
パッケージ詳細v0.4.1

styled_widget

メソッドを使用してウィジェットを定義することで、ウィジェットツリー構造を簡素化します。CSS および SwiftUI のインスピレーションから得ています

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2.4万
いいね数
925
Pub ポイント
130

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

flutter pub add styled_widget

パッケージ概要

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

Styled Widget は、CSS および SwiftUI を参考にしたメソッドチェーンを使用してウィジェットを定義することで、ウィジェットツリーの構築を簡素化する Flutter パッケージです。スタイルやレイアウトプロパティをスムーズに適用できるため、よりクリーンで読みやすいコードを実現します。このパッケージはネストを減らし、特に複雑なUIにおいて保守性を向上させます。すべての主要プラットフォームをサポートしており、宣言的で表現力豊かなFlutterインターフェースの構築を目指すチームにとって理想的です。

用途

  • クリーンで読みやすいUIの構築
  • ネストされたウィジェット構造の削減
  • 再利用可能な UI コンポーネントの作成
  • メソッドチェーンによるスタイルの簡素化
  • 迅速なUIプロトタイピング

主な機能

  • ウィジェット構築のためのメソッドチェーン
  • CSSに似たスタイル構文
  • SwiftUI を意識した API デザイン
  • クロスプラットフォーム互換性
  • 最小限のボイラープレート
  • レスポンシブレイアウトのサポート

適している対象

  • 簡潔なUIコードを望む開発者
  • コードの読みやすさを最優先とするチーム
  • 複雑なウィジェット階層を持つプロジェクト
  • フロントエンド中心のFlutter開発
  • 迅速なUIプロトタイピング

注意事項

  • 新規ユーザー向けの学習曲線
  • 深いチェーンによるパフォーマンスのオーバーヘッド
  • 生のウィジェットと比べてカスタマイズの選択肢が限られている
  • 追加のパターンなしでは、非常に動的または状態が重いUIには適していません
  • 他のスタイルライブラリと競合する可能性があります

元の README

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

Simplifying your widget tree structure by defining widgets using methods.

License: MIT

Buy Me A Coffee


Thanks to the introduction of extension methods in Dart 2.7.0, styled_widget makes it possible to build widget tree`s more readable and efficient.

styled_widget is build as a tool to enhance your Flutter development experience and to seamlessly integrate with your codebase.

Showcase
Design, Code Design, Code Design, Code
Basic example

styled_widget has a bottom up approach to building widget`s. This means you start with the inner most element and layer widget`s on top. The following example is structured as follows: Icon -> blue circle -> light blue circle -> card -> background

Icon(OMIcons.home, color: Colors.white)
  .padding(all: 10)
  .decorated(color: Color(0xff7AC1E7), shape: BoxShape.circle)
  .padding(all: 15)
  .decorated(color: Color(0xffE8F2F7), shape: BoxShape.circle)
  .padding(all: 20)
  .card(
    elevation: 10,
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(20),
    ),
  )
  .alignment(Alignment.center)
  .backgroundColor(Color(0xffEBECF1));
Raw Flutter (click to show)
DecoratedBox(
  decoration: BoxDecoration(
    color: Color(0xffEBECF1),
  ),
  child: Align(
    alignment: Alignment.center,
    child: Card(
      elevation: 10,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(20),
      ),
      child: Padding(
        padding: EdgeInsets.all(20),
        child: DecoratedBox(
          decoration: BoxDecoration(
            color: Color(0xffE8F2F7),
            shape: BoxShape.circle,
          ),
          child: Padding(
            padding: EdgeInsets.all(15),
            child: DecoratedBox(
              decoration: BoxDecoration(
                color: Color(0xff7AC1E7),
                shape: BoxShape.circle,
              ),
              child: Padding(
                padding: EdgeInsets.all(10),
                child: Icon(
                  OMIcons.home,
                  color: Colors.white,
                ),
              ),
            ),
          ),
        ),
      ),
    ),
  ),
);
Docs

See the documentation at styled_widget/wiki for more information about using styled_widget!

Quicklinks

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

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