Skip to content

[Proposal] TextButton.icon missing Alignment of icon  #89564

Closed

Description

@parmarravi

Please Add the position of the icon to change in TextButton.icon by default is on the left and side and there is no way to change it.

Usecase

Suppose we have a view pager with two buttons on the bottom. One with the Previous button and One with the Next Button aligned in a row

image

TextButton.icon(
    onPressed: () {},
    style: ButtonStyle(),
    label: Text("Next"),
    icon: Icon(Icons.arrow_forward_ios_rounded),
)

Activity

  1. maheshj01 commented on Sep 7, 2021

    @maheshj01
    Member

    Looks like a valid proposal to me.

  2. changed the title [-]TextButton.icon missing Alignment of icon [/-] [+][Proposal] TextButton.icon missing Alignment of icon [/+] on Sep 7, 2021
  3. added
    p: material_uimaterial_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Sep 7, 2021
  4. self-assigned this
    on Sep 7, 2021
  5. werainkhatri commented on Sep 18, 2021

    @werainkhatri
    Member

    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."

  6. uandi4446 commented on Nov 17, 2021

    @uandi4446

    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.
    
    class TextButtonWithSubfixIconChild extends StatelessWidget {
      TextButtonWithSubfixIconChild({
        Key? key,
        required this.label,
        required this.icon,
      });
    
      final Widget label;
      final Widget icon;
    
      @override
      Widget build(BuildContext context) {
        return Row(
          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.

             TextButton(
                onPressed: () {},
                child: TextButtonWithSubfixIconChild(
                  label: Text(
                    'Add',
                  ),
                  icon: Icon(
                    Icons.add,
                  ),
                ),
              ),
  7. hit-flutter commented on May 8, 2023

    @hit-flutter

    Any update or milestone to this?

  8. 3 remaining items

  9. added
    P3Issues that are less important to the Flutter project
    triaged-designTriaged by Design Languages team
    on Oct 23, 2023
  10. removed their assignment
    on Nov 2, 2023
  11. piedcipher commented on Nov 17, 2023

    @piedcipher
    Member

    I'll be fixing this for all ButtonStyleButton buttons. Multiple issues aren't necessary.

  12. added a commit that references this issue on Feb 12, 2024
    1044239
  13. github-actions commented on Feb 26, 2024

    @github-actions

    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.

  14. locked as resolved and limited conversation to collaborators on Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions