Thanks to visit codestin.com
Credit goes to github.com

Skip to content

#163840 - CupertinoButton cursor doesn't change to clickable on desktop #163967

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

Closed
wants to merge 4 commits into from
Closed

Conversation

srivats22
Copy link
Contributor

This PR addresses Issue number: 163840, where when hovering over a Cupertino button the mouse cursor wouldn't switch to clickable and there wasn't any option to configure it.

Adds Mouse cursor to CupertinoButton, CupertinoButton.Filled and CupertinoButton.Tinted

Fixes #163840
Part of #58192

Demo of the changes

pr_demo.mov

Code snippet showing new behavior

import 'package:flutter/cupertino.dart';

void main() => runApp(
  // const Center(child: Text('Hello, world!', key: Key('title'), textDirection: TextDirection.ltr)),
  CupertinoApp(
    theme: const CupertinoThemeData(
      brightness: Brightness.light,
    ),
    home: Center(
      child: Column(
        spacing: 5.0,
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          CupertinoButton(
            onPressed: (){},
            child: const Text('Default Cursor'),
          ),
          CupertinoButton(
            onPressed: (){},
            mouseCursor: SystemMouseCursors.grab,
            child: const Text('Custom Cursor'),
          ),
          CupertinoButton.filled(
            onPressed: (){},
            mouseCursor: SystemMouseCursors.copy,
            child: const Text('Custom Cursor 2'),
          ),
          CupertinoButton.tinted(
            onPressed: (){},
            mouseCursor: SystemMouseCursors.help,
            child: const Text('Custom Cursor 2'),
          ),
        ],
      )
    ),
  ),
);

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Feb 23, 2025
@dkwingsmt
Copy link
Contributor

dkwingsmt commented Feb 25, 2025

Thanks for your contribution! Since we're adding a property here, I think a better way is to use the WidgetStateProperty so that the disabled cursor is also included instead of being broken in the future. This has been done for many widgets before, such as in #151788 . Can you apply the approach in that PR here?

@srivats22
Copy link
Contributor Author

Sure let me give it a try and see if I am able to get the required output and then will push to the same PR

@srivats22
Copy link
Contributor Author

srivats22 commented Feb 26, 2025

I will close this PR and open a new one... my local fork something went wrong so took a new fork and will open the PR from that...

in a nutshell it wasnt able to recognize flutter & dart for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CupertinoButton cursor doesn't change to clickable on desktop
2 participants