feat(auth): 添加登录/注册页面及令牌恢复流程
- 新增 SplashPage(启动页)和 LoginPage(登录页),支持路由跳转 - 扩展 AuthState,增加 submitting/alert/busy 状态及消费机制 - AuthController 增加 checkLoginState/register/showAlert 等方法 - 删除旧模型文件(binding_item, token_response, verify_response) - 删除旧版 LoginPage,迁移至 features/auth 目录 - 更新本地化字符串,增加注册相关文案 - 调整默认 API 地址为本地开发环境
This commit is contained in:
@@ -3,12 +3,22 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
part 'auth_state.freezed.dart';
|
||||
|
||||
/// 登录状态。
|
||||
///
|
||||
/// [alert] 为一次性提示(登录失效、注册成功等),UI 展示后须调用
|
||||
/// `AuthController.consumeAlert()` 消费,避免重建时重复弹出。
|
||||
@freezed
|
||||
class AuthState with _$AuthState {
|
||||
const AuthState._();
|
||||
|
||||
const factory AuthState({
|
||||
@Default(false) bool loggedIn,
|
||||
@Default(false) bool restoring,
|
||||
@Default(false) bool submitting,
|
||||
String? username,
|
||||
String? error,
|
||||
String? alert,
|
||||
}) = _AuthState;
|
||||
|
||||
/// 是否应禁用输入与提交按钮。
|
||||
bool get busy => submitting || restoring;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user