Skip to content

RangeSlider dragged cursor is not visible if onChangeStart and onChangeEnd are not set. #179987

Description

@ksokolovskyi

Steps to reproduce

  1. Run the sample app from this issue
  2. Try to drag any handle and observe that the dragged cursor is not visible
  3. Uncomment onChangeStart and onChangeEnd callbacks
  4. Try to drag any handle again. The dragged cursor is now visible

Expected results

The dragged cursor appears no matter whether onChangeStart and onChangeEnd are set to be consistent with the Slider implementation.

after.mov

Actual results

The dragged cursor does not appear if onChangeStart and onChangeEnd are not set.

before.mov

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: _Slider(),
        ),
      ),
    );
  }
}

class _Slider extends StatefulWidget {
  const _Slider();

  @override
  State<_Slider> createState() => __SliderState();
}

class __SliderState extends State<_Slider> {
  var _values = RangeValues(0.25, 0.75);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: 500,
      height: 100,
      child: Center(
        child: SliderTheme(
          data: SliderThemeData(
            valueIndicatorColor: Colors.red,
            showValueIndicator: ShowValueIndicator.alwaysVisible,
          ),
          child: RangeSlider(
            values: _values,
            onChanged: (values) {
              print('Slider values changed: $values');
              setState(() {
                _values = values;
              });
            },
            // Uncomment those two callbacks to make the dragged cursor visible.
            // onChangeStart: (_) {},
            // onChangeEnd: (_) {},
            mouseCursor: WidgetStateMouseCursor.resolveWith((states) {
              if (states.contains(WidgetState.dragged)) {
                return SystemMouseCursors.grabbing;
              }
              return SystemMouseCursors.click;
            }),
          ),
        ),
      ),
    );
  }
}

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.40.0-1.0.pre-225, on macOS 15.6.1 24G90 darwin-arm64, locale en-US) [2.2s]
    • Flutter version 3.40.0-1.0.pre-225 on channel master at /Users/ksokolovskyi/development/flutter_master
    • Upstream repository git@github.com:ksokolovskyi/flutter.git
    • FLUTTER_GIT_URL = git@github.com:ksokolovskyi/flutter.git
    • Framework revision 109b65f0b8 (3 hours ago), 2025-12-17 02:36:19 -0500
    • Engine revision 109b65f0b8
    • Dart version 3.11.0 (build 3.11.0-253.0.dev)
    • DevTools version 2.53.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [2.1s]
    • Android SDK at /Users/ksokolovskyi/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = /Users/ksokolovskyi/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [990ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

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

[✓] Connected device (2 available) [9.0s]
    • macOS (desktop) • macos  • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 143.0.7499.110

[✓] Network resources [1,560ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.38Found to occur in 3.38found in release: 3.40Found to occur in 3.40frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type
No fields configured for issues without a type.

Projects

Status
Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions