New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canvas.drawShadow does not draw a shadow for a "line" path #104171
Labels
c: rendering
UI glitches reported at the engine/skia rendering level
engine
flutter/engine repository. See also e: labels.
found in release: 3.0
Found to occur in 3.0
found in release: 3.1
Found to occur in 3.1
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
P2
Important issues not at the top of the work list
team-engine
Owned by Engine team
triaged-engine
Triaged by Engine team
Comments
Issue is reproducible on In the code sample below, This reproduces on all platforms. code sampleimport 'dart:math' as math;
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
debugShowCheckedModeBanner: false,
home: const Scaffold(
body: MyWidget(),
),
);
}
}
class MyWidget extends StatelessWidget {
const MyWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: Container(
color: const Color.fromARGB(255, 198, 198, 198),
child: const CustomPaint(
size: Size(double.infinity, 2),
// painter: MyPainter(),
painter: MyPainter2(),
),
),
);
}
}
class MyPainter extends CustomPainter {
const MyPainter();
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..color = Colors.black
..style = PaintingStyle.stroke
..strokeWidth = 10;
final path = Path()..lineTo(size.width, 0);
canvas.drawPath(path, paint);
canvas.drawShadow(path, Colors.red, 5, true);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}
class MyPainter2 extends CustomPainter {
const MyPainter2();
@override
void paint(Canvas canvas, Size size) {
final rect = Rect.fromLTWH(30, 50, 50, 50);
final paint = Paint()
..style = PaintingStyle.stroke
..color = Colors.red
..strokeWidth = 3;
final path = Path()..addArc(rect, -math.pi / 2, math.pi);
canvas.drawPath(path, paint);
canvas.drawShadow(path, Colors.grey, 5, false);
}
@override
bool shouldRepaint(CustomPainter old) {
return false;
}
}
flutter doctor -v
|
danagbemava-nc
added
engine
flutter/engine repository. See also e: labels.
c: rendering
UI glitches reported at the engine/skia rendering level
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
found in release: 3.0
Found to occur in 3.0
found in release: 3.1
Found to occur in 3.1
and removed
in triage
Presently being triaged by the triage team
labels
May 19, 2022
flutter-triage-bot
bot
added
team-engine
Owned by Engine team
triaged-engine
Triaged by Engine team
labels
Jul 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c: rendering
UI glitches reported at the engine/skia rendering level
engine
flutter/engine repository. See also e: labels.
found in release: 3.0
Found to occur in 3.0
found in release: 3.1
Found to occur in 3.1
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
P2
Important issues not at the top of the work list
team-engine
Owned by Engine team
triaged-engine
Triaged by Engine team
Steps to Reproduce
Checkout the code below where I create a custom painter "MyPainter". The painter draws a line from left to right of the screen and adds a shadow along the same path using
canvas.drawShadow
. Note that the shadow doesn't appear.Expected: A red color shadow should appear below the line.
Actual: No shadow appears.
Additionally, I tried this same code by creating a path from a rect in which case the shadow appears.
Code sample
Flutter doctor
The text was updated successfully, but these errors were encountered: