GaugesFlutter
GaugesFlutter copied to clipboard
Changing start/end of gauges does not cause re-render
Describe the bug Changing start/end of a gauge does not cause a re-render, but changing a Pointer value does. I filed this under bug report as I would expect this to be out of the box behavior, but it can also suffice as a feature request.
To Reproduce See reproducible code.
Expected behavior When the start or end values are changed, the gauge is expected to respect these values and re-render.
Screenshots N/A
Desktop (please complete the following information):
- OS: Windows 10 22H2
- Browser: N/A, tested on Flutter Desktop
- Version: N/A
Additional context Reproducible code:
import 'package:flutter/material.dart';
import 'package:geekyants_flutter_gauges/geekyants_flutter_gauges.dart';
void main() {
runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: LinearGaugeExample(),
),
);
}
///
/// 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> {
double startVal = 0.0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
children: [
LinearGauge(
start: startVal,
gaugeOrientation: GaugeOrientation.horizontal,
enableGaugeAnimation: true,
rulers: RulerStyle(
rulerPosition: RulerPosition.bottom,
),
pointers: const [
Pointer(
value: 50,
shape: PointerShape.circle,
),
],
),
TextButton(
onPressed: () {
setState(() {
if (startVal == 0.0) {
startVal = 5.0;
} else {
startVal = 0.0;
}
});
},
child: const Text('Toggle Start'))
],
),
),
);
}
}
Hi, @NotTsunami Would you be willing to look at the code to find a possible solution? We will be happy to merge your PR. Happy Gaugeing