From 5426b3c79beea3b6c233d7d18c217be477b9845c Mon Sep 17 00:00:00 2001 From: DelLevin-Home Date: Mon, 6 Jul 2026 21:48:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=98=BE=E7=A4=BA=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reports/problems/problems-report.html | 2 +- lib/widgets/add_sheet.dart | 129 +++++++++--------- 2 files changed, 64 insertions(+), 67 deletions(-) diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html index 38d1d1d..600373f 100644 --- a/android/build/reports/problems/problems-report.html +++ b/android/build/reports/problems/problems-report.html @@ -650,7 +650,7 @@ code + .copy-button { diff --git a/lib/widgets/add_sheet.dart b/lib/widgets/add_sheet.dart index 064f7ca..3101eae 100644 --- a/lib/widgets/add_sheet.dart +++ b/lib/widgets/add_sheet.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import '../providers/app_provider.dart'; +import '../utils/user_prefs.dart'; /// 新增记录弹窗 — 供底部导航栏和 NavigationRail 共用 @@ -34,6 +35,67 @@ void showQuickAddSheet(BuildContext context, AppProvider provider) { void showAddSheet(BuildContext context, AppProvider provider) { final colors = Theme.of(context).colorScheme; final outerContext = context; + final userPrefs = UserPrefs(); + + final options = []; + if (userPrefs.showMovieTab) { + options.add(_buildOption( + colors: colors, + icon: Icons.movie_outlined, + title: '添加观影', + subtitle: '记录你看过的电影', + onTap: () { + Navigator.pop(outerContext); + final statusMap = {0: 'watched', 1: 'watching', 2: 'want_to_watch'}; + final s = statusMap[provider.movieStatusIndex] ?? 'want_to_watch'; + Navigator.pushNamed(outerContext, '/movie-form', + arguments: {'initialStatus': s}); + }, + )); + } + if (userPrefs.showBookTab) { + options.add(_buildOption( + colors: colors, + icon: Icons.menu_book_outlined, + title: '添加阅读', + subtitle: '记录你读过的书', + onTap: () { + Navigator.pop(outerContext); + final statusMap = {0: 'read', 1: 'reading', 2: 'want_to_read', 3: 'abandoned'}; + final s = statusMap[provider.bookStatusIndex] ?? 'want_to_read'; + Navigator.pushNamed(outerContext, '/book-form', + arguments: {'initialStatus': s}); + }, + )); + } + if (userPrefs.showNoteTab) { + options.add(_buildOption( + colors: colors, + icon: Icons.note_outlined, + title: '添加笔记', + subtitle: '记录你的想法和笔记', + onTap: () { + Navigator.pop(outerContext); + Navigator.pushNamed(outerContext, '/note-form'); + }, + )); + } + if (userPrefs.showGameTab) { + options.add(_buildOption( + colors: colors, + icon: Icons.sports_esports_outlined, + title: '添加游戏', + subtitle: '记录你玩过的游戏', + onTap: () { + Navigator.pop(outerContext); + final statusMap = {0: 'completed', 1: 'playing', 2: 'want_to_play', 3: 'abandoned'}; + final s = statusMap[provider.gameStatusIndex] ?? 'want_to_play'; + Navigator.pushNamed(outerContext, '/game-form', + arguments: {'initialStatus': s}); + }, + )); + } + showModalBottomSheet( context: context, backgroundColor: colors.surface, @@ -70,72 +132,7 @@ void showAddSheet(BuildContext context, AppProvider provider) { ), ), const SizedBox(height: 16), - _buildOption( - colors: bc, - icon: Icons.movie_outlined, - title: '添加观影', - subtitle: '记录你看过的电影', - onTap: () { - Navigator.pop(ctx); - final statusMap = { - 0: 'watched', - 1: 'watching', - 2: 'want_to_watch', - }; - final s = - statusMap[provider.movieStatusIndex] ?? 'want_to_watch'; - Navigator.pushNamed(outerContext, '/movie-form', - arguments: {'initialStatus': s}); - }, - ), - _buildOption( - colors: bc, - icon: Icons.menu_book_outlined, - title: '添加阅读', - subtitle: '记录你读过的书', - onTap: () { - Navigator.pop(ctx); - final statusMap = { - 0: 'read', - 1: 'reading', - 2: 'want_to_read', - 3: 'abandoned', - }; - final s = - statusMap[provider.bookStatusIndex] ?? 'want_to_read'; - Navigator.pushNamed(outerContext, '/book-form', - arguments: {'initialStatus': s}); - }, - ), - _buildOption( - colors: bc, - icon: Icons.note_outlined, - title: '添加笔记', - subtitle: '记录你的想法和笔记', - onTap: () { - Navigator.pop(ctx); - Navigator.pushNamed(outerContext, '/note-form'); - }, - ), - _buildOption( - colors: bc, - icon: Icons.sports_esports_outlined, - title: '添加游戏', - subtitle: '记录你玩过的游戏', - onTap: () { - Navigator.pop(ctx); - final statusMap = { - 0: 'completed', - 1: 'playing', - 2: 'want_to_play', - 3: 'abandoned', - }; - final s = - statusMap[provider.gameStatusIndex] ?? 'want_to_play'; - Navigator.pushNamed(outerContext, '/game-form', - arguments: {'initialStatus': s}); - }, - ), + ...options, ], ), ),