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

Background Color of Arc can now be instantiated by user. #3

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
9 changes: 8 additions & 1 deletion lib/kdgaugeview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class KdGaugeView extends StatefulWidget {
final Duration duration;
final int fractionDigits;

final Color inactiveArcColor;

final Widget? child;

KdGaugeView(
Expand Down Expand Up @@ -63,6 +65,7 @@ class KdGaugeView extends StatefulWidget {
this.activeGaugeColor = Colors.green,
this.innerCirclePadding = 30,
this.divisionCircleColors = Colors.blue,
this.inactiveArcColor = Colors.grey,
this.subDivisionCircleColors = Colors.blue,
this.animate = false,
this.duration = const Duration(milliseconds: 400),
Expand Down Expand Up @@ -130,6 +133,7 @@ class KdGaugeViewState extends State<KdGaugeView>
Widget build(BuildContext context) {
return CustomPaint(
painter: _KdGaugeCustomPainter(
widget.inactiveArcColor,
_gaugeMarkSpeed,
widget.speedTextStyle,
widget.unitOfMeasurement,
Expand Down Expand Up @@ -195,13 +199,16 @@ class _KdGaugeCustomPainter extends CustomPainter {
final Color subDivisionCircleColors;
final Color divisionCircleColors;

final Color inactiveArcColor;

Offset? center;
double mRadius = 200;
double mDottedCircleRadius = 0;

final int fractionDigits;

_KdGaugeCustomPainter(
this.inactiveArcColor,
this.speed,
this.speedTextStyle,
this.unitOfMeasurement,
Expand Down Expand Up @@ -245,7 +252,7 @@ class _KdGaugeCustomPainter extends CustomPainter {
degToRad(arcStartAngle) as double,
degToRad(arcSweepAngle) as double,
false,
paint..color = Colors.grey.withOpacity(.4));
paint..color = inactiveArcColor);

if (activeGaugeGradientColor == null) {
//Draw active gauge view
Expand Down