ScrollBuilder class
A builder widget that adds RefreshIndicator and Scrollbar to scrollable widgets.
This widget simplifies adding pull-to-refresh and scrollbar functionality to ListView or SingleChildScrollView. Perfect for list views with refresh capability and desktop/web scrollbar support.
Features:
- Easy pull-to-refresh integration
- Platform-specific scrollbar (desktop/web)
- Automatic ScrollController management
- Custom ScrollController support
- Interactive scrollbar with visibility controls
- Simple builder pattern
Example:
ScrollBuilder(
onRefresh: () async {
await refreshData();
},
showScrollbarWhenDesktopOrWeb: true,
builder: (context, controller) {
return ListView.builder(
controller: controller,
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(items[index].title),
);
},
);
},
)
スクロール可能なウィジェットにRefreshIndicatorとScrollbarを追加するビルダーウィジェット。
このウィジェットはListViewやSingleChildScrollViewに プルトゥリフレッシュとスクロールバー機能を追加することを簡素化します。 リフレッシュ機能とデスクトップ/Webスクロールバーサポートを備えたリストビューに最適です。
特徴:
- 簡単なプルトゥリフレッシュ統合
- プラットフォーム固有のスクロールバー(デスクトップ/Web)
- 自動ScrollController管理
- カスタムScrollControllerサポート
- 表示制御付きインタラクティブスクロールバー
- シンプルなビルダーパターン
例:
ScrollBuilder(
onRefresh: () async {
await refreshData();
},
showScrollbarWhenDesktopOrWeb: true,
builder: (context, controller) {
return ListView.builder(
controller: controller,
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(items[index].title),
);
},
);
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ScrollBuilder
Constructors
-
ScrollBuilder({required Widget builder(BuildContext context, ScrollController controller), Key? key, Future<
void> onRefresh()?, ScrollController? controller, bool showScrollbarWhenDesktopOrWeb = true}) -
A builder widget that adds RefreshIndicator and Scrollbar to scrollable widgets.
const
Properties
- builder → Widget Function(BuildContext context, ScrollController controller)
-
Please pass a ListView or SingleChildScrollView to builder.
final
- controller → ScrollController?
-
An internal ScrollController is created and passed to builder. If you want to specify your own ScrollController, pass it to controller.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onRefresh
→ Future<
void> Function()? -
If onRefresh is not
null, a RefreshIndicator will be placed and Pull to Refresh will be enabled.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showScrollbarWhenDesktopOrWeb → bool
-
If showScrollbarWhenDesktopOrWeb is
true, a mouse scrollable scrollbar will be displayed only on PC or Web.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited