- override
Calls the widget's builder by default.
Subclasses can override this method to build the interior of their
scrollable widget. Scrollable wraps the returned widget in a
GestureDetector to observe the user's interaction with this widget and
to adjust the scroll offset accordingly.
The widgets used by this method should be widgets that provide a
layout-time callback that reports the sizes that are relevant to
the scroll offset (typically the size of the scrollable
container and the scrolled contents). Viewport provides an
onPaintOffsetUpdateNeeded callback for this purpose; GridViewport,
ListViewport, LazyListViewport, and LazyBlockViewport provide an
onExtentsChanged callback for this purpose.
This callback should be used to update the scroll behavior, if
necessary, and then to call updateGestureDetector to update
the gesture detectors accordingly.
Source
@override
Widget buildContent(BuildContext context) {
assert(config.style != null);
assert(config.focusKey != null);
assert(config.cursorColor != null);
bool focused = Focus.at(config.focusKey.currentContext);
_attachOrDetachKeyboard(focused);
if (_cursorTimer == null && focused && config.value.selection.isCollapsed)
_startCursorTimer();
else if (_cursorTimer != null && (!focused || !config.value.selection.isCollapsed))
_stopCursorTimer();
if (_selectionOverlay != null) {
if (focused) {
_selectionOverlay.update(config.value);
} else {
_selectionOverlay?.dispose();
_selectionOverlay = null;
}
}
return new ClipRect(
child: new _Editable(
value: _currentValue,
style: config.style,
cursorColor: config.cursorColor,
showCursor: _showCursor,
maxLines: config.maxLines,
selectionColor: config.selectionColor,
textScaleFactor: config.textScaleFactor ?? MediaQuery.of(context).textScaleFactor,
hideText: config.hideText,
onSelectionChanged: _handleSelectionChanged,
paintOffset: scrollOffsetToPixelDelta(scrollOffset),
onPaintOffsetUpdateNeeded: _handlePaintOffsetUpdateNeeded
)
);
}