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

Changing start/end of gauges does not cause re-render #249

Open
NotTsunami opened this issue Sep 14, 2023 · 1 comment · Fixed by #269
Open

Changing start/end of gauges does not cause re-render #249

NotTsunami opened this issue Sep 14, 2023 · 1 comment · Fixed by #269
Assignees
Labels
bug Something isn't working has reproducible steps

Comments

@NotTsunami
Copy link

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'))
          ],
        ),
      ),
    );
  }
}
@hasnentai
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has reproducible steps
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants