android:v0.2.9

This commit is contained in:
DelLevin-Home
2026-08-06 23:49:49 +08:00
parent 31418eb2b7
commit eee15e0aa8
23 changed files with 1463 additions and 334 deletions

View File

@@ -244,6 +244,11 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
Text('观看于 ${_formatDate(movie.watchDate!)}',
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.4))),
],
if (movie.watchCount > 0) ...[
const SizedBox(height: 4),
Text('已观看 ${movie.watchCount}',
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.4))),
],
Divider(height: 32, thickness: 0.5, color: colors.outline),
// 详细信息
if (movie.directors.isNotEmpty) _buildDesktopInfoRow('导演', movie.directors.join(''), colors),
@@ -1464,6 +1469,14 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
color: colors.onSurface.withValues(alpha: 0.4),
),
),
if (movie.watchCount > 0)
Text(
'已观看 ${movie.watchCount}',
style: TextStyle(
fontSize: 14,
color: colors.onSurface.withValues(alpha: 0.4),
),
),
],
),
);

View File

@@ -53,6 +53,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
String _category = 'movie';
DateTime? _releaseDate;
DateTime? _watchDate;
int _watchCount = 0;
bool _isDownloading = false;
@override
@@ -89,6 +90,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
_category = movie.category;
_releaseDate = movie.releaseDate;
_watchDate = movie.watchDate;
_watchCount = movie.watchCount;
} else if (widget.initialStatus != null) {
// 添加模式:使用传入的默认状态
_status = widget.initialStatus!;
@@ -601,6 +603,18 @@ class _MovieFormPageState extends State<MovieFormPage> {
),
),
// 观看次数
SizedBox(
width: (MediaQuery.of(context).size.width - 52) / 2,
height: 90,
child: _buildInfoCard(
label: '观看次数',
value: _watchCount > 0 ? '$_watchCount' : '',
icon: Icons.repeat_outlined,
onTap: () => _editWatchCount(),
),
),
// 第五行:剧情简介(独占一行)
SizedBox(
width: double.infinity,
@@ -734,6 +748,31 @@ class _MovieFormPageState extends State<MovieFormPage> {
);
}
/// 编辑观看次数
Future<void> _editWatchCount() async {
final controller = TextEditingController(text: _watchCount > 0 ? '$_watchCount' : '');
final result = await showDialog<String>(
context: context,
builder: (ctx) => AlertDialog(
title: const Text('观看次数'),
content: TextField(
controller: controller,
keyboardType: TextInputType.number,
autofocus: true,
decoration: const InputDecoration(hintText: '输入次数'),
),
actions: [
TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('取消')),
TextButton(onPressed: () => Navigator.pop(ctx, controller.text), child: const Text('确定')),
],
),
);
if (result != null) {
final val = int.tryParse(result) ?? 0;
setState(() => _watchCount = val < 0 ? 0 : val);
}
}
/// 全屏编辑剧情简介
Future<void> _editSummary() async {
final result = await Navigator.push<String>(
@@ -1357,6 +1396,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
status: _status,
category: _category,
watchDate: _watchDate,
watchCount: _watchCount,
createdAt: now,
updatedAt: now,
);
@@ -1378,6 +1418,7 @@ class _MovieFormPageState extends State<MovieFormPage> {
status: _status,
category: _category,
watchDate: _watchDate,
watchCount: _watchCount,
updatedAt: now,
);

View File

@@ -38,6 +38,7 @@ class _MovieTabPageState extends State<MovieTabPage> {
int _prevLayoutStyle = -1;
int _prevCategoryIndex = -1;
int _prevDisplayMode = -1;
int _prevSortMode = -1;
double _swipeOffset = 0.0; // 当前拖动偏移量(用于左右滑动切换状态)
static const _statusMap = {0: 'watched', 1: 'watching', 2: 'want_to_watch'};
@@ -79,6 +80,7 @@ class _MovieTabPageState extends State<MovieTabPage> {
final layoutChanged = provider.movieLayoutStyle != _prevLayoutStyle;
final categoryChanged = provider.movieCategoryIndex != _prevCategoryIndex;
final displayModeChanged = provider.movieDisplayMode != _prevDisplayMode;
final sortModeChanged = UserPrefs().movieSortMode != _prevSortMode;
final countChanged = provider.movies.length != _prevMovieCount;
final editRefreshed = provider.editRefreshCounter > _lastEditRefreshCounter;
if (editRefreshed && provider.lastEditedItemId != null) {
@@ -95,10 +97,11 @@ class _MovieTabPageState extends State<MovieTabPage> {
}
return;
}
if (statusChanged || layoutChanged || categoryChanged || displayModeChanged || countChanged || editRefreshed) {
if (statusChanged || layoutChanged || categoryChanged || displayModeChanged || sortModeChanged || countChanged || editRefreshed) {
_prevLayoutStyle = provider.movieLayoutStyle;
_prevCategoryIndex = provider.movieCategoryIndex;
_prevDisplayMode = provider.movieDisplayMode;
_prevSortMode = UserPrefs().movieSortMode;
_prevMovieCount = provider.movies.length;
_loadFirst();
}