问题描述
我正在尝试制作一个颤振的网站。我想在部分之间进行一页滚动(当用户向下使用滚轮时,我希望页面滚动到前一个部分下的部分,反之亦然)。此外,我希望有一个起始页面,在向下滚动到固定的应用程序栏后,某些徽标会移动。为了获得它,我使用了 CustomScrollView 和 SliverAppBar 顶部和 SliverList 与下面的一些部分。
一些带有 CustomScrollView 的主页小部件:
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CustomScrollView(
slivers: [
NavigationBar(),Sections(),],);
}
}
以及小部件导航栏和部分:
class NavigationBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SliverAppBar(
title: //Some widgets in the pinnedappbar,pinned: true,backgroundColor: AppTheme.darkTheme.colorScheme.primary,expandedHeight: MediaQuery.of(context).size.height,flexibleSpace: //some logo that would move to the pinned appbar,),);
}
}
class Sections extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SliverList(
delegate: SliverChildListDelegate([
First(),Second(),Third(),]),);
}
}
部分:第一、第二、第三部分只是带有背景颜色的容器小部件,所以我不会在这里粘贴它们。 为了可视化问题,我还将粘贴一些图像:
The starting page with a flexible space
The first section after one use of a scroll wheel
The second and the third one as well
问题是如何使一页在每个元素之间滚动:扩展的应用栏和下面的各个部分。 是否有滚动监听器和一些滚动到页面上特定元素的方法?
我还想补充一点,我已经尝试过使用 PageView,但在桌面设备上它无法正常工作,因为当您必须在短时间内滚动多次才能使页面移动到另一个页面时一个,它也不能解决扩展导航栏的问题。
提前感谢您的帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)