返回顶部
f

flutter-schemaFlutter三层架构

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

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 2.0.0
安全检测
已通过
212
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

flutter-schema

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.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部