基于 Flutter × HarmonyOS 6.0 的宿舍管理系统设计
背景
随着高校信息化建设的加速,新生入学流程逐步从人工登记转向智能管理。宿舍分配、入住登记、通知公告、报修反馈等场景高度碎片化,传统 Web 管理后台难以满足高并发与移动端实时交互的需求。
传统宿舍管理存在的问题
| 问题 | 说明 |
|---|---|
| 信息割裂 | 教务系统、后勤系统、人工登记不互通 |
| 流程混乱 | 新生不清楚入住步骤 |
| 数据不可视 | 管理员难以统计入住状态 |
| 通知滞后 | 重要公告无法触达学生 |
| 跨平台困难 | 安卓 / 鸿蒙 / iOS 多套代码 |
Flutter × HarmonyOS 6.0 跨端开发介绍
技术选型
| 技术 | 作用 |
|---|---|
| Flutter | 一套 Dart 代码,编译到 Android / iOS / Web |
| HarmonyOS 6.0 | 国产分布式系统,支持 ArkUI / Flutter |
| Flutter on Harmony | 使用 OpenHarmony Flutter 引擎,直接运行 |
架构示意
Flutter UI 层 → 业务逻辑层(ViewModel / Provider / Riverpod) → 数据层(Repository + API + 本地缓存) → HarmonyOS 分布式能力(设备互联 / 推送 / 存储)
数据结构设计
class Student {
String id;
String name;
String college;
String dormId;
bool checkedIn;
}
class Dormitory {
String id;
String building;
int floor;
int capacity;
int occupied;
}
class NotificationMsg {
String id;
String title;
String content;
DateTime time;
}
class CheckInStep {
int step;
String title;
bool completed;
}
逻辑关系
- Student -> Dormitory (多对一)
- Student -> CheckInStep (一对多)
- Student -> NotificationMsg (多对多)
开发核心代码解析
当前展示的是系统首页 IntroPage,属于控制面板入口页。
1. 页面入口
class IntroPage extends StatefulWidget {
const IntroPage({super.key});
@override
State<IntroPage> createState() => _IntroPageState();
}
解析:
- 使用
StatefulWidget,因为后续会涉及登录状态、宿舍数据刷新、通知动态更新。
2. 页面骨架
return Scaffold(
body: SafeArea(
child: Column(
children: [
_buildHeader(theme),
Expanded(
child: SingleChildScrollView(
// ...
),
),
],
),
),
);


