fix(flutter): feed rail 底部对齐并复用播放页更多
This commit is contained in:
1 parent
e800f5971f
commit
7e415f6f4f
5 files changed
+15
-86
No files matched your search
@@ -434,13 +434,11 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
|||||||
onDownload: () => requestEpisodeDownload(context, episode.id),
|
onDownload: () => requestEpisodeDownload(context, episode.id),
|
||||||
onClear: () => setState(() => _chromeVisible = false),
|
onClear: () => setState(() => _chromeVisible = false),
|
||||||
onSearch: widget.onSearch ?? () => logic.showDiscover(context),
|
onSearch: widget.onSearch ?? () => logic.showDiscover(context),
|
||||||
|
onMore: () => _openMore(context, episode),
|
||||||
onScrubStart: ready ? () => logic.beginScrub(videoPort!) : null,
|
onScrubStart: ready ? () => logic.beginScrub(videoPort!) : null,
|
||||||
onSeek: ready
|
onSeek: ready
|
||||||
? (position) => logic.seekTo(context, videoPort!, position)
|
? (position) => logic.seekTo(context, videoPort!, position)
|
||||||
: null,
|
: null,
|
||||||
onPip: logic.pictureInPicture.isPlatformSupported
|
|
||||||
? () => unawaited(logic.enterPip(context))
|
|
||||||
: null,
|
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
PlayerPlaybackOverlay(
|
PlayerPlaybackOverlay(
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class HomeFeedOverlay extends StatefulWidget {
|
|||||||
required this.onDownload,
|
required this.onDownload,
|
||||||
required this.onClear,
|
required this.onClear,
|
||||||
required this.onSearch,
|
required this.onSearch,
|
||||||
|
required this.onMore,
|
||||||
required this.onTogglePlay,
|
required this.onTogglePlay,
|
||||||
required this.onBoostStart,
|
required this.onBoostStart,
|
||||||
required this.onBoostEnd,
|
required this.onBoostEnd,
|
||||||
@@ -65,7 +66,6 @@ class HomeFeedOverlay extends StatefulWidget {
|
|||||||
this.favoriteCount,
|
this.favoriteCount,
|
||||||
this.commentCount,
|
this.commentCount,
|
||||||
this.authorNote = '',
|
this.authorNote = '',
|
||||||
this.onPip,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final AppLocalizations l10n;
|
final AppLocalizations l10n;
|
||||||
@@ -91,8 +91,8 @@ class HomeFeedOverlay extends StatefulWidget {
|
|||||||
final VoidCallback onDownload;
|
final VoidCallback onDownload;
|
||||||
final VoidCallback onClear;
|
final VoidCallback onClear;
|
||||||
final VoidCallback onSearch;
|
final VoidCallback onSearch;
|
||||||
|
final VoidCallback onMore;
|
||||||
final VoidCallback onTogglePlay;
|
final VoidCallback onTogglePlay;
|
||||||
final VoidCallback? onPip;
|
|
||||||
final VoidCallback? onScrubStart;
|
final VoidCallback? onScrubStart;
|
||||||
final ValueChanged<Duration>? onSeek;
|
final ValueChanged<Duration>? onSeek;
|
||||||
final VoidCallback onBoostStart;
|
final VoidCallback onBoostStart;
|
||||||
@@ -137,9 +137,9 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
|||||||
_header(context),
|
_header(context),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: const Alignment(1.0, 0.80),
|
alignment: Alignment.bottomRight,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 0, 10, 16),
|
padding: const EdgeInsets.fromLTRB(0, 0, 10, 12),
|
||||||
child: _rail(),
|
child: _rail(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -160,7 +160,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
|||||||
widget.onBoostStart();
|
widget.onBoostStart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_openMore(context);
|
widget.onMore();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _boostHint() {
|
Widget _boostHint() {
|
||||||
@@ -209,7 +209,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
|||||||
glyphSize: _topIconGlyph,
|
glyphSize: _topIconGlyph,
|
||||||
refreshing: _refreshing,
|
refreshing: _refreshing,
|
||||||
onTap: _refresh,
|
onTap: _refresh,
|
||||||
onLongPress: () => _openMore(context),
|
onLongPress: widget.onMore,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
@@ -506,18 +506,4 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
|||||||
context,
|
context,
|
||||||
).showSnackBar(SnackBar(content: Text(widget.l10n.comingSoon)));
|
).showSnackBar(SnackBar(content: Text(widget.l10n.comingSoon)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _openMore(BuildContext context) async {
|
|
||||||
await showModalBottomSheet<void>(
|
|
||||||
context: context,
|
|
||||||
backgroundColor: AppColors.card,
|
|
||||||
showDragHandle: true,
|
|
||||||
builder: (sheetContext) => _FeedMoreSheet(
|
|
||||||
l10n: widget.l10n,
|
|
||||||
onDownload: widget.onDownload,
|
|
||||||
onPip: widget.onPip,
|
|
||||||
onClear: widget.onClear,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -294,65 +294,3 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FeedMoreSheet extends StatelessWidget {
|
|
||||||
const _FeedMoreSheet({
|
|
||||||
required this.l10n,
|
|
||||||
required this.onDownload,
|
|
||||||
required this.onClear,
|
|
||||||
this.onPip,
|
|
||||||
});
|
|
||||||
|
|
||||||
final AppLocalizations l10n;
|
|
||||||
final VoidCallback onDownload;
|
|
||||||
final VoidCallback onClear;
|
|
||||||
final VoidCallback? onPip;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SafeArea(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
ListTile(
|
|
||||||
key: const Key('home-feed-download'),
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.download_outlined,
|
|
||||||
color: AppColors.secondary,
|
|
||||||
),
|
|
||||||
title: Text(l10n.downloads),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
onDownload();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (onPip != null)
|
|
||||||
ListTile(
|
|
||||||
key: const Key('home-feed-pip'),
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.picture_in_picture_alt_outlined,
|
|
||||||
color: AppColors.secondary,
|
|
||||||
),
|
|
||||||
title: Text(l10n.pictureInPicture),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
onPip!();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
key: const Key('home-feed-clear'),
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.fullscreen_rounded,
|
|
||||||
color: AppColors.secondary,
|
|
||||||
),
|
|
||||||
title: Text(l10n.clearScreen),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
onClear();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -125,6 +125,7 @@ void main() {
|
|||||||
onDownload: () {},
|
onDownload: () {},
|
||||||
onClear: () {},
|
onClear: () {},
|
||||||
onSearch: () {},
|
onSearch: () {},
|
||||||
|
onMore: () {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -215,6 +216,7 @@ void main() {
|
|||||||
onDownload: () {},
|
onDownload: () {},
|
||||||
onClear: () {},
|
onClear: () {},
|
||||||
onSearch: () {},
|
onSearch: () {},
|
||||||
|
onMore: () {},
|
||||||
onScrubStart: () {},
|
onScrubStart: () {},
|
||||||
onSeek: (value) => seeked = value,
|
onSeek: (value) => seeked = value,
|
||||||
),
|
),
|
||||||
@@ -356,6 +358,7 @@ void main() {
|
|||||||
onDownload: () {},
|
onDownload: () {},
|
||||||
onClear: () {},
|
onClear: () {},
|
||||||
onSearch: () {},
|
onSearch: () {},
|
||||||
|
onMore: () {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ void main() {
|
|||||||
|
|
||||||
expect(railTop, greaterThan(844 * 0.45));
|
expect(railTop, greaterThan(844 * 0.45));
|
||||||
expect(railBottom, lessThanOrEqualTo(infoTop));
|
expect(railBottom, lessThanOrEqualTo(infoTop));
|
||||||
|
expect(infoTop - railBottom, lessThanOrEqualTo(20));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should_boost_feed_on_side_long_press', (tester) async {
|
testWidgets('should_boost_feed_on_side_long_press', (tester) async {
|
||||||
@@ -151,7 +152,10 @@ void main() {
|
|||||||
await gesture.up();
|
await gesture.up();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.byKey(const Key('home-feed-clear')), findsOneWidget);
|
expect(find.byKey(const Key('player-more-sheet')), findsOneWidget);
|
||||||
|
expect(find.byKey(const Key('home-feed-clear')), findsNothing);
|
||||||
|
expect(find.byKey(const Key('home-feed-download')), findsNothing);
|
||||||
|
expect(find.byKey(const Key('home-feed-pip')), findsNothing);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should_restore_light_theme_after_leaving_feed_tab', (
|
testWidgets('should_restore_light_theme_after_leaving_feed_tab', (
|
||||||
|
|||||||
Reference in new issue
Block a user