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,6 +1,8 @@
|
||||
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 '../widgets/settings_page_scaffold.dart';
|
||||
|
||||
class FeaturesScreen extends StatefulWidget {
|
||||
const FeaturesScreen({super.key});
|
||||
@@ -17,31 +19,20 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const widgets.PageHeader(leading: widgets.BackButton()),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('每日'),
|
||||
const SizedBox(height: 8),
|
||||
_buildDailyList(),
|
||||
const SizedBox(height: 16),
|
||||
_buildSectionTitle('每周'),
|
||||
const SizedBox(height: 8),
|
||||
_buildWeeklyList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
return SettingsPageScaffold(
|
||||
title: '周期计划',
|
||||
onBack: () => context.pop(),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('每日'),
|
||||
const SizedBox(height: 8),
|
||||
_buildDailyList(),
|
||||
const SizedBox(height: 16),
|
||||
_buildSectionTitle('每周'),
|
||||
const SizedBox(height: 8),
|
||||
_buildWeeklyList(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -59,6 +50,7 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
|
||||
Widget _buildDailyList() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_buildFeatureCard(
|
||||
icon: Icons.alarm,
|
||||
@@ -87,6 +79,7 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
|
||||
Widget _buildWeeklyList() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_buildFeatureCard(
|
||||
icon: Icons.calendar_view_week,
|
||||
@@ -128,9 +121,10 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE4ECF6)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
@@ -167,40 +161,9 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
_buildToggle(value, onChanged),
|
||||
AppToggleSwitch(value: value, onChanged: onChanged),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user