use null aware operators for function invocations (#79049)
This commit is contained in:
committed by
GitHub
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;
|
||||
|
||||
Reference in New Issue
Block a user