Skip to content

Not clear how to add a text label on a radio button #6678

Closed

Description

@mit-mit

It's not clear how to add a text label next to a radio button.

The sample app uses radio buttons with no labels:
https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/lib/gallery/example_code.dart#L148

The docs have no mentioning of labels:
https://docs.flutter.io/flutter/material/Radio-class.html

On Android you simple set the :text property:
https://developer.android.com/guide/topics/ui/controls/radiobutton.html

Activity

  1. eseidelGoogle commented on Nov 3, 2016

    @eseidelGoogle
    Contributor

    Feels a bit similar to #254. We have a bunch of issues around forms which @mpcomplete is processing through for customer: leafy. This may already be on his list via another bug, not sure.

  2. nelsonkam commented on Nov 3, 2016

    @nelsonkam

    On flutter, you can do this:
    new Row(children: [new Radio(...), new Text("Radio Label"),])
    Also works for checkboxes.

  3. mit-mit commented on Nov 3, 2016

    @mit-mit
    MemberAuthor

    That doesn't quite work, as pressing the text then doesn't do anything (the radio and text are supposed to be one big button in terms of selection).

  4. nelsonkam commented on Nov 3, 2016

    @nelsonkam

    @mit-mit Yeah, I understand your point here.

  5. mpcomplete commented on Nov 3, 2016

    @mpcomplete
    Contributor

    Yeah, this is #254.

  6. kras95 commented on Dec 24, 2019

    @kras95

    I solved this by using a Text widget in the same row and surrounding the Text widget with a GestureHandler, which invokes the setState(){}, method, which updates the enum value for the switch.

  7. github-actions commented on Aug 24, 2021

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

  8. locked as resolved and limited conversation to collaborators on Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions