feat: 调整播放历史为单列列表
This commit is contained in:
1 parent
b185200e8c
commit
c14d89ffce
8 files changed
+317
-14
No files matched your search
@@ -19,6 +19,7 @@ import '../../core/widgets/empty_state.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../player/open_player.dart';
|
||||
import 'following_grid_card.dart';
|
||||
import 'following_history_card.dart';
|
||||
import 'following_paged_grid.dart';
|
||||
|
||||
enum FollowingTab { favorites, history }
|
||||
@@ -94,7 +95,7 @@ class _FollowingPageState extends State<FollowingPage> {
|
||||
onGoHome: widget.onGoHome,
|
||||
onListEmptied: _exitEditingIfEmpty,
|
||||
),
|
||||
_HistoryGrid(
|
||||
_HistoryList(
|
||||
controller: _history,
|
||||
editing: _editing,
|
||||
scrollController: _historyScroll,
|
||||
@@ -301,8 +302,8 @@ class _FavoritesGrid extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _HistoryGrid extends StatelessWidget {
|
||||
const _HistoryGrid({
|
||||
class _HistoryList extends StatelessWidget {
|
||||
const _HistoryList({
|
||||
required this.controller,
|
||||
required this.editing,
|
||||
required this.scrollController,
|
||||
@@ -327,6 +328,7 @@ class _HistoryGrid extends StatelessWidget {
|
||||
loadingMore: controller.loadingMore,
|
||||
hasMore: controller.hasMore,
|
||||
hasItems: controller.records.isNotEmpty,
|
||||
singleColumn: true,
|
||||
errorMessage: controller.error == null
|
||||
? null
|
||||
: errorText(l10n, controller.error, l10n.progressError),
|
||||
@@ -345,15 +347,28 @@ class _HistoryGrid extends StatelessWidget {
|
||||
itemBuilder: (context, index) {
|
||||
final record = controller.records[index];
|
||||
final progress = record.progress.fraction;
|
||||
return FollowingGridCard(
|
||||
final hasProgress = record.progress.duration > Duration.zero;
|
||||
final watchedPercent = (progress * 100)
|
||||
.round()
|
||||
.clamp(0, 100)
|
||||
.toInt();
|
||||
void openRecord() {
|
||||
unawaited(_openHistory(context, controller, record));
|
||||
}
|
||||
|
||||
return FollowingHistoryCard(
|
||||
dramaId: record.dramaId,
|
||||
title: _historyTitle(l10n, record),
|
||||
posterUrl: record.displayCover,
|
||||
viewCount: record.drama?.viewCount ?? record.progress.playCount,
|
||||
progress: progress > 0 ? progress : null,
|
||||
progress: hasProgress ? progress : null,
|
||||
progressLabel: hasProgress
|
||||
? l10n.watchedPercent(watchedPercent)
|
||||
: null,
|
||||
editing: editing,
|
||||
subtitle: _historySubtitle(l10n, record),
|
||||
onTap: () => unawaited(_openHistory(context, controller, record)),
|
||||
onTap: openRecord,
|
||||
onContinue: openRecord,
|
||||
onRemove: () async {
|
||||
if (await _confirmRemove(context) &&
|
||||
await controller.remove(record.dramaId) &&
|
||||
|
||||
Reference in new issue
Block a user