-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: animationAnimation APIsAnimation APIsc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: googleVarious Google teamsVarious Google teamsf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Use case
When building for TV apps, the most common widget is a horizontal list (or row of cards), that can react to the D'Pad navigation. Flutter unlocks the D'pad navigation by using the Shortcuts widget. But currently when moving from one node to the other node, there is no smooth animation the whole row flashes to the next item.
It is desired to have a smooth horizontal animation or at latest as an option to so we don't have to build our own, scrolling.
More context
Proposal
This can be achieved by exposing the duration and curve arguments in the _focusAndEnsureVisible method.
void _focusAndEnsureVisible(
FocusNode node, {
ScrollPositionAlignmentPolicy alignmentPolicy = ScrollPositionAlignmentPolicy.explicit,
}) {
node.requestFocus();
Scrollable.ensureVisible(node.context!, alignment: 1.0, alignmentPolicy: alignmentPolicy);
}Will become
void _focusAndEnsureVisible(FocusNode node, { Duration duration, Curve curve,
ScrollPositionAlignmentPolicy alignmentPolicy =
ScrollPositionAlignmentPolicy.explicit}) {
node.requestFocus();
Scrollable.ensureVisible(
node.context!,
alignment: 1.0,
alignmentPolicy: alignmentPolicy,
duration: duration,
curve: curve,
);
}etienn01
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: animationAnimation APIsAnimation APIsc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: googleVarious Google teamsVarious Google teamsf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.