Flutter Ui Design logo

Flutter Ui Design

CommunityPopular
K9i-0
flutter-ui-design

Flutter UI実装のアーキテクチャ規約・コンポーネント分割・状態管理ガイド(Bloc/Cubit版)

Overview

PublisherK9i-0
Repositoryccpocket
Skill nameflutter-ui-design
Stars
1.1K
Forks
115
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by K9i-0 on GitHub. Read the source before you install it.

Installation

Install the Flutter Ui Design AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/K9i-0/ccpocket/tree/main/.claude/skills/flutter-ui-design
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/K9i-0/ccpocket.git /tmp/ccpocket
mkdir -p .claude/skills
cp -r /tmp/ccpocket/.claude/skills/flutter-ui-design .claude/skills/flutter-ui-design
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Flutter Ui Design in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Flutter Ui Design on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Flutter Ui Design is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Flutter UI 実装規約

アーキテクチャ概要

SSOT (Single Source of Truth) + UDF (Unidirectional Data Flow) に基づく設計。

データフローパターン

  • Path A (Query): Cubit/Bloc → Widget (BlocBuilder/BlocListener)
    • サーバー状態、永続化データ、共有状態
    • BlocProvider を通じて単方向に流れる
  • Path B (Command): Widget → Cubit method → State emit
    • ユーザーアクション、API呼び出し
    • Cubit のメソッド経由で状態を変更
  • Path C (Local): StatefulWidget / useState
    • テキスト入力、スクロール位置、展開状態等の一時的UI状態

Widget 分割ルール

禁止パターン

dart
// NG: プライベートメソッドでのWidget分割
class MyScreen extends StatefulWidget {
  Widget _buildHeader() { ... }
  Widget _buildBody() { ... }
  Widget _buildFooter() { ... }
}

推奨パターン

dart
// OK: 独立したWidgetクラスに分割
class MyScreenHeader extends StatelessWidget { ... }
class MyScreenBody extends StatelessWidget { ... }
class MyScreenFooter extends StatelessWidget { ... }

分割の判断基準

  • 20行以上のbuildメソッド内ブロック → 独立Widgetに
  • 独自のCubitを持つ → 独立Widget + BlocProvider
  • BlocBuilder を含む → 独立Widget
  • 表示のみ → StatelessWidget

状態管理

Cubit パターン

dart
class ChatSessionCubit extends Cubit<ChatSessionState> {
  ChatSessionCubit() : super(const ChatSessionState());

  void sendMessage(String text) {
    // Command (Path B)
    emit(state.copyWith(/* ... */));
  }
}

BridgeCubit パターン(Stream購読)

dart
class ConnectionCubit extends BridgeCubit<BridgeConnectionState> {
  ConnectionCubit(super.initialState, super.stream);
}

Freezed State

dart
@freezed
class ChatSessionState with _$ChatSessionState {
  const factory ChatSessionState({
    @Default([]) List<ChatEntry> entries,
    @Default(SessionStatus.idle) SessionStatus status,
  }) = _ChatSessionState;
}
  • 全ての状態クラスは Freezed で定義
  • sealed union で排他的状態を表現
  • @Default で初期値を明示

ファイル構成

feature-first 構造

lib/features/<feature>/
├── <feature>_screen.dart           # 画面Widget
├── state/
│   ├── <feature>_state.dart        # Freezed state classes
│   ├── <feature>_cubit.dart        # Cubit
│   └── <feature>_state.freezed.dart # 生成ファイル
└── widgets/
    ├── <component_a>.dart          # 独立Widget
    └── <component_b>.dart

命名規約

種別命名例
画面*_screen.dartchat_screen.dart
状態*_state.dartchat_session_state.dart
Cubit*_cubit.dartchat_session_cubit.dart
Widget機能を表す名前chat_app_bar.dart

ValueKey 命名規約(MCP自動テスト対応)

UI要素にはValueKeyを付与し、Marionette MCPでの自動テストを可能にする。

命名パターン

{要素の機能}_{要素タイプ}

例

