You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Proposal] TextButton.icon missing Alignment of icon #89564
Solution for this: use the text widget as the icon and icon widget as the label.
As @HansMuller said, "It's not elegant, but it avoids making the API a little more complicated."
Reacted by muji, Hit Flutter, Kishan Dhankecha, Majd Haj Hmidi and Yazan Farrah
I wanted to propose the same thing and happy to find out this is already working on.
@werainkhatri Thanks your tip. It's much simpler way to me.
I would like to add my use case.
I made my own TextButton child widget which was referred the _TextButtonWithIconChild.
// Create text button child widget for sub-fix icon.// I simply changed the location between the label and icon.// And I didn't apply the calculation the gap because I didn't need it.classTextButtonWithSubfixIconChildextendsStatelessWidget {
TextButtonWithSubfixIconChild({
Key? key,
requiredthis.label,
requiredthis.icon,
});
finalWidget label;
finalWidget icon;
@overrideWidgetbuild(BuildContext context) {
returnRow(
mainAxisSize:MainAxisSize.min,
crossAxisAlignment:CrossAxisAlignment.center,
children:<Widget>[
Flexible(child: label),
SizedBox(width:4),
icon,
],
);
}
}
And I used the child widget under the text button.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
maheshj01 commentedon Sep 7, 2021
Looks like a valid proposal to me.
[-]TextButton.icon missing Alignment of icon [/-][+][Proposal] TextButton.icon missing Alignment of icon [/+]werainkhatri commentedon Sep 18, 2021
Solution for this: use the text widget as the icon and icon widget as the label.
As @HansMuller said, "It's not elegant, but it avoids making the API a little more complicated."
uandi4446 commentedon Nov 17, 2021
I wanted to propose the same thing and happy to find out this is already working on.
@werainkhatri Thanks your tip. It's much simpler way to me.
I would like to add my use case.
I made my own TextButton child widget which was referred the _TextButtonWithIconChild.
And I used the child widget under the text button.
hit-flutter commentedon May 8, 2023
Any update or milestone to this?
3 remaining items
piedcipher commentedon Nov 17, 2023
I'll be fixing this for all ButtonStyleButton buttons. Multiple issues aren't necessary.
Introduce `iconAlignment` for the buttons with icon (#137348)
github-actions commentedon Feb 26, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.