scrollable.dart 21.9 KB
Newer Older
1 2 3 4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'dart:async';
6

7
import 'package:flutter/foundation.dart';
8
import 'package:flutter/gestures.dart';
9
import 'package:flutter/rendering.dart';
10
import 'package:flutter/scheduler.dart';
11 12 13 14

import 'basic.dart';
import 'framework.dart';
import 'gesture_detector.dart';
15
import 'notification_listener.dart';
16
import 'scroll_configuration.dart';
17
import 'scroll_context.dart';
18
import 'scroll_controller.dart';
19
import 'scroll_physics.dart';
20
import 'scroll_position.dart';
21
import 'scroll_position_with_single_context.dart';
22
import 'ticker_provider.dart';
23 24 25 26
import 'viewport.dart';

export 'package:flutter/physics.dart' show Tolerance;

27 28
/// Signature used by [Scrollable] to build the viewport through which the
/// scrollable content is displayed.
29 30
typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position);

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
/// A widget that scrolls.
///
/// [Scrollable] implements the interaction model for a scrollable widget,
/// including gesture recognition, but does not have an opinion about how the
/// viewport, which actually displays the children, is constructed.
///
/// It's rare to construct a [Scrollable] directly. Instead, consider [ListView]
/// or [GridView], which combine scrolling, viewporting, and a layout model. To
/// combine layout models (or to use a custom layout mode), consider using
/// [CustomScrollView].
///
/// The static [Scrollable.of] and [Scrollable.ensureVisible] functions are
/// often used to interact with the [Scrollable] widget inside a [ListView] or
/// a [GridView].
///
/// To further customize scrolling behavior with a [Scrollable]:
///
/// 1. You can provide a [viewportBuilder] to customize the child model. For
///    example, [SingleChildScrollView] uses a viewport that displays a single
///    box child whereas [CustomScrollView] uses a [Viewport] or a
///    [ShrinkWrappingViewport], both of which display a list of slivers.
///
/// 2. You can provide a custom [ScrollController] that creates a custom
///    [ScrollPosition] subclass. For example, [PageView] uses a
///    [PageController], which creates a page-oriented scroll position subclass
///    that keeps the same page visible when the [Scrollable] resizes.
///
/// See also:
///
///  * [ListView], which is a commonly used [ScrollView] that displays a
///    scrolling, linear list of child widgets.
///  * [PageView], which is a scrolling list of child widgets that are each the
///    size of the viewport.
///  * [GridView], which is a [ScrollView] that displays a scrolling, 2D array
///    of child widgets.
///  * [CustomScrollView], which is a [ScrollView] that creates custom scroll
///    effects using slivers.
///  * [SingleChildScrollView], which is a scrollable widget that has a single
///    child.
70
///  * [ScrollNotification] and [NotificationListener], which can be used to watch
71
///    the scroll position without using a [ScrollController].
Adam Barth's avatar
Adam Barth committed
72
class Scrollable extends StatefulWidget {
73 74 75
  /// Creates a widget that scrolls.
  ///
  /// The [axisDirection] and [viewportBuilder] arguments must not be null.
76
  const Scrollable({
77 78
    Key key,
    this.axisDirection: AxisDirection.down,
79
    this.controller,
Adam Barth's avatar
Adam Barth committed
80
    this.physics,
81
    @required this.viewportBuilder,
82
    this.excludeFromSemantics: false,
83 84
  }) : assert(axisDirection != null),
       assert(viewportBuilder != null),
85
       assert(excludeFromSemantics != null),
86
       super (key: key);
87

88 89 90 91 92 93 94 95 96 97
  /// The direction in which this widget scrolls.
  ///
  /// For example, if the [axisDirection] is [AxisDirection.down], increasing
  /// the scroll position will cause content below the bottom of the viewport to
  /// become visible through the viewport. Similarly, if [axisDirection] is
  /// [AxisDirection.right], increasing the scroll position will cause content
  /// beyond the right edge of the viewport to become visible through the
  /// viewport.
  ///
  /// Defaults to [AxisDirection.down].
98 99
  final AxisDirection axisDirection;

100 101 102
  /// An object that can be used to control the position to which this widget is
  /// scrolled.
  ///
103 104 105 106 107 108 109 110
  /// A [ScrollController] serves several purposes. It can be used to control
  /// the initial scroll position (see [ScrollController.initialScrollOffset]).
  /// It can be used to control whether the scroll view should automatically
  /// save and restore its scroll position in the [PageStorage] (see
  /// [ScrollController.keepScrollOffset]). It can be used to read the current
  /// scroll position (see [ScrollController.offset]), or change it (see
  /// [ScrollController.animateTo]).
  ///
111 112 113 114
  /// See also:
  ///
  ///  * [ensureVisible], which animates the scroll position to reveal a given
  ///    [BuildContext].
115 116
  final ScrollController controller;

117 118 119 120 121
  /// How the widgets should respond to user input.
  ///
  /// For example, determines how the widget continues to animate after the
  /// user stops dragging the scroll view.
  ///
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
  /// Defaults to matching platform conventions via the physics provided from
  /// the ambient [ScrollConfiguration].
  ///
  /// The physics can be changed dynamically, but new physics will only take
  /// effect if the _class_ of the provided object changes. Merely constructing
  /// a new instance with a different configuration is insufficient to cause the
  /// physics to be reapplied. (This is because the final object used is
  /// generated dynamically, which can be relatively expensive, and it would be
  /// inefficient to speculatively create this object each frame to see if the
  /// physics should be updated.)
  ///
  /// See also:
  ///
  ///  * [AlwaysScrollableScrollPhysics], which can be used to indicate that the
  ///    scrollable should react to scroll requests (and possible overscroll)
  ///    even if the scrollable's contents fit without scrolling being necessary.
Adam Barth's avatar
Adam Barth committed
138 139
  final ScrollPhysics physics;

140 141 142 143 144 145 146 147 148 149
  /// Builds the viewport through which the scrollable content is displayed.
  ///
  /// A typical viewport uses the given [ViewportOffset] to determine which part
  /// of its content is actually visible through the viewport.
  ///
  /// See also:
  ///
  ///  * [Viewport], which is a viewport that displays a list of slivers.
  ///  * [ShrinkWrappingViewport], which is a viewport that displays a list of
  ///    slivers and sizes itself based on the size of the slivers.
150
  final ViewportBuilder viewportBuilder;
151

152 153 154 155 156 157 158 159 160 161 162 163 164
  /// Whether the scroll actions introduced by this [Scrollable] are exposed
  /// in the semantics tree.
  ///
  /// Text fields with an overflow are usually scrollable to make sure that the
  /// user can get to the beginning/end of the entered text. However, these
  /// scrolling actions are generally not exposed to the semantics layer.
  ///
  /// See also:
  ///
  ///  * [GestureDetector.excludeFromSemantics], which is used to accomplish the
  ///    exclusion.
  final bool excludeFromSemantics;

165 166 167
  /// The axis along which the scroll view scrolls.
  ///
  /// Determined by the [axisDirection].
168 169 170
  Axis get axis => axisDirectionToAxis(axisDirection);

  @override
Adam Barth's avatar
Adam Barth committed
171
  ScrollableState createState() => new ScrollableState();
172 173

  @override
174
  void debugFillProperties(DiagnosticPropertiesBuilder description) {
175 176 177
    super.debugFillProperties(description);
    description.add(new EnumProperty<AxisDirection>('axisDirection', axisDirection));
    description.add(new DiagnosticsProperty<ScrollPhysics>('physics', physics));
178
  }
179 180 181 182 183 184

  /// The state from the closest instance of this class that encloses the given context.
  ///
  /// Typical usage is as follows:
  ///
  /// ```dart
Adam Barth's avatar
Adam Barth committed
185
  /// ScrollableState scrollable = Scrollable.of(context);
186
  /// ```
Adam Barth's avatar
Adam Barth committed
187
  static ScrollableState of(BuildContext context) {
188 189
    final _ScrollableScope widget = context.inheritFromWidgetOfExactType(_ScrollableScope);
    return widget?.scrollable;
190 191
  }

192 193
  /// Scrolls the scrollables that enclose the given context so as to make the
  /// given context visible.
194 195 196 197 198 199 200
  static Future<Null> ensureVisible(BuildContext context, {
    double alignment: 0.0,
    Duration duration: Duration.ZERO,
    Curve curve: Curves.ease,
  }) {
    final List<Future<Null>> futures = <Future<Null>>[];

Adam Barth's avatar
Adam Barth committed
201
    ScrollableState scrollable = Scrollable.of(context);
202
    while (scrollable != null) {
203 204 205 206 207 208
      futures.add(scrollable.position.ensureVisible(
        context.findRenderObject(),
        alignment: alignment,
        duration: duration,
        curve: curve,
      ));
209
      context = scrollable.context;
Adam Barth's avatar
Adam Barth committed
210
      scrollable = Scrollable.of(context);
211 212 213 214 215
    }

    if (futures.isEmpty || duration == Duration.ZERO)
      return new Future<Null>.value();
    if (futures.length == 1)
216
      return futures.single;
217
    return Future.wait<Null>(futures).then((List<Null> _) => null);
218
  }
219 220
}

