Skip to content
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

visible parameter #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/ribbon_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum RibbonLocation {
}

class Ribbon extends StatelessWidget {
final bool visible;
final double nearLength;
final double farLength;
final String title;
Expand All @@ -27,6 +28,7 @@ class Ribbon extends StatelessWidget {

const Ribbon(
{Key? key,
this.visible = true,
required this.nearLength,
required this.farLength,
required this.title,
Expand All @@ -40,6 +42,7 @@ class Ribbon extends StatelessWidget {
Widget build(BuildContext context) {
return CustomPaint(
foregroundPainter: _RibbonPainter(
visible: visible,
nearLength: nearLength,
farLength: farLength,
title: title,
Expand All @@ -52,6 +55,7 @@ class Ribbon extends StatelessWidget {
}

class _RibbonPainter extends CustomPainter {
bool visible;
double nearLength;
double farLength;
final String title;
Expand All @@ -73,7 +77,8 @@ class _RibbonPainter extends CustomPainter {
);

_RibbonPainter(
{required this.nearLength,
{required this.visible,
required this.nearLength,
required this.farLength,
required this.title,
required this.titleStyle,
Expand All @@ -83,6 +88,9 @@ class _RibbonPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
if (!initialized) _initializ(size);
if (!visible) {
return;
}
// canvas.drawPath(pathRibbon, paintShadow);
canvas
..drawShadow(pathRibbon, const Color(0x7F000000), 2.0, true)
Expand Down