From aa1ffced6f9bc251d08dec9caa3e0306adaa32d7 Mon Sep 17 00:00:00 2001 From: Erick Zanardo Date: Wed, 13 May 2020 12:03:06 -0300 Subject: [PATCH] Linting --- docs/examples/gestures/lib/main_multitap.dart | 6 +- .../gestures/lib/main_multitap_advanced.dart | 12 +- lib/game/gesture_detector.dart | 155 +++++---- lib/game/widget_builder.dart | 318 +++++++++--------- 4 files changed, 252 insertions(+), 239 deletions(-) diff --git a/docs/examples/gestures/lib/main_multitap.dart b/docs/examples/gestures/lib/main_multitap.dart index bda74bdea..f4ef3c9ec 100644 --- a/docs/examples/gestures/lib/main_multitap.dart +++ b/docs/examples/gestures/lib/main_multitap.dart @@ -22,11 +22,7 @@ class MyGame extends Game with MultiTouchTapDetector { @override void onTapDown(int pointerId, TapDownDetails details) { _taps[pointerId] = Rect.fromLTWH( - details.globalPosition.dx, - details.globalPosition.dy, - 50, - 50 - ); + details.globalPosition.dx, details.globalPosition.dy, 50, 50); } @override diff --git a/docs/examples/gestures/lib/main_multitap_advanced.dart b/docs/examples/gestures/lib/main_multitap_advanced.dart index 6c47aa61c..b67095c20 100644 --- a/docs/examples/gestures/lib/main_multitap_advanced.dart +++ b/docs/examples/gestures/lib/main_multitap_advanced.dart @@ -26,11 +26,7 @@ class MyGame extends Game with MultiTouchTapDetector, PanDetector { @override void onTapDown(int pointerId, TapDownDetails details) { _taps[pointerId] = Rect.fromLTWH( - details.globalPosition.dx, - details.globalPosition.dy, - 50, - 50 - ); + details.globalPosition.dx, details.globalPosition.dy, 50, 50); } @override @@ -57,8 +53,10 @@ class MyGame extends Game with MultiTouchTapDetector, PanDetector { @override void onPanEnd(details) { _panRect = Rect.fromLTRB( - _start.dx, _start.dy, - _end.dx, _end.dy, + _start.dx, + _start.dy, + _end.dx, + _end.dy, ); } diff --git a/lib/game/gesture_detector.dart b/lib/game/gesture_detector.dart index 4c6ff8d9b..3ffe905f2 100644 --- a/lib/game/gesture_detector.dart +++ b/lib/game/gesture_detector.dart @@ -61,51 +61,60 @@ class GestureDetector extends StatelessWidget { this.behavior, this.excludeFromSemantics = false, this.dragStartBehavior = DragStartBehavior.start, - }) : assert(excludeFromSemantics != null), - assert(dragStartBehavior != null), - assert(() { - final bool haveVerticalDrag = onVerticalDragStart != null || onVerticalDragUpdate != null || onVerticalDragEnd != null; - final bool haveHorizontalDrag = onHorizontalDragStart != null || onHorizontalDragUpdate != null || onHorizontalDragEnd != null; - final bool havePan = onPanStart != null || onPanUpdate != null || onPanEnd != null; - final bool haveScale = onScaleStart != null || onScaleUpdate != null || onScaleEnd != null; + }) : assert(excludeFromSemantics != null), + assert(dragStartBehavior != null), + assert(() { + final bool haveVerticalDrag = onVerticalDragStart != null || + onVerticalDragUpdate != null || + onVerticalDragEnd != null; + final bool haveHorizontalDrag = onHorizontalDragStart != null || + onHorizontalDragUpdate != null || + onHorizontalDragEnd != null; + final bool havePan = + onPanStart != null || onPanUpdate != null || onPanEnd != null; + final bool haveScale = onScaleStart != null || + onScaleUpdate != null || + onScaleEnd != null; - final bool haveTap = onTap != null || onTapCancel != null || onTapUp != null || onTapDown != null; - final bool haveMultiTap = onMultiTap != null || onMultiTapCancel != null || onMultiTapUp != null || onMultiTapDown != null; + final bool haveTap = onTap != null || + onTapCancel != null || + onTapUp != null || + onTapDown != null; + final bool haveMultiTap = onMultiTap != null || + onMultiTapCancel != null || + onMultiTapUp != null || + onMultiTapDown != null; - if (havePan || haveScale) { - if (havePan && haveScale) { - throw FlutterError.fromParts([ - ErrorSummary('Incorrect GestureDetector arguments.'), - ErrorDescription( - 'Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan.' - ), - ErrorHint('Just use the scale gesture recognizer.') - ]); - } - final String recognizer = havePan ? 'pan' : 'scale'; - if (haveVerticalDrag && haveHorizontalDrag) { - throw FlutterError( - 'Incorrect GestureDetector arguments.\n' - 'Simultaneously having a vertical drag gesture recognizer, a horizontal drag gesture recognizer, and a $recognizer gesture recognizer ' - 'will result in the $recognizer gesture recognizer being ignored, since the other two will catch all drags.' - ); - } - } - if (haveTap || haveMultiTap) { - if (haveTap && haveMultiTap) { - throw FlutterError.fromParts([ - ErrorSummary('Incorrect GestureDetector arguments.'), - ErrorDescription( - 'Having both a tap gesture recognizer and a multi tap gesture recognizer is redundant.' - ), - ErrorHint('Just use one of the recognizers.') - ]); - } - } + if (havePan || haveScale) { + if (havePan && haveScale) { + throw FlutterError.fromParts([ + ErrorSummary('Incorrect GestureDetector arguments.'), + ErrorDescription( + 'Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan.'), + ErrorHint('Just use the scale gesture recognizer.') + ]); + } + final String recognizer = havePan ? 'pan' : 'scale'; + if (haveVerticalDrag && haveHorizontalDrag) { + throw FlutterError('Incorrect GestureDetector arguments.\n' + 'Simultaneously having a vertical drag gesture recognizer, a horizontal drag gesture recognizer, and a $recognizer gesture recognizer ' + 'will result in the $recognizer gesture recognizer being ignored, since the other two will catch all drags.'); + } + } + if (haveTap || haveMultiTap) { + if (haveTap && haveMultiTap) { + throw FlutterError.fromParts([ + ErrorSummary('Incorrect GestureDetector arguments.'), + ErrorDescription( + 'Having both a tap gesture recognizer and a multi tap gesture recognizer is redundant.'), + ErrorHint('Just use one of the recognizers.') + ]); + } + } - return true; - }()), - super(key: key); + return true; + }()), + super(key: key); /// The widget below this widget in the tree. /// @@ -453,18 +462,18 @@ class GestureDetector extends StatelessWidget { @override Widget build(BuildContext context) { - final Map gestures = {}; + final Map gestures = + {}; - if ( - onTapDown != null || - onTapUp != null || - onTap != null || - onTapCancel != null || - onSecondaryTapDown != null || - onSecondaryTapUp != null || - onSecondaryTapCancel != null - ) { - gestures[TapGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + if (onTapDown != null || + onTapUp != null || + onTap != null || + onTapCancel != null || + onSecondaryTapDown != null || + onSecondaryTapUp != null || + onSecondaryTapCancel != null) { + gestures[TapGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => TapGestureRecognizer(debugOwner: this), (TapGestureRecognizer instance) { instance @@ -480,7 +489,8 @@ class GestureDetector extends StatelessWidget { } if (onDoubleTap != null) { - gestures[DoubleTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[DoubleTapGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => DoubleTapGestureRecognizer(debugOwner: this), (DoubleTapGestureRecognizer instance) { instance.onDoubleTap = onDoubleTap; @@ -493,14 +503,15 @@ class GestureDetector extends StatelessWidget { onLongPressStart != null || onLongPressMoveUpdate != null || onLongPressEnd != null) { - gestures[LongPressGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[LongPressGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => LongPressGestureRecognizer(debugOwner: this), (LongPressGestureRecognizer instance) { instance ..onLongPress = onLongPress ..onLongPressStart = onLongPressStart ..onLongPressMoveUpdate = onLongPressMoveUpdate - ..onLongPressEnd =onLongPressEnd + ..onLongPressEnd = onLongPressEnd ..onLongPressUp = onLongPressUp; }, ); @@ -511,7 +522,8 @@ class GestureDetector extends StatelessWidget { onVerticalDragUpdate != null || onVerticalDragEnd != null || onVerticalDragCancel != null) { - gestures[VerticalDragGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[VerticalDragGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => VerticalDragGestureRecognizer(debugOwner: this), (VerticalDragGestureRecognizer instance) { instance @@ -530,7 +542,8 @@ class GestureDetector extends StatelessWidget { onHorizontalDragUpdate != null || onHorizontalDragEnd != null || onHorizontalDragCancel != null) { - gestures[HorizontalDragGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[HorizontalDragGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => HorizontalDragGestureRecognizer(debugOwner: this), (HorizontalDragGestureRecognizer instance) { instance @@ -549,7 +562,8 @@ class GestureDetector extends StatelessWidget { onPanUpdate != null || onPanEnd != null || onPanCancel != null) { - gestures[PanGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[PanGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => PanGestureRecognizer(debugOwner: this), (PanGestureRecognizer instance) { instance @@ -564,7 +578,8 @@ class GestureDetector extends StatelessWidget { } if (onScaleStart != null || onScaleUpdate != null || onScaleEnd != null) { - gestures[ScaleGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[ScaleGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => ScaleGestureRecognizer(debugOwner: this), (ScaleGestureRecognizer instance) { instance @@ -579,7 +594,8 @@ class GestureDetector extends StatelessWidget { onForcePressPeak != null || onForcePressUpdate != null || onForcePressEnd != null) { - gestures[ForcePressGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + gestures[ForcePressGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => ForcePressGestureRecognizer(debugOwner: this), (ForcePressGestureRecognizer instance) { instance @@ -591,13 +607,12 @@ class GestureDetector extends StatelessWidget { ); } - if ( - onMultiTapDown != null || - onMultiTapUp != null || - onMultiTap != null || - onMultiTapCancel != null - ) { - gestures[MultiTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + if (onMultiTapDown != null || + onMultiTapUp != null || + onMultiTap != null || + onMultiTapCancel != null) { + gestures[MultiTapGestureRecognizer] = + GestureRecognizerFactoryWithHandlers( () => MultiTapGestureRecognizer(debugOwner: this), (MultiTapGestureRecognizer instance) { instance @@ -616,9 +631,11 @@ class GestureDetector extends StatelessWidget { child: child, ); } + @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); - properties.add(EnumProperty('startBehavior', dragStartBehavior)); + properties.add( + EnumProperty('startBehavior', dragStartBehavior)); } } diff --git a/lib/game/widget_builder.dart b/lib/game/widget_builder.dart index 4dd19af59..dc01fb092 100644 --- a/lib/game/widget_builder.dart +++ b/lib/game/widget_builder.dart @@ -7,171 +7,173 @@ import 'embedded_game_widget.dart'; import 'game.dart'; bool _hasGestureDetectors(Game game) => - game is TapDetector || - game is SecondaryTapDetector || - game is DoubleTapDetector || - game is LongPressDetector || - game is VerticalDragDetector || - game is HorizontalDragDetector || - game is ForcePressDetector || - game is PanDetector || - game is ScaleDetector || - game is MultiTouchTapDetector; + game is TapDetector || + game is SecondaryTapDetector || + game is DoubleTapDetector || + game is LongPressDetector || + game is VerticalDragDetector || + game is HorizontalDragDetector || + game is ForcePressDetector || + game is PanDetector || + game is ScaleDetector || + game is MultiTouchTapDetector; Widget _applyGesturesDetectors(Game game, Widget child) { - return flame_detector.GestureDetector( - // Taps - onTap: game is TapDetector ? () => (game as TapDetector).onTap() : null, - onTapCancel: game is TapDetector - ? () => (game as TapDetector).onTapCancel() - : null, - onTapDown: game is TapDetector - ? (TapDownDetails d) => (game as TapDetector).onTapDown(d) - : null, - onTapUp: game is TapDetector - ? (TapUpDetails d) => (game as TapDetector).onTapUp(d) - : null, + return flame_detector.GestureDetector( + // Taps + onTap: game is TapDetector ? () => (game as TapDetector).onTap() : null, + onTapCancel: + game is TapDetector ? () => (game as TapDetector).onTapCancel() : null, + onTapDown: game is TapDetector + ? (TapDownDetails d) => (game as TapDetector).onTapDown(d) + : null, + onTapUp: game is TapDetector + ? (TapUpDetails d) => (game as TapDetector).onTapUp(d) + : null, - // MultiTaps - onMultiTap: game is MultiTouchTapDetector ? (int pointerId) => (game as MultiTouchTapDetector).onTap(pointerId) : null, - onMultiTapCancel: game is MultiTouchTapDetector - ? (int pointerId) => (game as MultiTouchTapDetector).onTapCancel(pointerId) - : null, - onMultiTapDown: game is MultiTouchTapDetector - ? (int pointerId, TapDownDetails d) => (game as MultiTouchTapDetector).onTapDown(pointerId, d) - : null, - onMultiTapUp: game is MultiTouchTapDetector - ? (int pointerId, TapUpDetails d) => (game as MultiTouchTapDetector).onTapUp(pointerId, d) - : null, + // MultiTaps + onMultiTap: game is MultiTouchTapDetector + ? (int pointerId) => (game as MultiTouchTapDetector).onTap(pointerId) + : null, + onMultiTapCancel: game is MultiTouchTapDetector + ? (int pointerId) => + (game as MultiTouchTapDetector).onTapCancel(pointerId) + : null, + onMultiTapDown: game is MultiTouchTapDetector + ? (int pointerId, TapDownDetails d) => + (game as MultiTouchTapDetector).onTapDown(pointerId, d) + : null, + onMultiTapUp: game is MultiTouchTapDetector + ? (int pointerId, TapUpDetails d) => + (game as MultiTouchTapDetector).onTapUp(pointerId, d) + : null, - // Secondary taps - onSecondaryTapDown: game is SecondaryTapDetector - ? (TapDownDetails d) => - (game as SecondaryTapDetector).onSecondaryTapDown(d) - : null, - onSecondaryTapUp: game is SecondaryTapDetector - ? (TapUpDetails d) => - (game as SecondaryTapDetector).onSecondaryTapUp(d) - : null, - onSecondaryTapCancel: game is SecondaryTapDetector - ? () => (game as SecondaryTapDetector).onSecondaryTapCancel() - : null, + // Secondary taps + onSecondaryTapDown: game is SecondaryTapDetector + ? (TapDownDetails d) => + (game as SecondaryTapDetector).onSecondaryTapDown(d) + : null, + onSecondaryTapUp: game is SecondaryTapDetector + ? (TapUpDetails d) => (game as SecondaryTapDetector).onSecondaryTapUp(d) + : null, + onSecondaryTapCancel: game is SecondaryTapDetector + ? () => (game as SecondaryTapDetector).onSecondaryTapCancel() + : null, - // Double tap - onDoubleTap: game is DoubleTapDetector - ? () => (game as DoubleTapDetector).onDoubleTap() - : null, + // Double tap + onDoubleTap: game is DoubleTapDetector + ? () => (game as DoubleTapDetector).onDoubleTap() + : null, - // Long presses - onLongPress: game is LongPressDetector - ? () => (game as LongPressDetector).onLongPress() - : null, - onLongPressStart: game is LongPressDetector - ? (LongPressStartDetails d) => - (game as LongPressDetector).onLongPressStart(d) - : null, - onLongPressMoveUpdate: game is LongPressDetector - ? (LongPressMoveUpdateDetails d) => - (game as LongPressDetector).onLongPressMoveUpdate(d) - : null, - onLongPressUp: game is LongPressDetector - ? () => (game as LongPressDetector).onLongPressUp() - : null, - onLongPressEnd: game is LongPressDetector - ? (LongPressEndDetails d) => - (game as LongPressDetector).onLongPressEnd(d) - : null, + // Long presses + onLongPress: game is LongPressDetector + ? () => (game as LongPressDetector).onLongPress() + : null, + onLongPressStart: game is LongPressDetector + ? (LongPressStartDetails d) => + (game as LongPressDetector).onLongPressStart(d) + : null, + onLongPressMoveUpdate: game is LongPressDetector + ? (LongPressMoveUpdateDetails d) => + (game as LongPressDetector).onLongPressMoveUpdate(d) + : null, + onLongPressUp: game is LongPressDetector + ? () => (game as LongPressDetector).onLongPressUp() + : null, + onLongPressEnd: game is LongPressDetector + ? (LongPressEndDetails d) => + (game as LongPressDetector).onLongPressEnd(d) + : null, - // Vertical drag - onVerticalDragDown: game is VerticalDragDetector - ? (DragDownDetails d) => - (game as VerticalDragDetector).onVerticalDragDown(d) - : null, - onVerticalDragStart: game is VerticalDragDetector - ? (DragStartDetails d) => - (game as VerticalDragDetector).onVerticalDragStart(d) - : null, - onVerticalDragUpdate: game is VerticalDragDetector - ? (DragUpdateDetails d) => - (game as VerticalDragDetector).onVerticalDragUpdate(d) - : null, - onVerticalDragEnd: game is VerticalDragDetector - ? (DragEndDetails d) => - (game as VerticalDragDetector).onVerticalDragEnd(d) - : null, - onVerticalDragCancel: game is VerticalDragDetector - ? () => (game as VerticalDragDetector).onVerticalDragCancel() - : null, + // Vertical drag + onVerticalDragDown: game is VerticalDragDetector + ? (DragDownDetails d) => + (game as VerticalDragDetector).onVerticalDragDown(d) + : null, + onVerticalDragStart: game is VerticalDragDetector + ? (DragStartDetails d) => + (game as VerticalDragDetector).onVerticalDragStart(d) + : null, + onVerticalDragUpdate: game is VerticalDragDetector + ? (DragUpdateDetails d) => + (game as VerticalDragDetector).onVerticalDragUpdate(d) + : null, + onVerticalDragEnd: game is VerticalDragDetector + ? (DragEndDetails d) => + (game as VerticalDragDetector).onVerticalDragEnd(d) + : null, + onVerticalDragCancel: game is VerticalDragDetector + ? () => (game as VerticalDragDetector).onVerticalDragCancel() + : null, - // Horizontal drag - onHorizontalDragDown: game is HorizontalDragDetector - ? (DragDownDetails d) => - (game as HorizontalDragDetector).onHorizontalDragDown(d) - : null, - onHorizontalDragStart: game is HorizontalDragDetector - ? (DragStartDetails d) => - (game as HorizontalDragDetector).onHorizontalDragStart(d) - : null, - onHorizontalDragUpdate: game is HorizontalDragDetector - ? (DragUpdateDetails d) => - (game as HorizontalDragDetector).onHorizontalDragUpdate(d) - : null, - onHorizontalDragEnd: game is HorizontalDragDetector - ? (DragEndDetails d) => - (game as HorizontalDragDetector).onHorizontalDragEnd(d) - : null, - onHorizontalDragCancel: game is HorizontalDragDetector - ? () => (game as HorizontalDragDetector).onHorizontalDragCancel() - : null, + // Horizontal drag + onHorizontalDragDown: game is HorizontalDragDetector + ? (DragDownDetails d) => + (game as HorizontalDragDetector).onHorizontalDragDown(d) + : null, + onHorizontalDragStart: game is HorizontalDragDetector + ? (DragStartDetails d) => + (game as HorizontalDragDetector).onHorizontalDragStart(d) + : null, + onHorizontalDragUpdate: game is HorizontalDragDetector + ? (DragUpdateDetails d) => + (game as HorizontalDragDetector).onHorizontalDragUpdate(d) + : null, + onHorizontalDragEnd: game is HorizontalDragDetector + ? (DragEndDetails d) => + (game as HorizontalDragDetector).onHorizontalDragEnd(d) + : null, + onHorizontalDragCancel: game is HorizontalDragDetector + ? () => (game as HorizontalDragDetector).onHorizontalDragCancel() + : null, - // Force presses - onForcePressStart: game is ForcePressDetector - ? (ForcePressDetails d) => - (game as ForcePressDetector).onForcePressStart(d) - : null, - onForcePressPeak: game is ForcePressDetector - ? (ForcePressDetails d) => - (game as ForcePressDetector).onForcePressPeak(d) - : null, - onForcePressUpdate: game is ForcePressDetector - ? (ForcePressDetails d) => - (game as ForcePressDetector).onForcePressUpdate(d) - : null, - onForcePressEnd: game is ForcePressDetector - ? (ForcePressDetails d) => - (game as ForcePressDetector).onForcePressEnd(d) - : null, + // Force presses + onForcePressStart: game is ForcePressDetector + ? (ForcePressDetails d) => + (game as ForcePressDetector).onForcePressStart(d) + : null, + onForcePressPeak: game is ForcePressDetector + ? (ForcePressDetails d) => + (game as ForcePressDetector).onForcePressPeak(d) + : null, + onForcePressUpdate: game is ForcePressDetector + ? (ForcePressDetails d) => + (game as ForcePressDetector).onForcePressUpdate(d) + : null, + onForcePressEnd: game is ForcePressDetector + ? (ForcePressDetails d) => + (game as ForcePressDetector).onForcePressEnd(d) + : null, - // Pan - onPanDown: game is PanDetector - ? (DragDownDetails d) => (game as PanDetector).onPanDown(d) - : null, - onPanStart: game is PanDetector - ? (DragStartDetails d) => (game as PanDetector).onPanStart(d) - : null, - onPanUpdate: game is PanDetector - ? (DragUpdateDetails d) => (game as PanDetector).onPanUpdate(d) - : null, - onPanEnd: game is PanDetector - ? (DragEndDetails d) => (game as PanDetector).onPanEnd(d) - : null, - onPanCancel: game is PanDetector - ? () => (game as PanDetector).onPanCancel() - : null, + // Pan + onPanDown: game is PanDetector + ? (DragDownDetails d) => (game as PanDetector).onPanDown(d) + : null, + onPanStart: game is PanDetector + ? (DragStartDetails d) => (game as PanDetector).onPanStart(d) + : null, + onPanUpdate: game is PanDetector + ? (DragUpdateDetails d) => (game as PanDetector).onPanUpdate(d) + : null, + onPanEnd: game is PanDetector + ? (DragEndDetails d) => (game as PanDetector).onPanEnd(d) + : null, + onPanCancel: + game is PanDetector ? () => (game as PanDetector).onPanCancel() : null, - // Scales - onScaleStart: game is ScaleDetector - ? (ScaleStartDetails d) => (game as ScaleDetector).onScaleStart(d) - : null, - onScaleUpdate: game is ScaleDetector - ? (ScaleUpdateDetails d) => (game as ScaleDetector).onScaleUpdate(d) - : null, - onScaleEnd: game is ScaleDetector - ? (ScaleEndDetails d) => (game as ScaleDetector).onScaleEnd(d) - : null, + // Scales + onScaleStart: game is ScaleDetector + ? (ScaleStartDetails d) => (game as ScaleDetector).onScaleStart(d) + : null, + onScaleUpdate: game is ScaleDetector + ? (ScaleUpdateDetails d) => (game as ScaleDetector).onScaleUpdate(d) + : null, + onScaleEnd: game is ScaleDetector + ? (ScaleEndDetails d) => (game as ScaleDetector).onScaleEnd(d) + : null, - child: child, - ); + child: child, + ); } class WidgetBuilder { @@ -179,11 +181,11 @@ class WidgetBuilder { Widget build(Game game) { Widget widget = Container( - color: game.backgroundColor(), - child: Directionality( - textDirection: TextDirection.ltr, - child: EmbeddedGameWidget(game), - ), + color: game.backgroundColor(), + child: Directionality( + textDirection: TextDirection.ltr, + child: EmbeddedGameWidget(game), + ), ); if (_hasGestureDetectors(game)) {