Last active
January 13, 2025 17:00
-
-
Save coman3/e631fd55cd9cdf9bd4efe8ecfdbb85a7 to your computer and use it in GitHub Desktop.
Revisions
-
coman3 revised this gist
Feb 15, 2023 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,6 @@ class ClipShadowPath extends StatelessWidget { @override Widget build(BuildContext context) { return CustomPaint( painter: _ClipShadowShadowPainter( clipper: this.clipper, shadow: this.shadow, -
coman3 revised this gist
May 27, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class ClipShadowPath extends StatelessWidget { @override Widget build(BuildContext context) { return CustomPaint( key: UniqueKey(), painter: _ClipShadowShadowPainter( clipper: this.clipper, shadow: this.shadow, -
coman3 revised this gist
Apr 9, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,8 @@ class _ClipShadowShadowPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { var paint = shadow.toPaint(); var clipPath = clipper.getClip(size).shift(shadow.offset); canvas.drawPath(clipPath, paint); } @override -
coman3 revised this gist
Jan 27, 2019 . 1 changed file with 12 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,60 +1,39 @@ import 'package:flutter/material.dart'; @immutable class ClipShadowPath extends StatelessWidget { final Shadow shadow; final CustomClipper<Path> clipper; final Widget child; ClipShadowPath({ @required this.shadow, @required this.clipper, @required this.child, }); @override Widget build(BuildContext context) { return CustomPaint( painter: _ClipShadowShadowPainter( clipper: this.clipper, shadow: this.shadow, ), child: ClipPath(child: child, clipper: this.clipper), ); } } class _ClipShadowShadowPainter extends CustomPainter { final Shadow shadow; final CustomClipper<Path> clipper; _ClipShadowShadowPainter({@required this.shadow, @required this.clipper}); @override void paint(Canvas canvas, Size size) { var paint = shadow.toPaint(); canvas.drawPath(clipper.getClip(size), paint); } @override -
coman3 created this gist
Jan 27, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ import 'package:flutter/material.dart'; typedef Path BuildPath(Size size); @immutable class ClipShadowPath extends StatelessWidget { final Shadow shadow; final BuildPath buildPath; final Widget child; ClipShadowPath( {@required this.shadow, @required this.buildPath, @required this.child}); @override Widget build(BuildContext context) { return CustomPaint( painter: _ClipShadowShadowPainter( buildPath: this.buildPath, shadow: this.shadow), child: ClipPath( child: child, clipper: _ClipShadowPathClipper( buildPath: this.buildPath, ), ), ); } } class _ClipShadowPathClipper extends CustomClipper<Path> { final BuildPath buildPath; _ClipShadowPathClipper({ @required this.buildPath, }); @override Path getClip(Size size) { return this.buildPath(size); } @override bool shouldReclip(CustomClipper<Path> oldClipper) { return true; } } class _ClipShadowShadowPainter extends CustomPainter { final BuildPath buildPath; final Shadow shadow; _ClipShadowShadowPainter({ @required this.buildPath, @required this.shadow, }); @override void paint(Canvas canvas, Size size) { var paint = shadow.toPaint(); canvas.drawPath(this.buildPath(size), paint); } @override bool shouldRepaint(CustomPainter oldDelegate) { return true; } }