|
5 | 5 | > * FocusNode:用于管理焦点的类。 |
6 | 6 | > * LayoutBuilder:一个响应父容器布局约束的构建器小部件,它允许根据父级的尺寸动态调整子小部件的布局。它特别适合用于自适应布局场景,确保 UI 在不同屏幕尺寸下都能合理显示。 |
7 | 7 | > * ScrollController:用于控制滚动视图的一个类。它允许你在代码中管理滚动位置、监听滚动事件等。 |
| 8 | +> * RawScrollbar:滚动条小部件,它允许你自定义滚动条的样式和行为。 |
| 9 | +
|
8 | 10 |
|
9 | 11 | ## FutureBuilder类 |
10 | 12 | ### 默认构造函数 |
@@ -124,4 +126,59 @@ ScrollController({ |
124 | 126 | | onAttach | void Function | 在控制器附加到 Scrollable 时调用的回调函数 | |
125 | 127 | | onDetach | void Function | 在控制器从 Scrollable 分离时调用的回调函数 | |
126 | 128 |
|
| 129 | +## RawScrollbar类 |
| 130 | +### 默认构造函数 |
| 131 | +```text |
| 132 | +RawScrollbar({ |
| 133 | + super.key, |
| 134 | + required this.child, |
| 135 | + this.controller, |
| 136 | + this.thumbVisibility, |
| 137 | + this.shape, |
| 138 | + this.radius, |
| 139 | + this.thickness, |
| 140 | + this.thumbColor, |
| 141 | + this.minThumbLength = _kMinThumbExtent, |
| 142 | + this.minOverscrollLength, |
| 143 | + this.trackVisibility, |
| 144 | + this.trackRadius, |
| 145 | + this.trackColor, |
| 146 | + this.trackBorderColor, |
| 147 | + this.fadeDuration = _kScrollbarFadeDuration, |
| 148 | + this.timeToFade = _kScrollbarTimeToFade, |
| 149 | + this.pressDuration = Duration.zero, |
| 150 | + this.notificationPredicate = defaultScrollNotificationPredicate, |
| 151 | + this.interactive, |
| 152 | + this.scrollbarOrientation, |
| 153 | + this.mainAxisMargin = 0.0, |
| 154 | + this.crossAxisMargin = 0.0, |
| 155 | + this.padding, |
| 156 | + }) |
| 157 | +``` |
127 | 158 |
|
| 159 | +### RawScrollbar(...)参数解析 |
| 160 | +| 参数名称 | 使用类型 | 参数介绍 | |
| 161 | +|-----------------------|-----------------------------------------------|--------------------------------------------------| |
| 162 | +| key | Key | 用于标识这个小部件,通常用于构建 widget 树时的性能优化 | |
| 163 | +| child | Widget | 必填参数,表示要包裹的子组件 | |
| 164 | +| controller | ScrollController | ScrollController 实例,用于控制和监听滚动事件 | |
| 165 | +| thumbVisibility | bool | 控制滑块的可见性,类型为 ScrollbarVisibility | |
| 166 | +| shape | OutlinedBorder | 用于定义滚动条的形状 | |
| 167 | +| radius | Radius | 定义滑块的圆角半径 | |
| 168 | +| thickness | double | 定义滑块的宽度 | |
| 169 | +| thumbColor | Color | 定义滑块的颜色 | |
| 170 | +| minThumbLength | double | 定义滑块的最小长度,默认为 _kMinThumbExtent | |
| 171 | +| minOverscrollLength | double | 定义滑块在超出可滚动区域时的最小长度 | |
| 172 | +| trackVisibility | bool | 控制轨道的可见性 | |
| 173 | +| trackRadius | Radius | 定义轨道的圆角半径 | |
| 174 | +| trackColor | Color | 定义轨道的颜色 | |
| 175 | +| trackBorderColor | Color | 定义轨道边框的颜色 | |
| 176 | +| fadeDuration | Duration | 定义滑块淡入淡出的持续时间,默认为 _kScrollbarFadeDuration | |
| 177 | +| timeToFade | Duration | 定义滑块消失的时间,默认为 _kScrollbarTimeToFade | |
| 178 | +| pressDuration | Duration | 定义滑块被按下的持续时间,默认为 Duration.zero | |
| 179 | +| notificationPredicate | bool Function | 定义通知的预测条件,默认为 defaultScrollNotificationPredicate | |
| 180 | +| interactive | bool | 定义滚动条是否支持交互 | |
| 181 | +| scrollbarOrientation | ScrollbarOrientation ScrollbarOrientation | 定义滚动条的方向(水平或垂直) | |
| 182 | +| mainAxisMargin | double | 定义滑块在主轴方向上的边距,默认为 0.0 | |
| 183 | +| crossAxisMargin | double | 定义滑块在交叉轴方向上的边距,默认为 0.0 | |
| 184 | +| padding | EdgeInsets | 定义滑块的内边距 | |
0 commit comments