From 3821c35d0460b9b606d34d79012b0434079c44fa Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 7 Sep 2018 14:38:14 -0700 Subject: [PATCH] Ensure that textDirection is always passed to ShapeBorder.getOuterPath (#21532) --- .../lib/src/material/ink_highlight.dart | 6 +- .../flutter/lib/src/material/ink_ripple.dart | 8 +- .../flutter/lib/src/material/ink_splash.dart | 10 +- .../flutter/lib/src/material/ink_well.dart | 4 + .../lib/src/material/outline_button.dart | 2 +- .../flutter/lib/src/material/text_field.dart | 2 + .../flutter/test/material/ink_paint_test.dart | 151 ++++++++++-------- .../test/material/ink_splash_test.dart | 29 ++++ .../flutter/test/material/ink_well_test.dart | 82 ++++++---- .../material/raw_material_button_test.dart | 74 +++++---- .../test/material/text_field_splash_test.dart | 4 + .../flutter/test/widgets/run_app_test.dart | 15 +- 12 files changed, 247 insertions(+), 140 deletions(-) create mode 100644 packages/flutter/test/material/ink_splash_test.dart diff --git a/packages/flutter/lib/src/material/ink_highlight.dart b/packages/flutter/lib/src/material/ink_highlight.dart index dd9372968e4b9..26019f714ec00 100644 --- a/packages/flutter/lib/src/material/ink_highlight.dart +++ b/packages/flutter/lib/src/material/ink_highlight.dart @@ -39,6 +39,7 @@ class InkHighlight extends InteractiveInkFeature { @required MaterialInkController controller, @required RenderBox referenceBox, @required Color color, + @required TextDirection textDirection, BoxShape shape = BoxShape.rectangle, BorderRadius borderRadius, ShapeBorder customBorder, @@ -46,9 +47,11 @@ class InkHighlight extends InteractiveInkFeature { VoidCallback onRemoved, }) : assert(color != null), assert(shape != null), + assert(textDirection != null), _shape = shape, _borderRadius = borderRadius ?? BorderRadius.zero, _customBorder = customBorder, + _textDirection = textDirection, _rectCallback = rectCallback, super(controller: controller, referenceBox: referenceBox, color: color, onRemoved: onRemoved) { _alphaController = new AnimationController(duration: _kHighlightFadeDuration, vsync: controller.vsync) @@ -67,6 +70,7 @@ class InkHighlight extends InteractiveInkFeature { final BorderRadius _borderRadius; final ShapeBorder _customBorder; final RectCallback _rectCallback; + final TextDirection _textDirection; Animation _alpha; AnimationController _alphaController; @@ -102,7 +106,7 @@ class InkHighlight extends InteractiveInkFeature { assert(_shape != null); canvas.save(); if (_customBorder != null) { - canvas.clipPath(_customBorder.getOuterPath(rect)); + canvas.clipPath(_customBorder.getOuterPath(rect, textDirection: _textDirection)); } switch (_shape) { case BoxShape.circle: diff --git a/packages/flutter/lib/src/material/ink_ripple.dart b/packages/flutter/lib/src/material/ink_ripple.dart index 584d844a8c009..b56aa7947acdb 100644 --- a/packages/flutter/lib/src/material/ink_ripple.dart +++ b/packages/flutter/lib/src/material/ink_ripple.dart @@ -45,6 +45,7 @@ class _InkRippleFactory extends InteractiveInkFeatureFactory { @required RenderBox referenceBox, @required Offset position, @required Color color, + @required TextDirection textDirection, bool containedInkWell = false, RectCallback rectCallback, BorderRadius borderRadius, @@ -63,6 +64,7 @@ class _InkRippleFactory extends InteractiveInkFeatureFactory { customBorder: customBorder, radius: radius, onRemoved: onRemoved, + textDirection: textDirection, ); } } @@ -114,6 +116,7 @@ class InkRipple extends InteractiveInkFeature { @required RenderBox referenceBox, @required Offset position, @required Color color, + @required TextDirection textDirection, bool containedInkWell = false, RectCallback rectCallback, BorderRadius borderRadius, @@ -122,9 +125,11 @@ class InkRipple extends InteractiveInkFeature { VoidCallback onRemoved, }) : assert(color != null), assert(position != null), + assert(textDirection != null), _position = position, _borderRadius = borderRadius ?? BorderRadius.zero, _customBorder = customBorder, + _textDirection = textDirection, _targetRadius = radius ?? _getTargetRadius(referenceBox, containedInkWell, rectCallback, position), _clipCallback = _getClipCallback(referenceBox, containedInkWell, rectCallback), super(controller: controller, referenceBox: referenceBox, color: color, onRemoved: onRemoved) @@ -179,6 +184,7 @@ class InkRipple extends InteractiveInkFeature { final ShapeBorder _customBorder; final double _targetRadius; final RectCallback _clipCallback; + final TextDirection _textDirection; Animation _radius; AnimationController _radiusController; @@ -245,7 +251,7 @@ class InkRipple extends InteractiveInkFeature { if (_clipCallback != null) { final Rect rect = _clipCallback(); if (_customBorder != null) { - canvas.clipPath(_customBorder.getOuterPath(rect)); + canvas.clipPath(_customBorder.getOuterPath(rect, textDirection: _textDirection)); } else if (_borderRadius != BorderRadius.zero) { canvas.clipRRect(new RRect.fromRectAndCorners( rect, diff --git a/packages/flutter/lib/src/material/ink_splash.dart b/packages/flutter/lib/src/material/ink_splash.dart index 2b884d71ffe23..d6ede371edc37 100644 --- a/packages/flutter/lib/src/material/ink_splash.dart +++ b/packages/flutter/lib/src/material/ink_splash.dart @@ -51,6 +51,7 @@ class _InkSplashFactory extends InteractiveInkFeatureFactory { @required RenderBox referenceBox, @required Offset position, @required Color color, + @required TextDirection textDirection, bool containedInkWell = false, RectCallback rectCallback, BorderRadius borderRadius, @@ -69,6 +70,7 @@ class _InkSplashFactory extends InteractiveInkFeatureFactory { customBorder: customBorder, radius: radius, onRemoved: onRemoved, + textDirection: textDirection, ); } } @@ -116,6 +118,7 @@ class InkSplash extends InteractiveInkFeature { InkSplash({ @required MaterialInkController controller, @required RenderBox referenceBox, + @required TextDirection textDirection, Offset position, Color color, bool containedInkWell = false, @@ -124,12 +127,14 @@ class InkSplash extends InteractiveInkFeature { ShapeBorder customBorder, double radius, VoidCallback onRemoved, - }) : _position = position, + }) : assert(textDirection != null), + _position = position, _borderRadius = borderRadius ?? BorderRadius.zero, _customBorder = customBorder, _targetRadius = radius ?? _getTargetRadius(referenceBox, containedInkWell, rectCallback, position), _clipCallback = _getClipCallback(referenceBox, containedInkWell, rectCallback), _repositionToReferenceBox = !containedInkWell, + _textDirection = textDirection, super(controller: controller, referenceBox: referenceBox, color: color, onRemoved: onRemoved) { assert(_borderRadius != null); _radiusController = new AnimationController(duration: _kUnconfirmedSplashDuration, vsync: controller.vsync) @@ -156,6 +161,7 @@ class InkSplash extends InteractiveInkFeature { final double _targetRadius; final RectCallback _clipCallback; final bool _repositionToReferenceBox; + final TextDirection _textDirection; Animation _radius; AnimationController _radiusController; @@ -206,7 +212,7 @@ class InkSplash extends InteractiveInkFeature { if (_clipCallback != null) { final Rect rect = _clipCallback(); if (_customBorder != null) { - canvas.clipPath(_customBorder.getOuterPath(rect)); + canvas.clipPath(_customBorder.getOuterPath(rect, textDirection: _textDirection)); } else if (_borderRadius != BorderRadius.zero) { canvas.clipRRect(new RRect.fromRectAndCorners( rect, diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index 04b2eda083e66..c81ccd3d5fed2 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -92,6 +92,7 @@ abstract class InteractiveInkFeatureFactory { @required RenderBox referenceBox, @required Offset position, @required Color color, + @required TextDirection textDirection, bool containedInkWell = false, RectCallback rectCallback, BorderRadius borderRadius, @@ -372,6 +373,7 @@ class InkResponse extends StatefulWidget { @mustCallSuper bool debugCheckContext(BuildContext context) { assert(debugCheckHasMaterial(context)); + assert(debugCheckHasDirectionality(context)); return true; } @@ -426,6 +428,7 @@ class _InkResponseState extends State with AutomaticKe customBorder: widget.customBorder, rectCallback: widget.getRectCallback(referenceBox), onRemoved: _handleInkHighlightRemoval, + textDirection: Directionality.of(context), ); updateKeepAlive(); } else { @@ -476,6 +479,7 @@ class _InkResponseState extends State with AutomaticKe borderRadius: borderRadius, customBorder: customBorder, onRemoved: onRemoved, + textDirection: Directionality.of(context), ); return splash; diff --git a/packages/flutter/lib/src/material/outline_button.dart b/packages/flutter/lib/src/material/outline_button.dart index d57a66f9df0cd..85f88e31746c9 100644 --- a/packages/flutter/lib/src/material/outline_button.dart +++ b/packages/flutter/lib/src/material/outline_button.dart @@ -497,7 +497,7 @@ class _OutlineBorder extends ShapeBorder { case BorderStyle.none: break; case BorderStyle.solid: - canvas.drawPath(shape.getOuterPath(rect), side.toPaint()); + canvas.drawPath(shape.getOuterPath(rect, textDirection: textDirection), side.toPaint()); } } diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index 36a02821298de..3d4f900d13ca3 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -473,6 +473,7 @@ class _TextFieldState extends State with AutomaticKeepAliveClientMixi // TODO(hansmuller): splash clip borderRadius should match the input decorator's border. borderRadius: BorderRadius.zero, onRemoved: handleRemoved, + textDirection: Directionality.of(context), ); return splash; @@ -539,6 +540,7 @@ class _TextFieldState extends State with AutomaticKeepAliveClientMixi Widget build(BuildContext context) { super.build(context); // See AutomaticKeepAliveClientMixin. assert(debugCheckHasMaterial(context)); + assert(debugCheckHasDirectionality(context)); final ThemeData themeData = Theme.of(context); final TextStyle style = widget.style ?? themeData.textTheme.subhead; final Brightness keyboardAppearance = widget.keyboardAppearance ?? themeData.primaryColorBrightness; diff --git a/packages/flutter/test/material/ink_paint_test.dart b/packages/flutter/test/material/ink_paint_test.dart index eea0020ce9914..908b63a5c749d 100644 --- a/packages/flutter/test/material/ink_paint_test.dart +++ b/packages/flutter/test/material/ink_paint_test.dart @@ -15,16 +15,19 @@ void main() { final BorderRadius borderRadius = new BorderRadius.circular(6.0); await tester.pumpWidget( - new Material( - child: new Center( - child: new Container( - width: 200.0, - height: 60.0, - child: new InkWell( - borderRadius: borderRadius, - highlightColor: highlightColor, - splashColor: splashColor, - onTap: () { }, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new Container( + width: 200.0, + height: 60.0, + child: new InkWell( + borderRadius: borderRadius, + highlightColor: highlightColor, + splashColor: splashColor, + onTap: () { }, + ), ), ), ), @@ -61,18 +64,21 @@ void main() { final BorderRadius borderRadius = new BorderRadius.circular(6.0); await tester.pumpWidget( - new Material( - child: new Center( - child: new Container( - width: 100.0, - height: 100.0, - child: new InkWell( - borderRadius: borderRadius, - highlightColor: highlightColor, - splashColor: splashColor, - onTap: () { }, - radius: 100.0, - splashFactory: InkRipple.splashFactory, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new Container( + width: 100.0, + height: 100.0, + child: new InkWell( + borderRadius: borderRadius, + highlightColor: highlightColor, + splashColor: splashColor, + onTap: () { }, + radius: 100.0, + splashFactory: InkRipple.splashFactory, + ), ), ), ), @@ -138,15 +144,18 @@ void main() { testWidgets('Does the Ink widget render anything', (WidgetTester tester) async { await tester.pumpWidget( - new Material( - child: new Center( - child: new Ink( - color: Colors.blue, - width: 200.0, - height: 200.0, - child: new InkWell( - splashColor: Colors.green, - onTap: () { }, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new Ink( + color: Colors.blue, + width: 200.0, + height: 200.0, + child: new InkWell( + splashColor: Colors.green, + onTap: () { }, + ), ), ), ), @@ -167,15 +176,18 @@ void main() { ); await tester.pumpWidget( - new Material( - child: new Center( - child: new Ink( - color: Colors.red, - width: 200.0, - height: 200.0, - child: new InkWell( - splashColor: Colors.green, - onTap: () { }, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new Ink( + color: Colors.red, + width: 200.0, + height: 200.0, + child: new InkWell( + splashColor: Colors.green, + onTap: () { }, + ), ), ), ), @@ -192,11 +204,14 @@ void main() { ); await tester.pumpWidget( - new Material( - child: new Center( - child: new InkWell( // this is at a different depth in the tree so it's now a new InkWell - splashColor: Colors.green, - onTap: () { }, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new InkWell( // this is at a different depth in the tree so it's now a new InkWell + splashColor: Colors.green, + onTap: () { }, + ), ), ), ), @@ -213,15 +228,18 @@ void main() { testWidgets('Cancel an InkRipple that was disposed when its animation ended', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/14391 await tester.pumpWidget( - new Material( - child: new Center( - child: new Container( - width: 100.0, - height: 100.0, - child: new InkWell( - onTap: () { }, - radius: 100.0, - splashFactory: InkRipple.splashFactory, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new Container( + width: 100.0, + height: 100.0, + child: new InkWell( + onTap: () { }, + radius: 100.0, + splashFactory: InkRipple.splashFactory, + ), ), ), ), @@ -246,17 +264,20 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/14391 await tester.pumpWidget( - new Material( - child: new Center( - child: new Container( - width: 100.0, - height: 100.0, - child: new InkWell( - splashColor: splashColor, - highlightColor: highlightColor, - onTap: () { }, - radius: 100.0, - splashFactory: InkRipple.splashFactory, + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new Container( + width: 100.0, + height: 100.0, + child: new InkWell( + splashColor: splashColor, + highlightColor: highlightColor, + onTap: () { }, + radius: 100.0, + splashFactory: InkRipple.splashFactory, + ), ), ), ), diff --git a/packages/flutter/test/material/ink_splash_test.dart b/packages/flutter/test/material/ink_splash_test.dart new file mode 100644 index 0000000000000..c9119b108955b --- /dev/null +++ b/packages/flutter/test/material/ink_splash_test.dart @@ -0,0 +1,29 @@ +// Copyright 2018 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. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + // Regression test for https://github.com/flutter/flutter/issues/21506. + testWidgets('InkSplash receives textDirection', (WidgetTester tester) async { + await tester.pumpWidget(new MaterialApp( + home: new Scaffold( + appBar: new AppBar(title: const Text('Button Border Test')), + body: new Center( + child: new RaisedButton( + child: const Text('Test'), + onPressed: () {}, + shape: new Border.all( + color: Colors.blue, + ), + ), + ), + ))); + await tester.tap(find.text('Test')); + // start ink animation which asserts for a textDirection. + await tester.pumpAndSettle(const Duration(milliseconds: 30)); + expect(tester.takeException(), isNull); + }); +} diff --git a/packages/flutter/test/material/ink_well_test.dart b/packages/flutter/test/material/ink_well_test.dart index ac4556eb8bbc6..b0c921a7fd61c 100644 --- a/packages/flutter/test/material/ink_well_test.dart +++ b/packages/flutter/test/material/ink_well_test.dart @@ -14,27 +14,32 @@ void main() { testWidgets('InkWell gestures control test', (WidgetTester tester) async { final List log = []; - await tester.pumpWidget(new Material( - child: new Center( - child: new InkWell( - onTap: () { - log.add('tap'); - }, - onDoubleTap: () { - log.add('double-tap'); - }, - onLongPress: () { - log.add('long-press'); - }, - onTapDown: (TapDownDetails details) { - log.add('tap-down'); - }, - onTapCancel: () { - log.add('tap-cancel'); - }, - ), - ), - )); + await tester.pumpWidget( + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new Center( + child: new InkWell( + onTap: () { + log.add('tap'); + }, + onDoubleTap: () { + log.add('double-tap'); + }, + onLongPress: () { + log.add('long-press'); + }, + onTapDown: (TapDownDetails details) { + log.add('tap-down'); + }, + onTapCancel: () { + log.add('tap-cancel'); + }, + ), + ), + ) + ) + ); await tester.tap(find.byType(InkWell), pointer: 1); @@ -72,9 +77,12 @@ void main() { testWidgets('long-press and tap on disabled should not throw', (WidgetTester tester) async { await tester.pumpWidget(const Material( - child: Center( - child: InkWell(), - ), + child: Directionality( + textDirection: TextDirection.ltr, + child: Center( + child: InkWell(), + ), + ) )); await tester.tap(find.byType(InkWell), pointer: 1); await tester.pump(const Duration(seconds: 1)); @@ -95,10 +103,13 @@ void main() { testWidgets('enabled (default)', (WidgetTester tester) async { await tester.pumpWidget(new Material( - child: new Center( - child: new InkWell( - onTap: () {}, - onLongPress: () {}, + child: new Directionality( + textDirection: TextDirection.ltr, + child: new Center( + child: new InkWell( + onTap: () {}, + onLongPress: () {}, + ), ), ), )); @@ -120,13 +131,16 @@ void main() { testWidgets('disabled', (WidgetTester tester) async { await tester.pumpWidget(new Material( - child: new Center( - child: new InkWell( - onTap: () {}, - onLongPress: () {}, - enableFeedback: false, + child: new Directionality( + textDirection: TextDirection.ltr, + child: new Center( + child: new InkWell( + onTap: () {}, + onLongPress: () {}, + enableFeedback: false, + ), ), - ), + ) )); await tester.tap(find.byType(InkWell), pointer: 1); await tester.pump(const Duration(seconds: 1)); diff --git a/packages/flutter/test/material/raw_material_button_test.dart b/packages/flutter/test/material/raw_material_button_test.dart index fee544ab04ba1..0d4a22f607a04 100644 --- a/packages/flutter/test/material/raw_material_button_test.dart +++ b/packages/flutter/test/material/raw_material_button_test.dart @@ -9,14 +9,19 @@ void main() { testWidgets('materialTapTargetSize.padded expands hit test area', (WidgetTester tester) async { int pressed = 0; - await tester.pumpWidget(new RawMaterialButton( - onPressed: () { - pressed++; - }, - constraints: new BoxConstraints.tight(const Size(10.0, 10.0)), - materialTapTargetSize: MaterialTapTargetSize.padded, - child: const Text('+', textDirection: TextDirection.ltr), - )); + await tester.pumpWidget( + new Directionality( + textDirection: TextDirection.ltr, + child: new RawMaterialButton( + onPressed: () { + pressed++; + }, + constraints: new BoxConstraints.tight(const Size(10.0, 10.0)), + materialTapTargetSize: MaterialTapTargetSize.padded, + child: const Text('+'), + ), + ) + ); await tester.tapAt(const Offset(40.0, 400.0)); @@ -26,12 +31,15 @@ void main() { testWidgets('materialTapTargetSize.padded expands semantics area', (WidgetTester tester) async { final SemanticsTester semantics = new SemanticsTester(tester); await tester.pumpWidget( - new Center( - child: new RawMaterialButton( - onPressed: () {}, - constraints: new BoxConstraints.tight(const Size(10.0, 10.0)), - materialTapTargetSize: MaterialTapTargetSize.padded, - child: const Text('+', textDirection: TextDirection.ltr), + new Directionality( + textDirection: TextDirection.ltr, + child: new Center( + child: new RawMaterialButton( + onPressed: () {}, + constraints: new BoxConstraints.tight(const Size(10.0, 10.0)), + materialTapTargetSize: MaterialTapTargetSize.padded, + child: const Text('+'), + ), ), ), ); @@ -66,14 +74,17 @@ void main() { const Color fillColor = Color(0xFFEF5350); await tester.pumpWidget( - new Center( - child: new RawMaterialButton( - materialTapTargetSize: MaterialTapTargetSize.padded, - onPressed: () {}, - fillColor: fillColor, - highlightColor: highlightColor, - splashColor: splashColor, - child: const SizedBox(), + new Directionality( + textDirection: TextDirection.ltr, + child: new Center( + child: new RawMaterialButton( + materialTapTargetSize: MaterialTapTargetSize.padded, + onPressed: () {}, + fillColor: fillColor, + highlightColor: highlightColor, + splashColor: splashColor, + child: const SizedBox(), + ), ), ), ); @@ -95,14 +106,17 @@ void main() { const Color fillColor = Color(0xFFEF5350); await tester.pumpWidget( - new Center( - child: new RawMaterialButton( - materialTapTargetSize: MaterialTapTargetSize.padded, - onPressed: () {}, - fillColor: fillColor, - highlightColor: highlightColor, - splashColor: splashColor, - child: const SizedBox(), + new Directionality( + textDirection: TextDirection.ltr, + child: new Center( + child: new RawMaterialButton( + materialTapTargetSize: MaterialTapTargetSize.padded, + onPressed: () {}, + fillColor: fillColor, + highlightColor: highlightColor, + splashColor: splashColor, + child: const SizedBox(), + ), ), ), ); diff --git a/packages/flutter/test/material/text_field_splash_test.dart b/packages/flutter/test/material/text_field_splash_test.dart index d0c259c0573e2..2cc920ca72a54 100644 --- a/packages/flutter/test/material/text_field_splash_test.dart +++ b/packages/flutter/test/material/text_field_splash_test.dart @@ -22,6 +22,7 @@ class TestInkSplash extends InkSplash { ShapeBorder customBorder, double radius, VoidCallback onRemoved, + TextDirection textDirection }) : super( controller: controller, referenceBox: referenceBox, @@ -33,6 +34,7 @@ class TestInkSplash extends InkSplash { customBorder: customBorder, radius: radius, onRemoved: onRemoved, + textDirection: textDirection, ); @override @@ -63,6 +65,7 @@ class TestInkSplashFactory extends InteractiveInkFeatureFactory { ShapeBorder customBorder, double radius, VoidCallback onRemoved, + TextDirection textDirection, }) { return new TestInkSplash( controller: controller, @@ -75,6 +78,7 @@ class TestInkSplashFactory extends InteractiveInkFeatureFactory { customBorder: customBorder, radius: radius, onRemoved: onRemoved, + textDirection: textDirection, ); } } diff --git a/packages/flutter/test/widgets/run_app_test.dart b/packages/flutter/test/widgets/run_app_test.dart index 7ef4124cce4f8..5a527224caee3 100644 --- a/packages/flutter/test/widgets/run_app_test.dart +++ b/packages/flutter/test/widgets/run_app_test.dart @@ -8,12 +8,15 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('runApp inside onPressed does not throw', (WidgetTester tester) async { await tester.pumpWidget( - new Material( - child: new RaisedButton( - onPressed: () { - runApp(const Center(child: Text('Done', textDirection: TextDirection.ltr))); - }, - child: const Text('GO', textDirection: TextDirection.ltr) + new Directionality( + textDirection: TextDirection.ltr, + child: new Material( + child: new RaisedButton( + onPressed: () { + runApp(const Center(child: Text('Done', textDirection: TextDirection.ltr,))); + }, + child: const Text('GO') + ) ) ) );