fix: appbar滑动距离移除
This commit is contained in:
@ -17,12 +17,16 @@ class ScrollAppBar extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||||
final videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
|
final videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
|
||||||
|
double scrollDistance = scrollVal;
|
||||||
|
if (scrollVal > videoHeight - kToolbarHeight) {
|
||||||
|
scrollDistance = videoHeight - kToolbarHeight;
|
||||||
|
}
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: -videoHeight + scrollVal + kToolbarHeight + 0.5,
|
top: -videoHeight + scrollDistance + kToolbarHeight + 0.5,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
opacity: scrollVal / (videoHeight - kToolbarHeight),
|
opacity: scrollDistance / (videoHeight - kToolbarHeight),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: statusBarHeight + kToolbarHeight,
|
height: statusBarHeight + kToolbarHeight,
|
||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
Reference in New Issue
Block a user