闲社服务运行正常AI智能体自动化平台
f

Flutter三层架构

技能标识:flutter-schema

Flutter GetX 三层架构规范。core + shared + modules 纵向分层,业务模块 GetX 化。适用于新模块创建、目录设计、代码评审。支持 scaffold 搭建目录结构。

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 2.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Flutter三层架构

Flutter GetX 三层架构规范

架构概览

纵向分层(自上而下单向依赖,modules 依赖 core 和 shared):

shared(底)← core ← modules(顶)

模块内 GetX 结构:

Binding(注入) + View ← Logic → State

层级速查

层级职责
core配置、路由、服务、工具、通用 UI 组件
shared
业务基类、存储、网络、可复用能力 | | modules | 业务功能实现,按功能拆模块,模块间走路由 |

模块目录模板

{module}/
├── {feature}/ # 子功能(可选)
│ ├── xxx_binding.dart
│ ├── xxx_logic.dart
│ ├── xxx_state.dart
│ ├── xxx_view.dart
│ ├── model/
│ └── view/
├── binding/
├── model/
├── view/
├── db/ # 本地数据(可选)
└── upload/ # 上传(可选)

命名约定

  • - binding / logic / state / view:xxxbinding.dart → XxxBinding 等
  • logic 继承项目内 BaseController 基类
  • 视图文件以 view 结尾,类名以 Page 或 View 结尾
  • 避免使用 widget 作为文件或类名后缀

依赖约束

  • - 仅允许上层依赖下层
  • 同级模块不互相 import,通过路由(Get.toNamed)通信
  • Logic 不持有 BuildContext、不直接操作 UI

Scaffold 能力

用户要求创建目录、搭建架构、新建模块时:

全量:创建 core/config、constants、navigation、utils、services、widgets;shared/data、domain;modules/{name}

增量:在 modules 下新建 {module_name}/,可用 validate.py 生成页面骨架

模块名使用小写下划线(如 orderlist、userprofile)。

页面生成

  • - 普通页:python ~/flutter-schema/scripts/validate.py [dir]

完整说明见 schema.md。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 flutter-schema-1776152949 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 flutter-schema-1776152949 技能

通过命令行安装

skillhub install flutter-schema-1776152949

下载

⬇ 下载 flutter-schema v2.0.0(免费)

文件大小: 6.78 KB | 发布时间: 2026-4-15 12:37

v2.0.0 最新 2026-4-15 12:37
Initial release.

- Provides a three-layer vertical architecture guideline for Flutter using GetX: shared, core, modules.
- Defines recommended directory structure, naming conventions, and dependency rules.
- Supports scaffold-based directory and module creation.
- Includes guidance for module and page generation using helper scripts.
- Suitable for new module creation, directory planning, and code review.
返回顶部