macos_ui icon indicating copy to clipboard operation
macos_ui copied to clipboard

Add icon support to push buttons (#522)

Open skythomp16 opened this issue 1 year ago • 8 comments

This PR adds support for adding an icon to a push button. This approach allows passing in an iconData instead of an icon so that we can control the size of the icon proportional to the button size. I have also updated the buttons_page.dart class for the example to include both primary and secondary buttons with icons. Comparing against a fresh SwiftUI project side by side, these look identical to those produced by it.

Pre-launch Checklist

  • [x] I have incremented the package version as appropriate and updated CHANGELOG.md with my changes
  • [x] I have added/updated relevant documentation
  • [x] I have run "optimize/organize imports" on all changed files
  • [x] I have addressed all analyzer warnings as best I could

skythomp16 avatar Oct 30 '24 21:10 skythomp16

I checked the box about updating documentation but I am just assuming that will get updated because of my comments in the push_button.dart class but is that true? If not, I need to update that an iconData can be passed.

skythomp16 avatar Oct 30 '24 21:10 skythomp16

I checked the box about updating documentation but I am just assuming that will get updated because of my comments in the push_button.dart class but is that true? If not, I need to update that an iconData can be passed.

Your assumption is correct.

Would you mind providing a screenshot of what the buttons look like, please?

GroovinChip avatar Nov 01 '24 19:11 GroovinChip

Sure, here is a screenshot of the modified example next to a blank canvas in swiftui with a push button with an icon for comparison. Screenshot 2024-11-01 at 3 02 04 PM

skythomp16 avatar Nov 01 '24 20:11 skythomp16

I pushed an update to fix the tests that were failing. Apologies - I didn't know that I could run 'flutter test' to run all of the tests - I will do that from now on. I am a little new to Flutter and Dart

skythomp16 avatar Nov 02 '24 13:11 skythomp16

Do the SwiftUI versions of these buttons have this extra space on the left of the icon, for mini and small control sizes? I think it looks kind of lopsided. image

GroovinChip avatar Nov 03 '24 18:11 GroovinChip

I think you're right. I pushed a change to allow us to control that padding. Here is a screenshot of what it looks like now: Screenshot 2024-11-03 at 4 48 09 PM

skythomp16 avatar Nov 03 '24 22:11 skythomp16

It looks like the dart-code-metrics failing isn't due to anything in my PR

skythomp16 avatar Nov 05 '24 19:11 skythomp16

Yes, that check needs to be removed

GroovinChip avatar Nov 06 '24 19:11 GroovinChip

This PR is old and it looks like I never finished it up. I will close and reopen if I get time to fix these issues.

skythomp16 avatar Dec 31 '25 02:12 skythomp16