Commit 0786a373 authored by 张宏's avatar 张宏

remark

parent bd3c7628
1.http及response 移动至 http
## 任务分解及实现明细
## 其他
### 路由生产
dart run build_runner build
dart run build_runner watch
---
### gitlab
git config --global user.name "xxx"
git config --global user.email "xxx"
Create a new repository
git clone http://git.ruanyiit.com/zhanghong/smart_hotel_app.git
cd smart_hotel_app
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin http://git.ruanyiit.com/zhanghong/smart_hotel_app.git
git add .
git commit -m "Initial commit"
git push -u origin master
### 版本处理
版本对齐后,必须清除旧缓存,否则 Gradle 会继续读取损坏的元数据
......
......@@ -28,11 +28,13 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
try {
// todo 这里暂定返回bool
final success = await _authService.login(event.username, event.password);
// final success = await _authService.login(event.username, event.password);
final success = true;
if (success) {
final userInfo = UserInfoBO();
userInfo.username = event.username; // todo 这里应对从login接口获取到
final userInfo = const UserInfoBO(
username: "张三丰",
);
emit(AuthSuccess(userInfo));
} else {
emit(const AuthFailure('登录失败,请检查用户名和密码'));
......
......@@ -92,7 +92,7 @@ class _MyAppState extends State<MyApp> {
BlocListener<AuthBloc, AuthState>(
listener: (context, state) {
if (state is AuthSuccess) {
_appRouter.navigate(const DefaultLayoutRoute());
_appRouter.replaceAll([const DefaultLayoutRoute()]);
}
if (state is AuthTokenExpired) {
_scaffoldMessengerKey.currentState?.showSnackBar(
......
import 'package:equatable/equatable.dart';
/**
* 业务对象
*/
class UserInfoBO {
String? username;
String? rolename;
String? rolecode;
// 用户相关其他信息
class UserInfoBO extends Equatable {
final String? username;
final String? rolename;
final String? rolecode;
const UserInfoBO({
this.username,
this.rolename,
this.rolecode,
});
@override
List<Object?> get props => [username, rolename, rolecode];
}
\ No newline at end of file
......@@ -85,7 +85,7 @@ class _HomeViewState extends State<HomeView> {
width: 2.w,
),
Text(
"香蜜湖店",
"xxxx",
style: TextStyle(
color: Color(0xFFFFFFFF),
fontSize: 32.sp),
......
......@@ -15,6 +15,7 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> {
Widget build(BuildContext context) {
return AutoTabsScaffold(
routes: const [HomeRoute(), NewsRoute(), MessageRoute(), ProfileRoute()],
transitionBuilder: (context, child, animation) => child,
bottomNavigationBuilder: (context, tabsRouter) {
return Container(
decoration: const BoxDecoration(
......@@ -34,9 +35,9 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> {
selectedFontSize: 12,
unselectedFontSize: 12,
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: "首页"),
BottomNavigationBarItem(icon: Icon(Icons.new_label), label: "新闻"),
BottomNavigationBarItem(icon: Icon(Icons.message), label: "消息"),
BottomNavigationBarItem(icon: Icon(Icons.home), label: "告警"),
BottomNavigationBarItem(icon: Icon(Icons.new_label), label: "服务"),
BottomNavigationBarItem(icon: Icon(Icons.message), label: "看板"),
BottomNavigationBarItem(
icon: Icon(Icons.my_location), label: "我的")
],
......
......@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:smart_hotel_app/blocs/auth/auth_bloc.dart';
import 'package:smart_hotel_app/blocs/auth/auth_state.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart';
import 'package:smart_hotel_app/utils/storage/storage_service.dart';
import 'package:smart_hotel_app/views/login/child/btn_login.dart';
import 'package:smart_hotel_app/views/login/child/btn_reset.dart';
......@@ -55,11 +56,15 @@ class _LoginViewState extends State<LoginView> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.only(left: 50.w, right: 50.w),
decoration: BoxDecoration(
color: Color(0xFF1A2B3C),
),
child: SingleChildScrollView(
child: Column(
children: [
Container(
......@@ -114,6 +119,7 @@ class _LoginViewState extends State<LoginView> {
textColor: Colors.white,
fontSize: 16.0);
}
},
builder: (context, state) {
return BtnLogin(
......@@ -131,6 +137,7 @@ class _LoginViewState extends State<LoginView> {
),
])
),
),
);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment