Closed ueman closed 3 weeks ago
I could narrow it down a bit more:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: _FrameSquare(
height: 200,
width: 200,
borderRadius: 4,
lineWidth: 4,
)),
);
}
}
class _FrameSquare extends StatelessWidget {
const _FrameSquare({
required this.height,
required this.width,
required this.borderRadius,
required this.lineWidth,
});
final double height;
final double width;
final double borderRadius;
final double lineWidth;
@override
Widget build(BuildContext context) {
return Center(
child: CustomPaint(
size: Size(width, height),
painter: _FrameBorderPainter(
borderRadius: borderRadius,
lineWidth: lineWidth,
),
),
);
}
}
class _FrameBorderPainter extends CustomPainter {
_FrameBorderPainter({required this.borderRadius, required this.lineWidth});
final double borderRadius;
final double lineWidth;
@override
void paint(Canvas canvas, Size size) {
final legLength = size.width * 0.3;
final paint = Paint();
paint.color = const Color(0xFFFF69b4);
paint.style = PaintingStyle.stroke;
paint.strokeCap = StrokeCap.round;
paint.strokeWidth = lineWidth;
final path = Path()
..moveTo(0, legLength)
..lineTo(0, borderRadius)
..arcToPoint(
Offset(borderRadius, 0),
radius: Radius.circular(borderRadius),
)
..lineTo(legLength, 0)
..moveTo(0, legLength)
..close();
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return false;
}
}
That code results in the following images:
Impeller disabled | Impeller enabled |
---|---|
Thanks for the bug report. I was able to replicate this on latest stable and master versions.
The reason this is happening is a bug with Path.close(). We should be ignoring the final close call which is supposed to draw a line to the path start - since this is stroke and not a fill.
So we should fix this, but in this case you don't need/shouldn't use the Path.close at the end there. Because the fix is going to be ignoring it anyway
I can confirm that the workaround works like a charm. Thanks for that!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Steps to reproduce
Run the following code on iOS (simulator or phyiscal device, it doesn't matter) (complete code can be found in the collapsed block later)
Expected results
With Impeller disabled (the following code added to Info.plist)
Actual results
With Impeller
Code sample
Code sample
```dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override StateScreenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
There are no logsFlutter Doctor output
Doctor output
```console flutter doctor -v [✓] Flutter (Channel stable, 3.19.3, on macOS 14.3.1 23D60 darwin-arm64, locale en-DE) • Flutter version 3.19.3 on channel stable at /Users/ueman/Developer/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ba39319843 (5 weeks ago), 2024-03-07 15:22:21 -0600 • Engine revision 2e4ba9c6fb • Dart version 3.3.1 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/ueman/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) [✓] VS Code (version 1.88.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.86.0 [✓] Connected device (4 available) • iPhone-GWTGT1UTPLJQ (mobile) • 00008030-000E4D310CD3402E • ios • iOS 17.4.1 21E236 • iPhone 15 Pro Max (mobile) • 4E4B3D83-EAA8-490B-B699-90A09831AC06 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.107 [✓] Network resources • All expected network resources are available. • No issues found! ```