flutter-ui-design
Skill1.1k starsChanged 10 months agoMITView on GitHub
Flutter UI実装のアーキテクチャ規約・コンポーネント分割・状態管理ガイド(Bloc/Cubit版)
1 other project uses a version of this.
Trending
Quiet since October.thin dataabout the whole repository
Most recently taken up by
- K9i-0/flutter_claude_sandboxtheir own version, first seen Jan 4, 2026
Who's talking about K9i-0/ccpocket
- A Hacker News story“Show HN: CC Pocket – Control Claude Code/Codex from Your Phone”Hacker News · Mar 7, 2026 · 2 points
- @android.activitypub.awakari.com.ap.brid.gy“Show HN: CC Pocket – Control Claude Code/Codex from Your Phone CC Pocket is a mobile app (iOS/Android) for …”Bluesky · Mar 7, 2026 · 1 likes
- sudosubin/agents.nix“agent-skills.github.k9i-0.ccpocket: 1.136.1+258 → 0-unstable-2026-09-30”GitHub · Oct 3, 2026
- sudosubin/agents.nix“agent-skills.github.k9i-0.ccpocket: init at 1.136.1+258”GitHub · Sep 28, 2026
- @munawwar.bsky.social“Guys, CC Pocket! One of few projects that shows local (linux) Codex sessions on a native (android) app …”Bluesky · May 5, 2026
The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 8
Talked about on GitHub, Bluesky and Hacker News (8 times).
On GitHub · 5
- Oct 3, 2026agent-skills.github.k9i-0.ccpocket: 1.136.1+258 → 0-unstable-2026-09-30 — sudosubin/agents.nix0 reactions
- Sep 28, 2026agent-skills.github.k9i-0.ccpocket: init at 1.136.1+258 — sudosubin/agents.nix0 reactions
- Apr 18, 2026Audit candidate: K9i-0/ccpocket — xiaolai/nlpm0 reactions · 1 comment
- Apr 13, 2026Not support custom model in the claude code and OAuth — getpaseo/paseo0 reactions · 1 comment
- Mar 15, 2026feat: Claude Code 承認UI の改善(ネイティブ PermissionSheet) — dashi296/remocoder0 reactions
On Bluesky · 2
- Mar 7, 2026Show HN: CC Pocket – Control Claude Code/Codex from Your Phone CC Pocket is a mobile app (iOS/Android) for remotely controlling Claude Code… — @android.activitypub.awakari.com.ap.brid.gy1 likes and repost
- May 5, 2026Guys, CC Pocket! One of few projects that shows local (linux) Codex sessions on a native (android) app github.com/K9i-0/ccpocket — @munawwar.bsky.social0 likes and reposts · 1 reply
On Hacker News · 1
- Mar 7, 2026Show HN: CC Pocket – Control Claude Code/Codex from Your Phone2 points
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- K9i-0/flutter_claude_sandbox★ 18same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- codex-guideSkill
- flutter-upgradeSkill
- mergeSkill
- mobile-automationSkill
- playwright-cliSkill
- release-appSkill
- release-bridgeSkill
- release-cardSkill
- self-reviewSkill
- shorebird-patchSkill
- sim-previewSkill
- submit-store-reviewSkill
- test-bridgeSkill
- test-flutterSkill
- triageSkill
- update-storeSkill
- web-previewSkill
The file
Files
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 分割ルール
禁止パターン
// NG: プライベートメソッドでのWidget分割
class MyScreen extends StatefulWidget {
Widget _buildHeader() { ... }
Widget _buildBody() { ... }
Widget _buildFooter() { ... }
}推奨パターン
// OK: 独立したWidgetクラスに分割
class MyScreenHeader extends StatelessWidget { ... }
class MyScreenBody extends StatelessWidget { ... }
class MyScreenFooter extends StatelessWidget { ... }分割の判断基準
- 20行以上のbuildメソッド内ブロック → 独立Widgetに
- 独自のCubitを持つ → 独立Widget + BlocProvider
- BlocBuilder を含む → 独立Widget
- 表示のみ → StatelessWidget
状態管理
Cubit パターン
class ChatSessionCubit extends Cubit<ChatSessionState> {
ChatSessionCubit() : super(const ChatSessionState());
void sendMessage(String text) {
// Command (Path B)
emit(state.copyWith(/* ... */));
}
}BridgeCubit パターン(Stream購読)
class ConnectionCubit extends BridgeCubit<BridgeConnectionState> {
ConnectionCubit(super.initialState, super.stream);
}Freezed State
@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.dart | chat_screen.dart |
| 状態 | *_state.dart | chat_session_state.dart |
| Cubit | *_cubit.dart | chat_session_cubit.dart |
| Widget | 機能を表す名前 | chat_app_bar.dart |
ValueKey 命名規約(MCP自動テスト対応)
UI要素にはValueKeyを付与し、Marionette MCPでの自動テストを可能にする。
命名パターン
{要素の機能}_{要素タイプ}例
ElevatedButton(
key: const ValueKey('approve_button'),
onPressed: _approve,
child: const Text('Approve'),
)
TextField(
key: const ValueKey('message_input'),
controller: _controller,
)要素タイプ一覧
| タイプ | 用途 |
_button | ボタン |
_field | テキスト入力 |
_input | テキスト入力(短い) |
_list | リスト |
_fab | FloatingActionButton |
_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: スクリーンリーダー向けに
SemanticsWidgetで説明ラベルを付与 - 動的テキストスケーリング: システムフォントサイズ変更時にUIが崩れないことを確認
build_runner
状態クラスの変更後は必ず実行:
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コンストラクタが使われていること
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

