优化侧边栏和我的界面

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) { Widget _buildWatchlist(List<Movie> movies, List<Book> books, List<Game> games) {
final colors = Theme.of(context).colorScheme; 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>[]; final items = <_WatchlistItem>[];
if (_userPrefs.showMovieTab) { if (_userPrefs.showMovieTab) {
for (final m in movies.where((m) => m.status == 'want_to_watch')) { 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)); 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( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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), const SizedBox(height: 12),
if (items.isEmpty) if (items.isEmpty)
Padding( Padding(
@@ -778,40 +793,23 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Stack( child: Container(
children: [ width: 78,
Container( decoration: BoxDecoration(
width: 78, color: colors.surfaceContainerHighest,
decoration: BoxDecoration( borderRadius: BorderRadius.circular(8),
color: colors.surfaceContainerHighest, ),
borderRadius: BorderRadius.circular(8), clipBehavior: Clip.antiAlias,
), child: item.imagePath != null && item.imagePath!.isNotEmpty
clipBehavior: Clip.antiAlias, ? FadeInLocalImage(
child: item.imagePath != null && item.imagePath!.isNotEmpty path: item.imagePath,
? FadeInLocalImage( fit: BoxFit.cover,
path: item.imagePath, errorWidget: Icon(Icons.image_outlined,
fit: BoxFit.cover,
errorWidget: Icon(Icons.image_outlined,
size: 20,
color: colors.onSurface.withValues(alpha: 0.2)))
: Icon(Icons.image_outlined,
size: 20, size: 20,
color: colors.onSurface.withValues(alpha: 0.2)), color: colors.onSurface.withValues(alpha: 0.2)))
), : Icon(Icons.image_outlined,
Positioned( size: 20,
top: 4, color: colors.onSurface.withValues(alpha: 0.2)),
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),
),
),
],
), ),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),

View File

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

View File

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

View File

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