Files
FlutterUnit/lib/views/widgets/MultiChildRenderObjectWidget/NestedScrollViewViewport/node1_base.dart
2021-03-27 16:38:32 +08:00

40 lines
1.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
/// create by 张风捷特烈 on 2020/9/21
/// contact me by email 1981462002@qq.com
/// 说明: 344 NestedScrollViewViewport 嵌套滑动视口
/// 在 NestedScrollView 中使用的视口,该视口持有 SliverOverlapAbsorberHandle会在视口需要重新计算布局时通知它。例如当滚动它时。
///
// {
// "widgetId": 344,
// "name": 'NestedScrollViewViewport 介绍',
// "priority": 1,
// "subtitle":
// "【offset】 : *偏移 【ViewportOffset】\n"
// "【handle】 : *处理器 【SliverOverlapAbsorberHandle】\n"
// "【axisDirection】 : 轴向 【AxisDirection】\n"
// "【crossAxisDirection】 : 交叉轴向 【AxisDirection】\n"
// "【slivers】 : 子组件 【List<Widget>】\n"
// "【clipBehavior】 : 裁剪行为 【Clip】\n"
// "【anchor】 : 锚点 【double】",
// }
class NestedScrollViewViewportDemo extends StatelessWidget {
final String info =
'NestedScrollViewViewport 在源码中只有一处使用:'
'_NestedScrollViewCustomScrollView 继承自 CustomScrollView复写了 buildViewport 方法,返回 NestedScrollViewViewport 。'
'而 NestedScrollView 构建时使用了 _NestedScrollViewCustomScrollView也就是 NestedScrollView 的视口依赖于 NestedScrollViewViewport。'
'NestedScrollViewViewport 的特点是持有 SliverOverlapAbsorberHandle 类对象 handle源码中该 handle 在 NestedScrollViewState 中初始化。'
'可通过上下文获取,用于 SliverOverlapAbsorber/SliverOverlapInjector 组件,使用详见相关组件。';
@override
Widget build(BuildContext context) {
return Container(
color: Colors.blue.withOpacity(0.1),
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
child: Text(info),
);
}
}