useScrollController function
A ScrollController of the first build, whose scrollable starts at
initialScrollOffset, made anew when the keys of a build differ from the
last one's.
HookBuilder(
builder: (context) {
final controller = useScrollController();
return KeyBindings({
'g': () => controller.jumpTo(0),
}, child: SingleChildScrollView(
controller: controller,
child: Text(files.join('\n')),
));
},
)
Implementation
ScrollController useScrollController({
int initialScrollOffset = 0,
List<Object?>? keys,
}) => use(
_ControllerHook(
() => ScrollController(initialScrollOffset: initialScrollOffset),
keys,
'useScrollController',
),
);