flutterflutter-cupertinocupertinopicker

How to take out the padding of the CupertinoPicker?


I have two CupertinoPicker and a i need to take out the gap that it has between then,anyone have an idea please ? enter image description here

 Center(
        child: Row(
          children: [
            SizedBox(
                height: 200,
                width: 100,
                child: CupertinoPicker(
                    itemExtent: 20,
                    onSelectedItemChanged: (index) => setState(() {
                          this.index == index;
                        }),
                    children: definingHoursList())),
            SizedBox(
                height: 200,
                width: 100,
                child: CupertinoPicker(
                    itemExtent: 20,
                    onSelectedItemChanged: (index) => setState(() {
                          this.index == index;
                        }),
                    children: definingHoursList()))
          ],
        ),
      ),

Solution

  • Take a look at the documentation for the CupertinoPickerDefaultSelectionOverlay class.

    By passing it to CupertinoPicker you can disable the margin, but it'll also lose the rounded corners.

      CupertinoPicker(
        selectionOverlay: const CupertinoPickerDefaultSelectionOverlay(
          capStartEdge: false,
          capEndEdge: false, 
        ),
        // other parameters,
      )