We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe. Add a hook for FixedExtentScrollController
Describe the solution you'd like
import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; /// Creates [FixedExtentScrollController] that will be disposed automatically. /// /// See also: /// - [FixedExtentScrollController] FixedExtentScrollController useFixedExtentScrollController({ int initialItem = 0, List<Object?>? keys, }) { return use( _FixedExtentScrollControllerHook( initialItem: initialItem, keys: keys, ), ); } class _FixedExtentScrollControllerHook extends Hook<FixedExtentScrollController> { const _FixedExtentScrollControllerHook({ required this.initialItem, super.keys, }); final int initialItem; @override HookState<FixedExtentScrollController, Hook<FixedExtentScrollController>> createState() => _FixedExtentScrollControllerHookState(); } class _FixedExtentScrollControllerHookState extends HookState< FixedExtentScrollController, _FixedExtentScrollControllerHook> { late final controller = FixedExtentScrollController( initialItem: hook.initialItem, ); @override FixedExtentScrollController build(BuildContext context) => controller; @override void dispose() => controller.dispose(); @override String get debugLabel => 'useFixedExtentScrollController'; }
Additional context
Example:
ListWheelScrollView( controller: scrollController, itemExtent: 25, squeeze: 0.8, onSelectedItemChanged: (value) { selected.value = value; }, children: counts.map( (index) => OnClick( onTap: () { selected.value = index; scrollController.jumpToItem(index); },
https://dartpad.dev/?id=a8d241f3fcc2f73a43b77860e6b5f066
The text was updated successfully, but these errors were encountered:
Sure. Feel free to raise a PR with the relevant tests
Sorry, something went wrong.
useFixedExtentScrollController
rrousselGit
Successfully merging a pull request may close this issue.
Is your feature request related to a problem? Please describe.
Add a hook for FixedExtentScrollController
Describe the solution you'd like
Additional context
Example:
https://dartpad.dev/?id=a8d241f3fcc2f73a43b77860e6b5f066
The text was updated successfully, but these errors were encountered: