Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

CupertinoPicker infinite scroll instead empty space

I have a cupertino picker, however when I enter the view I can see a lot of empty space at the top. How can I make an infinite scroll there, or remove the empty space?

enter image description here

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        border: Border.all(
          color: Colors.black,
        ),
      ),
      child: CupertinoPicker(
          scrollController: scrollController,
          itemExtent: 64.0,
          selectionOverlay: Container(),
          onSelectedItemChanged: (value) => widget.callback(widget.data[value]),
          children: widget.data
              .map(
                (e) => Center(child: Container(
                  width: double.infinity,
                    decoration: BoxDecoration(
                        border: Border.all(color: Colors.blueAccent)
                    ),
                    child: Text(e))),
          )
              .toList()),
    );
  }

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Set your parent container height and/or set your initialItem to something other than the default 0.

scrollController = FixedExtentItemScrollController(initialItem: 3);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading