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

Update icon color & icon size assignment to align with new Flutter 3.27.0 breaking changes #513

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukemmtt
Copy link

@lukemmtt lukemmtt commented Dec 12, 2024

This is just a proof of concept—I've only tested for my own use case. It's intended as an option that closes #512.

On closer inspection of Flutter 3.27.0's release notes, I saw several mentions of changes to Icons and their properties:

I haven't explored which of these, if any, is relevant, but they gave me an idea. I noticed that flutter_slidable instantiates the SlidableAction icon like this (link):

Icon(icon);

As a test, I forked flutter_slidable and tried explicitly assigning the color and size like this:

Icon(icon, color: foregroundColor, size: iconSize);

where foregroundColor is an existing property, and iconSize is a property I've added (defaulting to 25.0).

This yielded an appearance similar to what I observed before these API changes:

Results

Appearance in Flutter 3.24.5:

Appearance in Flutter 3.27.0 with flutter_slidable v3.1.2:

Appearance in Flutter 3.27.0 with flutter_slidable fork w/ modified icon style assignment approach:

@egormzln
Copy link

Upvote this pr 🤝

@rodolfocop
Copy link

Is it possible to accept this pr?

@letsar
Copy link
Owner

letsar commented Dec 21, 2024

It seems the default size of 25, is not what was before. Can you update the default value so that it will not impact previous versions?

@lukemmtt
Copy link
Author

I eyeballed it, this is the best I could come up with easily. If someone else can provide a more suitable value, I'm happy to try it.

In my observation, the tricky bit is that it appears that even the default icon weight (stroke line width) might have changed a tiny bit in 3.27 well here, hence why I didn't try to aim for perfection.

@petervanvogelpoel-filmbooking

I tried:

Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( iconTheme: IconThemeData( color: Colors.blue, size: 24.0, ), ), home: MyHomePage(), ); }

which had no effect. Same issue?

@lazysteff
Copy link

lazysteff commented Jan 2, 2025

I tried @lukemmtt branch with 25. Worked like a charm for both Android and iOS, no issues or complaints from customers. I'd suggest merging the modification as is, those who want a different setting might adjust it on their own. It's just worth mentioning in the release notes. I would also suggest bumping major version up to explicitly highlight the change.

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

Successfully merging this pull request may close these issues.

Icon in SlidableAction is not using foreground color
6 participants