generated from dellevin/template
代码优化,epub阅读标签
This commit is contained in:
@@ -598,6 +598,8 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
_buildStatusTag(movie),
|
||||
const SizedBox(width: 6),
|
||||
_buildCategoryTag(movie),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -679,6 +681,35 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCategoryTag(Movie movie) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
const labels = {
|
||||
'movie': '电影',
|
||||
'tv': '电视剧',
|
||||
'anime': '动漫',
|
||||
'variety': '综艺',
|
||||
'documentary': '纪录片',
|
||||
'short': '微短剧',
|
||||
};
|
||||
final label = labels[movie.category];
|
||||
if (label == null) return const SizedBox.shrink();
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: colors.onSurface.withValues(alpha: 0.5),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDirectorsSection(Movie movie) {
|
||||
final isOverlay = _detailStyle == 1;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
@@ -50,6 +50,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
List<String> _alternateTitles = [];
|
||||
String? _posterPath;
|
||||
String _status = 'want_to_watch';
|
||||
String _category = 'movie';
|
||||
DateTime? _releaseDate;
|
||||
DateTime? _watchDate;
|
||||
bool _isDownloading = false;
|
||||
@@ -85,6 +86,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
_alternateTitles = List.from(movie.alternateTitles);
|
||||
_posterPath = movie.posterPath;
|
||||
_status = movie.status;
|
||||
_category = movie.category;
|
||||
_releaseDate = movie.releaseDate;
|
||||
_watchDate = movie.watchDate;
|
||||
} else if (widget.initialStatus != null) {
|
||||
@@ -831,11 +833,60 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 分类
|
||||
Row(
|
||||
children: [
|
||||
Text('分类', style: TextStyle(fontSize: 12, color: colors.onSurface.withValues(alpha: 0.4))),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _categories.map((c) {
|
||||
final isSelected = _category == c.$2;
|
||||
return GestureDetector(
|
||||
onTap: () => setState(() => _category = c.$2),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
margin: EdgeInsets.only(right: c == _categories.last ? 0 : 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? colors.primary : colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
c.$1,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: isSelected ? FontWeight.w500 : FontWeight.normal,
|
||||
color: isSelected ? colors.onPrimary : colors.onSurface.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 影视分类选项
|
||||
static const _categories = [
|
||||
('电影', 'movie'),
|
||||
('电视剧', 'tv'),
|
||||
('动漫', 'anime'),
|
||||
('综艺', 'variety'),
|
||||
('纪录片', 'documentary'),
|
||||
('微短剧', 'short'),
|
||||
];
|
||||
|
||||
/// 构建状态选项
|
||||
Widget _buildStatusOption(String label, String value) {
|
||||
final isSelected = _status == value;
|
||||
@@ -1292,6 +1343,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
summary: _summaryController.text.trim(),
|
||||
rating: rating,
|
||||
status: _status,
|
||||
category: _category,
|
||||
watchDate: _watchDate,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
@@ -1311,6 +1363,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
summary: _summaryController.text.trim(),
|
||||
rating: rating,
|
||||
status: _status,
|
||||
category: _category,
|
||||
watchDate: _watchDate,
|
||||
updatedAt: now,
|
||||
);
|
||||
|
||||
@@ -533,24 +533,31 @@ class _MoviePostersPageState extends State<MoviePostersPage> {
|
||||
return AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||
title: const Text('确认删除'),
|
||||
content: const Text('确定要删除这张海报吗?'),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Text('确认删除', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
content: Text('确定要删除这张海报吗?删除后可在回收站恢复。',
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6), height: 1.5)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('取消', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.6))),
|
||||
),
|
||||
TextButton(
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await context.read<AppProvider>().removeMoviePoster(poster.id);
|
||||
Navigator.pop(context);
|
||||
_loadPosters();
|
||||
ToastUtil.show(context, '已删除');
|
||||
},
|
||||
child: Text('删除', style: TextStyle(color: colors.error)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colors.error, foregroundColor: colors.onError, elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
child: const Text('删除'),
|
||||
),
|
||||
],
|
||||
actionsPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -50,17 +50,27 @@ class _MovieReviewDetailPageState extends State<MovieReviewDetailPage> {
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Text('确认删除', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
content: Text('确定要删除这条影评吗?', style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6))),
|
||||
content: Text('确定要删除这条影评吗?删除后可在回收站恢复。',
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6), height: 1.5)),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(ctx, false), child: Text('取消', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.5)))),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: Text('取消', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.6))),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
style: ElevatedButton.styleFrom(backgroundColor: colors.error, foregroundColor: colors.onError, elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colors.error, foregroundColor: colors.onError, elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
child: const Text('删除'),
|
||||
),
|
||||
],
|
||||
actionsPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
),
|
||||
);
|
||||
if (confirmed == true) {
|
||||
|
||||
@@ -323,24 +323,31 @@ class _MovieReviewsPageState extends State<MovieReviewsPage> {
|
||||
return AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||
title: const Text('确认删除'),
|
||||
content: const Text('确定要删除这条影评吗?'),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Text('确认删除', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
content: Text('确定要删除这条影评吗?删除后可在回收站恢复。',
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6), height: 1.5)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('取消', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.6))),
|
||||
),
|
||||
TextButton(
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await context.read<AppProvider>().removeMovieReview(review.id);
|
||||
Navigator.pop(context);
|
||||
_loadReviews();
|
||||
ToastUtil.show(context, '已删除');
|
||||
},
|
||||
child: Text('删除', style: TextStyle(color: colors.error)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colors.error, foregroundColor: colors.onError, elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
child: const Text('删除'),
|
||||
),
|
||||
],
|
||||
actionsPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user