scroll_picker 0.0.1 copy "scroll_picker: ^0.0.1" to clipboard
scroll_picker: ^0.0.1 copied to clipboard

Scroll picker to select an item from String list

The package scroll_picker is to help in picking an option out of String array/list. It shows wheel scroll view on top of your view like a modal. The cursor moves to the current selection. Picking a new option is either by clicking the "confirm" button or directly clicking the item desired. The selected item is returned via the callback function.

Features #

  • Easy iplementation to pick an option from a list of String.
  • Support multiple item lines, 5 is good, 7, 9 are options.
  • The pack inclue a funtion returning Color.fromRGBO from hex string like '#F0605Ff0',
    color: stringToRGBO('#FFFFFFff'),
    

frontScreen frontScreen

Getting started #

Github provide an example.

Usage #

Add to the pubspec.yaml:

flutter pub add scroll_picker

Import the package:

import 'package:scroll_picker/scroll_picker.dart';
  • The parent widget calling the package should be STATEFUL

  • declare your local currentPick and String List: _ eg:

    List<String> options=['Apple','Kiwi', 'Tomato','Pear'];
    String currentOption =options[0];
    
  • make and pass a callback funtion to take the selected item (val) from the package:

    void callbackString(val) {
        setState((){
            currentOption =val;
        });
    }
    

    _ when an item on the wheel is clicked or the confirm button is clicked, currentOption is updated in the parent Widget, and the currentOption appear on the box the ScrollPicker() is located.

        ...
        Column(chidren:[
            ...
            ScrollPicker(dataArray: options, currentSelection: currOption!, fontSizeList: 20,       fontSizeTitle:18,  callback: callbackString),
            ...
        ]),
        ...
    

    The button-like currentPick is displayed at the spot of ScrollPicker().

Additional information #

Please refer my Github site for details.

scroll_picker #

1
likes
130
pub points
0%
popularity

Publisher

unverified uploader

Scroll picker to select an item from String list

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, logger

More

Packages that depend on scroll_picker