Skip to content

Commit

Permalink
fix: appbar滑动距离移除
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 24, 2024
1 parent a925ef6 commit 7e7bb1f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/pages/video/detail/widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ class ScrollAppBar extends StatelessWidget {
Widget build(BuildContext context) {
final double statusBarHeight = MediaQuery.of(context).padding.top;
final videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
double scrollDistance = scrollVal;
if (scrollVal > videoHeight - kToolbarHeight) {
scrollDistance = videoHeight - kToolbarHeight;
}
return Positioned(
top: -videoHeight + scrollVal + kToolbarHeight + 0.5,
top: -videoHeight + scrollDistance + kToolbarHeight + 0.5,
left: 0,
right: 0,
child: Opacity(
opacity: scrollVal / (videoHeight - kToolbarHeight),
opacity: scrollDistance / (videoHeight - kToolbarHeight),
child: Container(
height: statusBarHeight + kToolbarHeight,
color: Theme.of(context).colorScheme.background,
Expand Down

0 comments on commit 7e7bb1f

Please sign in to comment.