优化侧边栏和我的界面

This commit is contained in:
DelLevin-Home
2026-08-10 20:22:39 +08:00
parent b9a92214c2
commit 5698c232d1
4 changed files with 70 additions and 54 deletions

View File

@@ -669,6 +669,16 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
Widget _buildWatchlist(List<Movie> movies, List<Book> books, List<Game> games) {
final colors = Theme.of(context).colorScheme;
final movieWantTo = _userPrefs.showMovieTab
? movies.where((m) => m.status == 'want_to_watch').length
: 0;
final bookWantTo = _userPrefs.showBookTab
? books.where((b) => b.status == 'want_to_read').length
: 0;
final gameWantTo = _userPrefs.showGameTab
? games.where((g) => g.status == 'want_to_play').length
: 0;
final items = <_WatchlistItem>[];
if (_userPrefs.showMovieTab) {
for (final m in movies.where((m) => m.status == 'want_to_watch')) {
@@ -705,17 +715,6 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
}
items.sort((a, b) => b.createdAt.compareTo(a.createdAt));
final typeIcon = <String, IconData>{
'movie': Icons.movie_outlined,
'book': Icons.menu_book_outlined,
'game': Icons.sports_esports_outlined,
};
final typeColor = <String, Color>{
'movie': const Color(0xFF2563EB),
'book': const Color(0xFF16A34A),
'game': const Color(0xFFEA580C),
};
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -750,6 +749,22 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
],
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(children: [
if (_userPrefs.showMovieTab) ...[
_buildStatusTag('影视', movieWantTo, true, colors),
const SizedBox(width: 10),
],
if (_userPrefs.showBookTab) ...[
_buildStatusTag('书籍', bookWantTo, false, colors),
const SizedBox(width: 10),
],
if (_userPrefs.showGameTab)
_buildStatusTag('游戏', gameWantTo, false, colors),
]),
),
const SizedBox(height: 12),
if (items.isEmpty)
Padding(
@@ -778,40 +793,23 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Stack(
children: [
Container(
width: 78,
decoration: BoxDecoration(
color: colors.surfaceContainerHighest,
borderRadius: BorderRadius.circular(8),
),
clipBehavior: Clip.antiAlias,
child: item.imagePath != null && item.imagePath!.isNotEmpty
? FadeInLocalImage(
path: item.imagePath,
fit: BoxFit.cover,
errorWidget: Icon(Icons.image_outlined,
size: 20,
color: colors.onSurface.withValues(alpha: 0.2)))
: Icon(Icons.image_outlined,
child: Container(
width: 78,
decoration: BoxDecoration(
color: colors.surfaceContainerHighest,
borderRadius: BorderRadius.circular(8),
),
clipBehavior: Clip.antiAlias,
child: item.imagePath != null && item.imagePath!.isNotEmpty
? FadeInLocalImage(
path: item.imagePath,
fit: BoxFit.cover,
errorWidget: Icon(Icons.image_outlined,
size: 20,
color: colors.onSurface.withValues(alpha: 0.2)),
),
Positioned(
top: 4,
left: 4,
child: Container(
padding: const EdgeInsets.all(3),
decoration: BoxDecoration(
color: typeColor[item.type]!,
borderRadius: BorderRadius.circular(4),
),
child: Icon(typeIcon[item.type],
size: 10, color: Colors.white),
),
),
],
color: colors.onSurface.withValues(alpha: 0.2)))
: Icon(Icons.image_outlined,
size: 20,
color: colors.onSurface.withValues(alpha: 0.2)),
),
),
const SizedBox(height: 4),

View File

@@ -42,9 +42,10 @@ class AppTheme {
Color(0xFFFF8F00), // 琥珀
Color(0xFFE91E63), // 玫瑰
Color(0xFF673AB7), // 紫罗兰
Color(0xFF8B6F47), // 米黄
];
static const List<String> colorSchemeNames = ['经典', '靛蓝', '薄荷', '琥珀', '玫瑰', '紫罗兰'];
static const List<String> colorSchemeNames = ['经典', '靛蓝', '薄荷', '琥珀', '玫瑰', '紫罗兰', '米黄'];
// 莫奈动态取色
static Color? _monetColor;

View File

@@ -263,7 +263,7 @@ class _CustomDrawerState extends State<CustomDrawer> {
final actions = <(IconData, String, Color, VoidCallback)>[];
if (userPrefs.showMovieTab) actions.add((
Icons.add_photo_alternate_outlined, '影视', const Color(0xFF2563EB),
Icons.movie_outlined, '影视', const Color(0xFF2563EB),
() { if (!widget.embedded) { Navigator.pop(context); } Navigator.push(context, MaterialPageRoute(builder: (_) => const MovieFormPage())); },
));
if (userPrefs.showBookTab) actions.add((
@@ -297,13 +297,30 @@ class _CustomDrawerState extends State<CustomDrawer> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 36, height: 36,
decoration: BoxDecoration(
color: color.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(10),
),
child: Icon(icon, size: 18, color: color),
Stack(
clipBehavior: Clip.none,
children: [
Container(
width: 36, height: 36,
decoration: BoxDecoration(
color: color.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(10),
),
child: Icon(icon, size: 18, color: color),
),
Positioned(
top: -4,
right: -4,
child: Container(
width: 14, height: 14,
decoration: BoxDecoration(
color: colors.surface,
shape: BoxShape.circle,
),
child: Icon(Icons.add, size: 10, color: color),
),
),
],
),
const SizedBox(height: 4),
Text(label, style: TextStyle(fontSize: 11, fontWeight: FontWeight.w500, color: colors.onSurface.withValues(alpha: 0.6))),

View File

@@ -1,7 +1,7 @@
name: mooknote
description: "app for tracking movies, books, and notes"
publish_to: 'none'
version: 0.3.0
version: 0.3.1
environment:
sdk: ^3.5.0