后端:

1、事件订阅增加rabbitmq中间件
移动端:
1、完善移动端目录结构和代码框架
This commit is contained in:
2026-01-28 18:19:45 +08:00
47 changed files with 821 additions and 265 deletions
+3
View File
@@ -1,7 +1,10 @@
allprojects {
repositories {
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://maven.aliyun.com/repository/public") }
google()
mavenCentral()
}
}
@@ -2,4 +2,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
# ??????????
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.14-all.zip
+2
View File
@@ -11,6 +11,8 @@ pluginManagement {
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://maven.aliyun.com/repository/public") }
google()
mavenCentral()
gradlePluginPortal()
+14
View File
@@ -0,0 +1,14 @@
import 'package:app/core/router/app_router.dart';
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: '测试应用',
routerConfig:appRouter
);
}
}
@@ -0,0 +1,5 @@
import 'dart:ui';
class AppColors {
static const Color primaryColor = Color(0xFF4FDBFF); // 微信绿
}
@@ -0,0 +1,26 @@
import 'package:app/features/auth/pages/login_page.dart';
import 'package:app/features/home/pages/index_page.dart';
import 'package:go_router/go_router.dart';
import '../../features/home/pages/main_page.dart';
final appRouter = GoRouter(
initialLocation: '/auth/login',
routes: [
GoRoute(path: '/auth/login', builder: (context, state) => const LoginPage()),
ShellRoute(
builder: (context, state, child) {
return MainPage(child: child);
},
routes: [
GoRoute(
path: '/',
builder: (context, state) => const IndexPage()
)
]
)
],
);
@@ -0,0 +1,167 @@
import 'package:app/core/constants/app_colors.dart';
import 'package:app/features/auth/pages/login_page.dart';
import 'package:flutter/material.dart';
class LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
TextButton(
onPressed: () {},
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
),
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
// 1. 品牌Logo/头像区域
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: AppColors.primaryColor.withOpacity(0.1),
shape: BoxShape.circle,
),
child: const Icon(
Icons.person_rounded,
size: 60,
color: AppColors.primaryColor,
),
),
const SizedBox(height: 24),
const Text(
"登录您的聊天账号",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 60),
// 2. 账号输入框 (极简下划线风格)
TextField(
decoration: InputDecoration(
labelText: "账号 / 邮箱 / 手机号",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
),
),
),
const SizedBox(height: 25),
// 3. 密码输入框
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: "请输入密码",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
),
),
),
const SizedBox(height: 60),
// 4. 登录按钮 (圆润大按钮)
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primaryColor,
foregroundColor: Colors.white,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: const Text(
"登 录",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
),
),
const SizedBox(height: 20),
// 5. 注册/切换登录方式
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {},
child: const Text(
"注册账号",
style: TextStyle(color: Color(0xFF576B95)),
), // 经典的链接蓝
),
const SizedBox(
height: 20,
child: VerticalDivider(color: Colors.grey),
),
TextButton(
onPressed: () {},
child: const Text(
"验证码登录",
style: TextStyle(color: Color(0xFF576B95)),
),
),
],
),
const SizedBox(height: 80),
// 6. 底部协议 (社交App必有)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Checkbox(
value: true,
activeColor: AppColors.primaryColor,
onChanged: (v) {},
),
const Text(
"我已阅读并同意",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《用户协议》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
const Text(
"",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《隐私政策》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
],
),
],
),
),
),
);
}
}
@@ -0,0 +1,12 @@
import 'package:app/features/auth/bloc/login_page_state.dart';
import 'package:flutter/cupertino.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@override
State<StatefulWidget> createState() {
return LoginPageState();
}
}
@@ -0,0 +1,10 @@
import 'package:app/features/home/pages/index_page.dart';
import 'package:flutter/cupertino.dart';
class IndexPageState extends State<IndexPage> {
@override
Widget build(BuildContext context) {
return Text('test');
}
}
@@ -0,0 +1,19 @@
import 'package:app/features/home/pages/main_page.dart';
import 'package:flutter/material.dart';
class MainPageState extends State<MainPage> {
int count = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(count.toString()),
backgroundColor: Colors.blue,
),
body: widget.child
);
}
}
@@ -0,0 +1,12 @@
import 'package:app/features/home/bloc/index_page_state.dart';
import 'package:flutter/cupertino.dart';
class IndexPage extends StatefulWidget {
const IndexPage({super.key});
@override
State<StatefulWidget> createState() {
return IndexPageState();
}
}
@@ -0,0 +1,13 @@
import 'package:app/features/home/bloc/main_page_state.dart';
import 'package:flutter/material.dart';
class MainPage extends StatefulWidget {
final Widget child;
const MainPage({super.key,required this.child});
@override
State<StatefulWidget> createState() {
return MainPageState();
}
}
+6 -174
View File
@@ -1,178 +1,10 @@
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:app/app.dart';
import 'package:flutter/material.dart';
void main() => runApp(
const MaterialApp(home: IMLoginPage(), debugShowCheckedModeBanner: false),
);
void main(List<String> args){
class IMLoginPage extends StatefulWidget {
const IMLoginPage({super.key});
usePathUrlStrategy();
@override
State<IMLoginPage> createState() => _IMLoginPageState();
}
class _IMLoginPageState extends State<IMLoginPage> {
@override
Widget build(BuildContext context) {
// 主题色定义:这里用类似微信的深绿或经典的社交蓝
const Color primaryColor = Color(0xFF07C160); // 微信绿,你也可以换成 0xFF0084FF (社交蓝)
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
TextButton(
onPressed: () {},
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
),
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
// 1. 品牌Logo/头像区域
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: primaryColor.withOpacity(0.1),
shape: BoxShape.circle,
),
child: const Icon(
Icons.person_rounded,
size: 60,
color: primaryColor,
),
),
const SizedBox(height: 24),
const Text(
"登录您的聊天账号",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 60),
// 2. 账号输入框 (极简下划线风格)
TextField(
decoration: InputDecoration(
labelText: "账号 / 邮箱 / 手机号",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 2),
),
),
),
const SizedBox(height: 25),
// 3. 密码输入框
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: "请输入密码",
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
floatingLabelStyle: const TextStyle(color: primaryColor),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 2),
),
),
),
const SizedBox(height: 60),
// 4. 登录按钮 (圆润大按钮)
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
foregroundColor: Colors.white,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: const Text(
"登 录",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
),
),
const SizedBox(height: 20),
// 5. 注册/切换登录方式
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {},
child: const Text(
"注册账号",
style: TextStyle(color: Color(0xFF576B95)),
), // 经典的链接蓝
),
const SizedBox(
height: 20,
child: VerticalDivider(color: Colors.grey),
),
TextButton(
onPressed: () {},
child: const Text(
"验证码登录",
style: TextStyle(color: Color(0xFF576B95)),
),
),
],
),
const SizedBox(height: 80),
// 6. 底部协议 (社交App必有)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Checkbox(
value: true,
activeColor: primaryColor,
onChanged: (v) {},
),
const Text(
"我已阅读并同意",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《用户协议》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
const Text(
"",
style: TextStyle(color: Colors.grey, fontSize: 12),
),
const Text(
"《隐私政策》",
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
),
],
),
],
),
),
),
);
}
}
runApp(const MyApp());
}
+46 -25
View File
@@ -6,7 +6,7 @@ packages:
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.13.0"
boolean_selector:
@@ -14,7 +14,7 @@ packages:
description:
name: boolean_selector
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
characters:
@@ -22,7 +22,7 @@ packages:
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
clock:
@@ -30,7 +30,7 @@ packages:
description:
name: clock
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
collection:
@@ -38,7 +38,7 @@ packages:
description:
name: collection
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.19.1"
cupertino_icons:
@@ -46,7 +46,7 @@ packages:
description:
name: cupertino_icons
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.8"
fake_async:
@@ -54,7 +54,7 @@ packages:
description:
name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.3"
flutter:
@@ -67,7 +67,7 @@ packages:
description:
name: flutter_lints
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.0.0"
flutter_test:
@@ -75,12 +75,25 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
go_router:
dependency: "direct main"
description:
name: go_router
sha256: eff94d2a6fc79fa8b811dde79c7549808c2346037ee107a1121b4a644c745f2a
url: "https://pub.flutter-io.cn"
source: hosted
version: "17.0.1"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "11.0.2"
leak_tracker_flutter_testing:
@@ -88,7 +101,7 @@ packages:
description:
name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.10"
leak_tracker_testing:
@@ -96,7 +109,7 @@ packages:
description:
name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.2"
lints:
@@ -104,15 +117,23 @@ packages:
description:
name: lints
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.0.0"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.17"
material_color_utilities:
@@ -120,7 +141,7 @@ packages:
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.1"
meta:
@@ -128,7 +149,7 @@ packages:
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.17.0"
path:
@@ -136,7 +157,7 @@ packages:
description:
name: path
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.1"
sky_engine:
@@ -149,7 +170,7 @@ packages:
description:
name: source_span
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.1"
stack_trace:
@@ -157,7 +178,7 @@ packages:
description:
name: stack_trace
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.12.1"
stream_channel:
@@ -165,7 +186,7 @@ packages:
description:
name: stream_channel
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
string_scanner:
@@ -173,7 +194,7 @@ packages:
description:
name: string_scanner
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.1"
term_glyph:
@@ -181,7 +202,7 @@ packages:
description:
name: term_glyph
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.2"
test_api:
@@ -189,7 +210,7 @@ packages:
description:
name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.7"
vector_math:
@@ -197,7 +218,7 @@ packages:
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
vm_service:
@@ -205,9 +226,9 @@ packages:
description:
name: vm_service
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
url: "https://pub.flutter-io.cn"
source: hosted
version: "15.0.2"
sdks:
dart: ">=3.10.4 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
flutter: ">=3.35.0"
+4
View File
@@ -31,9 +31,13 @@ dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
go_router: ^17.0.1
dev_dependencies:
flutter_test:
+2 -3
View File
@@ -5,15 +5,14 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:app/features/auth/pages/login_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const IMLoginPage());
await tester.pumpWidget(const LoginPage());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);