SVG radialGradient with negative cx and gradientTransform matrix fails to render correctly after Flutter upgrade
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
1. Create a Flutter project with the [`flutter_svg`](https://pub.dev/packages/flutter_svg) package.
2. Add an SVG asset that includes a with:
a negative cx value.
a gradientTransform="matrix(...)".
Run on Flutter 3.29.1 or later.
### Expected results
The rectangle is filled with a radial gradient, rendered correctly regardless of the negative cx.
### Actual results
The gradient is not rendered incorrectly but it was ok with flutter 3.27.0
### Code sample
```dart
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(body: Center(child: GradientExample())),
);
}
}
class GradientExample extends StatefulWidget {
const GradientExample({super.key});
@override
State createState() => _GradientExampleState();
}
class _GradientExampleState extends State {
@override
Widget build(BuildContext context) {
final svgString = '''
''';
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.string(
svgString,
height: 240,
width: 240,
allowDrawingOutsideViewBox: true,
),
const SizedBox(height: 20),
],
);
}
}
### Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
### Logs
Logs
```console
[Paste your logs here]
```
### Flutter Doctor output
[✓] Flutter (Channel stable, 3.29.1, on macOS 15.4.1 24E263 darwin-arm64, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.100.2)
[✓] Connected device (4 available)
[✓] Network resources
Contributor guide
Assessment
This issue has not been assessed yet.