GeekyAnts / GaugesFlutter

A gauge package for Flutter that displays progress and can be customized for appearance and behavior.
https://pub.dev/packages/geekyants_flutter_gauges
MIT License
67 stars 15 forks source link

Embedding LinearGauge in other widget causes Overflow #278

Closed maldag closed 2 months ago

maldag commented 3 months ago

I'm not sure if this is a bug, but I'm not able to arrage an instance of LinearGauge in a row or column styled layout. It always overflows.

Is the gauge always consuming the whole screen size?

What I was trying to to:

@override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Row(
          children: [
            Expanded(
              child: LinearGauge(
                gaugeOrientation: gaugeOrientation,
                rulers: RulerStyle(
                  rulerPosition: rulerPosition,
                  showLabel: showLabel,
                ),
                linearGaugeBoxDecoration: const LinearGaugeBoxDecoration(
                  thickness: 10.0,
                  linearGaugeValueColor: Colors.blue,
                  backgroundColor: Colors.grey,
                ),
                valueBar: const [
                  ValueBar(
                    value: 90,
                    valueBarThickness: 10,
                    position: ValueBarPosition.center,
                    color: Colors.red,
                  ),
                ],
              ),
            ),
          ],
        ),
        Row(
          children: [Expanded(child: Text("Bottom Line"))],
        )
      ],
    );
  }
flutter doctor -v
[√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.22621.3737], locale de-DE)
    • Flutter version 3.22.1 on channel stable at C:\Users\user\sdk\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (7 weeks ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\user\AppData\Local\Android\Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = C:\Users\user\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.10.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.10.35013.160
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)

[√] VS Code (version 1.91.0)
    • VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.86.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.3737]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 126.0.6478.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 126.0.2592.87

[√] Network resources
    • All expected network resources are available.

• No issues found!
Afroz-Shaikh commented 2 months ago

Hi @maldag, could you please attach a screenshot to show us what's overflowing and what you intend to achieve? This will help us take a better look at the problem. Thank you!

maldag commented 2 months ago

The problem arises when the linear gauge is embedded in another flexible container like Row or Column or something similar with requires additional space in the main axis direction. The linear gauge will consume all the space there is but in this case it cannot consume everything because another container also needs space.

I don't know if this is really a bug but more the behaviour of the widget (consume all there is).