Skip to content

Slider dragged cursor remains visible after drag. #172752

@ksokolovskyi

Description

@ksokolovskyi

Steps to reproduce

  1. Pass the WidgetStateMouseCursor with WidgetState.dragged state handled into Slider
  2. Start drag gesture (dragged mouse cursor becomes visible)
  3. End drag gesture (dragged mouse cursor remains visible)

Expected results

The dragged cursor is visible only when dragging.

Actual results

The dragged cursor remains visible after the drag.

Code sample

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

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

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

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  final _value = ValueNotifier(0.0);

  @override
  void dispose() {
    _value.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ColoredBox(
                color: Colors.blue,
                child: ListenableBuilder(
                  listenable: _value,
                  builder: (context, child) {
                    return Slider(
                      value: _value.value,
                      onChanged: (value) => _value.value = value,
                      mouseCursor: WidgetStateMouseCursor.resolveWith((states) {
                        if (states.contains(WidgetState.dragged)) {
                          return SystemMouseCursors.grabbing;
                        }
                        return SystemMouseCursors.click;
                      }),
                    );
                  },
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
slider_dragged_cursor.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.33.0-1.0.pre-1078, on macOS 15.5 24F74 darwin-arm64, locale en-US) [1,999ms]
    • Flutter version 3.33.0-1.0.pre-1078 on channel master at /Users/ksokolovskyi/development/flutter_master
    • Upstream repository [email protected]:ksokolovskyi/flutter.git
    • FLUTTER_GIT_URL = [email protected]:ksokolovskyi/flutter.git
    • Framework revision afba7d75b3 (2 days ago), 2025-07-23 14:04:50 +1200
    • Engine revision afba7d75b3
    • Dart version 3.10.0 (build 3.10.0-15.0.dev)
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [5.0s]
    • 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) [1,162ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

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

[✓] Connected device (2 available) [6.1s]
    • macOS (desktop) • macos  • darwin-arm64   • macOS 15.5 24F74 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 138.0.7204.168

[✓] Network resources [697ms]
    • 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.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33frameworkflutter/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 team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions