fix: add navigation links and account screen
- Fix empty onPressed handlers in login/home screens - Add todo/calendar toggle navigation in bottom dock - Fix message invite detail path (/messages/invites/:id) - Add account screen with logout/switch account dialogs - Add /settings/account route
This commit is contained in:
@@ -131,7 +131,7 @@ class _LoginPasswordScreenState extends State<LoginPasswordScreen> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
AppButton(text: '登录', onPressed: () {}),
|
||||
AppButton(text: '登录', onPressed: () => context.go('/home')),
|
||||
const SizedBox(height: 12),
|
||||
AppButton(
|
||||
text: '使用验证码登录',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../widgets/bottom_dock.dart';
|
||||
@@ -288,7 +289,7 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen> {
|
||||
Widget _buildBottomDock() {
|
||||
return BottomDock(
|
||||
activeTab: DockTab.calendar,
|
||||
onTodoTap: () {},
|
||||
onTodoTap: () => context.push('/todo'),
|
||||
onCalendarTap: () {},
|
||||
onHomeTap: () => Navigator.of(context).pop(),
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../widgets/bottom_dock.dart';
|
||||
@@ -350,7 +351,7 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen> {
|
||||
Widget _buildBottomDock() {
|
||||
return BottomDock(
|
||||
activeTab: DockTab.calendar,
|
||||
onTodoTap: () {},
|
||||
onTodoTap: () => context.push('/todo'),
|
||||
onCalendarTap: () {},
|
||||
onHomeTap: () => Navigator.of(context).pop(),
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import 'home_sheet.dart';
|
||||
@@ -13,7 +14,7 @@ class HomeScreen extends StatelessWidget {
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
_buildHeader(context),
|
||||
Expanded(child: _buildChatArea()),
|
||||
_buildInputContainer(context),
|
||||
],
|
||||
@@ -22,7 +23,7 @@ class HomeScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 60,
|
||||
child: Padding(
|
||||
@@ -36,7 +37,7 @@ class HomeScreen extends StatelessWidget {
|
||||
size: 24,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
onPressed: () {},
|
||||
onPressed: () => context.push('/settings'),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
@@ -46,7 +47,7 @@ class HomeScreen extends StatelessWidget {
|
||||
size: 24,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
onPressed: () {},
|
||||
onPressed: () => context.push('/calendar/dayweek'),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
IconButton(
|
||||
@@ -55,7 +56,7 @@ class HomeScreen extends StatelessWidget {
|
||||
size: 24,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
onPressed: () {},
|
||||
onPressed: () => context.push('/messages/invites'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -58,7 +58,7 @@ class MessageInviteListScreen extends StatelessWidget {
|
||||
|
||||
Widget _buildInviteCard(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => context.push('/messages/invite/detail'),
|
||||
onTap: () => context.push('/messages/invites/1'),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(14),
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
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;
|
||||
|
||||
class AccountScreen extends StatelessWidget {
|
||||
const AccountScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildAccountInfo(),
|
||||
const SizedBox(height: 16),
|
||||
_buildMenuCard(context),
|
||||
const SizedBox(height: 24),
|
||||
_buildLogoutButton(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 64,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Row(
|
||||
children: [
|
||||
widgets.BackButton(),
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
'我的账户',
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAccountInfo() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEAF1FF),
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
),
|
||||
child: const Icon(Icons.person, size: 28, color: AppColors.blue500),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Qiuzhiliang',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'qiuzhiliang@xunmee.com',
|
||||
style: TextStyle(fontSize: 14, color: AppColors.slate500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuCard(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildMenuItem(icon: Icons.edit, title: '编辑资料', onTap: () {}),
|
||||
_buildDivider(),
|
||||
_buildMenuItem(icon: Icons.lock, title: '修改密码', onTap: () {}),
|
||||
_buildDivider(),
|
||||
_buildMenuItem(
|
||||
icon: Icons.swap_horiz,
|
||||
title: '切换账户',
|
||||
onTap: () => _showSwitchAccountDialog(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuItem({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
height: 56,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 20, color: AppColors.slate500),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.slate900,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Icon(
|
||||
Icons.chevron_right,
|
||||
size: 18,
|
||||
color: AppColors.slate400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDivider() {
|
||||
return Container(
|
||||
height: 1,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
color: const Color(0xFFEEF2F7),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogoutButton(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => _showLogoutDialog(context),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 52,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFEE2E2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFFECACA)),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'退出登录',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFFDC2626),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showLogoutDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text('退出登录'),
|
||||
content: const Text('确定要退出当前账户吗?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
context.go('/');
|
||||
},
|
||||
child: const Text('退出', style: TextStyle(color: Color(0xFFDC2626))),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showSwitchAccountDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text('切换账户'),
|
||||
content: const Text('确定要切换到其他账户吗?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
context.go('/');
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -328,7 +328,11 @@ class SettingsScreen extends StatelessWidget {
|
||||
onTap: () => context.push('/settings/memory'),
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildMenuItem(icon: Icons.person, title: '我的账户', onTap: () {}),
|
||||
_buildMenuItem(
|
||||
icon: Icons.person,
|
||||
title: '我的账户',
|
||||
onTap: () => context.push('/settings/account'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
|
||||
@@ -14,7 +15,7 @@ class TodoQuadrantsScreen extends StatelessWidget {
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(child: _buildContent()),
|
||||
_buildBottomDock(),
|
||||
_buildBottomDock(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -172,7 +173,7 @@ class TodoQuadrantsScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomDock() {
|
||||
Widget _buildBottomDock(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 61,
|
||||
child: Padding(
|
||||
@@ -214,36 +215,42 @@ class TodoQuadrantsScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.calendar,
|
||||
size: 20,
|
||||
color: AppColors.slate500,
|
||||
GestureDetector(
|
||||
onTap: () => context.push('/calendar/dayweek'),
|
||||
child: Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.calendar,
|
||||
size: 20,
|
||||
color: AppColors.slate500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.todoHomeBtnBg,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(
|
||||
color: AppColors.todoHomeBtnBorder,
|
||||
width: 1,
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.todoHomeBtnBg,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(
|
||||
color: AppColors.todoHomeBtnBorder,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.home,
|
||||
size: 20,
|
||||
color: Color(0xFF1E3A8A),
|
||||
),
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.home,
|
||||
size: 20,
|
||||
color: Color(0xFF1E3A8A),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user