Open crissCM opened 1 year ago
@crissCM Thanks for reporting the issue we are able to reproduce and we will be sending patch soon
Thanks for the report! A #PR has been raised for the same!
I still see this issue is there even on master @Afroz-Shaikh . Its very random and I have to always drag it from center of the needle @crissCM Here is the code snippet which is working partially for me
import 'package:flutter/material.dart';
import 'package:geekyants_flutter_gauges/geekyants_flutter_gauges.dart';
void main() {
runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: RadialGaugeExample(),
),
);
}
///
/// The following code is a Simple Example of [LinearGauge] Widget.
/// You can customize the [LinearGauge] Widget as per your need.
///
class LinearGaugeExample extends StatefulWidget {
const LinearGaugeExample({Key? key}) : super(key: key);
@override
State<LinearGaugeExample> createState() => _LinearGaugeExampleState();
}
class _LinearGaugeExampleState extends State<LinearGaugeExample> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: LinearGauge(
gaugeOrientation: GaugeOrientation.horizontal,
enableGaugeAnimation: true,
rulers: RulerStyle(
rulerPosition: RulerPosition.bottom,
),
pointers: const [
Pointer(
value: 50,
shape: PointerShape.circle,
),
],
),
),
);
}
}
///
/// The following code is a Simple Example of [RadialGauge] Widget.
/// You can customize the [RadialGauge] Widget as per your need.
///
class RadialGaugeExample extends StatefulWidget {
const RadialGaugeExample({super.key});
@override
State<RadialGaugeExample> createState() => _RadialGaugeExampleState();
}
class _RadialGaugeExampleState extends State<RadialGaugeExample> {
double value = 30;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: [
RadialGauge(
track: const RadialTrack(
color: Colors.grey,
start: 0,
end: 100,
trackStyle: TrackStyle(
showLastLabel: false,
secondaryRulerColor: Colors.grey,
secondaryRulerPerInterval: 3)),
needlePointer: [
NeedlePointer(
value: value,
color: Colors.red,
tailColor: Colors.black,
onChanged: (val){
setState(() {
value = val;
});
},
isInteractive: true,
needleStyle: NeedleStyle.flatNeedle,
),
],
),
],
),
);
}
}
Video
@hasnentai in your case the issue is with the Shape of the GaugeNeedle, The path doesn't correctly add upto the tip of the Needle, Except the tip of the needle it would work fine for rest of the Areas.
You can try by changing needleStyle: NeedleStyle.gaugeNeedle
This is happening because of the BorderRadius of the plainNeedle
@crissCM , I have identified the problem
plainNeedle
and its corner Radius.
Gauge is not interactive when the parent widget is a ListView If you take the Temperature Controller showcase example and encapsulate the Stack widget in a ListView, the gauge stops being interactive. You won't be able to drag the RadialShapePointer properly.
To Reproduce Steps to reproduce the behavior:
Expected behavior The gauge should remain fully interactive even if it's in a scrollable view.
Additional context https://github.com/GeekyAnts/GaugesFlutter/assets/78145538/a96b41d7-17d2-4274-8bf7-d5f3f318b698
Flutter Doctor