221 222 223
// Enable Scrollable.of() to work as if ScrollableState was an inherited widget.
// ScrollableState.build() always rebuilds its _ScrollableScope.
class _ScrollableScope extends InheritedWidget {
224
  const _ScrollableScope({
225 226 227 228
    Key key,
    @required this.scrollable,
    @required this.position,
    @required Widget child
229 230 231
  }) : assert(scrollable != null),
       assert(child != null),
       super(key: key, child: child);
232 233 234 235 236 237 238 239 240 241

  final ScrollableState scrollable;
  final ScrollPosition position;

  @override
  bool updateShouldNotify(_ScrollableScope old) {
    return position != old.position;
  }
}

Adam Barth's avatar
Adam Barth committed
242
/// State object for a [Scrollable] widget.
243
///
Adam Barth's avatar
Adam Barth committed
244
/// To manipulate a [Scrollable] widget's scroll position, use the object
245 246
/// obtained from the [position] property.
///
Adam Barth's avatar
Adam Barth committed
247 248
/// To be informed of when a [Scrollable] widget is scrolling, use a
/// [NotificationListener] to listen for [ScrollNotification] notifications.
249 250
///
/// This class is not intended to be subclassed. To specialize the behavior of a
Adam Barth's avatar
Adam Barth committed
251 252
/// [Scrollable], provide it with a [ScrollPhysics].
class ScrollableState extends State<Scrollable> with TickerProviderStateMixin
253 254
    implements ScrollContext {
  /// The manager for this [Scrollable] widget's viewport position.
255
  ///
Adam Barth's avatar
Adam Barth committed
256
  /// To control what kind of [ScrollPosition] is created for a [Scrollable],
257 258
  /// provide it with custom [ScrollController] that creates the appropriate
  /// [ScrollPosition] in its [ScrollController.createScrollPosition] method.
259 260 261
  ScrollPosition get position => _position;
  ScrollPosition _position;

262 263 264
  @override
  AxisDirection get axisDirection => widget.axisDirection;

Adam Barth's avatar
Adam Barth committed
265
  ScrollBehavior _configuration;
266
  ScrollPhysics _physics;
267

268
  // Only call this from places that will definitely trigger a rebuild.
269
  void _updatePosition() {
Adam Barth's avatar
Adam Barth committed
270
    _configuration = ScrollConfiguration.of(context);
271
    _physics = _configuration.getScrollPhysics(context);
272 273 274
    if (widget.physics != null)
      _physics = widget.physics.applyTo(_physics);
    final ScrollController controller = widget.controller;
275 276
    final ScrollPosition oldPosition = position;
    if (oldPosition != null) {
277
      controller?.detach(oldPosition);
278 279 280
      // It's important that we not dispose the old position until after the
      // viewport has had a chance to unregister its listeners from the old
      // position. So, schedule a microtask to do it.
281 282
      scheduleMicrotask(oldPosition.dispose);
    }
283

284
    _position = controller?.createScrollPosition(_physics, this, oldPosition)
285
      ?? new ScrollPositionWithSingleContext(physics: _physics, context: this, oldPosition: oldPosition);
286
    assert(position != null);
287
    controller?.attach(position);
288 289 290
  }

  @override
291 292
  void didChangeDependencies() {
    super.didChangeDependencies();
293 294 295
    _updatePosition();
  }

296
  bool _shouldUpdatePosition(Scrollable oldWidget) {
297 298 299 300 301 302 303 304 305 306
    ScrollPhysics newPhysics = widget.physics;
    ScrollPhysics oldPhysics = oldWidget.physics;
    do {
      if (newPhysics?.runtimeType != oldPhysics?.runtimeType)
        return true;
      newPhysics = newPhysics?.parent;
      oldPhysics = oldPhysics?.parent;
    } while (newPhysics != null || oldPhysics != null);

    return widget.controller?.runtimeType != oldWidget.controller?.runtimeType;
307 308
  }

309
  @override
310 311
  void didUpdateWidget(Scrollable oldWidget) {
    super.didUpdateWidget(oldWidget);
312

313 314 315
    if (widget.controller != oldWidget.controller) {
      oldWidget.controller?.detach(position);
      widget.controller?.attach(position);
316 317
    }

318
    if (_shouldUpdatePosition(oldWidget))
319 320 321 322 323
      _updatePosition();
  }

  @override
  void dispose() {
324
    widget.controller?.detach(position);
325 326 327 328 329
    position.dispose();
    super.dispose();
  }


330 331 332
  // SEMANTICS

  final GlobalKey _excludableScrollSemanticsKey = new GlobalKey();
333 334 335 336 337 338 339 340 341

  @override
  @protected
  void setSemanticsActions(Set<SemanticsAction> actions) {
    if (_gestureDetectorKey.currentState != null)
      _gestureDetectorKey.currentState.replaceSemanticsActions(actions);
  }


342 343 344 345 346 347 348 349 350 351 352 353
  // GESTURE RECOGNITION AND POINTER IGNORING

  final GlobalKey<RawGestureDetectorState> _gestureDetectorKey = new GlobalKey<RawGestureDetectorState>();
  final GlobalKey _ignorePointerKey = new GlobalKey();

  // This field is set during layout, and then reused until the next time it is set.
  Map<Type, GestureRecognizerFactory> _gestureRecognizers = const <Type, GestureRecognizerFactory>{};
  bool _shouldIgnorePointer = false;

  bool _lastCanDrag;
  Axis _lastAxisDirection;

354 355 356
  @override
  @protected
  void setCanDrag(bool canDrag) {
357
    if (canDrag == _lastCanDrag && (!canDrag || widget.axis == _lastAxisDirection))
358 359 360 361
      return;
    if (!canDrag) {
      _gestureRecognizers = const <Type, GestureRecognizerFactory>{};
    } else {
362
      switch (widget.axis) {
363 364
        case Axis.vertical:
          _gestureRecognizers = <Type, GestureRecognizerFactory>{
365 366 367 368 369 370 371 372 373 374 375 376 377 378
            VerticalDragGestureRecognizer: new GestureRecognizerFactoryWithHandlers<VerticalDragGestureRecognizer>(
              () => new VerticalDragGestureRecognizer(),
              (VerticalDragGestureRecognizer instance) {
                instance
                  ..onDown = _handleDragDown
                  ..onStart = _handleDragStart
                  ..onUpdate = _handleDragUpdate
                  ..onEnd = _handleDragEnd
                  ..onCancel = _handleDragCancel
                  ..minFlingDistance = _physics?.minFlingDistance
                  ..minFlingVelocity = _physics?.minFlingVelocity
                  ..maxFlingVelocity = _physics?.maxFlingVelocity;
              },
            ),
379 380 381 382
          };
          break;
        case Axis.horizontal:
          _gestureRecognizers = <Type, GestureRecognizerFactory>{
383 384 385 386 387 388 389 390 391 392 393 394 395 396
            HorizontalDragGestureRecognizer: new GestureRecognizerFactoryWithHandlers<HorizontalDragGestureRecognizer>(
              () => new HorizontalDragGestureRecognizer(),
              (HorizontalDragGestureRecognizer instance) {
                instance
                  ..onDown = _handleDragDown
                  ..onStart = _handleDragStart
                  ..onUpdate = _handleDragUpdate
                  ..onEnd = _handleDragEnd
                  ..onCancel = _handleDragCancel
                  ..minFlingDistance = _physics?.minFlingDistance
                  ..minFlingVelocity = _physics?.minFlingVelocity
                  ..maxFlingVelocity = _physics?.maxFlingVelocity;
              },
            ),
397 398 399 400 401
          };
          break;
      }
    }
    _lastCanDrag = canDrag;
402
    _lastAxisDirection = widget.axis;
403 404 405 406
    if (_gestureDetectorKey.currentState != null)
      _gestureDetectorKey.currentState.replaceGestureRecognizers(_gestureRecognizers);
  }

407 408 409 410 411 412
  @override
  TickerProvider get vsync => this;

  @override
  @protected
  void setIgnorePointer(bool value) {
413 414 415 416
    if (_shouldIgnorePointer == value)
      return;
    _shouldIgnorePointer = value;
    if (_ignorePointerKey.currentContext != null) {
417
      final RenderIgnorePointer renderBox = _ignorePointerKey.currentContext.findRenderObject();
418 419 420 421
      renderBox.ignoring = _shouldIgnorePointer;
    }
  }

422
  @override
423
  BuildContext get notificationContext => _gestureDetectorKey.currentContext;
424

425 426 427
  @override
  BuildContext get storageContext => context;

428 429
  // TOUCH HANDLERS

430
  Drag _drag;
431
  ScrollHoldController _hold;
432 433 434

  void _handleDragDown(DragDownDetails details) {
    assert(_drag == null);
435 436
    assert(_hold == null);
    _hold = position.hold(_disposeHold);
437 438 439
  }

  void _handleDragStart(DragStartDetails details) {
Ian Hickson's avatar
Ian Hickson committed
440 441 442
    // It's possible for _hold to become null between _handleDragDown and
    // _handleDragStart, for example if some user code calls jumpTo or otherwise
    // triggers a new activity to begin.
443
    assert(_drag == null);
444
    _drag = position.drag(details, _disposeDrag);
445
    assert(_drag != null);
446
    assert(_hold == null);
447 448 449
  }

  void _handleDragUpdate(DragUpdateDetails details) {
450
    // _drag might be null if the drag activity ended and called _disposeDrag.
451
    assert(_hold == null || _drag == null);
452
    _drag?.update(details);
453 454 455
  }

  void _handleDragEnd(DragEndDetails details) {
456
    // _drag might be null if the drag activity ended and called _disposeDrag.
457
    assert(_hold == null || _drag == null);
458
    _drag?.end(details);
459 460 461
    assert(_drag == null);
  }

462
  void _handleDragCancel() {
463
    // _hold might be null if the drag started.
464
    // _drag might be null if the drag activity ended and called _disposeDrag.
465 466
    assert(_hold == null || _drag == null);
    _hold?.cancel();
467
    _drag?.cancel();
468
    assert(_hold == null);
469 470 471
    assert(_drag == null);
  }

472 473 474 475
  void _disposeHold() {
    _hold = null;
  }

476
  void _disposeDrag() {
477 478 479
    _drag = null;
  }

480 481 482 483 484 485 486

  // DESCRIPTION

  @override
  Widget build(BuildContext context) {
    assert(position != null);
    // TODO(ianh): Having all these global keys is sad.
487
    Widget result = new RawGestureDetector(
488 489 490 491 492 493 494 495 496 497 498 499 500 501
      key: _gestureDetectorKey,
      gestures: _gestureRecognizers,
      behavior: HitTestBehavior.opaque,
      excludeFromSemantics: widget.excludeFromSemantics,
      child: new Semantics(
        explicitChildNodes: !widget.excludeFromSemantics,
        child: new IgnorePointer(
          key: _ignorePointerKey,
          ignoring: _shouldIgnorePointer,
          ignoringSemantics: false,
          child: new _ScrollableScope(
            scrollable: this,
            position: position,
            child: widget.viewportBuilder(context, position),
502
          ),
503
        ),
504 505
      ),
    );
506 507 508 509 510

    if (!widget.excludeFromSemantics) {
      result = new _ExcludableScrollSemantics(
        key: _excludableScrollSemanticsKey,
        child: result,
511
        position: position,
512 513 514
      );
    }

515
    return _configuration.buildViewportChrome(context, result, widget.axisDirection);
516 517 518
  }

  @override
519
  void debugFillProperties(DiagnosticPropertiesBuilder description) {
520 521
    super.debugFillProperties(description);
    description.add(new DiagnosticsProperty<ScrollPosition>('position', position));
522 523
  }
}
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539

/// With [_ExcludableScrollSemantics] certain child [SemanticsNode]s can be
/// excluded from the scrollable area for semantics purposes.
///
/// Nodes, that are to be excluded, have to be tagged with
/// [RenderViewport.excludeFromScrolling] and the [RenderAbstractViewport] in
/// use has to add the [RenderViewport.useTwoPaneSemantics] tag to its
/// [SemanticsConfiguration] by overriding
/// [RenderObject.describeSemanticsConfiguration].
///
/// If the tag [RenderViewport.useTwoPaneSemantics] is present on the viewport,
/// two semantics nodes will be used to represent the [Scrollable]: The outer
/// node will contain all children, that are excluded from scrolling. The inner
/// node, which is annotated with the scrolling actions, will house the
/// scrollable children.
class _ExcludableScrollSemantics extends SingleChildRenderObjectWidget {
540 541 542 543 544 545 546 547 548 549
  const _ExcludableScrollSemantics({
    Key key,
    @required this.position,
    Widget child
  }) : assert(position != null), super(key: key, child: child);

  final ScrollPosition position;

  @override
  _RenderExcludableScrollSemantics createRenderObject(BuildContext context) => new _RenderExcludableScrollSemantics(position: position);
550 551

  @override
552 553 554
  void updateRenderObject(BuildContext context, _RenderExcludableScrollSemantics renderObject) {
    renderObject.position = position;
  }
555 556 557
}

