feat(flutter): 重设计播放页与操作面板
This commit is contained in:
1 parent
148fbc3c93
commit
9a4269b847
24 files changed
+2395
-1101
No files matched your search
@@ -21,7 +21,6 @@ import '../../core/data/services/playback_session.dart';
|
||||
import '../../core/data/services/video_player_port.dart';
|
||||
import '../../core/data/services/wallet_controller.dart';
|
||||
import '../../core/formatting/localized_content.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../discover/discover_types.dart';
|
||||
import '../discover/discover_view.dart';
|
||||
@@ -30,9 +29,7 @@ import '../mine/mine_types.dart';
|
||||
import '../mine/mine_view.dart';
|
||||
import 'player_view.dart';
|
||||
import 'widgets/drama_comments_sheet.dart';
|
||||
import 'widgets/episode_picker_cell.dart';
|
||||
|
||||
const double _episodeCellAspect = 1.05;
|
||||
import 'widgets/episode_picker_sheet.dart';
|
||||
|
||||
class PlayerLogic extends ChangeNotifier {
|
||||
PlayerLogic({
|
||||
@@ -628,12 +625,10 @@ class PlayerLogic extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<void> showEpisodes(BuildContext context) async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final entry = queue.entryAt(session.currentIndex);
|
||||
final drama = await _withFullEpisodes(context, entry.drama);
|
||||
if (!context.mounted) return;
|
||||
final homeFeed = feedDramas != null;
|
||||
final episodes = drama.episodes;
|
||||
final currentNumber = entry.episode.number;
|
||||
session.setOverlayOpen(true);
|
||||
await session.playbackSettled;
|
||||
@@ -644,62 +639,13 @@ class PlayerLogic extends ChangeNotifier {
|
||||
try {
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: AppColors.ink,
|
||||
showDragHandle: true,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.sizeOf(sheetContext).height * 0.46,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
l10n.episodes,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 16),
|
||||
child: Text(
|
||||
localizedDramaTitle(l10n, drama),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.muted,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 6,
|
||||
mainAxisSpacing: 10,
|
||||
crossAxisSpacing: 10,
|
||||
childAspectRatio: _episodeCellAspect,
|
||||
),
|
||||
itemCount: episodes.length,
|
||||
itemBuilder: (_, index) => _episodeCell(
|
||||
context,
|
||||
sheetContext,
|
||||
drama,
|
||||
episodes[index],
|
||||
index,
|
||||
homeFeed,
|
||||
currentNumber,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
isScrollControlled: true,
|
||||
builder: (_) => EpisodePickerSheet(
|
||||
drama: drama,
|
||||
currentNumber: currentNumber,
|
||||
onSelect: (index) =>
|
||||
_selectFromSheet(context, drama, index, homeFeed, currentNumber),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
@@ -724,37 +670,25 @@ class PlayerLogic extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _episodeCell(
|
||||
void _selectFromSheet(
|
||||
BuildContext pageContext,
|
||||
BuildContext sheetContext,
|
||||
Drama drama,
|
||||
Episode episode,
|
||||
int index,
|
||||
bool homeFeed,
|
||||
int currentNumber,
|
||||
) {
|
||||
final selected = episode.number == currentNumber;
|
||||
final l10n = AppLocalizations.of(pageContext)!;
|
||||
return EpisodePickerCell(
|
||||
episode: episode,
|
||||
selected: selected,
|
||||
lockLabel: l10n.locked,
|
||||
onTap: () {
|
||||
Navigator.of(sheetContext).pop();
|
||||
if (homeFeed) {
|
||||
if (episode.number == currentNumber) return;
|
||||
unawaited(openSeriesAt(pageContext, drama, index));
|
||||
return;
|
||||
}
|
||||
if (index == session.currentIndex) return;
|
||||
unawaited(
|
||||
pages.animateToPage(
|
||||
index,
|
||||
duration: const Duration(milliseconds: 260),
|
||||
curve: Curves.easeOutCubic,
|
||||
),
|
||||
);
|
||||
},
|
||||
if (homeFeed) {
|
||||
if (drama.episodes[index].number == currentNumber) return;
|
||||
unawaited(openSeriesAt(pageContext, drama, index));
|
||||
return;
|
||||
}
|
||||
if (index == session.currentIndex) return;
|
||||
unawaited(
|
||||
pages.animateToPage(
|
||||
index,
|
||||
duration: const Duration(milliseconds: 260),
|
||||
curve: Curves.easeOutCubic,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -839,8 +773,8 @@ class PlayerLogic extends ChangeNotifier {
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: AppColors.ink,
|
||||
showDragHandle: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
showDragHandle: false,
|
||||
builder: (_) => DramaCommentsSheet(drama: drama),
|
||||
);
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user