首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    Flutter 首页必用组件NestedScrollView

    今天介绍的组件是NestedScrollView,大部分的App首页都会用到这个组件。 NestedScrollView 可以在其内部嵌套其他滚动视图的组件,其滚动位置是固有链接的。...滚动隐藏AppBar 比如实现如下场景,当列表滚动时,隐藏AppBar,用法如下: NestedScrollView( headerSliverBuilder: (BuildContext context...(color: Colors.white, fontSize: 20), ), ); },itemCount: 20,), ) 效果如下: SliverAppBar展开折叠 用法如下: NestedScrollView...TextStyle(color: Colors.white, fontSize: 20), ), ); },itemCount: 20,), ) 效果如下: 与TabBar配合使用 用法如下: NestedScrollView...SliverPersistentHeaderDelegate oldDelegate) { return true; } } 效果如下: 其他属性 通过scrollDirection和reverse参数控制其滚动方向,用法如下: NestedScrollView

    4.3K10

    CoordinatorLayout使用(三):NestedScrollView & 嵌套滑动事件

    简单了解 有一个类,叫 NestedScrollView: ?...NestedScrollView 直接从源码看,可以知道, 它既是一个 NestedScrollingChild 也是一个 NestedScrollingParent 换句话说, 即可以 接收事件,...---- 嵌套滑动事件 简单实例 注意: 这里是用 事件流中 嵌套滑动事件 去处理的 我们可以用NestedScrollView做事件发送,给外面的Parent发事件, 再传递给Behavior...效果 我们可以得到, 右边 滑动,左边随着滑动 左边单独滑动,右边不动 和前面提到的逻辑是一样的, 因为Parent会传递给左边 ---- 再添加一个NestedScrollView 我们知道 NestedScrollView...可以发送事件给外面的Parent, 也就是CoordinatorLayout 那如果我们再添加一个 NestedScrollView 那应该都可以发送滑动事件 <?

    10.7K40

    踩坑记 | Flutter升级影响了NestedScrollView?

    嗨,我是哈利迪~最近有个bug排查了好几天,就是有个老页面因业务复杂度,使用了NestedScrollView+tab+多Fragment的结构(各Fragment里有RecyclerView,即存在嵌套滑动...果然对NestedScrollView进行了改动,看一下这个类: 1.0.0: class NestedScrollView extends FrameLayout implements NestedScrollingParent2...NestedScrollView 简析 那么接下来我们来看看1.1.0里NestedScrollView都改了写啥,先来捋下NestedScrollView的继承关系: [007S8ZIlly1ghf3b0k2voj316a0pedjc.jpg...[007S8ZIlly1ghf2ej40ryj306406aabd.jpg] 代码仅供演示,非必要情况下并不推荐NestedScrollView和RecyclerView的嵌套。...相比NestedScrollView,RecyclerView只实现了NestedScrollingChild2,在嵌套滑动体系里只能作为子布局存在,所以下面以RecyclerView为子,NestedScrollView

    97800

    踩坑记 | Flutter升级影响了NestedScrollView?

    嗨,我是哈利迪~最近有个bug排查了好几天,就是有个老页面因业务复杂度,使用了NestedScrollView+tab+多Fragment的结构(各Fragment里有RecyclerView,即存在嵌套滑动...果然对NestedScrollView进行了改动,看一下这个类: 1.0.0: class NestedScrollView extends FrameLayout implements NestedScrollingParent2...NestedScrollView 简析 那么接下来我们来看看1.1.0里NestedScrollView都改了写啥,先来捋下NestedScrollView的继承关系: ?...代码仅供演示,非必要情况下并不推荐NestedScrollView和RecyclerView的嵌套。...相比NestedScrollView,RecyclerView只实现了NestedScrollingChild2,在嵌套滑动体系里只能作为子布局存在,所以下面以RecyclerView为子,NestedScrollView

    82220

    Flutter NestedScrollView实现的一个经典滑动折叠头部图片的效果

    Flutter NestedScrollView 滑动组件是用来处理复杂情况下的滑动应用场景,如向上滑动视图时,要折叠隐藏一部分内容,这时候就需要使用到 NestedScrollView 与 SliverAppBar...在本节中是使用 NestedScrollView 结合 SliverAppBar 与 TabBar 、TabBarView 实现的折叠头部效果undefined 【x1】微信公众号的每日提醒 随时随记.../// 处理滑动 body: buildNestedScrollView(), ); } buildNestedScrollView 方法就是构建了一个滑动布局 NestedScrollView...,其中两部分,头部使用的是 SliverAppBar 来触发折叠效果, body 用来配置页面主体部分,代码如下: ///构建滑动布局 ///如下图1-1所示 NestedScrollView...buildNestedScrollView() { return NestedScrollView( headerSliverBuilder: (BuildContext context

    2.8K11

    炫酷~RecyclerView视差装饰器-ParallaxDecoration

    老规矩,先上图,看看是不是你想要的,美团效果: 最终效果: 来一个图形分析 接下来我要写一个简单示例,先分析一下布局,见下图,最外层是NestedScrollView,之后嵌套一个LinearLayout...头部,中间TabLayout选择器,底部一个ViewPager ViewPager高度需要动态控制,看自己的需求了,如果是美团那种效果,就是ViewPager高度 = NestedScrollView高度...TabLayout高度 话不多说,代码实现 接下来我写一个例子,如果按照普通控件的嵌套方式来实现,那么肯定存在滑动冲突,会出现RecyclerView先进行滑动其次才是ScrollView滑动,那么就需要先重写NestedScrollView...NestedScrollView重写 需要继承自NestedScrollView并重写onStartNestedScroll和onNestedPreScroll方法,如下 package com.cyn.mt.../** * @author cyn */ class CoordinatorScrollview : NestedScrollView, NestedScrollingParent2 {

    77100

    扫码

    添加站长 进交流群

    领取专属 10元无门槛券

    手把手带您无忧上云

    扫码加入开发者社群

    相关资讯

    热门标签

    活动推荐

      运营活动

      活动名称
      广告关闭
      领券