diff --git a/CHANGELOG.md b/CHANGELOG.md index 504554ff..b5793bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.0.3 + +**Fixes** + +- Fixed Drawing of `Pointer` over `valueBar` + + ## 1.0.2 **Features** diff --git a/README.md b/README.md index d0f1b299..9d03922d 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ This will add a line like this to your package's pubspec.yaml (and run an implic ```dart dependencies: - geekyants_flutter_gauges: 1.0.1 + geekyants_flutter_gauges: 1.0.2 ``` ## Usage @@ -77,6 +77,8 @@ import 'package:geekyants_flutter_gauges/geekyants_flutter_gauges.dart'; Use it as below +# Linear Gauge usage + ```dart class _MyGaugeExampleState extends State { @override @@ -94,6 +96,31 @@ class _MyGaugeExampleState extends State { } ``` +# Radial Gauge usage + +```dart +class _MyGaugeExampleState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: RadialGauge( + track: RadialTrack( + start: 0, + end: 100, + ), + needlePointer: [ + NeedlePointer( + value: 30, + ), + ], + ), + ) + ); + } +} +``` + ## Linear Gauge ### **Gauge Orientation**: @@ -224,3 +251,7 @@ In the Radial Gauge, the `NeedlePointer` and `RadialShapePointer` can be set to ## Credits Made with ❤️ by + +``` + +``` diff --git a/example/lib/gauge_vertical.dart b/example/lib/gauge_vertical.dart index 7e601de9..eca59c07 100644 --- a/example/lib/gauge_vertical.dart +++ b/example/lib/gauge_vertical.dart @@ -14,26 +14,36 @@ class _MyVerticalGaugeState extends State { return Scaffold( body: Center( child: Padding( - padding: const EdgeInsets.all(2.0), - child: LinearGauge( - linearGaugeBoxDecoration: const LinearGaugeBoxDecoration( - thickness: 30, - borderRadius: 10, - ), - // enableAnimation: true, - gaugeOrientation: GaugeOrientation.horizontal, - rulers: RulerStyle( - primaryRulersWidth: 10, - primaryRulersHeight: 30, - primaryRulerColor: const Color(0xff310072), - inverseRulers: false, - showLabel: false, - showSecondaryRulers: false, - showPrimaryRulers: true, - rulerPosition: RulerPosition.center, - ), - ), - ), + padding: const EdgeInsets.all(2.0), + child: LinearGauge( + end: 126, + gaugeOrientation: GaugeOrientation.vertical, + rulers: RulerStyle( + rulerPosition: RulerPosition.right, + ), + pointers: const [ + Pointer( + value: 50, + height: 20, + color: Colors.green, + width: 20, + shape: PointerShape.triangle, + isInteractive: true, + onChanged: null, + pointerPosition: PointerPosition.left, + ), + ], + curves: const [ + CustomCurve( + startHeight: 4, + endHeight: 50, + midHeight: 5, + curvePosition: CurvePosition.left, + end: 126, + midPoint: 50 * 0.8, + ), + ], + )), ), ); } diff --git a/example/lib/main.dart b/example/lib/main.dart index cb40c6d9..30e7c13b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:example/gauge_vertical.dart'; import 'package:flutter/material.dart'; import 'package:geekyants_flutter_gauges/geekyants_flutter_gauges.dart'; @@ -5,7 +6,7 @@ void main() { runApp( const MaterialApp( debugShowCheckedModeBanner: false, - home: RadialGaugeExample(), + home: MyVerticalGauge(), ), ); } @@ -63,20 +64,12 @@ class _RadialGaugeExampleState extends State { backgroundColor: Colors.white, body: RadialGauge( track: RadialTrack( - color: Colors.grey, - start: 0, - end: 100, - trackStyle: TrackStyle( - showLastLabel: false, - secondaryRulerColor: Colors.grey, - secondaryRulerPerInterval: 3)), + start: 0, + end: 100, + ), needlePointer: [ NeedlePointer( value: 30, - color: Colors.red, - tailColor: Colors.black, - tailRadius: 0, - needleStyle: NeedleStyle.flatNeedle, ), ], ), diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index d9333e47..c5fd5489 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -182,7 +182,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb7259e1..83d88728 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =3.0.0-0 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=1.17.0" diff --git a/lib/src/linear_gauge/custom_label/custom_ruler_label.dart b/lib/src/linear_gauge/custom_label/custom_ruler_label.dart index 9fbcad20..b2495ced 100644 --- a/lib/src/linear_gauge/custom_label/custom_ruler_label.dart +++ b/lib/src/linear_gauge/custom_label/custom_ruler_label.dart @@ -12,7 +12,6 @@ /// ``` /// /// - class CustomRulerLabel { const CustomRulerLabel({ required this.text, diff --git a/lib/src/linear_gauge/linear_gauge.dart b/lib/src/linear_gauge/linear_gauge.dart index 5a0726d9..0b45332b 100644 --- a/lib/src/linear_gauge/linear_gauge.dart +++ b/lib/src/linear_gauge/linear_gauge.dart @@ -647,6 +647,11 @@ class _LinearGauge extends State with TickerProviderStateMixin { } } + if (widget.curves != null && widget.curves!.isNotEmpty) { + for (final CustomCurve curve in widget.curves!) { + _addChild(curve, null, null); + } + } if (widget.pointers != null && widget.pointers!.isNotEmpty) { for (final dynamic pointer in widget.pointers!) { _addChild( @@ -655,12 +660,6 @@ class _LinearGauge extends State with TickerProviderStateMixin { } } - if (widget.curves != null && widget.curves!.isNotEmpty) { - for (final CustomCurve curve in widget.curves!) { - _addChild(curve, null, null); - } - } - return _linearGaugeWidgets; } diff --git a/lib/src/radial_gauge/pointer/needle_pointer_painter.dart b/lib/src/radial_gauge/pointer/needle_pointer_painter.dart index d623f950..d02753de 100644 --- a/lib/src/radial_gauge/pointer/needle_pointer_painter.dart +++ b/lib/src/radial_gauge/pointer/needle_pointer_painter.dart @@ -200,6 +200,7 @@ class RenderNeedlePointer extends RenderBox { final needlePaint = Paint() ..color = _color + ..style = PaintingStyle.fill ..strokeWidth = strokeWidth ..shader = gradient.createShader( Rect.fromPoints( diff --git a/pubspec.yaml b/pubspec.yaml index 033680db..650fbf1a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: geekyants_flutter_gauges description: A linear gauge package for Flutter that displays progress and can be customized for appearance and behavior. -version: 1.0.2 +version: 1.0.3 homepage: https://github.com/GeekyAnts/GaugesFlutter environment: