Commit 2a813919 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Some semantics documentation. (#5922)

parent 2d4d1713
...@@ -13,14 +13,53 @@ import 'package:vector_math/vector_math_64.dart'; ...@@ -13,14 +13,53 @@ import 'package:vector_math/vector_math_64.dart';
import 'node.dart'; import 'node.dart';
/// The possible actions that can be conveyed from the operating system
/// accessibility APIs to a [SemanticsNode] object.
enum SemanticAction { enum SemanticAction {
/// The equivalent of a user briefly tapping the screen with the finger
/// without moving it.
tap, tap,
/// The equivalent of a user pressing and holding the screen with the finger
/// for a few seconds without moving it.
longPress, longPress,
/// The equivalent of a user moving their finger across the screen from right
/// to left.
///
/// This action should be recognized by controls that are horizontally
/// scrollable.
scrollLeft, scrollLeft,
/// The equivalent of a user moving their finger across the screen from left
/// to right.
///
/// This action should be recognized by controls that are horizontally
/// scrollable.
scrollRight, scrollRight,
/// The equivalent of a user moving their finger across the screen from
/// bottom to top.
///
/// This action should be recognized by controls that are vertically
/// scrollable.
scrollUp, scrollUp,
/// The equivalent of a user moving their finger across the screen from top
/// to bottom.
///
/// This action should be recognized by controls that are vertically
/// scrollable.
scrollDown, scrollDown,
/// A request to increase the value represented by the [SemanticsNode].
///
/// For example, this action might be recognized by a slider control.
increase, increase,
/// A request to decrease the value represented by the [SemanticsNode].
///
/// For example, this action might be recognized by a slider control.
decrease, decrease,
} }
...@@ -32,6 +71,11 @@ enum SemanticAction { ...@@ -32,6 +71,11 @@ enum SemanticAction {
/// [SemanticsNode.canBeTapped] is true, [handleSemanticScrollDown]() will only /// [SemanticsNode.canBeTapped] is true, [handleSemanticScrollDown]() will only
/// be called if [SemanticsNode.canBeScrolledVertically] is true, etc). /// be called if [SemanticsNode.canBeScrolledVertically] is true, etc).
abstract class SemanticActionHandler { // ignore: one_member_abstracts abstract class SemanticActionHandler { // ignore: one_member_abstracts
/// Called when the object implementing this interface receives a
/// [SemanticAction]. For example, if the user of an accessibility tool
/// instructs their device that they wish to tap a button, the [RenderObject]
/// behind that button would have its [performAction] method called with the
/// [SemanticAction.tap] action.
void performAction(SemanticAction action); void performAction(SemanticAction action);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment