mirror of
https://github.com/flutter/flutter
synced 2024-10-13 03:32:55 +00:00
use null aware operators for function invocations (#79049)
This commit is contained in:
parent
bc2c7954db
commit
e384ca7979
|
@ -25,9 +25,7 @@ class CategoryMenuPage extends StatelessWidget {
|
|||
GestureDetector(
|
||||
onTap: () {
|
||||
model.setCategory(category);
|
||||
if (onCategoryTap != null) {
|
||||
onCategoryTap!();
|
||||
}
|
||||
onCategoryTap?.call();
|
||||
},
|
||||
child: model.selectedCategory == category
|
||||
? Column(
|
||||
|
|
|
@ -27,9 +27,7 @@ class ColorPicker extends StatelessWidget {
|
|||
color: color,
|
||||
selected: color == selectedColor,
|
||||
onTap: () {
|
||||
if (onColorSelection != null) {
|
||||
onColorSelection!(color);
|
||||
}
|
||||
onColorSelection?.call(color);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
|
@ -59,9 +57,7 @@ class _ColorPickerSwatch extends StatelessWidget {
|
|||
child: RawMaterialButton(
|
||||
fillColor: color,
|
||||
onPressed: () {
|
||||
if (onTap != null) {
|
||||
onTap!();
|
||||
}
|
||||
onTap?.call();
|
||||
},
|
||||
child: !selected ? null : const Icon(
|
||||
Icons.check,
|
||||
|
|
|
@ -392,9 +392,7 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
|
|||
|
||||
// Handle the start of a gesture of _GestureType.
|
||||
void _onScaleStart(ScaleStartDetails details) {
|
||||
if (widget.onScaleStart != null) {
|
||||
widget.onScaleStart!(details);
|
||||
}
|
||||
widget.onScaleStart?.call(details);
|
||||
|
||||
if (_controller.isAnimating) {
|
||||
_controller.stop();
|
||||
|
@ -417,13 +415,11 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
|
|||
// Handle an update to an ongoing gesture of _GestureType.
|
||||
void _onScaleUpdate(ScaleUpdateDetails details) {
|
||||
double scale = _transform.getMaxScaleOnAxis();
|
||||
if (widget.onScaleUpdate != null) {
|
||||
widget.onScaleUpdate!(ScaleUpdateDetails(
|
||||
focalPoint: fromViewport(details.focalPoint, _transform),
|
||||
scale: details.scale,
|
||||
rotation: details.rotation,
|
||||
));
|
||||
}
|
||||
widget.onScaleUpdate?.call(ScaleUpdateDetails(
|
||||
focalPoint: fromViewport(details.focalPoint, _transform),
|
||||
scale: details.scale,
|
||||
rotation: details.rotation,
|
||||
));
|
||||
final Offset focalPointScene = fromViewport(
|
||||
details.focalPoint,
|
||||
_transform,
|
||||
|
@ -476,9 +472,7 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
|
|||
|
||||
// Handle the end of a gesture of _GestureType.
|
||||
void _onScaleEnd(ScaleEndDetails details) {
|
||||
if (widget.onScaleEnd != null) {
|
||||
widget.onScaleEnd!(details);
|
||||
}
|
||||
widget.onScaleEnd?.call(details);
|
||||
setState(() {
|
||||
_scaleStart = null;
|
||||
_rotationStart = null;
|
||||
|
|
|
@ -255,9 +255,7 @@ class _CupertinoPickerState extends State<CupertinoPicker> {
|
|||
HapticFeedback.selectionClick();
|
||||
}
|
||||
|
||||
if (widget.onSelectedItemChanged != null) {
|
||||
widget.onSelectedItemChanged!(index);
|
||||
}
|
||||
widget.onSelectedItemChanged?.call(index);
|
||||
}
|
||||
|
||||
/// Draws the selectionOverlay.
|
||||
|
|
|
@ -475,18 +475,14 @@ class _RenderCupertinoSlider extends RenderConstrainedBox {
|
|||
|
||||
void _startInteraction(Offset globalPosition) {
|
||||
if (isInteractive) {
|
||||
if (onChangeStart != null) {
|
||||
onChangeStart!(_discretizedCurrentDragValue);
|
||||
}
|
||||
onChangeStart?.call(_discretizedCurrentDragValue);
|
||||
_currentDragValue = _value;
|
||||
onChanged!(_discretizedCurrentDragValue);
|
||||
}
|
||||
}
|
||||
|
||||
void _endInteraction() {
|
||||
if (onChangeEnd != null) {
|
||||
onChangeEnd!(_discretizedCurrentDragValue);
|
||||
}
|
||||
onChangeEnd?.call(_discretizedCurrentDragValue);
|
||||
_currentDragValue = 0.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,8 +116,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
|
|||
}
|
||||
super.onSingleTapUp(details);
|
||||
_state._requestKeyboard();
|
||||
if (_state.widget.onTap != null)
|
||||
_state.widget.onTap!();
|
||||
_state.widget.onTap?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1104,9 +1104,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti
|
|||
static void reportError(FlutterErrorDetails details) {
|
||||
assert(details != null);
|
||||
assert(details.exception != null);
|
||||
if (onError != null) {
|
||||
onError!(details);
|
||||
}
|
||||
onError?.call(details);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,9 +193,7 @@ class _BottomSheetState extends State<BottomSheet> {
|
|||
bool get _dismissUnderway => widget.animationController!.status == AnimationStatus.reverse;
|
||||
|
||||
void _handleDragStart(DragStartDetails details) {
|
||||
if (widget.onDragStart != null) {
|
||||
widget.onDragStart!(details);
|
||||
}
|
||||
widget.onDragStart?.call(details);
|
||||
}
|
||||
|
||||
void _handleDragUpdate(DragUpdateDetails details) {
|
||||
|
@ -226,12 +224,10 @@ class _BottomSheetState extends State<BottomSheet> {
|
|||
widget.animationController!.forward();
|
||||
}
|
||||
|
||||
if (widget.onDragEnd != null) {
|
||||
widget.onDragEnd!(
|
||||
details,
|
||||
isClosing: isClosing,
|
||||
);
|
||||
}
|
||||
widget.onDragEnd?.call(
|
||||
details,
|
||||
isClosing: isClosing,
|
||||
);
|
||||
|
||||
if (isClosing) {
|
||||
widget.onClosing();
|
||||
|
|
|
@ -330,9 +330,7 @@ class _RawMaterialButtonState extends State<RawMaterialButton> {
|
|||
if (_pressed != value) {
|
||||
setState(() {
|
||||
_updateState(MaterialState.pressed, value);
|
||||
if (widget.onHighlightChanged != null) {
|
||||
widget.onHighlightChanged!(value);
|
||||
}
|
||||
widget.onHighlightChanged?.call(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,9 +150,7 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
|
|||
void _handleOnTap() {
|
||||
final DropdownMenuItem<T> dropdownMenuItem = widget.route.items[widget.itemIndex].item!;
|
||||
|
||||
if (dropdownMenuItem.onTap != null) {
|
||||
dropdownMenuItem.onTap!();
|
||||
}
|
||||
dropdownMenuItem.onTap?.call();
|
||||
|
||||
Navigator.pop(
|
||||
context,
|
||||
|
@ -1270,13 +1268,10 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
|||
_removeDropdownRoute();
|
||||
if (!mounted || newValue == null)
|
||||
return;
|
||||
if (widget.onChanged != null)
|
||||
widget.onChanged!(newValue.result);
|
||||
widget.onChanged?.call(newValue.result);
|
||||
});
|
||||
|
||||
if (widget.onTap != null) {
|
||||
widget.onTap!();
|
||||
}
|
||||
widget.onTap?.call();
|
||||
}
|
||||
|
||||
// When isDense is true, reduce the height of this button from _kMenuItemHeight to
|
||||
|
|
|
@ -137,8 +137,7 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
|
|||
}
|
||||
|
||||
void _handlePressed() {
|
||||
if (widget.onPressed != null)
|
||||
widget.onPressed!(widget.isExpanded);
|
||||
widget.onPressed?.call(widget.isExpanded);
|
||||
}
|
||||
|
||||
/// Default icon colors and opacities for when [Theme.brightness] is set to
|
||||
|
|
|
@ -442,8 +442,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
|
|||
}
|
||||
|
||||
void _handlePressed(bool isExpanded, int index) {
|
||||
if (widget.expansionCallback != null)
|
||||
widget.expansionCallback!(index, isExpanded);
|
||||
widget.expansionCallback?.call(index, isExpanded);
|
||||
|
||||
if (widget._allowOnlyOnePanelOpen) {
|
||||
final ExpansionPanelRadio pressedChild = widget.children[index] as ExpansionPanelRadio;
|
||||
|
|
|
@ -241,8 +241,7 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
|
|||
}
|
||||
PageStorage.of(context)?.writeState(context, _isExpanded);
|
||||
});
|
||||
if (widget.onExpansionChanged != null)
|
||||
widget.onExpansionChanged!(_isExpanded);
|
||||
widget.onExpansionChanged?.call(_isExpanded);
|
||||
}
|
||||
|
||||
Widget _buildChildren(BuildContext context, Widget? child) {
|
||||
|
|
|
@ -626,8 +626,7 @@ abstract class InkFeature {
|
|||
return true;
|
||||
}());
|
||||
_controller._removeFeature(this);
|
||||
if (onRemoved != null)
|
||||
onRemoved!();
|
||||
onRemoved?.call();
|
||||
}
|
||||
|
||||
void _paint(Canvas canvas) {
|
||||
|
|
|
@ -1110,12 +1110,10 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
|
|||
if (!mounted)
|
||||
return null;
|
||||
if (newValue == null) {
|
||||
if (widget.onCanceled != null)
|
||||
widget.onCanceled!();
|
||||
widget.onCanceled?.call();
|
||||
return null;
|
||||
}
|
||||
if (widget.onSelected != null)
|
||||
widget.onSelected!(newValue);
|
||||
widget.onSelected?.call(newValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1131,9 +1131,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
|
|||
}
|
||||
_updateLabelPainter(_lastThumbSelection!);
|
||||
|
||||
if (onChangeStart != null) {
|
||||
onChangeStart!(currentValues);
|
||||
}
|
||||
onChangeStart?.call(currentValues);
|
||||
|
||||
onChanged!(_discretizeRangeValues(_newValues));
|
||||
|
||||
|
@ -1202,9 +1200,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
|
|||
|
||||
if (_active && _state.mounted && _lastThumbSelection != null) {
|
||||
final RangeValues discreteValues = _discretizeRangeValues(_newValues);
|
||||
if (onChangeEnd != null) {
|
||||
onChangeEnd!(discreteValues);
|
||||
}
|
||||
onChangeEnd?.call(discreteValues);
|
||||
_active = false;
|
||||
}
|
||||
_state.overlayController.reverse();
|
||||
|
@ -1710,12 +1706,8 @@ class _RenderValueIndicator extends RenderBox with RelayoutWhenSystemFontsChange
|
|||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (_state.paintBottomValueIndicator != null) {
|
||||
_state.paintBottomValueIndicator!(context, offset);
|
||||
}
|
||||
if (_state.paintTopValueIndicator != null) {
|
||||
_state.paintTopValueIndicator!(context, offset);
|
||||
}
|
||||
_state.paintBottomValueIndicator?.call(context, offset);
|
||||
_state.paintTopValueIndicator?.call(context, offset);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1230,9 +1230,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||
// We supply the *current* value as the start location, so that if we have
|
||||
// a tap, it consists of a call to onChangeStart with the previous value and
|
||||
// a call to onChangeEnd with the new value.
|
||||
if (onChangeStart != null) {
|
||||
onChangeStart!(_discretize(value));
|
||||
}
|
||||
onChangeStart?.call(_discretize(value));
|
||||
_currentDragValue = _getValueFromGlobalPosition(globalPosition);
|
||||
onChanged!(_discretize(_currentDragValue));
|
||||
_state.overlayController.forward();
|
||||
|
@ -1256,9 +1254,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||
}
|
||||
|
||||
if (_active && _state.mounted) {
|
||||
if (onChangeEnd != null) {
|
||||
onChangeEnd!(_discretize(_currentDragValue));
|
||||
}
|
||||
onChangeEnd?.call(_discretize(_currentDragValue));
|
||||
_active = false;
|
||||
_currentDragValue = 0.0;
|
||||
_state.overlayController.reverse();
|
||||
|
@ -1584,9 +1580,7 @@ class _RenderValueIndicator extends RenderBox with RelayoutWhenSystemFontsChange
|
|||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (_state.paintValueIndicator != null) {
|
||||
_state.paintValueIndicator!(context, offset);
|
||||
}
|
||||
_state.paintValueIndicator?.call(context, offset);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -648,8 +648,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
|
|||
duration: kThemeAnimationDuration,
|
||||
);
|
||||
|
||||
if (widget.onStepTapped != null)
|
||||
widget.onStepTapped!(i);
|
||||
widget.onStepTapped?.call(i);
|
||||
} : null,
|
||||
canRequestFocus: widget.steps[i].state != StepState.disabled,
|
||||
child: _buildVerticalHeader(i),
|
||||
|
@ -666,8 +665,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
|
|||
for (int i = 0; i < widget.steps.length; i += 1) ...<Widget>[
|
||||
InkResponse(
|
||||
onTap: widget.steps[i].state != StepState.disabled ? () {
|
||||
if (widget.onStepTapped != null)
|
||||
widget.onStepTapped!(i);
|
||||
widget.onStepTapped?.call(i);
|
||||
} : null,
|
||||
canRequestFocus: widget.steps[i].state != StepState.disabled,
|
||||
child: Row(
|
||||
|
|
|
@ -1123,9 +1123,7 @@ class _TabBarState extends State<TabBar> {
|
|||
void _handleTap(int index) {
|
||||
assert(index >= 0 && index < widget.tabs.length);
|
||||
_controller!.animateTo(index);
|
||||
if (widget.onTap != null) {
|
||||
widget.onTap!(index);
|
||||
}
|
||||
widget.onTap?.call(index);
|
||||
}
|
||||
|
||||
Widget _buildStyledTab(Widget child, bool selected, Animation<double> animation) {
|
||||
|
|
|
@ -114,8 +114,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
|
|||
}
|
||||
}
|
||||
_state._requestKeyboard();
|
||||
if (_state.widget.onTap != null)
|
||||
_state.widget.onTap!();
|
||||
_state.widget.onTap?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1074,9 +1074,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
|||
_center = null;
|
||||
_animateTo(_getThetaForTime(widget.selectedTime));
|
||||
if (widget.mode == _TimePickerMode.hour) {
|
||||
if (widget.onHourSelected != null) {
|
||||
widget.onHourSelected!();
|
||||
}
|
||||
widget.onHourSelected?.call();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1092,9 +1090,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
|||
} else {
|
||||
_announceToAccessibility(context, localizations.formatDecimal(newTime.hourOfPeriod));
|
||||
}
|
||||
if (widget.onHourSelected != null) {
|
||||
widget.onHourSelected!();
|
||||
}
|
||||
widget.onHourSelected?.call();
|
||||
} else {
|
||||
_announceToAccessibility(context, localizations.formatDecimal(newTime.minute));
|
||||
}
|
||||
|
|
|
@ -534,9 +534,7 @@ void paintImage({
|
|||
if (existingSizeInfo == null || existingSizeInfo.displaySizeInBytes < sizeInfo.displaySizeInBytes) {
|
||||
_pendingImageSizeInfo[sizeInfo.source!] = sizeInfo;
|
||||
}
|
||||
if (debugOnPaintImage != null) {
|
||||
debugOnPaintImage!(sizeInfo);
|
||||
}
|
||||
debugOnPaintImage?.call(sizeInfo);
|
||||
SchedulerBinding.instance!.addPostFrameCallback((Duration timeStamp) {
|
||||
_lastFrameImageSizeInfo = _pendingImageSizeInfo.values.toSet();
|
||||
if (_pendingImageSizeInfo.isEmpty) {
|
||||
|
|
|
@ -598,9 +598,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||
if (nextSelection == selection && cause != SelectionChangedCause.keyboard && !focusingEmpty) {
|
||||
return;
|
||||
}
|
||||
if (onSelectionChanged != null) {
|
||||
onSelectionChanged!(nextSelection, this, cause);
|
||||
}
|
||||
onSelectionChanged?.call(nextSelection, this, cause);
|
||||
}
|
||||
|
||||
static final Set<LogicalKeyboardKey> _movementKeys = <LogicalKeyboardKey>{
|
||||
|
|
|
@ -4760,103 +4760,83 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
|
|||
}
|
||||
|
||||
void _performTap() {
|
||||
if (onTap != null)
|
||||
onTap!();
|
||||
onTap?.call();
|
||||
}
|
||||
|
||||
void _performLongPress() {
|
||||
if (onLongPress != null)
|
||||
onLongPress!();
|
||||
onLongPress?.call();
|
||||
}
|
||||
|
||||
void _performDismiss() {
|
||||
if (onDismiss != null)
|
||||
onDismiss!();
|
||||
onDismiss?.call();
|
||||
}
|
||||
|
||||
void _performScrollLeft() {
|
||||
if (onScrollLeft != null)
|
||||
onScrollLeft!();
|
||||
onScrollLeft?.call();
|
||||
}
|
||||
|
||||
void _performScrollRight() {
|
||||
if (onScrollRight != null)
|
||||
onScrollRight!();
|
||||
onScrollRight?.call();
|
||||
}
|
||||
|
||||
void _performScrollUp() {
|
||||
if (onScrollUp != null)
|
||||
onScrollUp!();
|
||||
onScrollUp?.call();
|
||||
}
|
||||
|
||||
void _performScrollDown() {
|
||||
if (onScrollDown != null)
|
||||
onScrollDown!();
|
||||
onScrollDown?.call();
|
||||
}
|
||||
|
||||
void _performIncrease() {
|
||||
if (onIncrease != null)
|
||||
onIncrease!();
|
||||
onIncrease?.call();
|
||||
}
|
||||
|
||||
void _performDecrease() {
|
||||
if (onDecrease != null)
|
||||
onDecrease!();
|
||||
onDecrease?.call();
|
||||
}
|
||||
|
||||
void _performCopy() {
|
||||
if (onCopy != null)
|
||||
onCopy!();
|
||||
onCopy?.call();
|
||||
}
|
||||
|
||||
void _performCut() {
|
||||
if (onCut != null)
|
||||
onCut!();
|
||||
onCut?.call();
|
||||
}
|
||||
|
||||
void _performPaste() {
|
||||
if (onPaste != null)
|
||||
onPaste!();
|
||||
onPaste?.call();
|
||||
}
|
||||
|
||||
void _performMoveCursorForwardByCharacter(bool extendSelection) {
|
||||
if (onMoveCursorForwardByCharacter != null)
|
||||
onMoveCursorForwardByCharacter!(extendSelection);
|
||||
onMoveCursorForwardByCharacter?.call(extendSelection);
|
||||
}
|
||||
|
||||
void _performMoveCursorBackwardByCharacter(bool extendSelection) {
|
||||
if (onMoveCursorBackwardByCharacter != null)
|
||||
onMoveCursorBackwardByCharacter!(extendSelection);
|
||||
onMoveCursorBackwardByCharacter?.call(extendSelection);
|
||||
}
|
||||
|
||||
void _performMoveCursorForwardByWord(bool extendSelection) {
|
||||
if (onMoveCursorForwardByWord != null)
|
||||
onMoveCursorForwardByWord!(extendSelection);
|
||||
onMoveCursorForwardByWord?.call(extendSelection);
|
||||
}
|
||||
|
||||
void _performMoveCursorBackwardByWord(bool extendSelection) {
|
||||
if (onMoveCursorBackwardByWord != null)
|
||||
onMoveCursorBackwardByWord!(extendSelection);
|
||||
onMoveCursorBackwardByWord?.call(extendSelection);
|
||||
}
|
||||
|
||||
void _performSetSelection(TextSelection selection) {
|
||||
if (onSetSelection != null)
|
||||
onSetSelection!(selection);
|
||||
onSetSelection?.call(selection);
|
||||
}
|
||||
|
||||
void _performSetText(String text) {
|
||||
if (onSetText != null)
|
||||
onSetText!(text);
|
||||
onSetText?.call(text);
|
||||
}
|
||||
|
||||
void _performDidGainAccessibilityFocus() {
|
||||
if (onDidGainAccessibilityFocus != null)
|
||||
onDidGainAccessibilityFocus!();
|
||||
onDidGainAccessibilityFocus?.call();
|
||||
}
|
||||
|
||||
void _performDidLoseAccessibilityFocus() {
|
||||
if (onDidLoseAccessibilityFocus != null)
|
||||
onDidLoseAccessibilityFocus!();
|
||||
onDidLoseAccessibilityFocus?.call();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6178,8 +6178,7 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget {
|
|||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, RenderBox renderObject) {
|
||||
if (onBuild != null)
|
||||
onBuild!();
|
||||
onBuild?.call();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -543,13 +543,9 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
|
|||
|
||||
void _handleResizeProgressChanged() {
|
||||
if (_resizeController!.isCompleted) {
|
||||
if (widget.onDismissed != null) {
|
||||
final DismissDirection direction = _dismissDirection;
|
||||
widget.onDismissed!(direction);
|
||||
}
|
||||
widget.onDismissed?.call(_dismissDirection);
|
||||
} else {
|
||||
if (widget.onResize != null)
|
||||
widget.onResize!();
|
||||
widget.onResize?.call();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -576,8 +576,7 @@ class _DraggableState<T extends Object> extends State<Draggable<T>> {
|
|||
widget.onDraggableCanceled!(velocity, offset);
|
||||
},
|
||||
);
|
||||
if (widget.onDragStarted != null)
|
||||
widget.onDragStarted!();
|
||||
widget.onDragStarted?.call();
|
||||
return avatar;
|
||||
}
|
||||
|
||||
|
@ -754,8 +753,7 @@ class _DragTargetState<T extends Object> extends State<DragTarget<T>> {
|
|||
_candidateAvatars.remove(avatar);
|
||||
_rejectedAvatars.remove(avatar);
|
||||
});
|
||||
if (widget.onLeave != null)
|
||||
widget.onLeave!(avatar.data as T?);
|
||||
widget.onLeave?.call(avatar.data as T?);
|
||||
}
|
||||
|
||||
void didDrop(_DragAvatar<Object> avatar) {
|
||||
|
@ -765,17 +763,14 @@ class _DragTargetState<T extends Object> extends State<DragTarget<T>> {
|
|||
setState(() {
|
||||
_candidateAvatars.remove(avatar);
|
||||
});
|
||||
if (widget.onAccept != null)
|
||||
widget.onAccept!(avatar.data! as T);
|
||||
if (widget.onAcceptWithDetails != null)
|
||||
widget.onAcceptWithDetails!(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
|
||||
widget.onAccept?.call(avatar.data! as T);
|
||||
widget.onAcceptWithDetails?.call(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
|
||||
}
|
||||
|
||||
void didMove(_DragAvatar<Object> avatar) {
|
||||
if (!mounted)
|
||||
return;
|
||||
if (widget.onMove != null)
|
||||
widget.onMove!(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
|
||||
widget.onMove?.call(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -937,8 +932,7 @@ class _DragAvatar<T extends Object> extends Drag {
|
|||
_entry!.remove();
|
||||
_entry = null;
|
||||
// TODO(ianh): consider passing _entry as well so the client can perform an animation.
|
||||
if (onDragEnd != null)
|
||||
onDragEnd!(velocity ?? Velocity.zero, _lastOffset!, wasAccepted);
|
||||
onDragEnd?.call(velocity ?? Velocity.zero, _lastOffset!, wasAccepted);
|
||||
}
|
||||
|
||||
Widget _build(BuildContext context) {
|
||||
|
|
|
@ -670,9 +670,7 @@ class _FocusState extends State<Focus> {
|
|||
final bool hasPrimaryFocus = focusNode.hasPrimaryFocus;
|
||||
final bool canRequestFocus = focusNode.canRequestFocus;
|
||||
final bool descendantsAreFocusable = focusNode.descendantsAreFocusable;
|
||||
if (widget.onFocusChange != null) {
|
||||
widget.onFocusChange!(focusNode.hasFocus);
|
||||
}
|
||||
widget.onFocusChange?.call(focusNode.hasFocus);
|
||||
if (_hasPrimaryFocus != hasPrimaryFocus) {
|
||||
setState(() {
|
||||
_hasPrimaryFocus = hasPrimaryFocus;
|
||||
|
|
|
@ -167,9 +167,7 @@ class FormState extends State<Form> {
|
|||
// Called when a form field has changed. This will cause all form fields
|
||||
// to rebuild, useful if form fields have interdependencies.
|
||||
void _fieldDidChange() {
|
||||
if (widget.onChanged != null)
|
||||
widget.onChanged!();
|
||||
|
||||
widget.onChanged?.call();
|
||||
|
||||
_hasInteractedByUser = _fields
|
||||
.any((FormFieldState<dynamic> field) => field._hasInteractedByUser);
|
||||
|
@ -435,8 +433,7 @@ class FormFieldState<T> extends State<FormField<T>> {
|
|||
|
||||
/// Calls the [FormField]'s onSaved method with the current value.
|
||||
void save() {
|
||||
if (widget.onSaved != null)
|
||||
widget.onSaved!(value);
|
||||
widget.onSaved?.call(value);
|
||||
}
|
||||
|
||||
/// Resets the field to its initial value.
|
||||
|
|
|
@ -4241,9 +4241,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||
if (_lifecycleState != _ElementLifecycle.active || !_dirty)
|
||||
return;
|
||||
assert(() {
|
||||
if (debugOnRebuildDirtyWidget != null) {
|
||||
debugOnRebuildDirtyWidget!(this, _debugBuiltOnce);
|
||||
}
|
||||
debugOnRebuildDirtyWidget?.call(this, _debugBuiltOnce);
|
||||
if (debugPrintRebuildDirtyWidgets) {
|
||||
if (!_debugBuiltOnce) {
|
||||
debugPrint('Building $this');
|
||||
|
|
|
@ -1332,12 +1332,9 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
|
|||
|
||||
return () {
|
||||
assert(tap != null);
|
||||
if (tap.onTapDown != null)
|
||||
tap.onTapDown!(TapDownDetails());
|
||||
if (tap.onTapUp != null)
|
||||
tap.onTapUp!(TapUpDetails(kind: PointerDeviceKind.unknown));
|
||||
if (tap.onTap != null)
|
||||
tap.onTap!();
|
||||
tap.onTapDown?.call(TapDownDetails());
|
||||
tap.onTapUp?.call(TapUpDetails(kind: PointerDeviceKind.unknown));
|
||||
tap.onTap?.call();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1347,14 +1344,10 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
|
|||
return null;
|
||||
|
||||
return () {
|
||||
if (longPress.onLongPressStart != null)
|
||||
longPress.onLongPressStart!(const LongPressStartDetails());
|
||||
if (longPress.onLongPress != null)
|
||||
longPress.onLongPress!();
|
||||
if (longPress.onLongPressEnd != null)
|
||||
longPress.onLongPressEnd!(const LongPressEndDetails());
|
||||
if (longPress.onLongPressUp != null)
|
||||
longPress.onLongPressUp!();
|
||||
longPress.onLongPressStart?.call(const LongPressStartDetails());
|
||||
longPress.onLongPress?.call();
|
||||
longPress.onLongPressEnd?.call(const LongPressEndDetails());
|
||||
longPress.onLongPressUp?.call();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1365,27 +1358,19 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
|
|||
final GestureDragUpdateCallback? horizontalHandler = horizontal == null ?
|
||||
null :
|
||||
(DragUpdateDetails details) {
|
||||
if (horizontal.onDown != null)
|
||||
horizontal.onDown!(DragDownDetails());
|
||||
if (horizontal.onStart != null)
|
||||
horizontal.onStart!(DragStartDetails());
|
||||
if (horizontal.onUpdate != null)
|
||||
horizontal.onUpdate!(details);
|
||||
if (horizontal.onEnd != null)
|
||||
horizontal.onEnd!(DragEndDetails(primaryVelocity: 0.0));
|
||||
horizontal.onDown?.call(DragDownDetails());
|
||||
horizontal.onStart?.call(DragStartDetails());
|
||||
horizontal.onUpdate?.call(details);
|
||||
horizontal.onEnd?.call(DragEndDetails(primaryVelocity: 0.0));
|
||||
};
|
||||
|
||||
final GestureDragUpdateCallback? panHandler = pan == null ?
|
||||
null :
|
||||
(DragUpdateDetails details) {
|
||||
if (pan.onDown != null)
|
||||
pan.onDown!(DragDownDetails());
|
||||
if (pan.onStart != null)
|
||||
pan.onStart!(DragStartDetails());
|
||||
if (pan.onUpdate != null)
|
||||
pan.onUpdate!(details);
|
||||
if (pan.onEnd != null)
|
||||
pan.onEnd!(DragEndDetails());
|
||||
pan.onDown?.call(DragDownDetails());
|
||||
pan.onStart?.call(DragStartDetails());
|
||||
pan.onUpdate?.call(details);
|
||||
pan.onEnd?.call(DragEndDetails());
|
||||
};
|
||||
|
||||
if (horizontalHandler == null && panHandler == null)
|
||||
|
@ -1405,27 +1390,19 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
|
|||
final GestureDragUpdateCallback? verticalHandler = vertical == null ?
|
||||
null :
|
||||
(DragUpdateDetails details) {
|
||||
if (vertical.onDown != null)
|
||||
vertical.onDown!(DragDownDetails());
|
||||
if (vertical.onStart != null)
|
||||
vertical.onStart!(DragStartDetails());
|
||||
if (vertical.onUpdate != null)
|
||||
vertical.onUpdate!(details);
|
||||
if (vertical.onEnd != null)
|
||||
vertical.onEnd!(DragEndDetails(primaryVelocity: 0.0));
|
||||
vertical.onDown?.call(DragDownDetails());
|
||||
vertical.onStart?.call(DragStartDetails());
|
||||
vertical.onUpdate?.call(details);
|
||||
vertical.onEnd?.call(DragEndDetails(primaryVelocity: 0.0));
|
||||
};
|
||||
|
||||
final GestureDragUpdateCallback? panHandler = pan == null ?
|
||||
null :
|
||||
(DragUpdateDetails details) {
|
||||
if (pan.onDown != null)
|
||||
pan.onDown!(DragDownDetails());
|
||||
if (pan.onStart != null)
|
||||
pan.onStart!(DragStartDetails());
|
||||
if (pan.onUpdate != null)
|
||||
pan.onUpdate!(details);
|
||||
if (pan.onEnd != null)
|
||||
pan.onEnd!(DragEndDetails());
|
||||
pan.onDown?.call(DragDownDetails());
|
||||
pan.onStart?.call(DragStartDetails());
|
||||
pan.onUpdate?.call(details);
|
||||
pan.onEnd?.call(DragEndDetails());
|
||||
};
|
||||
|
||||
if (verticalHandler == null && panHandler == null)
|
||||
|
|
|
@ -370,8 +370,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
|
|||
_controller.addStatusListener((AnimationStatus status) {
|
||||
switch (status) {
|
||||
case AnimationStatus.completed:
|
||||
if (widget.onEnd != null)
|
||||
widget.onEnd!();
|
||||
widget.onEnd?.call();
|
||||
break;
|
||||
case AnimationStatus.dismissed:
|
||||
case AnimationStatus.forward:
|
||||
|
|
|
@ -228,8 +228,7 @@ class _AnyTapGestureRecognizer extends BaseTapGestureRecognizer {
|
|||
@protected
|
||||
@override
|
||||
void handleTapUp({PointerDownEvent? down, PointerUpEvent? up}) {
|
||||
if (onAnyTapUp != null)
|
||||
onAnyTapUp!();
|
||||
onAnyTapUp?.call();
|
||||
}
|
||||
|
||||
@protected
|
||||
|
|
|
@ -5968,9 +5968,7 @@ class RestorableRouteFuture<T> extends RestorableProperty<String?> {
|
|||
_route?.restorationScopeId.removeListener(notifyListeners);
|
||||
_route = null;
|
||||
notifyListeners();
|
||||
if (onComplete != null) {
|
||||
onComplete!(result as T);
|
||||
}
|
||||
onComplete?.call(result as T);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -638,9 +638,7 @@ class _UiKitViewState extends State<UiKitView> {
|
|||
controller.dispose();
|
||||
return;
|
||||
}
|
||||
if (widget.onPlatformViewCreated != null) {
|
||||
widget.onPlatformViewCreated!(id);
|
||||
}
|
||||
widget.onPlatformViewCreated?.call(id);
|
||||
setState(() { _controller = controller; });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,8 +121,7 @@ class _RawKeyboardListenerState extends State<RawKeyboardListener> {
|
|||
}
|
||||
|
||||
void _handleRawKeyEvent(RawKeyEvent event) {
|
||||
if (widget.onKey != null)
|
||||
widget.onKey!(event);
|
||||
widget.onKey?.call(event);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -445,8 +445,7 @@ class LocalHistoryEntry {
|
|||
}
|
||||
|
||||
void _notifyRemoved() {
|
||||
if (onRemove != null)
|
||||
onRemove!();
|
||||
onRemove?.call();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -214,8 +214,7 @@ class HoldScrollActivity extends ScrollActivity implements ScrollHoldController
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
if (onHoldCanceled != null)
|
||||
onHoldCanceled!();
|
||||
onHoldCanceled?.call();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -406,8 +405,7 @@ class ScrollDragController implements Drag {
|
|||
@mustCallSuper
|
||||
void dispose() {
|
||||
_lastDetails = null;
|
||||
if (onDragCanceled != null)
|
||||
onDragCanceled!();
|
||||
onDragCanceled?.call();
|
||||
}
|
||||
|
||||
/// The most recently observed [DragStartDetails], [DragUpdateDetails], or
|
||||
|
|
|
@ -782,8 +782,7 @@ class _TextSelectionHandleOverlayState
|
|||
}
|
||||
|
||||
void _handleTap() {
|
||||
if (widget.onSelectionHandleTapped != null)
|
||||
widget.onSelectionHandleTapped!();
|
||||
widget.onSelectionHandleTapped?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1386,9 +1385,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
// The down handler is force-run on success of a single tap and optimistically
|
||||
// run before a long press success.
|
||||
void _handleTapDown(TapDownDetails details) {
|
||||
if (widget.onTapDown != null) {
|
||||
widget.onTapDown!(details);
|
||||
}
|
||||
widget.onTapDown?.call(details);
|
||||
// This isn't detected as a double tap gesture in the gesture recognizer
|
||||
// because it's 2 single taps, each of which may do different things depending
|
||||
// on whether it's a single tap, the first tap of a double tap, the second
|
||||
|
@ -1396,9 +1393,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
if (_doubleTapTimer != null && _isWithinDoubleTapTolerance(details.globalPosition)) {
|
||||
// If there was already a previous tap, the second down hold/tap is a
|
||||
// double tap down.
|
||||
if (widget.onDoubleTapDown != null) {
|
||||
widget.onDoubleTapDown!(details);
|
||||
}
|
||||
widget.onDoubleTapDown?.call(details);
|
||||
|
||||
_doubleTapTimer!.cancel();
|
||||
_doubleTapTimeout();
|
||||
|
@ -1408,9 +1403,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
|
||||
void _handleTapUp(TapUpDetails details) {
|
||||
if (!_isDoubleTap) {
|
||||
if (widget.onSingleTapUp != null) {
|
||||
widget.onSingleTapUp!(details);
|
||||
}
|
||||
widget.onSingleTapUp?.call(details);
|
||||
_lastTapOffset = details.globalPosition;
|
||||
_doubleTapTimer = Timer(kDoubleTapTimeout, _doubleTapTimeout);
|
||||
}
|
||||
|
@ -1418,9 +1411,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
}
|
||||
|
||||
void _handleTapCancel() {
|
||||
if (widget.onSingleTapCancel != null) {
|
||||
widget.onSingleTapCancel!();
|
||||
}
|
||||
widget.onSingleTapCancel?.call();
|
||||
}
|
||||
|
||||
DragStartDetails? _lastDragStartDetails;
|
||||
|
@ -1430,9 +1421,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
void _handleDragStart(DragStartDetails details) {
|
||||
assert(_lastDragStartDetails == null);
|
||||
_lastDragStartDetails = details;
|
||||
if (widget.onDragSelectionStart != null) {
|
||||
widget.onDragSelectionStart!(details);
|
||||
}
|
||||
widget.onDragSelectionStart?.call(details);
|
||||
}
|
||||
|
||||
void _handleDragUpdate(DragUpdateDetails details) {
|
||||
|
@ -1450,9 +1439,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
void _handleDragUpdateThrottled() {
|
||||
assert(_lastDragStartDetails != null);
|
||||
assert(_lastDragUpdateDetails != null);
|
||||
if (widget.onDragSelectionUpdate != null) {
|
||||
widget.onDragSelectionUpdate!(_lastDragStartDetails!, _lastDragUpdateDetails!);
|
||||
}
|
||||
widget.onDragSelectionUpdate?.call(_lastDragStartDetails!, _lastDragUpdateDetails!);
|
||||
_dragUpdateThrottleTimer = null;
|
||||
_lastDragUpdateDetails = null;
|
||||
}
|
||||
|
@ -1465,9 +1452,7 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
_dragUpdateThrottleTimer!.cancel();
|
||||
_handleDragUpdateThrottled();
|
||||
}
|
||||
if (widget.onDragSelectionEnd != null) {
|
||||
widget.onDragSelectionEnd!(details);
|
||||
}
|
||||
widget.onDragSelectionEnd?.call(details);
|
||||
_dragUpdateThrottleTimer = null;
|
||||
_lastDragStartDetails = null;
|
||||
_lastDragUpdateDetails = null;
|
||||
|
@ -1476,13 +1461,11 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
|
|||
void _forcePressStarted(ForcePressDetails details) {
|
||||
_doubleTapTimer?.cancel();
|
||||
_doubleTapTimer = null;
|
||||
if (widget.onForcePressStart != null)
|
||||
widget.onForcePressStart!(details);
|
||||
widget.onForcePressStart?.call(details);
|
||||
}
|
||||
|
||||
void _forcePressEnded(ForcePressDetails details) {
|
||||
if (widget.onForcePressEnd != null)
|
||||
widget.onForcePressEnd!(details);
|
||||
widget.onForcePressEnd?.call(details);
|
||||
}
|
||||
|
||||
void _handleLongPressStart(LongPressStartDetails details) {
|
||||
|
|
|
@ -130,9 +130,7 @@ class PassiveGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||
|
||||
@override
|
||||
void acceptGesture(int pointer) {
|
||||
if (onGestureAccepted != null) {
|
||||
onGestureAccepted!();
|
||||
}
|
||||
onGestureAccepted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -89,8 +89,7 @@ class TestAnnotationTarget with Diagnosticable implements MouseTrackerAnnotation
|
|||
@override
|
||||
void handleEvent(PointerEvent event, HitTestEntry entry) {
|
||||
if (event is PointerHoverEvent)
|
||||
if (onHover != null)
|
||||
onHover!(event);
|
||||
onHover?.call(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -111,9 +111,7 @@ class _TestImageStreamCompleter extends ImageStreamCompleter {
|
|||
}) {
|
||||
final List<ImageStreamListener> localListeners = listeners.toList();
|
||||
for (final ImageStreamListener listener in localListeners) {
|
||||
if (listener.onError != null) {
|
||||
listener.onError!(exception, stackTrace);
|
||||
}
|
||||
listener.onError?.call(exception, stackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2026,9 +2026,7 @@ class _TestImageStreamCompleter extends ImageStreamCompleter {
|
|||
}) {
|
||||
final List<ImageStreamListener> localListeners = listeners.toList();
|
||||
for (final ImageStreamListener listener in localListeners) {
|
||||
if (listener.onError != null) {
|
||||
listener.onError!(exception, stackTrace);
|
||||
}
|
||||
listener.onError?.call(exception, stackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,8 +86,7 @@ class Counter {
|
|||
class Trigger {
|
||||
VoidCallback? callback;
|
||||
void fire() {
|
||||
if (callback != null)
|
||||
callback!();
|
||||
callback?.call();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,21 +29,13 @@ class HoverClient extends StatefulWidget {
|
|||
|
||||
class HoverClientState extends State<HoverClient> {
|
||||
void _onExit(PointerExitEvent details) {
|
||||
if (widget.onExit != null) {
|
||||
widget.onExit!();
|
||||
}
|
||||
if (widget.onHover != null) {
|
||||
widget.onHover!(false);
|
||||
}
|
||||
widget.onExit?.call();
|
||||
widget.onHover?.call(false);
|
||||
}
|
||||
|
||||
void _onEnter(PointerEnterEvent details) {
|
||||
if (widget.onEnter != null) {
|
||||
widget.onEnter!();
|
||||
}
|
||||
if (widget.onHover != null) {
|
||||
widget.onHover!(true);
|
||||
}
|
||||
widget.onEnter?.call();
|
||||
widget.onHover?.call(true);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -3587,22 +3587,19 @@ class RouteAnnouncementSpy extends Route<void> {
|
|||
@override
|
||||
void didChangeNext(Route<dynamic>? nextRoute) {
|
||||
super.didChangeNext(nextRoute);
|
||||
if (onDidChangeNext != null)
|
||||
onDidChangeNext!(nextRoute);
|
||||
onDidChangeNext?.call(nextRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangePrevious(Route<dynamic>? previousRoute) {
|
||||
super.didChangePrevious(previousRoute);
|
||||
if (onDidChangePrevious != null)
|
||||
onDidChangePrevious!(previousRoute);
|
||||
onDidChangePrevious?.call(previousRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didPopNext(Route<dynamic> nextRoute) {
|
||||
super.didPopNext(nextRoute);
|
||||
if (onDidPopNext != null)
|
||||
onDidPopNext!(nextRoute);
|
||||
onDidPopNext?.call(nextRoute);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3728,9 +3725,7 @@ class HeroControllerSpy extends HeroController {
|
|||
OnObservation? onPushed;
|
||||
@override
|
||||
void didPush(Route<dynamic>? route, Route<dynamic>? previousRoute) {
|
||||
if (onPushed != null) {
|
||||
onPushed!(route, previousRoute);
|
||||
}
|
||||
onPushed?.call(route, previousRoute);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,33 +16,26 @@ class TestObserver extends NavigatorObserver {
|
|||
|
||||
@override
|
||||
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
||||
if (onPushed != null) {
|
||||
onPushed!(route, previousRoute);
|
||||
}
|
||||
onPushed?.call(route, previousRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
||||
if (onPopped != null) {
|
||||
onPopped!(route, previousRoute);
|
||||
}
|
||||
onPopped?.call(route, previousRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didRemove(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
||||
if (onRemoved != null)
|
||||
onRemoved!(route, previousRoute);
|
||||
onRemoved?.call(route, previousRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didReplace({ Route<dynamic>? oldRoute, Route<dynamic>? newRoute }) {
|
||||
if (onReplaced != null)
|
||||
onReplaced!(newRoute, oldRoute);
|
||||
onReplaced?.call(newRoute, oldRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didStartUserGesture(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
||||
if (onStartUserGesture != null)
|
||||
onStartUserGesture!(route, previousRoute);
|
||||
onStartUserGesture?.call(route, previousRoute);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,8 +102,7 @@ class TestTextInput {
|
|||
case 'TextInput.clearClient':
|
||||
_client = 0;
|
||||
_isVisible = false;
|
||||
if (onCleared != null)
|
||||
onCleared!();
|
||||
onCleared?.call();
|
||||
break;
|
||||
case 'TextInput.setEditingState':
|
||||
editingState = methodCall.arguments as Map<String, dynamic>;
|
||||
|
|
Loading…
Reference in a new issue