dart
ElevatedButton(
  key: const ValueKey('approve_button'),
  onPressed: _approve,
  child: const Text('Approve'),
)

TextField(
  key: const ValueKey('message_input'),
  controller: _controller,
)

要素タイプ一覧

タイプ用途
_buttonボタン
_fieldテキスト入力
_inputテキスト入力(短い)
_listリスト
_fabFloatingActionButton
_toggleトグル
_chipチップ
_badgeバッジ
_indicatorインジケーター

Flutter ベストプラクティス

Flutter公式AIルール (flutter/flutter docs/rules) から、本プロジェクトに適用可能なものを抜粋。

パフォーマンス

  • build()内で重い処理をしない: ネットワーク呼び出し・複雑な計算はbuild()の外で行う
  • ListView.builder / SliverList: 長いリストは必ずbuilder系コンストラクタで遅延生成する
  • constコンストラクタ: Widget・build()内で可能な限り const を使いリビルドを削減する
  • Isolate: JSON解析等の重い処理は compute() で別Isolateに逃がす

Dartコーディング

  • Null Safety: ! (bang operator) は値がnon-nullと保証できる場合のみ使用。安易に使わない
  • exhaustive switch: switch文/式は網羅的に書く。breakは不要
  • パターンマッチング: コードを簡潔にできる箇所ではパターンマッチングを活用する
  • アロー関数: 1行で済む関数はアロー構文 (=>) を使う
  • 関数の長さ: 1関数20行未満を目指す。超える場合は分割を検討

レイアウト

  • Expanded / Flexible: 同一Row/Column内での混在禁止
  • Wrap: Row/Columnで溢れる要素はWrapで折り返す
  • SingleChildScrollView: 固定サイズでビューポートを超えるコンテンツに使用
  • FittedBox: 子Widgetを親のサイズに合わせてスケーリング
  • LayoutBuilder: レスポンシブレイアウトでの利用可能スペースに基づく分岐

テーマ・スタイリング

  • ThemeExtension: 標準ThemeDataに無いカスタムスタイルはThemeExtensionで定義する
  • ColorScheme.fromSeed(): シードカラーからLight/Dark両テーマを生成
  • WidgetStateProperty: ボタン等の状態別スタイルは resolveWith で定義

アクセシビリティ

  • コントラスト比: テキストは背景に対して4.5:1以上(大きいテキストは3:1以上)
  • Semantics: スクリーンリーダー向けに Semantics Widgetで説明ラベルを付与
  • 動的テキストスケーリング: システムフォントサイズ変更時にUIが崩れないことを確認

build_runner

状態クラスの変更後は必ず実行:

bash
cd apps/mobile && dart run build_runner build --delete-conflicting-outputs

チェックリスト

実装完了時に確認:

  • _buildXxx() メソッドが残っていないこと
  • 全状態がFreezedクラスで管理されていること
  • BlocBuilder/BlocListenerが適切に使い分けられていること
  • 新規UI要素にValueKeyが付与されていること
  • dart analyze apps/mobile がクリーン
  • dart format apps/mobile が適用済み
  • 既存テストがパス (flutter test)
  • 新規Cubitのユニットテストが追加されていること
  • build()内に重い処理(ネットワーク、複雑な計算)がないこと
  • 長いリストがListView.builder/SliverListで実装されていること
  • 可能な箇所でconstコンストラクタが使われていること

Frequently asked questions

What does the Flutter Ui Design AI skill do?

Flutter UI実装のアーキテクチャ規約・コンポーネント分割・状態管理ガイド(Bloc/Cubit版)

Why use Flutter Ui Design on TypingMind?

Because you install it once and use it with any model. Flutter Ui Design is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Flutter Ui Design in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/K9i-0/ccpocket/tree/main/.claude/skills/flutter-ui-design. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Flutter Ui Design?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Flutter Ui Design?

As many as you like. As long as a model supports skills, you can use Flutter Ui Design with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Flutter Ui Design AI skill free?

Yes. It is published on GitHub by K9i-0 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