6

Cupertino Picker in flutter takes 100% width.

How do we give it custom styling? Height, Width, Borders?

I tried putting it inside a container with width and all, didn't work.Instead there was a weird soft edged background when I gave container a color.

Pushan Gupta
  • 3,697
  • 5
  • 23
  • 39

2 Answers2

5

Answering my own question for the time being,

I got a workaround by making the following tree:

  • Row

    • Sized box(width:20)

    • Expanded

      • Cupertino Picker
    • Sized Box(width: 20)

I tried multiple workarounds but none worked

A better approach is highly appreciated!

Pushan Gupta
  • 3,697
  • 5
  • 23
  • 39
0

you can try wrapping it up with a container and setting width or height

        Container(
              height: 250,
              child: CupertinoPicker(
                itemExtent: 32,
                onSelectedItemChanged: (value) {
                  setState(() {});
                },
              children:
                        ...
        }),