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

Custom Widths not being honored #94

Open
PfernFSU opened this issue Aug 2, 2024 · 2 comments
Open

Custom Widths not being honored #94

PfernFSU opened this issue Aug 2, 2024 · 2 comments

Comments

@PfernFSU
Copy link

PfernFSU commented Aug 2, 2024

Describe the bug
The customWidths property is not being honored. I saw this already opened here but they did not give more info. I have a reproducible case (I believe).

To Reproduce

    return ToggleSwitch(
      minWidth: double.maxFinite,
      cornerRadius: 20.0,
      activeFgColor: Theme.of(context).colorScheme.onPrimary,
      inactiveBgColor: Theme.of(context).disabledColor.withAlpha(50),
      inactiveFgColor: Theme.of(context).primaryColor,
      dividerColor: Theme.of(context).primaryColor,
      totalSwitches: 4,
      labels: const ['Game', 'Tournament', 'Chat', ''],
      icons: const [null, null, null, Icons.settings],
      onToggle: (index) {
        debugPrint('The index is $index');
      },
      animate: true,
      customWidths: [65.0, 200.0, 65.0, 50.0],
    );

Expected behavior
It seems the width is sometimes expanded, but other times it is ignored. For instance, the one above that is 200, if I change it to 150 it is the same size. 100 is even the same size as all the others. The max width of the screen is 393, so I don't think that is an issue. It is not in any padding, just a column inside a scaffold body.

Screenshots
If at 200:
image

If at 150:
image

If at 65.0 to match the neighbors it does shrink and matches them:
image

Additional information

  • toggle_switch version
    2.3.0
  • flutter doctor -v
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.2.1 23C71 darwin-arm64, locale en-US)
    • Flutter version 3.22.3 on channel stable at /Users/justinpfenning/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0850beeb2 (2 weeks ago), 2024-07-16 21:43:41 -0700
    • Engine revision 235db911ba
    • Dart version 3.4.4
    • DevTools version 2.34.3

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/justinpfenning/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.91.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.94.0

[✓] Connected device (5 available)
    • Justin's iPhone 14 (mobile)     • 00008110-001044E10C81401E            • ios            • iOS 17.5.1 21F90
    • iPhone 15 Pro (mobile)          • 40B59F60-F887-4C6D-A36A-B01D31129D7E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.2.1 23C71 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.2.1 23C71 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 127.0.6533.89

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

! Doctor found issues in 1 category.
  • Any other additional information.
    This is iOS if it makes a difference, running on a iPhone 15 Pro emulator with iOS 17.5
@PramodJoshi
Copy link
Owner

@PfernFSU great info! Let me do some digging and get back to you. Thanks!

@PfernFSU
Copy link
Author

Hey @PramodJoshi - I just wanted to touch base on this and see if you were able to reproduce or troubleshoot. Thanks for everything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants