Unverified Commit effa7d52 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

use textdirection for gradient of ShapeDecoration (#77186)

parent 6c062894
...@@ -329,7 +329,7 @@ class _ShapeDecorationPainter extends BoxPainter { ...@@ -329,7 +329,7 @@ class _ShapeDecorationPainter extends BoxPainter {
_interiorPaint!.color = _decoration.color!; _interiorPaint!.color = _decoration.color!;
} }
if (_decoration.gradient != null) if (_decoration.gradient != null)
_interiorPaint!.shader = _decoration.gradient!.createShader(rect); _interiorPaint!.shader = _decoration.gradient!.createShader(rect, textDirection: textDirection);
if (_decoration.shadows != null) { if (_decoration.shadows != null) {
if (_shadowCount == null) { if (_shadowCount == null) {
_shadowCount = _decoration.shadows!.length; _shadowCount = _decoration.shadows!.length;
......
...@@ -114,6 +114,32 @@ Future<void> main() async { ...@@ -114,6 +114,32 @@ Future<void> main() async {
); );
}); });
testWidgets('Does not crash with directional gradient', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/76967.
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.rtl,
child: DecoratedBox(
decoration: ShapeDecoration(
gradient: RadialGradient(
focal: AlignmentDirectional(0, 1),
focalRadius: 5,
radius: 2,
colors: <Color>[Colors.red, Colors.black],
stops: <double>[0.0, 0.4],
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
),
),
),
),
);
expect(tester.takeException(), isNull);
});
test('ShapeDecoration equality', () { test('ShapeDecoration equality', () {
const ShapeDecoration a = ShapeDecoration( const ShapeDecoration a = ShapeDecoration(
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment