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.


Solution 1: Pushan Gupta

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!


Solution 2: Sampath Narayanan

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:
                        ...
        }),