class _RenderExcludableScrollSemantics extends RenderProxyBox {
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
  _RenderExcludableScrollSemantics({
    @required ScrollPosition position,
    RenderBox child,
  }) : _position = position, assert(position != null), super(child) {
    position.addListener(markNeedsSemanticsUpdate);
  }

  /// Whether this render object is excluded from the semantic tree.
  ScrollPosition get position => _position;
  ScrollPosition _position;
  set position(ScrollPosition value) {
    assert(value != null);
    if (value == _position)
      return;
    _position.removeListener(markNeedsSemanticsUpdate);
    _position = value;
    _position.addListener(markNeedsSemanticsUpdate);
    markNeedsSemanticsUpdate();
  }
577 578 579 580 581

  @override
  void describeSemanticsConfiguration(SemanticsConfiguration config) {
    super.describeSemanticsConfiguration(config);
    config.isSemanticBoundary = true;
582 583 584 585 586 587
    if (position.haveDimensions) {
      config
          ..scrollPosition = _position.pixels
          ..scrollExtentMax = _position.maxScrollExtent
          ..scrollExtentMin = _position.minScrollExtent;
    }
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
  }

  SemanticsNode _innerNode;

  @override
  void assembleSemanticsNode(SemanticsNode node, SemanticsConfiguration config, Iterable<SemanticsNode> children) {
    if (children.isEmpty || !children.first.isTagged(RenderViewport.useTwoPaneSemantics)) {
      super.assembleSemanticsNode(node, config, children);
      return;
    }

    _innerNode ??= new SemanticsNode(showOnScreen: showOnScreen);
    _innerNode
      ..isMergedIntoParent = node.isPartOfNodeMerging
      ..rect = Offset.zero & node.rect.size;

    final List<SemanticsNode> excluded = <SemanticsNode>[_innerNode];
    final List<SemanticsNode> included = <SemanticsNode>[];
    for (SemanticsNode child in children) {
      assert(child.isTagged(RenderViewport.useTwoPaneSemantics));
      if (child.isTagged(RenderViewport.excludeFromScrolling))
        excluded.add(child);
      else
        included.add(child);
    }
    node.updateWith(config: null, childrenInInversePaintOrder: excluded);
    _innerNode.updateWith(config: config, childrenInInversePaintOrder: included);
  }

617 618 619 620
  @override
  void clearSemantics() {
    super.clearSemantics();
    _innerNode = null;
621 622
  }
}