feat: 实现 Auth 全局状态机与 401 统一处理机制
- 新增 AuthSessionInvalidated 事件处理 token 失效场景 - ApiInterceptor 新增 authFailureCallback 单飞机制 - AuthBloc 区分 manual logout 与 auto expiry 语义 - 新增 startup recovery fallback 防止启动卡死 feat: 重构 Calendar DayWeek 视图事件布局引擎 - 新增 DayEventLayoutEngine 解耦事件计算与渲染 - 新增 DayTimelineMetrics 统一时间轴常量 - 新增 DayViewScale 支持捏合缩放 feat: 新增 Settings 页面共享 UI 组件 - 新增 BackTitlePageHeader 统一页面 header - 新增 DetailHeaderActionMenu 统一操作菜单 - 新增 DestructiveActionSheet 统一删除确认 - 新增 AppToggleSwitch 统一开关组件 feat: Chat UI Schema 支持导航操作 - 支持 navigation 类型 action 触发内部路由跳转 - 新增路径验证与参数处理 chore: 更新相关测试覆盖 auth 失效路径
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../../../../shared/widgets/page_header.dart' as widgets;
|
||||
import '../../../../shared/widgets/app_toggle_switch.dart';
|
||||
import '../../data/services/memory_service.dart';
|
||||
import '../widgets/settings_page_scaffold.dart';
|
||||
|
||||
class MemoryScreen extends StatefulWidget {
|
||||
const MemoryScreen({super.key});
|
||||
@@ -23,33 +25,22 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
widgets.PageHeader(leading: widgets.BackButton(), height: 56),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(20, 12, 20, 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildToggleCard(),
|
||||
if (_memoryItems.isNotEmpty) ...[
|
||||
const SizedBox(height: 14),
|
||||
_buildListTitle(),
|
||||
const SizedBox(height: 8),
|
||||
_buildMemoryList(),
|
||||
],
|
||||
const SizedBox(height: 20),
|
||||
_buildManageButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
return SettingsPageScaffold(
|
||||
title: '我的记忆',
|
||||
onBack: () => context.pop(),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildToggleCard(),
|
||||
if (_memoryItems.isNotEmpty) ...[
|
||||
const SizedBox(height: 14),
|
||||
_buildListTitle(),
|
||||
const SizedBox(height: 8),
|
||||
_buildMemoryList(),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildManageButton(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -63,8 +54,10 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
@@ -114,9 +107,10 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE1E8F3)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
for (int i = 0; i < _memoryItems.length; i++) ...[
|
||||
_buildMemoryItem(_memoryItems[i]),
|
||||
@@ -136,9 +130,10 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceTertiary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFE8EDF7)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 32,
|
||||
@@ -175,7 +170,11 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(Icons.chevron_right, size: 16, color: Color(0xFF9AAAC1)),
|
||||
const Icon(
|
||||
Icons.chevron_right,
|
||||
size: 16,
|
||||
color: AppColors.slate400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -190,7 +189,7 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFDCE6F4)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
@@ -207,33 +206,6 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
}
|
||||
|
||||
Widget _buildToggle(bool value, ValueChanged<bool> onChanged) {
|
||||
return GestureDetector(
|
||||
onTap: () => onChanged(!value),
|
||||
child: Container(
|
||||
width: 44,
|
||||
height: 24,
|
||||
padding: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: value ? const Color(0xFFBFDBFE) : const Color(0xFFF1F5FC),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: value ? const Color(0xFF93C5FD) : const Color(0xFFD5DFEE),
|
||||
),
|
||||
),
|
||||
child: AnimatedAlign(
|
||||
duration: const Duration(milliseconds: 150),
|
||||
alignment: value ? Alignment.centerRight : Alignment.centerLeft,
|
||||
child: Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: const Color(0xFFCCDDF8)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return AppToggleSwitch(value: value, onChanged: onChanged);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user